How to Install ProcessWire CMS on CentOS 7
ProcessWire is free and open source content management system. It provides an easy to use flexible platform which is fully customizable. It provides a simpler and stronger control over your pages, fields, templates and markup at any scale. A full featured API is also included to make content management easy.
In this tutorial, we will install ProcessWire on CentOS 7 server.
- Minimal CentOS 7 server
- Root privileges
Step 1 - Installing Apache
It is recommended to update the server before installing any package so that the existing packages and repositories are updated.
yum -y update
Once you have your system updated, you can proceed to install the Apache web server.
yum -y install httpd
Now start Apache web server and enable it to start at boot time using the following command.
systemctl start httpd
systemctl enable httpd
Step 2 - Installing PHP
ProcessWire support all the version of PHP greater than 5.3. But in this tutorial, we will install PHP 7.1 as PHP v5.3 has reached the end of life. Installing the latest version of PHP will ensure the maximum security and performance of the application.
The default YUM repository of CentOS does not have PHP 7.1 included, 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
Type the commands to install Webtatic repository.
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y update
Type the following command to install PHP 7.1 along with all the required dependencies.
yum -y install php71w php71w-mysqli php71w-gd php71w-cli ImageMagick
To check if PHP is installed successfully, you can run:
You should get output similar to this.
[root@liptan-pc ~]# php -v PHP 7.1.6 (cli) (built: Jun 10 2017 07:28:42) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
Now you will need to configure few configurations in PHP. Open the PHP configuration file, php.ini using your favourite text editor. In this tutorial, we will be using nano editor. If you do not have nano installed, you can run yum -y install nano.
Find the following line and Uncomment the line and set the timezone according to your region. For example:
[Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone = Asia/Kolkata
Step 3 - Installing MariaDB
MariaDB is a fork of MySQL database. To install MariaDB on your server, run:
yum -y install mariadb mariadb-server
Run the following commands to start MariaDB and enable it to start at boot time.
systemctl start mariadb
systemctl enable mariadb
Now run the following commands to secure your MariaDB installation.
The above command will run a script to secure fresh MariaDB installation. The script will ask for the existing root user password, we have just installed MariaDB, the root password is not set, just press enter to proceed further.
The script 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. Most of the questions are self-explanatory and you should answer yes or y to all the questions. The output will look like shown below.
To create a database we will need to login to MySQL command line first. Run the following command for same.
mysql -u root -p
The above command will login to MySQL shell of the root user, it will prompt for the password of the root user. Provide the password to login. Now run the following query to create a new database for your ProcessWire installation.
CREATE DATABASE pw_data;
The above query will create a new database named pw_data. You can use any other name for your database if you want. 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. To create a new database user, run the following query.
CREATE USER 'pw_user'@'localhost' IDENTIFIED BY 'StrongPassword';
The above query will create a user with username pw_user. You can use any username you prefer instead of pw_user. Replace StrongPassword with a very strong password. Now provide the all the privileges to your database user over the database you have created. Run the following command.
GRANT ALL PRIVILEGES ON pw_data.* TO 'pw_user'@'localhost';
Now run the following command to immediately apply the changes on the database privileges.
Exit from MySQL prompt using the following command.
Step 4 - Installing and Configuring ProcessWire
As we have all the dependencies ready, we can now download the install package from ProcessWire website.
You can always find the link to the latest version of the application on ProcessWire download page. Extract the archive using the following command.
If you do not have unzip installed, you can run yum -y install unzip. Rename your ProcessWire folder using:
mv processwire-master processwire
Step 5 - Configure Permissions and Firewall
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/processwire
You may also need to allow HTTP traffic on port 80 through the firewall if you are running one. Run the following commands for same.
firewall-cmd --zone=public --permanent --add-service=http
Now you will need to disable your SELinux because Proxy configuration does not work with SELinux policies. To temporary disable SELinux without restarting the server, run the following command.
To completely disable the SELinux you will need to edit /etc/selinux/config file.
Find the following line:
Change it to:
Now create a virtual host for the ProcessWire application. Run the following command for same.
Paste the following lines into the file.
<VirtualHost *:80> ServerAdmin firstname.lastname@example.org DocumentRoot "/var/www/processwire" ServerName cms.yourdomain.com ServerAlias www.cms.yourdomain.com <Directory "/var/www/processwire"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> ErrorLog "/var/log/httpd/cms.yourdomain.com-error_log" CustomLog "/var/log/httpd/cms.yourdomain.com-access_log" combined </VirtualHost>
Replace cms.yourdomain.com with any domain or subdomain 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 favourite web browser.
You will be welcomed by the following page.
Click on the button Get Started to start the web based installation. In next interface choose the installation profile.
You can choose to install the Default beginner or intermediate profile, or blank or classic profile. For a beginner you can choose the default profile. It will install a minimalistic responsive theme on your site. If you choose blank profile, then no theme will be installed. Choosing Classic profile will install the default theme of Processwire 2.3.
In next interface you will see the required requirements, if you have followed the tutorial correctly, you will have all the dependencies satisfied.
In next interface, provide the database details. Choose the default time zone and provide the hostname for your site. If you are accessing the site using the domain name, put your domain name. You can also put your IP address here.
ProcessWire is has now written the database. You can now change the admin panel url. Keep a private non guessable URL so that the admin panel is protected from brute force attacks. Provide an username and password for admin user.
ProcessWire is now installed, you can access the admin panel at cms.yourdomain.com.
To access the backend of your site. Go to the admin URL you chose at the time of installation and login using admin credentials.
Installation of ProcessWire CMS is now finished, you can use the CMS to easily create a beautiful website for personal or commercial purpose.