Showing posts with label bitnami. Show all posts
Showing posts with label bitnami. Show all posts

Tuesday, December 22, 2020

Set Bitnami Wordpress Application to Start on Boot on Ubuntu 20.04

To set a bitnami wordpress application to start on boot, you just need to make sure that systemctl can use the ctlscript. To do that:


1. Locate the installation directory of your bitnami wordpress. If you are following the default setting, the location should be in /opt


2. Locate the ctlscript.sh file, which is the script to start, stop and restart bitnami-application.

$ sudo find / -iname "ctlscript.sh" -type f

/opt/bitnami-wordpress-5.6-0/ctlscript.sh


3. Copy the script to /etc/init.d, and rename it to bitnami-wordpress

$ sudo cp /opt/bitnami-wordpress-5.6-0/ctlscript.sh /etc/init.t/bitnami-wordpress


4. Edit the script, and add "INIT INFO" settings below #!/bin/sh to ensure systemd can understand the script

#!/bin/sh

### BEGIN INIT INFO

# Provides:          bitnami-wordpress

# Required-Start:    $remote_fs $syslog

# Required-Stop:     $remote_fs $syslog

# Default-Start:     2 3 4 5

# Default-Stop:      0 1 6

# Short-Description: Start daemon at boot time

# Description:       Enable services provided by daemon.

### END INIT INFO

...


5. Save the file, and make systemd aware of the new startup script
$ sudo systemctl daemon-reload

6. Test the new bitnami-wordpress script
$ sudo systemctl status bitnami-wordpress

7. Enable bitnami-wordpress on boot
$ sudo systemctl enable bitnami-wordpress

8. Test it out by rebooting your machine...
$ sudo reboot

9. ...and check the status of the bitnami-wordpress service after reboot
$ sudo systemctl status bitnami-wordpress

Installing a Bitnami Wordpress Stack on Ubuntu 20.04

Bitnami team have done a great job in making the adoption of a lot of open source software easier. Today I want to show how you can install a bitnami wordpress stack on ubuntu 20.04.

First, we need to visit https://bitnami.com/stack/wordpress/installer, and download the installer for linux. As of today, the version available is 5.6.0.

$ wget -c https://bitnami.com/redirect/to/1252289/bitnami-wordpress-5.6-0-linux-x64-installer.run 

Once downloaded, give the file permission to be executed

$ chmod +x bitnami-wordpress-5.6-0-linux-x64-installer.run

Run the installer

$ sudo sh bitnami-wordpress-5.6-0-linux-x64-installer.run

Run through the wizard. In this example, we will install just wordpress and mysql, with default option for most of the questions asked in the wizard.

Once the installation is complete, you will see below confirmation:

Bitnami confirmation

Choose Y to start bitnami wordpress.

Your wordpress site can now be accessed at http://<ip address>/wordpress, and the admin page can be accessed at http://<ip address>/wordpress/wp-admin, my ip address in this example is 192.168.58.4.
Wordpress main page

Wordpress admin page

In order to control the service, you can do so by using the script in bitnami installation directory called ctlscript.sh. In this example, I used the default settings for the installation directory, which is /opt/wordpress-5.6-0.

To show status of bitnami wordpress
$ sudo /opt/wordpress-5.6-0/ctlscript.sh status

To stop wordpress services
$ sudo /opt/wordpress-5.6-0/ctlscript.sh stop

And to start wordpress services 
$ sudo /opt/wordpress-5.6-0/ctlscript.sh start