How To Install Fork CMS on Ubuntu 20.04 LTS
In this tutorial, we will show you how to install Fork CMS on Ubuntu 20.04 LTS. For those of you who didn’t know, Fork CMS is a free open source content management system (CMS) written in PHP and uses Symphony components. It combines the much-needed intuitive and user-friendly interface with technological innovations and powerful apps that help you create, manage and monitor your website.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the Fork CMS on Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.
Prerequisites
- A server running one of the following operating systems: Ubuntu 20.04, 18.04, 16.04, and any other Debian-based distribution like Linux Mint.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Fork CMS on Ubuntu 20.04 LTS Focal Fossa
Step 1. First, make sure that all your system packages are up-to-date by running the following apt
commands in the terminal.
sudo apt update sudo apt upgrade
Step 2. Install the LAMP server.
A Ubuntu 20.04 LAMP server is required. If you do not have LAMP installed, you can follow our guide here.
Step 3. Installing Composer.
Run the following command to install Composer:
curl -sS https://getcomposer.org/installer | php sudo mv composer.phar /usr/local/bin/composer
Verify your Composer installation:
composer
Step 4. Installing Fork CMS on Ubuntu 20.04.
By default, Fork CMS is not available on Ubuntu 20.04 base repository. Now we run the commands below to install the latest stable release of Fork from the command line:
composer create-project forkcms/forkcms sudo mv forkcms/* /var/www/html/
We will need to change some folders permissions:
chown -R www-data:www-data /var/www/html/
Step 5. Configuring MariaDB.
By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation
script. You should read and below each step carefully which will set the root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:
mysql_secure_installation
Configure it like this:
- Switch to unix_socket authentication [Y/n] Y - Set root password? [Y/n] y - Remove anonymous users? [Y/n] y - Disallow root login remotely? [Y/n] y - Remove test database and access to it? [Y/n] y - Reload privilege tables now? [Y/n] y
Next, we will need to log in to the MariaDB console and create a database for Fork CMS. Run the following command:
mysql -u root -p
This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server, you need to create a database for Fork CMS installation:
MariaDB [(none)]> CREATE DATABASE forkdb; MariaDB [(none)]> CREATE USER 'forkuser'@'localhost' IDENTIFIED BY 'your-strong-password'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON forkdb.* to forkuser@'localhost'; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> exit
Step 6. Configure Apache.
Now we create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘fork.conf
’ on your virtual server:
sudo nano /etc/apache2/sites-available/fork.conf
Add the following file:
<VirtualHost *:80> ServerAdmin admin@your-domain.com ServerName your-domain.com ServerAlias www.your-domain.com DocumentRoot /var/www/html/ <Directory /> Options +Indexes +FollowSymLinks +ExecCGI AllowOverride All Order deny,allow Allow from all Require all granted </Directory> <Directory /var/www/html> Require all denied </Directory> ErrorLog /var/log/apache2/fork_error_log TransferLog /var/log/apache2/fork_access_log </VirtualHost>
Save and close the file, then restart the Apache webserver so that the changes take place:
sudo a2enmod rewrite sudo a2ensite fork.conf sudo systemctl restart apache2
Step 7. Set up HTTPS.
We should enable a secure HTTPS connection on Fork CMS. We can obtain a free TLS certificate from Let’s Encrypt. Install the Let’s Encrypt client (Certbot) from Ubuntu 20.04 repository:
sudo apt install certbot python3-certbot-apache
Next, run the following command to obtain a free TLS certificate using the Apache plugin:
certbot --apache -d your-domain.com
You will be asked to provide your email and accept the term of service:
Enabled Apache rewrite module Redirecting vhost in /etc/apache2/sites-available/fork.conf to ssl vhost in /etc/apache2/sites-available/fork-le-ssl.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://your-domain.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=your-domain.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/your-domain.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/your-domain.com/privkey.pem Your cert will expire on 2022-08-11. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot renew" - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le
If the test is successful, reload Apache for the change to take effect:
sudo apache2ctl -t sudo systemctl reload apache2
Step 8. Configure Firewall.
By default, the UFW firewall is enabled on Ubuntu. Depending on your Apache virtual host configuration file, open ports 80 and 443 to allow HTTP and HTTPS traffic:
sudo ufw allow 80/tcp sudo ufw allow 443/tcp sudo ufw reload
Step 9. Accessing Fork CMS Web Interface.
Once successfully installed, open your web browser and access the Fork CMS web interface using the URL https://your-domain.com/install
. You should see the Fork CMS containing the login password:
Congratulations! You have successfully installed Fork CMS. Thanks for using this tutorial for installing the Fork CMS viewer on Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you check the official Fork CMS website.