How to Install Pagekit CMS on CentOS 7.4 — Part 2 Installing Pagekit

By Arslan Ud Din Shafiq, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud’s incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.

This is second part of my tutorial about how to install Pagekit CMS on CentOS 7.4.

In the previous tutorial, we have set up a LAMP stack and other required packages for Pagekit. In the second part of the tutorial, we will install Pagekit on our Alibaba Cloud Elastic Compute Service (ECS) instance.

But before doing that, we will need to configure our domain. We will also secure the domain with Let’s Encrypt (SSL). After that, we will create a database and then finally install Pagekit CMS on our ECS instance.

Configure Domain

If you bought your domain from Alibaba Cloud, it will automatically setup DNS records. You will only require to add domain to Alibaba Cloud DNS. In case, if you have already registered domain from any other registrar, you will need to add that domain in Alibaba Cloud DNS and update its nameserver records on your registrar account. Once your DNS records are propagated, check them from intodns.com.

To setup domain name bought from a third party, follow the steps below:

  1. Login to your Alibaba Cloud account and click on Alibaba Cloud DNS (available in left sidebar of your dashboard). Click Add Domain Name.
Image for post
Image for post
  1. Now add A record and its value will be the IP address of your ECS instance as shown below.
Image for post
Image for post
  1. You can skip this step, if you have bought domain from Alibaba Cloud. If you have bought domain from a third party, you will need to visit the domain registrar’s website. The steps differ according to the registrar.
Image for post
Image for post

Create Virtual Host

  1. Once your nameservers are updated, you can setup virtual host to point your domain on your Alibaba Cloud ECS IP Address. To setup virtual host on your ECS, execute the following command. Replace imarslan.com with your domain name.
  • <VirtualHost *:80> # Admin email, Server Name (domain name), and any aliases ServerAdmin itsaareez@example.com ServerName imarslan.com ServerAlias www.imarslan.com # Index file and Document Root (where the public files are located) DirectoryIndex index.html index.php DocumentRoot /var/www/html/ # Log file locations LogLevel warn ErrorLog /var/www/html/error.log CustomLog /var/www/html/access.log combined </VirtualHost>
  1. After adding the text, use Ctrl + X, then press ‘Y’, then hit Enter key to save the file.

Install Git

  1. To begin installation of Let’s Encrypt from GitHub repository, you will need to install Git. Execute the following command to install Git.

Configure Let’s Encrypt SSL

  1. For installation of Let’s Encrypt SSL, you will have to stop your Apache Server. Use the command below to stop apache server. Remember, Certbot uses port 80 to get SSL certificate. Apache server uses same port 80. So, to avoid conflict, Apache server must be stopped until you get SSL certificate issued.
  • <IfModule mod_ssl.c> <VirtualHost *:443> ServerName imarslan.com ServerAdmin itsaareez@example.com ServerAlias www.imarslan.com SSLEngine on SSLCertificateFile /etc/letsencrypt/live/imarslan.com/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/imarslan.com/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/imarslan.com/chain.pem DirectoryIndex index.html index.php DocumentRoot /var/www/html/ # Log file locations LogLevel warn ErrorLog /var/www/html/error.log CustomLog /var/www/html/access.log combined </VirtualHost> </IfModule> <VirtualHost *:80> # Admin email, Server Name (domain name), and any aliases ServerAdmin itsaareez@example.com ServerName imarslan.com ServerAlias www.imarslan.com Redirect permanent / https://www.imarslan.com/ # Log file locations LogLevel warn ErrorLog /var/www/html/error.log CustomLog /var/www/html/access.log combined </VirtualHost>
  1. Replace imarslan.com with your domain name. This above code will force SSL and all of the traffic will be redirected to HTTPS version of the website.

Create Database

  1. Use MariaDB shell to login as root user and execute the following command:
  • CREATE DATABASE pk_db CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE USER 'pk_db'@'localhost' IDENTIFIED BY 'SecurePassword'; GRANT ALL PRIVILEGES ON pk_db.* TO 'pk_db'@'localhost'; FLUSH PRIVILEGES; EXIT;
  1. where pk_db can be changed to your desired name.

Install PageKit CMS Files

  1. To begin installation of PageKit CMS, navigate to directory cd /var/www/html/because in Apache Server, we use this as web-directory.
Image for post
Image for post
  1. Downloaded PageKit CMS is saved in compressed form as pagekit.zip. Now you will have to unzip the compressed zip folder as listed when executed ls -li command. To do so, use the command:

Accessing Pagekit CMS

Congratulations! Now it’s time to access your Pagekit CMS. Just open website in your browser. In my case, I will open www.imarslan.com. Now we will proceed towards completion of installation of Pagekit CMS which will involve different settings.

Image for post
Image for post

Complete the Installation of PageKit CMS

  1. As you are accessing the link first time, you will be automatically redirected to installer page as shown below. Click the arrow shown in figure to proceed to next step.
Image for post
Image for post
  1. In the next step, you will be asked to select your desired language. Select your desired language and click Next.
Image for post
Image for post
  1. After this, add the values for database configurations. Add the following values as we used in the query above.
Image for post
Image for post
  1. Then hit Next.

That’s it! You have successfully installed Pagekit CMS on Alibaba Cloud ECS.

You can access your admin panel by using the admin panel URL you have configured.. To view your website, you can simply access it through https://www.yourdomain.com.

Reference:

https://community.alibabacloud.com/blog/how-to-install-pagekit-cms-on-centos-7-4-%E2%80%93-part-2-installing-pagekit_593700?spm=a2c41.11584364.0.0

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store