DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. How to Install Fork CMS on ECS

How to Install Fork CMS on ECS

We look into how to get Fork CMS up and running, and installing some other necessary tech such as PHP and Symphony.

Arslan ud Din Shafiq user avatar by
Arslan ud Din Shafiq
CORE ·
Jan. 28, 19 · Tutorial
Like (2)
Save
Tweet
Share
8.55K Views

Join the DZone community and get the full member experience.

Join For Free

Fork is an intuitive, user-friendly, and open source CMS. Fork uses the Symphony framework and provides various tools for its users to build, monitor, and update websites. You easily can integrate it with web analytics tools to analyze user behavior on your website and perform search engine optimization.

In this tutorial, we will be installing and setting up Fork CMS on an Alibaba Cloud Elastic Compute Service (ECS) with Ubuntu 16.04 installed.

Prerequisites

  • You must have Alibaba Cloud Elastic Compute Service (ECS) activated and verified your valid payment method. If you are a new user, you can get $300 - $1200 worth in Alibaba Cloud credits for your new account. If you don't know about how to set up your ECS instance, you can refer to this tutorial or quick-start guide. Your ECS instance must have at least 1GB RAM and 1 Core processor.
  • A domain name registered from Alibaba Cloud. If you have already registered a domain from Alibaba Cloud or any other host, you can update its domain nameserver records.
  • The domain name must be pointed to your Alibaba Cloud ECS's IP address.
  • Access to VNC console in your Alibaba Cloud or SSH client installed in your PC.
  • Set up your server's hostname and create a user with root privileges.

Setting Up Your Server

Before proceeding with installation of any kind of package, use the following command to update your Ubuntu system. To execute this command, remember to log in from a non-root user with sudo privileges.

# sudo apt update && sudo apt upgrade

You will need to install unzip which will be used to unzip the compressed zip folder.

# sudo apt-get install unzip -y

You will also need to download Fork CMS from GitHub, so you will have to install Git.

# sudo apt-get install git -y

For additional server security, check How to secure your server?

Install PHP

Fork CMS requires the installation of PHP 7.1 or newer version of PHP. In this tutorial, you will install PHP 7.2. To install PHP 7.2, execute the following steps.

First, you will need to install Python software properties and software properties common.

# sudo apt-get install software-properties-common python-software-properties 

Add the repository for newer versions of PHP.

# sudo add-apt-repository ppa:ondrej/php

Update the system to refresh the available repositories.

# sudo apt update

Install PHP 7.2 by executing the following command.

# sudo apt install -y php7.2

Fork CMS requires the following PHP extensions:

  1. php7.2-cli
  2. php7.2-fpm
  3. php7.2-common
  4. php7.2-curl
  5. php7.2-mbstring
  6. php7.2-gd
  7. php7.2-intl
  8. php7.2-mysql
  9. php7.2-xml
  10. php7.2-json

To install the above extensions of PHP, execute the following command.

# sudo apt install -y php7.2 php7.2-cli php7.2-fpm php7.2-common php7.2-curl php7.2-mbstring php7.2-gd php7.2-intl php7.2-mysql php7.2-xml php7.2-json

When you have installed the above extensions, Apache 2 will be installed automatically. You don't need to install Apache explicitly.

To check PHP installation, you can execute the following command to check your installed PHP version.

# php --version

Install MariaDB

Fork CMS supports MySQL. In this tutorial, you will use a MariaDB database. By default, the Ubuntu repository has an older version of MariaDB. To use a new version of MariaDB, you will need to add MariaDB repository to your Ubuntu system. To do so, follow the steps below.

Verify the keys by executing the following command.

# sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8

Add the repository using the following command.

# sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://mirror.nodesdirect.com/mariadb/repo/10.2/ubuntu xenial main'

Update the system.

# sudo apt update

Install MariaDB using the following command.

# sudo apt install -y mariadb-server

Start and enable the MariaDB so that after reboot, MariaDB can start automatically.

# sudo systemctl start mariadb
# sudo systemctl enable mariadb

Run the following command to enhance the security of MariaDB and set a password for the root user.

# sudo mysql_secure_installation

Connect to the MySQL shell as the root user using the command below and enter your password.

# sudo mysql -u root -p

Execute the following MySQL queries in your MariaDB server.

CREATE DATABASE forkdb;
CREATE USER 'aareez'@'localhost' IDENTIFIED BY '654321Ab';
GRANT ALL PRIVILEGES ON forkdb.* TO aareez@localhost;
FLUSH PRIVILEGES;
EXIT; 

Install Composer

Fork CMS uses the Symphony framework, so it requires the installation of Composer. To install and setup Composer, execute the following commands.

# php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
# php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
# php composer-setup.php
# php -r "unlink('composer-setup.php');"
# sudo mv composer.phar /usr/local/bin/composer

Install Fork CMS

To install Fork CMS, you will need to perform the following steps.

Navigate to /var/www/ using the command.

# cd /var/www

Download the latest stable release of Fork CMS using the command below.

# sudo composer create-project forkcms/forkcms

Provide ownership of /var/www/ to www-data so that apache server can access the required files.

# sudo chown -R www-data:www-data /var/www/forkcms

Configure Database

To set up the database, execute the following command. It will open a file using nano editor in which you will need to update username, password, database name, host and port.

# sudo nano /var/www/forkcms/app/config/parameters_install.yml

Configure Apache Server

Create a virtual host configuration file for Fork CMS. Execute the following command, a file will be opened in nano text editor.

# sudo nano /etc/apache2/sites-available/fork.conf

Copy and Fork CMS the following code and save the file.

<VirtualHost *:80> 
    ServerAdmin admin@xyz.com
    ServerName www.softpedia.xyz
    DocumentRoot /var/www/forkcms
    DirectoryIndex index.php index.htm index.html
   <Directory /var/www/forkcms>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
 ErrorLog ${APACHE_LOG_DIR}/ForkCMS_error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/ForkCMS_access.log combined
</VirtualHost>

Execute the command below to disable default site.

# sudo a2dissite 000-default.conf

You will need to enable the newly created virtual host.

# sudo a2ensite fork

You will need to enable rewrite mod. You can do so by editing the configuration file in Apache 2 directory or you can simply execute the command below.

# sudo a2enmod rewrite

You will need to enable an SSL engine. You can do so by editing the configuration file in Apache 2 directory or you can simply execute the command below.

# sudo a2enmod ssl

You will have to restart the Apache Server to apply the changes and load the settings by executing the command below.

# sudo service apache2 restart

You can access Fork CMS via your domain name or ECS IP address. In my case, I have accessed it via http://www.softpedia.xyz . Remember to prefix www in the URL. You will see the following screen.

Install SSL Certificate

To install an SSL certificate using Let's Encrypt, you will use Certbot. To do so, execute the following steps.

Update the package using the command.

# sudo apt-get update

To install software-properties-common, execute the command below.

# sudo apt-get install software-properties-common

Add the certbot repository by using the command below.

# sudo add-apt-repository ppa:certbot/certbot

Update the package to load the added certbot repository using the command.

# sudo apt-get update

Stop Apache before the issuance of the SSL certificate.

# sudo systemctl stop apache2

Install python-certbot-apache using the command below.

# sudo apt-get install python-certbot-apache

Execute the following command to get Let's Encrypt SSL issued.

# sudo certbot --apache -d www.softpedia.xyz

Select option two to redirect the link to https and update virtual host settings for SSL.

Restart the Apache Server.

# sudo systemctl start apache2

You will have to edit the .htaccess file to activate rules for SSL. To do so, execute the command below.

# sudo nano /var/www/forkcms/.htaccess

Now remove the # sign as shown in the following code.

# redirect all traffic to https
     <IfModule headers_module>
       Header set Strict-Transport-Security "max-age=31536000; includeSubDomains" env=HTTPS
     </IfModule>
     RewriteCond %{HTTPS} !=on
     RewriteCond %{HTTP_HOST} !.*\.dev [NC]
     RewriteCond %{HTTP_HOST} !.*localhost(:\d+)?$ [NC]
     RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

 # one url to rule them all
     RewriteCond %{HTTP_HOST} !^www\.softpedia\.xyz [NC]
     RewriteCond %{HTTP_HOST} !.*\.dev [NC]
     RewriteCond %{HTTP_HOST} !.*localhost(:\d+)?$ [NC]
     RewriteRule ^(.*)$ http://www.softpedia.xyz/$1 [R=301,L]

You can access your website using https protocol https://www.your_domain_name.tld.

Set Up Firewalls and Ports

If you have activated firewalls, you will have to define a rule in Alibaba Cloud security group for your cloud server to add an exception for port 80/tcp and 443/tcp. You can enable these ports while creating ECS instance, but in case if you have forgotten to unblock these ports, you can follow the procedure in this guide: https://www.alibabacloud.com/help/doc-detail/25471.htm

Configuring Fork CMS

Access Fork CMS via domain name or ECS IP address.

Hit Next twice. You will see the database configuration screen. Add the details about your database.

Set the email and password for admin panel and hit Finish Installation.

6

You will be redirected to the following screen.

7


You can access the admin panel by prefixing /private to the link.

After login, you will see the following dashboard.

9

After accessing the home page, you will see the following screen.

10

Congratulations! You have successfully installed and configured Fork CMS on your Alibaba Cloud Elastic Compute Service (ECS) server.

Content management system Entity component system Fork (software development) Command (computing) Cloud computing Alibaba Cloud

Published at DZone with permission of Arslan ud Din Shafiq, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Understanding gRPC Concepts, Use Cases, and Best Practices
  • Upgrade Guide To Spring Data Elasticsearch 5.0
  • Web Application Architecture: The Latest Guide
  • Iptables Basic Commands for Novice

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: