Bitnami LAMP on CentOS 7.4

Context

  • CentOS 7.4 default image on Digital Ocean, entry level plan, with 1 GB RAM

Prerequisites

local$ ssh root@SERVER_IP

swap

add swap if RAM+swap is less than 2 GB
this is a short version of these two guides: Bitnami low memory & Digital Ocean swap guide

# free -m | grep Swap
Swap: 0 0 0
# dd if=/dev/zero of=/swapfile count=1024 bs=1MiB
# chmod 600 /swapfile
# ls -lh /swapfile
-rw-------. 1 root root 1.0G Jan 19 19:05 /swapfile
# mkswap /swapfile
Setting up swapspace version 1, size = 1048572 KiB
no label, UUID=ed94f556-38a2-43de-a64b-a3829e85dbd0
# swapon /swapfile
# free -m | grep Swap
Swap: 1023 0 1023
# sysctl vm.swappiness=10
vm.swappiness = 10
# echo "/mnt/swap.0 swap swap defaults 0 0" >> /etc/fstab
# reboot
...

# free -m | grep Swap
Swap: 1023 0 1023

perl

The MySQL installer requires perl and the perl Data::Dumper module.

# yum install perl perl-Data-Dumper
# perl
Ctrl+D

create regular user

# adduser lampy
# passwd lampy
# su lampy
$ cd
$ pwd
/home/lampy

Default install

$ curl --remote-name --location  https://bitnami.com/redirect/to/181565/bitnami-lampstack-7.1.15-0-linux-x64-installer.run
$ chmod +x bitnami-lampstack-7.1.15-0-linux-x64-installer.run
$ ./bitnami-lampstack-7.1.15-0-linux-x64-installer.run
The installer warns about low memory (0.92GB instead on 1) but as the difference is minimal and we have increased the swap it is safe to continue.

Then it asks optional components to install. Except phpMyAdmin which is always installed, the rest are optional if you just want to install WordPress (later).

Installation folder. Accepted default /home/lampy/lampstack-7.1.15-0

Finally it requires a password for the MySQL root user.


Essential commands

  • Start servers (other options: restart, stop, status)
$ /home/lampy/lampstack-7.1.15-0/ctlscript.sh start
  • Uninstall:
    • $ /home/lampy/lampstack-7.1.15-0/uninstall
      $ rm -rf /home/lampy/lampstack-7.1.15-0/
    • you may need to do it if there was some problem with the installation, before trying to install again.

Verify it works

http://SERVER_IP:8080 should show Bitnami's "wellcome" page

Start on boot

# cp /home/lampy/lampstack-7.1.15-0/ctlscript.sh /etc/init.d/bitnami-lamp
# vi /etc/init.d/bitnami-lamp

#!/bin/sh
#
# chkconfig: 2345 80 30
# description: Bitnami services

runuser...

# chkconfig --add bitnami-lamp
# reboot

...then verify servers have started and pre-packaged apps work.