There is a new version of this tutorial available for Ubuntu 22.04 (Jammy Jellyfish).

How to Install Fork CMS on Ubuntu 20.04

Fork is a simple, lightweight, and easy-to-use content management system. It is based on Symfony and provides a user-friendly web interface to manage all your content through the web browser. It also offers powerful apps and themes that allow you to customize your website more shine. It has a functional marketplace with lots of apps and also offers powerful tools for both beginners and professionals.

In this post, we will explain how to install Fork CMS with Apache and Let's Encrypt SSL on Ubuntu 20.04.

Prerequisites

  • A server running Ubuntu 20.04.
  • Valid domain name pointed with your server IP.
  • A root password is configured on the server.

Install LAMP Stack

First, you will need to install the Apache web server, MariaDB database server, PHP and other required PHP extensions to your server. You can install all of them by running the following command:

apt-get install apache2 mariadb-server php libapache2-mod-php php-json php-xml php-cli php-zip php-common php-sqlite3 php-curl php-intl php-mbstring php-xmlrpc php-mysql php-gd wget unzip -y

After installing all those packages, edit the PHP configuration file:

nano /etc/php/7.4/apache2/php.ini

Change the following settings as per your needs:

memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
file_uploads = On
date.timezone = Asia/Kolkata

Save and close the file, then restart the Apache service to apply the configuration changes:

systemctl restart apache2

Configure MariaDB Database

First, you must secure the MariaDB and set the MariaDB root password. You can run the following script to secure the MariaDB installation:

mysql_secure_installation

This script will set a root password, remove anonymous users, disallow root login remotely and remove the test database as shown below:

Set root password? [Y/n] n
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
Once MariaDB is secured, log in to MariaDB shell:

Next, log in to the MariaDB shell with the following command:

mysql -u root -p

Enter your root password then create a database and user for Fork CMS:

MariaDB [(none)]> CREATE DATABASE forkcmsdb;
MariaDB [(none)]> CREATE USER 'forkcms'@'localhost' IDENTIFIED BY 'password';

Next, grant privileges to the Fork CMS database with the following command:

MariaDB [(none)]> GRANT ALL PRIVILEGES ON forkcmsdb.* TO 'forkcms'@'localhost';

Next, run the FLUSH PRIVILEGES command so that MariaDB will reload the privileges table:

MariaDB [(none)]> FLUSH PRIVILEGES;

Finally, exit from the MariaDB shell using the following command:

MariaDB [(none)]> EXIT;

Install Fork CMS

First, you will need to install the Composer to your system. You can install it with the following command:

curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

You will get the following output:

All settings correct for using Composer
Downloading...

Composer (version 2.3.3) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

Next, navigate to the Apache web root directory and download the Fork CMS using the Composer:

cd /var/www/html/
composer create-project forkcms/forkcms

Once the download is completed, set proper permission and ownership to the FOrk CMS directory:

chown -R www-data:www-data /var/www/html/forkcms
chmod -R 775 /var/www/html/forkcms

Once you are finished, you can proceed to the next step.

Configure Apache for Fork CMS

Next, you will need to create an Apache virtual host configuration file to serve Fork CMS over the internet. You can create it with the following command:

nano /etc/apache2/sites-available/forkcms.conf

Add the following lines:

<VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot /var/www/html/forkcms
     ServerName forkcms.example.com
     ServerAlias www.example.com

     <Directory /var/www/html/forkcms/>
          Options FollowSymlinks
          AllowOverride All
          Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Save and close the file then activate the Fork CMS and enable the Apache rewrite module with the following command:

a2ensite forkcms.conf
a2enmod rewrite

Next, restart the Apache service to apply the changes:

systemctl restart apache2

You can also check the Apache service status using the following command:

systemctl status apache2

You will get the following output:

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2022-04-02 08:04:06 UTC; 13s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 15441 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 15460 (apache2)
      Tasks: 6 (limit: 2348)
     Memory: 13.4M
     CGroup: /system.slice/apache2.service
             ??15460 /usr/sbin/apache2 -k start
             ??15461 /usr/sbin/apache2 -k start
             ??15462 /usr/sbin/apache2 -k start
             ??15463 /usr/sbin/apache2 -k start
             ??15464 /usr/sbin/apache2 -k start
             ??15465 /usr/sbin/apache2 -k start

Apr 02 08:04:06 ubuntu2004 systemd[1]: Starting The Apache HTTP Server...

Once you are finished, you can proceed to the next step.

Access Fork CMS Web Interface

Now, open your web browser and type the URL http://forkcms.example.com. You will be redirected to the following page:

Here, select the language as you wish, then click on the Next button. You should see the following page:

Here, select the module you want to install, then click on the Next button. You should see the following page:

Here, provide your database details, then click on the Next button. You should see the following page:

Here, provide your admin email address, username, and password, then click on the Finish Installation button. You should see the following page:

Now, click on the Log In To Fork CMS button. You should see the Fork CMS log in screen on the following page:

Now, provide your admin username and password, then click on the Log In button. You will be redirected to the Fork CMS dashboard as shown in the following image:

Secure Fork CMS with Let's Encrypt SSL

Next, it is recommended to secure your website with Let's Encrypt SSL. First, install the Certbot client using the following command:

apt-get install python3-certbot-apache -y

Once installed, run the following command to secure your website with Let's Encrypt SSL:

certbot --apache -d forkcms.example.com

You will be asked to provide your email and accept the term of service as shown below:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for forkcms.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/forkcms-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/forkcms-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/forkcms-le-ssl.conf

Next, select whether or not to redirect HTTP traffic to HTTPS as shown below:

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

Type 2 and hit Enter to install the Let's Encrypt SSL for your website:

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/forkcms.conf to ssl vhost in /etc/apache2/sites-available/forkcms-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://forkcms.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=forkcms.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/forkcms.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/forkcms.example.com/privkey.pem
   Your cert will expire on 2022-07-23. 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

Conclusion

Congratulations! you have successfully installed Fork CMS with Apache and Let's Encrypt SSL on Ubuntu 20.04 server. You can now explore the Fork CMS and start building your own website from the Fork CMS intuitive web interface.

Share this page:

0 Comment(s)