Install Anchor CMS on a Debian 8 VPS

install-anchor-cms-on-a-debian-8-vpsIn this tutorial, we will explain how to install Anchor CMS on a Debian 8 VPS with MariaDB, PHP-FPM and Nginx. Anchor CMS is a modern lightweight open source CMS built on PHP. This guide should work on other Linux VPS systems as well but was tested and written for an Debian 8 VPS.

Login to your VPS via SSH

ssh user@vps

Update the system and install necessary packages

[user]$ sudo apt-get update && sudo apt-get -y upgrade
[user]$ sudo apt-get install wget software-properties-common

Install MariaDB 10.0

To install the latest MariaDB 10 version, run the following commands:

[user]$ sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
[user]$ sudo add-apt-repository 'deb http://mirror.jmu.edu/pub/mariadb/repo/10.0/debian jessie main'
[user]$ sudo apt-get update
[user]$ sudo apt-get install -y mariadb-server

When the installation is complete, run the following command to secure your installation:

[user]$ mysql_secure_installation

Next, we need to create a database for our Anchor installation.

[user]$ mysql -uroot -p
MariaDB [(none)]> CREATE DATABASE anchor;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON anchor.* TO 'anchoruser'@'localhost' IDENTIFIED BY 'anchoruserpasswd';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> \q

Install Nginx

The latest version of Nginx, version 1.8 is not available via the default Debian repositories, so we will add the Dotdeb repository. Open the /etc/apt/sources.list file and append the following lines:

[user]$ sudo vim /etc/apt/sources.list
deb http://packages.dotdeb.org jessie all
deb-src http://packages.dotdeb.org jessie all

Fetch and install the GnuPG key:

[user]$ curl -sS http://www.dotdeb.org/dotdeb.gpg | sudo apt-key add -

Update the system and install Nginx:

[user]$ sudo apt-get update
[user]$ sudo apt-get -y install nginx

Install PHP and required PHP modules

To install the latest stable version of PHP version 5.6 and all nessesary modules, run:

[user]$ sudo apt-get -y install php5-fpm php5-cli php5-gd php5-mysqlnd php5-curl php5-mcrypt

Download Anchor

Create a root directory

[user]$ mkdir -p ~/myAnchor.com/public_html

Download the latest version of Anchor

[user]$ wget -O /tmp/anchorcms.zip http://anchorcms.com/download

Unzip the Anchor archive

[user]$ unzip /tmp/anchorcms.zip -d /tmp
[user]$ mv /tmp/anchor-cms-*/* ~/myAnchor.com/public_html/

PHP-FPM configuration

Create a new PHP-FPM pool for your user:

[user]$ sudo tee -a /etc/php5/fpm/pool.d/$(whoami).conf  << EOF
[$(whoami)]
user = $(whoami)  
group = $(whoami)  
listen = /var/run/php5-fpm-$(whoami).sock  
listen.owner = $(whoami)
listen.group = $(whoami)  
listen.mode = 0666  
pm = ondemand  
pm.max_children = 5  
pm.process_idle_timeout = 10s;  
pm.max_requests = 200  
chdir = /
EOF

Change the upload filesize limit:

[user]$ sudo cp /etc/php5/fpm/php.ini{,.backup}  
[user]$ sudo sed -i "s/^upload_max_filesize = .*/upload_max_filesize = 64M/" /etc/php5/fpm/php.ini

Restart PHP-FPM:

[user]$ sudo service php5-fpm restart

Nginx configuration

Create a new Nginx server block with the following content:

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS
[user]$ sudo tee -a /etc/nginx/sites-available/myAnchor.com  << EOF
server {
    server_name myAnchor.com;
    listen 80;
    root $HOME/myAnchor.com/public_html;
    index index.html index.php;

    access_log /var/log/nginx/myAnchor.com-access.log;
    error_log /var/log/nginx/myAnchor.com-error.log;

    location / {
        try_files \$uri \$uri/ /index.php;
    }

    location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
      access_log off;
      expires max;
    }

    location ~ \.php\$ {
        fastcgi_pass unix:/var/run/php5-fpm-$(whoami).sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)\$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
        fastcgi_index index.php;
    }

    location ~ /\.ht {
        deny all;
    }    
}
EOF

Activate the server block by creating a symbolic link :

[user]$ sudo ln -s /etc/nginx/sites-available/myAnchor.com /etc/nginx/sites-enabled/myAnchor.com

Test the Nginx configuration and restart nginx:

[user]$ sudo nginx -t
[user]$ sudo service nginx restart

Install Anchor

Open your web browser, navigate to http://myAnchor.com/install enter the following information:

  • Database Host: localhost
  • Database Name: anchor (the name of the database you previously created)
  • Username: anchoruser (the name of the MySQL user you previously created)
  • Password: anchoruserpasswd (the password of the MySQL user you previously created)

create an administrator account and click on the “Complete” button.

That’s it. You have successfully installed Anchor on your Debian 8 VPS. For more information about how to manage your Anchor installation, please refer to the Anchor website.


Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to setup this 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.

Leave a Comment