{"id":17534,"date":"2015-08-24T15:57:54","date_gmt":"2015-08-24T20:57:54","guid":{"rendered":"https:\/\/secure.rosehosting.com\/blog\/?p=17534"},"modified":"2022-06-03T03:44:14","modified_gmt":"2022-06-03T08:44:14","slug":"install-anchor-cms-on-a-debian-8-vps","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/install-anchor-cms-on-a-debian-8-vps\/","title":{"rendered":"Install Anchor CMS on a Debian 8 VPS"},"content":{"rendered":"
<\/div>

\"install-anchor-cms-on-a-debian-8-vps\"In 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<\/a> systems as well but was tested and written for an Debian 8 VPS<\/a>.
\n<\/p>\n

Login to your VPS via SSH<\/h4>\n
ssh user@vps<\/pre>\n

Update the system and install necessary packages<\/h4>\n
[user]$ sudo apt-get update && sudo apt-get -y upgrade\r\n[user]$ sudo apt-get install wget software-properties-common<\/pre>\n

Install MariaDB 10.0<\/h4>\n

To install the latest MariaDB 10 version, run the following commands:<\/p>\n

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

When the installation is complete, run the following command to secure your installation:<\/p>\n

[user]$ mysql_secure_installation<\/pre>\n

Next, we need to create a database for our Anchor installation.<\/p>\n

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

Install Nginx<\/h4>\n

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:<\/p>\n

[user]$ sudo vim \/etc\/apt\/sources.list<\/pre>\n
deb http:\/\/packages.dotdeb.org jessie all\r\ndeb-src http:\/\/packages.dotdeb.org jessie all<\/pre>\n

Fetch and install the GnuPG key:<\/p>\n

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

Update the system and install Nginx:<\/p>\n

[user]$ sudo apt-get update\r\n[user]$ sudo apt-get -y install nginx<\/pre>\n

Install PHP and required PHP modules<\/h4>\n

To install the latest stable version of PHP version 5.6 and all nessesary modules, run:<\/p>\n

[user]$ sudo apt-get -y install php5-fpm php5-cli php5-gd php5-mysqlnd php5-curl php5-mcrypt<\/pre>\n

Download Anchor<\/h4>\n

Create a root directory<\/p>\n

[user]$ mkdir -p ~\/myAnchor.com\/public_html<\/pre>\n

Download the latest version of Anchor<\/p>\n

[user]$ wget -O \/tmp\/anchorcms.zip http:\/\/anchorcms.com\/download<\/pre>\n

Unzip the Anchor archive<\/p>\n

[user]$ unzip \/tmp\/anchorcms.zip -d \/tmp\r\n[user]$ mv \/tmp\/anchor-cms-*\/* ~\/myAnchor.com\/public_html\/<\/pre>\n

PHP-FPM configuration<\/h4>\n

Create a new PHP-FPM pool for your user:<\/p>\n

[user]$ sudo tee -a \/etc\/php5\/fpm\/pool.d\/$(whoami).conf  << EOF\r\n[$(whoami)]\r\nuser = $(whoami)  \r\ngroup = $(whoami)  \r\nlisten = \/var\/run\/php5-fpm-$(whoami).sock  \r\nlisten.owner = $(whoami)\r\nlisten.group = $(whoami)  \r\nlisten.mode = 0666  \r\npm = ondemand  \r\npm.max_children = 5  \r\npm.process_idle_timeout = 10s;  \r\npm.max_requests = 200  \r\nchdir = \/\r\nEOF<\/pre>\n

Change the upload filesize limit:<\/p>\n

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

Restart PHP-FPM:<\/p>\n

[user]$ sudo service php5-fpm restart<\/pre>\n

Nginx configuration<\/h4>\n

Create a new Nginx server block with the following content:<\/p>\n

[user]$ sudo tee -a \/etc\/nginx\/sites-available\/myAnchor.com  << EOF\r\nserver {\r\n    server_name myAnchor.com;\r\n    listen 80;\r\n    root $HOME\/myAnchor.com\/public_html;\r\n    index index.html index.php;\r\n\r\n    access_log \/var\/log\/nginx\/myAnchor.com-access.log;\r\n    error_log \/var\/log\/nginx\/myAnchor.com-error.log;\r\n\r\n    location \/ {\r\n        try_files \\$uri \\$uri\/ \/index.php;\r\n    }\r\n\r\n    location ~* \\.(jpg|jpeg|gif|css|png|js|ico|html)$ {\r\n      access_log off;\r\n      expires max;\r\n    }\r\n\r\n    location ~ \\.php\\$ {\r\n        fastcgi_pass unix:\/var\/run\/php5-fpm-$(whoami).sock;\r\n        fastcgi_split_path_info ^(.+\\.php)(\/.*)\\$;\r\n        include fastcgi_params;\r\n        fastcgi_param SCRIPT_FILENAME \\$document_root\\$fastcgi_script_name;\r\n        fastcgi_intercept_errors off;\r\n        fastcgi_buffer_size 16k;\r\n        fastcgi_buffers 4 16k;\r\n        fastcgi_index index.php;\r\n    }\r\n\r\n    location ~ \/\\.ht {\r\n        deny all;\r\n    }    \r\n}\r\nEOF<\/pre>\n

Activate the server block by creating a symbolic link :<\/p>\n

[user]$ sudo ln -s \/etc\/nginx\/sites-available\/myAnchor.com \/etc\/nginx\/sites-enabled\/myAnchor.com<\/pre>\n

Test the Nginx configuration and restart nginx:<\/p>\n

[user]$ sudo nginx -t\r\n[user]$ sudo service nginx restart<\/pre>\n

Install Anchor<\/h4>\n

Open your web browser, navigate to http:\/\/myAnchor.com\/install<\/code> enter the following information:<\/p>\n