Install Fork CMS on Ubuntu 20.04 LTS

Updated on December 8, 2021
Install Fork CMS on Ubuntu 20.04 LTS header image

Fork CMS is a free open source content management system (CMS) written in PHP and uses Symphony components. The CMS offers a user-friendly interface with powerful apps that make it easy to create, manage and monitor your website.

In this article, you will install Fork CMS on a fresh Ubuntu 20.04 Vultr server instance.

Prerequisites

  • Deploy a fresh Ubuntu 20.04 server on Vultr
  • Install LAMP on your server
  • SSH to the server and log in with a non-root user account

Step 1: Create a new Database for Fork CMS

Login to MySQL.

$ mysql -u root

Create a new database.

CREATE DATABASE  forkdb;

Create a new user and assign a strong password.

 CREATE USER `forkuser`@`localhost` IDENTIFIED BY `STRONG PASSWORD`;

Grant the user full rights to the fork cms database.

GRANT ALL PRIVILEGES ON forkdb.* TO `forkuser`@`localhost`;

Refresh database rights and exit the console.

FLUSH PRIVILEGES;
EXIT

Step 2: Download Fork CMS

Method 1: Download the latest Fork CMS release file

Ensure that you download the latest release from the Fork CMS website. In this article, we install version 5.11.0 as the latest version.

$ wget https://www.fork-cms.com/frontend/files/releases/forkcms-5.11.0.tar.gz

Extract the file

$ tar -xvf forkcms-5.11.0.tar.gz

Now, move the extracted file contents to your webroot directory, by default /var/www/html is used for LAMP.

$ sudo mv forkcms/* /usr/share/nginx/html/

Method 2: Download Using Composer

Install dependencies.

$ sudo apt install php-curl php-cli php-zip unzip

Download Composer.

$ curl -sS https://getcomposer.org/installer | php

Install Composer to the /usr/local/bin directory.

$ sudo mv composer.phar /usr/local/bin/composer

Verify your Composer installation.

$ composer

Composer version 2.1.11 2021-11-02 12:10:25

Usage:
  command [options] [arguments]

Create a new Fork CMS project using Composer.

$ composer create-project forkcms/forkcms

Move the created forkcms project files to your webroot directory.

$ sudo mv forkcms/* /var/www/html/

Step 3: Configure Apache2 to allow .htaccess files

Edit your Apache virtual host file /etc/apache2/sites-available/default.

$ sudo nano /etc/apache2/sites-available/default

Find the lines:

<Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>

Change them to:

<Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>

Find the lines below and change Require all to granted.

<Files ".ht*">
    Require all denied
</Files>

Save and close the file.

Enable mod-rewrite.

$ sudo a2enmod rewrite

Restart Apache

$ sudo service apache2 restart

Step 4: Configure Fork CMS

Visit your server IP address or linked domain name through a web browser. A welcome page will be displayed if all Fork CMS files were installed well.

Click Next and select modules you wish to install along on your CMS.

Under Settings, enter your database information created on Step 1.

Next, enter your valid Email address and password you will use to login to Fork CMS and Finish Installation

Once Fork CMS is installed, login to your Admin Dashboard by adding /private to your server URL.

Step 5: Secure Fork CMS

Delete the fork cms installation script to protect your server.

$ rm -r /var/www/html/var/cache/install

Fix Common Installation Errors

Error 500

Use composer to install Fork CMS dependencies.

$ composer install -o

Unable to read .env file

Create a new .env in your webroot directory and add the following lines

FORK_ENV=prod
FORK_DEBUG=0

Congratulations, you have successfully installed Fork CMS on your Ubuntu 20.04 server. You can now get started with building your website on the PHP-based platform.