X

Install Anchor CMS on CentOS 7

Spread the love

We’ll show you, how to Install Anchor CMS on CentOS 7. Anchor CMS is an open-source, lighter-weight and ultra-simple blogging system.It’s written in PHP and comes with markdown support, custom fields, themes, i18n compatibility and many more. In this tutorial, we gonna show you How to install Anchor CMS on CentOS 7.

In order to run Anchor CMS on your VPS, the following requirements have to be installed:

  • MySQL
  • PHP
  • Apache 2.4 with mod_php module

In this tutorial, we will install the latest version of Anchor CMS on CentOS 7, with MySQL, PHP and Apache.

1. Update the system

First of all login to your CentOS 7 VPS via SSH as user root:

ssh root@IP_Address

and make sure that it is fully up to date:

yum -y update

2. Install MySQL server

Anchor CMS requires an empty database, so we will install MySQL server:

wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum localinstall mysql57-community-release-el7-7.noarch.rpm
yum install mysql-community-server

Once it is installed, start MySQL and enable it to start on boot:

systemctl start mysqld
systemctl enable mysqld

and run the mysql_secure_installation post-installation script to finish the MySQL set-up:

mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No:y
There are three levels of password validation policy:
LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
Please set the password for root here.
New password: Set New MySQL Password
Re-enter new password: Re-enter New MySQL Password
Estimated strength of the password: 100 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.
All done!

Once MySQL is installed, login to the database server as user root, and create database and user for Anchor CMS:

mysql -u root -p

mysql> CREATE DATABASE anchor;
mysql> GRANT ALL PRIVILEGES ON anchor.* TO 'anchoruser'@'localhost' IDENTIFIED BY 'YOURPASSWORD';
mysql> FLUSH PRIVILEGES;
mysql> \q

3. Install Apache Web Server

Next, we will install Apache web server:

yum install httpd -y

start Apache and make it start on boot:

systemctl start httpd.service
systemctl enable httpd.service

4. Install PHP 7.1

The default PHP version on CentOS 7 is PHP 5.4. In this tutorial, we will install PHP version 7.1.

Install Remi and EPEL repository packages:

rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Enable Remi PHP 7.1 repo:

yum-config-manager --enable remi-php71

and install PHP 7.1 and several PHP modules required by Anchor CMS by executing the following command:

yum -y install php php-mysql php-pecl-zip php-xml php-mbstring php-gd

Next, open the PHP configuration file and increase the upload file size. You can find the location of the PHP configuration file by executing the following command:

php --ini |grep Loaded
Loaded Configuration File:         /etc/php.ini

In our case, we have to make changes to the /etc/php.ini file. We will increase the default upload limit to 100 MB. You can set the values according to your needs. Run the following commands:

sed -i "s/post_max_size = 8M/post_max_size = 100M/" /etc/php.ini
sed -i "s/upload_max_filesize = 2M/upload_max_filesize = 100M/" /etc/php.ini

and restart the web server:

systemctl restart httpd

5. Install Anchor CMS

Go to Anchor’s official website and download the latest stable release of the application

wget https://github.com/anchorcms/anchor-cms/archive/0.12.3a.zip

unpack the downloaded zip archive to the document root directory on your server

unzip 0.12.3a.zip -d /var/www/html/
mv /var/www/html/anchor-cms-0.12.3a /var/www/html/anchor

Set the Apache user to be owner of the Anchor CMS files

chown -R apache:apache /var/www/html/anchor/

Create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘anchor.conf’ on your virtual server:

touch /etc/httpd/conf.d/anchor.conf
nano /etc/httpd/conf.d/anchor.conf

Then, add the following lines:

<VirtualHost YOUR_SERVER_IP:80>
ServerAdmin webmaster@yourdomain.com
DocumentRoot "/var/www/html/anchor/"
ServerName yourdomain.com
ServerAlias www.yourdomain.com
ErrorLog "/var/log/httpd/yourdomain.com-error_log"
CustomLog "/var/log/httpd/yourdomain.com-access_log" combined

<Directory "/var/www/html/anchor/">
DirectoryIndex index.html index.php
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

Restart the Apache web server for the changes to take effect:

systemctl restart httpd

Install Composer

Composer is a dependency manager for PHP with which you can install packages. Composer will pull in all the required libraries and dependencies you need for your project.

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

Now go to the Anchor CMS directory and run the following command:

cd /var/www/html/anchor
composer install

Finally, open your favorite web browser, navigate to http://your-domain.com/ and if you configured everything correctly the Anchor CMS installer should be starting. You should follow the easy instructions on the install screen inserting the necessary information as requested.

That is it. The Anchor CMS installation is now complete.


Of course, you don’t have to install Anchor CMS on CentOS 7 if you use one of our Hosting and Server Support services, in which case you can simply ask our expert Linux admins to install Anchor CMS on CentOS 7 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Categories: Tutorials
admin:
Related Post