How to Install NEOS CMS on CentOS 7
Neos is a free and open source content management system written in PHP and uses its own framework flow. Neos CMS provides a customizable, extensible and easy to use web interface to edit web content easily. You don't need expensive training or time consuming tutorials on how to operate the CMS. Neos provides a rich set of features like, Users and Roles, Package Manager, Multisite capabilities, Human readable URLs, Reviews and Workflows, Templates and many more.
Features
- Run multiple sites in a single instance.
- Provides human readable out of the box. No requirements or setup needed.
- Allow us to create a user, assign roles and restrict access to administrative and editing features.
- Neos is built for easy deployments and the use of version control systems in mind.
In this tutorial, I will explain how to install and configure Neos CMS on CentOS 7 server.
Requirements
- A server running CentOS 7.
- A not-root user with sudo privileges.
Getting Started
Before starting, it is recommended to update the system with the latest version. You can do this with the following command:
sudo yum update -y
Once your system is updated, restart the system to apply all the changes.
Install LAMP Server
Neos runs on a web server, is written in PHP and uses MariaDB to store its data. So you will need to install LAMP server on your system.
First, install Apache web server using the following command:
sudo yum install httpd -y
Next, start Apache web server and enable it to start at boot time using the following command:
sudo systemctl start httpd
sudo systemctl enable httpd
By default, the latest version of the MariaDB is not available in CentOS 7. so you will need to install MariaDB repository to your system.
You can add the MariaDB repository with the following command:
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
Next, install MariaDB by running the following command:
sudo yum install MariaDB-server MariaDB-client -y
Once MariaDB is installed, start MariaDB service and enable it to start on boot using the following command:
sudo systemctl start mariadb
sudo systemctl enable mariadb
Neos works on any version of PHP greater than 7.0. By default, PHP 7 is not included in CentOS 7 default repository. So you will need to add EPEL and Webtatic repository in your system.
You can install EPEL and Webtatic repository using the following command:
sudo yum install epel-release -y
sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Next, install PHP7.0 with other required libraries using the following command:
sudo yum install php71w php71w-mbstring php71w-pdo_mysql php71w-cli php71w-tokenizer php71w-pecl-imagick php71w-xml php71w-pecl-imagick php71w-mcrypt php71w-opcache php71w-imap php71w-process php71w-intl -y
Once all the packages are installed, you can check the version of the PHP using the following command:
php -v
You should see the following output:
PHP 7.1.5 (cli) (built: May 12 2017 21:54:58) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
Next, you will need to make some changes inside php.ini file. You can do this by running the following command:
sudo nano /etc/php.ini
Make the following changes:
date.timezone = Asia/Kolkata memory_limit = 250M xdebug.max_nesting_level = 500
Save and close the file, when you are finished.
Configure the Database
By default, MariaDB is not secured, so you will need to secure it first. You can do this by running the mysql_secure_installation script. This script will set a root password, remove an anonymous user, disallow root login and remove test database:
sudo mysql_secure_installation
Answer all the questions as follows:
Enter current password for root (enter for none): Just press the Enter button Set root password? [Y/n]: Y New password: your-MariaDB-root-password Re-enter new password: your-MariaDB-root-password Remove anonymous users? [Y/n]: Y Disallow root login remotely? [Y/n]: Y Remove test database and access to it? [Y/n]: Y Reload privilege tables now? [Y/n]: Y
Once the MariaDB is secured, log in to MariaDB console and create a database for Neos:
mysql -u root -p
Enter your root password, then create a database using the following command:
MariaDB [(none)]>CREATE DATABASE neosdb;
Next, create a username and password for Neos with the following command:
MariaDB [(none)]>CREATE USER 'neosuser'@'localhost' IDENTIFIED BY 'password';
Next, grant privileges to the Neos database with the following command:
MariaDB [(none)]>GRANT ALL PRIVILEGES ON neosdb.* TO 'neosuser'@'localhost';
Now change the character set of your database to utf8 using following query.
MariaDB [(none)]>GALTER DATABASE neos_data charset=utf8;
Next, flush the privileges with the following command:
MariaDB [(none)]>flush privileges;
Finally close the MySQL console:
MariaDB [(none)]>exit;
Once MariaDB is configured, you can proceed to install Neos.
Install Neos CMS
Before installing Neos, you will need to install Composer to your system. The Composer is a dependency manager for PHP. You can install it by running the following command:
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/bin/composer
Next, change the directory to the Apache web root directory and download Neos with the following command:
cd /var/www/html
sudo composer create-project --no-dev neos/neos-base-distribution neos
Above command will download the Neos with all required dependencies.
Next, give proper permissions to the neos directory:
sudo choen -R apache:apache /var/www/html/neos
sudo chmod -R 777 /var/www/html/neos
Next, you will need to create a Virtual host for Neos. You can do this by running the following command:
sudo nano /etc/httpd/conf.d/neos.conf
Add the following lines:
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "/var/www/html/neos/Web" ServerName example.com ServerAlias www.example.com <Directory "/var/www/html/neos/Web"> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all Require all granted </Directory> ErrorLog "/var/log/httpd/neos-error_log" CustomLog "/var/log/httpd/neos-access_log" combined </VirtualHost>
Save and close the file, then restart Apache service to apply these changes:
sudo systemctl restart httpd
Access Neos Web Installation Wizard
Before accessing Neos web interface, you will need to allow http and https service for outside access. You can do this by running the following command:
sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --zone=public --permanent --add-service=https
Finally, reload the firewalld to apply all the changes:
sudo firewall-cmd --reload
Now, open your web browser and type the URL http://example.com, you will be redirected to the setup page as shown below:
You will be asked to enter setup password, you can obtain the setup password by running the following command:
cat /var/www/html/neos/Data/SetupPassword.txt
You should see the setup password as shown below:
The setup password is: MLGJHlj6apttd you successfully logged in, this file is automatically deleted for security reasons. Make sure to save the setup password for later use.
Enter the above password in the web interface, then click on the Login button, you should see the following page:
Here, make sure that the imagick or gmagick PHP extension has been installed and chosen. Then click on the Next button, you should see the following page:
Here, enter Database username and password which you have created earlier, select database drive, then click on the Next button, you should see the following page:
Here, enter your administrator account detail, then click on the Next button, you should see the following page:
Here, enter the site name as you wish, then click on the Next button to start the installation. Once the installation is finished, you should see the following page:
Now, click on Go to backend button, you will be redirected to the Neos CMS login page as shown below:
Enter your administrator credential and click on the Login button, you will be redirected to the Neos CMS dashboard as below:
Conclusion
Congratulations! you have successfully installed and configured Neos CMS in your CentOS 7 server. You can now easily create and host your personal site using Neos CMS. Feel free to ask me if you have any questions.