Pagekit is a free and open source content management system. It is written in PHP and uses MySQL or SQLite database for storing the data. Pagekit provides beautiful and easy to use drag and drop control panel to manage the pages, menus, and widgets. It has a configurable dashboard which shows all the statistics related to your site at one place. It also provides an inbuilt blog feature so that you can share the blog posts right away. You can write the web page using in-browser tools or Markdown format. It has a file manager which you can use to upload and organize the media files in your browser.
In this tutorial, we will learn how to install Pagekit CMS on CentOS 7 server.
Requirements
Pagekit does not require any special hardware requirements. It can be installed on servers with a small amount of RAM. All the required dependencies will be installed throughout the tutorial. You will need a minimal installation of CentOS 7 with root access on it. If you are logged in as a non-root user, you can run sudo -i
to switch to root user.
Installing Pagekit
Before installing any package it is recommended that you update the packages and repository using the following command.
yum -y update
Once you have your system updated, you can proceed to install the LAMP stack. Start the LAMP installation by installing Apache web server and MariaDB, which is a fork of MySQL using the following command.
yum -y install httpd mariadb-server mariadb
Pagekit can be installed on any version of PHP greater than 5.5. But as PHP 5.5 has reached the end of life. We will install PHP 7 to obtain high performance. PHP 7 is not included in default YUM repository, hence you will need to add the Webtatic repository in your system. Webtatic repository requires EPEL repository to work. Run the following command to install EPEL repository.
yum -y install epel-release
yum -y update
Now install Webtatic repository using the following commands.
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y update
To install PHP 7.1 and all the required PHP modules, run the following command.
yum -y install php71w php71w-openssl php71w-mysql php71w-cli php71w-mbstring php71w-dom php71w-json php71w-session php71w-ctype php71w-tokenizer php71w-simplexml php71w-pcre php71w-zip php71w-pdo php71w-curl php71w-iconv php71w-xml php71w-apc
Once you have PHP installed, you can check the version of PHP using the following command.
php -v
You should get output similar to this.
[root@liptan-pc ~]# php -v
PHP 7.1.3 (cli) (built: Mar 19 2017 15:31:52) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
Now start the Apache web server and enable it to start at boot time using the following command.
systemctl start httpd
systemctl enable httpd
To start MariaDB and enable it to start at boot time using the following commands.
systemctl start mariadb
systemctl enable mariadb
Now run the following commands to secure your MySQL or MariaDB installation.
mysql_secure_installation
It will run a small script which asks you to provide the root password for MariaDB. As we have just installed MariaDB, the root password is not set, just press enter to proceed further. It will ask you if you want to set a root password for your MariaDB installation, choose y
and set a strong password for the installation. It will also ask you for removing test databases and anonymous users. Most of the questions are self-explanatory and you should answer yes
or y
to all the questions.
To create a database we will need to login to MySQL command line first. Run the following command for same.
mysql -u root -p
This will prompt you for the password, provide the root password of MySQL which you have set earlier. Now run the following query to create a new database for your Pagekit installation.
CREATE DATABASE pagekit_data;
The above query will create a database named pagekit_data
. For the database, you can use any name you prefer at the place of pagekit_data
. Make sure that you use semicolon at the end of each query as the query always ends with a semicolon. Once the database is created you can create a new user and grant all the permissions to the user for the database. Using root user is not recommended for the databases. To create a new database user, run the following query.
CREATE USER 'pagekit_user'@'localhost' IDENTIFIED BY 'StrongPassword';
The above query will create a user with username Pagekit_user
. You can use any preferred username instead of Pagekit_user
. Replace StrongPassword
with a strong password. Now provide the appropriate privileges to your database user over the database you have created. Run the following command.
GRANT ALL PRIVILEGES ON pagekit_data.* TO 'pagekit_user'@'localhost';
Now run the following command to immediately apply the changes on the database privileges.
FLUSH PRIVILEGES;
Exit from MySQL prompt using exit
command.
As we have all the dependencies ready, we can now download the install package from the Pagekit site.
cd /var/www/html
wget http://pagekit.com/api/download/latest -O pagekit.zip
The above command will always download the latest installer archive and store it as pagekit.zip
file. Extract the archive using the following command.
unzip pagekit.zip
If you don’t have unzip
installed, you can run yum -y install unzip
. The above command will extract the files under /var/www/html
directory.
Now you will need to disable your SELinux. To temporary disable SELinux, run the following command.
setenforce 0
To completely disable the SELinux you will need to edit the /etc/selinux/config
file.
nano /etc/selinux/config
Find the following line:
SELINUX=enforcing
Change it to:
SELINUX=disabled
Now, you will need to provide the ownership of the application to web server user using the following command.
chown -R apache:apache /var/www/html
You may also need to allow HTTP traffic on port 80
through the firewall if you are running one. Run the following commands to do so.
firewall-cmd --zone=public --permanent --add-service=http
firewall-cmd --reload
Now create a virtual host for the Pagekit application. Run the following command for same.
nano /etc/httpd/conf.d/pagekit.yourdomain.com.conf
Paste the following lines into the file.
<VirtualHost *:80>
ServerAdmin me@liptanbiswas.com
DocumentRoot "/var/www/html"
ServerName pagekit.yourdomain.com
ServerAlias www.pagekit.yourdomain.com
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog "/var/log/httpd/pagekit.yourdomain.com-error_log"
CustomLog "/var/log/httpd/pagekit.yourdomain.com-access_log" combined
</VirtualHost>
Replace pagekit.yourdomain.com
with any domain or sub-domain you want to use to access the application. Save the file and exit from the editor. Run the following command to restart your Apache server.
systemctl restart httpd
Now complete the installation using a web browser, go to the following link using your favorite web browser.
http://pagekit.yourdomain.com
You will be welcomed by the following page.
HP_NO_IMG/data/uploads/users/5bc5f3e0-17df-4257-afd4-59fc57ecae4e/1225859696.jpg” alt=”” />
Click on the button at the center to proceed further. Choose a language to use for the blog and click Next to proceed further.
HP_NO_IMG/data/uploads/users/5bc5f3e0-17df-4257-afd4-59fc57ecae4e/1802493777.jpg” alt=”” />
Now choose a MySQL driver from drop-down list and provide the database and database user information which we have created earlier. Leave the default value in table prefix.
HP_NO_IMG/data/uploads/users/5bc5f3e0-17df-4257-afd4-59fc57ecae4e/1587209822.jpg” alt=”” />
In next step, provide the site name and create administrator user. Click Install button to proceed further.
HP_NO_IMG/data/uploads/users/5bc5f3e0-17df-4257-afd4-59fc57ecae4e/1101186833.jpg” alt=”” />
Pagekit is now installed on your server. You can now access the frontend of your website, which will look as shown below.
HP_NO_IMG/data/uploads/users/5bc5f3e0-17df-4257-afd4-59fc57ecae4e/636695503.jpg” alt=”” />
You can login to administration dashboard using /admin
in URL. You will see the admin dashboard.
HP_NO_IMG/data/uploads/users/5bc5f3e0-17df-4257-afd4-59fc57ecae4e/351598164.jpg” alt=”” />
Conclusion
In this tutorial, we learned how to install Pagekit CMS on CentOS 7. You can now edit the website to create a modern looking website for your business or a beautiful personal blog.