{"id":7578,"date":"2018-12-10T17:10:26","date_gmt":"2018-12-10T14:10:26","guid":{"rendered":"https:\/\/www.howtoforge.com\/tutorial\/how-to-install-anchor-cms-on-centos-7\/"},"modified":"2018-12-10T17:10:26","modified_gmt":"2018-12-10T14:10:26","slug":"how-to-install-anchor-cms-on-centos-7","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/how-to-install-anchor-cms-on-centos-7\/","title":{"rendered":"\u0646\u062d\u0648\u0647 \u0646\u0635\u0628 Anchor CMS \u062f\u0631 CentOS 7"},"content":{"rendered":"<p dir=\"ltr\" style=\"text-align: left;\">Anchor\u00a0is a lightweight open source blog CMS written in PHP. Anchor&#8217;s source code is hosted on\u00a0GitHub. This\u00a0tutorial will show you how to install Anchor CMS on a CentOS 7 system.<\/p>\n<h2 id=\"requirements\" dir=\"ltr\" style=\"text-align: left;\">Requirements<\/h2>\n<p dir=\"ltr\" style=\"text-align: left;\">Make sure your server meets the following requirements.<\/p>\n<ul dir=\"ltr\" style=\"text-align: left;\">\n<li>MySQL 5.6 or greater (MySQL 5.7 recommended)<\/li>\n<li>PHP 5.6 or greater with the following PHP extensions: (<code>curl,\u00a0<\/code><code>mcrypt,<\/code>\u00a0<code>gd,<\/code>\u00a0<code>mbstring,<\/code>\u00a0<code>pdo_mysql<\/code>\u00a0or\u00a0<code>pdo_sqlite<\/code>)<\/li>\n<li>Apache or Nginx. In this tutorial we will use Nginx.<\/li>\n<\/ul>\n<ul dir=\"ltr\" style=\"text-align: left;\">\n<li>CentOS 7 operating system.<\/li>\n<li>A <em>non-root<\/em> user with\u00a0<code>sudo<\/code>\u00a0privileges.<\/li>\n<\/ul>\n<h2 id=\"initial-steps\" dir=\"ltr\" style=\"text-align: left;\">Initial steps<\/h2>\n<p dir=\"ltr\" style=\"text-align: left;\">Check\u00a0your CentOS system version:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">cat \/etc\/centos-release<br \/># CentOS Linux release 7.5.1804 (Core)<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Set up the timezone:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">timedatectl list-timezones<br \/>sudo timedatectl set-timezone 'Region\/City'<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Update your operating system\u2019s packages:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">sudo yum update\u00a0-y<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Install some useful\u00a0packages if they are not already installed:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">sudo yum install -y vim wget curl git unzip bash-completion<\/code><\/pre>\n<h2 id=\"step-install-nodejs-and-npm\" dir=\"ltr\" style=\"text-align: left;\">Step 1 &#8211; Install PHP and necessary PHP extensions<\/h2>\n<p dir=\"ltr\" style=\"text-align: left;\">Anchor CMS\u00a0requires PHP version\u00a05.6\u00a0or greater. Default CentOS repositories contain an older version of PHP, and thus we will need to set up a third-party repository to install a newer PHP version. We will use Webtatic repository.<\/p>\n<p dir=\"ltr\" style=\"text-align: left;\">Setup the Webtatic YUM repo:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">sudo rpm -Uvh https:\/\/mirror.webtatic.com\/yum\/el7\/webtatic-release.rpm<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Install PHP, as well as the necessary PHP extensions:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">sudo yum install -y php72w php72w-cli php72w-fpm php72w-common php72w-mbstring php72w-curl php72w-mysql php72w-sqlite3 php72w-gd php72w-mcrypt php72w-dom<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Check the PHP version:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">php --version<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">#\u00a0PHP 7.2.12 (cli) (built: Nov\u00a011 2018 14:54:16) ( NTS )<br \/># Copyright (c) 1997-2018 The PHP Group<br \/>#\u00a0Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\"><\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Start and enable PHP-FPM service:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">sudo systemctl start php-fpm.service<br \/>sudo systemctl enable php-fpm.service<\/code><\/pre>\n<h2 id=\"step-installnbspmysql-and-create-a-database-for-croogo\" dir=\"ltr\" style=\"text-align: left;\">Step 2 &#8211; Install\u00a0MariaDB and create a database for\u00a0Anchor CMS<\/h2>\n<p dir=\"ltr\" style=\"text-align: left;\">Anchor supports MySQL\/MariaDB and SQLite databases. Default CentOS repository contains an unsupported version of MariaDB. Because of that, we will use the official MariaDB repository that contains a newer version of MariaDB.<\/p>\n<p dir=\"ltr\" style=\"text-align: left;\">Create MariaDB YUM repository for CentOS:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">sudo vim \/etc\/yum.repos.d\/MariaDB.repo<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Copy and paste the following text into it:<\/p>\n<pre dir=\"ltr\"><code># MariaDB 10.2 CentOS repository list - created 2017-12-11 23:19 UTC\n# http:\/\/downloads.mariadb.org\/mariadb\/repositories\/\n[mariadb]\nname=MariaDB\nbaseurl=https:\/\/yum.mariadb.org\/10.2\/centos7-amd64\ngpgkey=https:\/\/yum.mariadb.org\/RPM-GPG-KEY-MariaDB\ngpgcheck=1<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">After the file is in place, install MariaDB by running:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">sudo yum install -y MariaDB-server MariaDB-client<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Check the MariaDB version:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">mysql --version<br \/># mysql\u00a0 Ver 15.1 Distrib 10.2.19-MariaDB, for Linux (x86_64) using readline 5.1<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Start and enable MariaDB service:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">sudo systemctl start mariadb.service<br \/>sudo systemctl enable mariadb.service<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Run\u00a0<code>mysql_secure installation<\/code>\u00a0script to improve MariaDB security and set the password for MariaDB\u00a0<code>root<\/code>\u00a0user:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">sudo mysql_secure_installation<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Answer all the questions as shown below:<\/p>\n<pre dir=\"ltr\"><code spellcheck=\"false\"><code spellcheck=\"false\">Enter current password for root (enter for none):<br \/>Set root password? [Y\/n]: Y<br \/>Remove anonymous users? [Y\/n]: Y<br \/>Disallow root login remotely? [Y\/n]: Y<br \/>Remove test database and access to it? [Y\/n]: Y<br \/>Reload privilege tables now? [Y\/n]: Y<\/code><\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Log into MariaDB shell as the user root:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">mysql -u root -p<br \/># Enter password<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Create a MariaDB database and user that you will use for your installation of Anchor CMS, and remember the credentials:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">CREATE DATABASE dbname;<br \/>GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';<br \/>FLUSH PRIVILEGES;<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Exit from MariaDB shell:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">quit<\/code><\/pre>\n<h2 id=\"step-install-and-configurenbspnginx\" dir=\"ltr\" style=\"text-align: left;\">Step 3 &#8211; Install and configure\u00a0Nginx<\/h2>\n<p dir=\"ltr\" style=\"text-align: left;\">Install Nginx web server:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">sudo yum install -y nginx<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Check the\u00a0Nginx version:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">nginx -v<br \/># nginx version: nginx\/1.12.2<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Start and enable Nginx service:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">sudo systemctl start nginx.service<br \/>sudo systemctl enable nginx.service<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Run\u00a0<code>sudo vim \/etc\/nginx\/conf.d\/anchor.conf<\/code>\u00a0and populate the file with the following configuration:<\/p>\n<pre dir=\"ltr\">server {\n listen 80;\n\n server_name example.com;\n root \/var\/www\/anchor;\n\n index index.php index.html;\n\n location \/ {\n try_files $uri $uri\/ \/index.php;\n }\n \n location ~ \\.php$ {\n try_files $uri =404;\n include fastcgi_params;\n fastcgi_pass 127.0.0.1:9000;\n fastcgi_index index.php;\n fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n }\n\n}<\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Test\u00a0Nginx configuration:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">sudo nginx -t<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Reload Nginx:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">sudo systemctl reload nginx.service<\/code><\/pre>\n<h2 id=\"step-download-and-install-composer\" dir=\"ltr\" style=\"text-align: left;\">Step 4 &#8211; Download and install Composer<\/h2>\n<p dir=\"ltr\" style=\"text-align: left;\">To successfully install Anchor, we will need to install Composer, the dependency manager for PHP applications:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">php -r \"copy('https:\/\/getcomposer.org\/installer', 'composer-setup.php');\"<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">php -r &#8220;if (hash_file(&#8216;SHA384&#8217;, &#8216;composer-setup.php&#8217;) === &#8217;93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388a8&#8242;) { echo &#8216;Installer verified&#8217;; } else { echo &#8216;Installer corrupt&#8217;; unlink(&#8216;composer-setup.php&#8217;); } echo PHP_EOL;&#8221;<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\"><\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">php composer-setup.php<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\"><\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">php -r &#8220;unlink(&#8216;composer-setup.php&#8217;);&#8221;<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\"><\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">sudo mv composer.phar \/usr\/local\/bin\/composer<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\"><\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Check the Composer version.<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">composer --version<br \/>#\u00a0Composer version 1.8.0 2018-12-03 10:31:16<\/code><\/pre>\n<h2 id=\"step-install-and-configurenbspnginx\" dir=\"ltr\" style=\"text-align: left;\">Step 5 &#8211; Download and install\u00a0Anchor CMS<\/h2>\n<p dir=\"ltr\" style=\"text-align: left;\">Create a document root directory:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">sudo mkdir -p \/var\/www\/anchor<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Change ownership of the\u00a0<code>\/var\/www\/limesurvey<\/code>\u00a0directory to\u00a0[jour_user]<code>:<\/code><\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">sudo chown -R [your_user]:[your_user] \/var\/www\/anchor<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Navigate to document root:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">cd \/var\/www\/anchor<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Download\u00a0the latest release of Anchor CMS by using Composer:<\/p>\n<pre class=\"command\" dir=\"ltr\">composer create-project anchorcms\/anchor-cms .<\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Change ownership of the\u00a0<code>\/var\/www\/anchor<\/code>\u00a0directory to\u00a0<code>nginx:<\/code><\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">sudo chown -R nginx:nginx \/var\/www\/anchor<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Create the directory<code>\/var\/lib\/php\/session<\/code>\u00a0and set ownership to\u00a0<code>nginx<\/code>.<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">sudo mkdir -p \/var\/lib\/php\/session &amp;&amp; sudo chown -R nginx:nginx \/var\/lib\/php<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Run\u00a0<code>sudo vim \/etc\/php-fpm.d\/www.conf<\/code>\u00a0and set the user and group to\u00a0<code>nginx<\/code>. Initially, they will be set to\u00a0<code>apache:<\/code><\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">sudo vim \/etc\/php-fpm.d\/www.conf<br \/># user = nginx<br \/># group = nginx<\/code><\/pre>\n<p dir=\"ltr\" style=\"text-align: left;\">Restart the PHP-FPM service:<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">sudo systemctl restart php-fpm.service<\/code><\/pre>\n<h2 id=\"step-complete-the-cachet-setup\" dir=\"ltr\" style=\"text-align: left;\">Step 6 &#8211; Complete the\u00a0Anchor CMS\u00a0setup<\/h2>\n<p dir=\"ltr\" style=\"text-align: left;\">Open your web browser and type the URL\u00a0&#8220;<strong>http:\/\/example.com&#8221;<\/strong>. You will be redirected to the following page:<\/p>\n<p dir=\"ltr\" style=\"text-align: left;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/12\/how-to-install-anchor-cms-on-centos-7.png\" alt=\"Anchor CMS web installer\" width=\"550\" height=\"316\" title=\"\"><\/p>\n<p dir=\"ltr\" style=\"text-align: left;\">Click on the &#8220;<strong>Run the installer&#8221;<\/strong> button, to initiate Anchor CMS web installer. After, language and timezone page should appear:<\/p>\n<p dir=\"ltr\" style=\"text-align: left;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/12\/how-to-install-anchor-cms-on-centos-7-1.png\" alt=\"Select Language and Time zone\" width=\"550\" height=\"316\" title=\"\"><\/p>\n<p dir=\"ltr\" style=\"text-align: left;\">Select the settings that you want and\u00a0click on the &#8220;<strong>Next Step&#8221;<\/strong> button to proceed to the database configuration page:<\/p>\n<p dir=\"ltr\" style=\"text-align: left;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/12\/how-to-install-anchor-cms-on-centos-7-2.png\" alt=\"Database settings\" width=\"550\" height=\"316\" title=\"\"><\/p>\n<p dir=\"ltr\" style=\"text-align: left;\">Enter your database details, and click on the &#8220;<strong>Next Step&#8221;<\/strong> button to proceed to site metadata configuration page:<\/p>\n<p dir=\"ltr\" style=\"text-align: left;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/12\/how-to-install-anchor-cms-on-centos-7-3.png\" alt=\"Site Metadata\" width=\"550\" height=\"316\" title=\"\"><\/p>\n<p dir=\"ltr\" style=\"text-align: left;\">You can\u00a0set site name or site description here, or leave the defaults and change it later via Anchor backend interface. Click on the &#8220;<strong>Next Step&#8221;<\/strong> button for the next step which is setting your first account:<\/p>\n<p dir=\"ltr\" style=\"text-align: left;\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/12\/how-to-install-anchor-cms-on-centos-7-4.png\" alt=\"Create admin account\" width=\"550\" height=\"316\" title=\"\"><\/p>\n<p dir=\"ltr\" style=\"text-align: left;\">After setting up your first account, click on the &#8220;<strong>Complete&#8221;<\/strong> button to finish the installation process.<\/p>\n<p dir=\"ltr\" style=\"text-align: left;\">Once you have completed the install, make sure to delete\u00a0<code class=\"highlighter-rouge\">install<\/code>\u00a0folder for security purposes.<\/p>\n<pre class=\"command\" dir=\"ltr\"><code spellcheck=\"false\">sudo rm -rf \/var\/www\/anchor\/install<\/code><\/pre>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Anchor\u00a0is a lightweight open source blog CMS written in PHP. Anchor&#8217;s source code is hosted on\u00a0GitHub. This\u00a0tutorial will show you how to install Anchor CMS on a CentOS 7 system. Requirements Make sure your server meets the following requirements. MySQL 5.6 or greater (MySQL 5.7 recommended) PHP 5.6 or greater with the following PHP extensions: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-7578","post","type-post","status-publish","format-standard","hentry","category-36"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/7578","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=7578"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/7578\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=7578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=7578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=7578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}