{"id":1048,"date":"2018-07-11T11:54:05","date_gmt":"2018-07-11T06:24:05","guid":{"rendered":"https:\/\/www.coimbatorewebhosting.com\/blog\/?p=1048"},"modified":"2019-04-09T17:13:46","modified_gmt":"2019-04-09T11:43:46","slug":"install-drupal-php-7-on-centos7","status":"publish","type":"post","link":"https:\/\/coimbatorewebhosting.com\/blog\/install-drupal-php-7-on-centos7\/","title":{"rendered":"How to install Drupal with PHP 7 on CentOS 7"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/install-drupal-php-7-on-centos7\/#Introduction\" >Introduction<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/install-drupal-php-7-on-centos7\/#Install_Apache\" >Install Apache<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/install-drupal-php-7-on-centos7\/#Install_MariaDB\" >Install MariaDB<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/install-drupal-php-7-on-centos7\/#Install_MariaDB_55\" >Install MariaDB 5.5<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/install-drupal-php-7-on-centos7\/#Install_MariaDB_102_Latest\" >Install MariaDB 10.2 (Latest)<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/install-drupal-php-7-on-centos7\/#Install_PHP_7\" >Install PHP 7<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/install-drupal-php-7-on-centos7\/#Creating_Database\" >Creating Database<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/install-drupal-php-7-on-centos7\/#Download_and_install_Drupal\" >Download and install Drupal<\/a><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Introduction\"><\/span>Introduction<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p style=\"text-align: left;\">Drupal is one of the greatest free and open-source content management systems that used to make many of the websites you see every day.<\/p>\n<p style=\"text-align: left;\">Easy content authoring, excellent security, and reliable performance are some of the most important benefits of using Drupal, but the most important feature of Drupal that sets it apart from other CMS is the flexibility and modularity which is one of the core principals of it.<\/p>\n<p style=\"text-align: left;\">It\u2019s also a great choice for creating integrated digital frameworks. You can extend it to anyone, or many, of thousands of add-ons. Modules expand Drupal\u2019s functionality.<\/p>\n<p>Prerequisites:<\/p>\n<p>For install and using Drupal, you need the following things:<\/p>\n<ul>\n<li>A web server like Apache or Nginx<\/li>\n<li>A database like Mysql (MariaDB)<\/li>\n<li>PHP 5.5 or Higher<\/li>\n<\/ul>\n<p>We are going to Install Apache as our web server, MariaDB as our Database and PHP 7.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Install_Apache\"><\/span>Install Apache<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>install Apache from the official repository with the command below:<\/p>\n<pre>yum install httpd<\/pre>\n<p>After installation execute the following commands to start your Apache service and make it run at startup;<\/p>\n<pre>systemctl start httpd\r\n\r\nsystemctl enable httpd<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"Install_MariaDB\"><\/span>Install MariaDB<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>MariaDB 5.5 is provided by the official RHEL repository and you can install it easily and it\u2019s fine with Drupal (tested out) but it\u2019s not the latest version if you want to install the latest version you need to add the official MariaDB repository first.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Install_MariaDB_55\"><\/span>Install MariaDB 5.5<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>As told you can easily install it with the following command:<\/p>\n<pre>yum install mariadb-server<\/pre>\n<p>Start and Enable the MariaDB service:<\/p>\n<pre>systemctl start mariadb\r\n\r\nsystemctl enable mariadb<\/pre>\n<h4><span class=\"ez-toc-section\" id=\"Install_MariaDB_102_Latest\"><\/span>Install MariaDB 10.2 (Latest)<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>At the time of the writing, 10.2 is the latest stable version of MariaDB.<\/p>\n<p>For adding the MariaDB official repository create a file called \u201cmariadb.repo\u201d with the command below:<\/p>\n<pre>nano \/etc\/yum.repos.d\/mariadb.repo<\/pre>\n<p>And paste the following configuration in it, then save and exit:<\/p>\n<pre># MariaDB 10.2 CentOS repository list - created 2017-09-23 08:48 UTC\r\n# http:\/\/downloads.mariadb.org\/mariadb\/repositories\/\r\n[mariadb]\r\nname = MariaDB\r\nbaseurl = http:\/\/yum.mariadb.org\/10.2\/centos7-amd64\r\ngpgkey=https:\/\/yum.mariadb.org\/RPM-GPG-KEY-MariaDB\r\ngpgcheck=1<\/pre>\n<p>Now you can install MariaDB 10.2 with the following command:<\/p>\n<pre>yum install mariadb-server<\/pre>\n<p>And after the installation, don\u2019t forget to start and enable the service:<\/p>\n<pre>systemctl start mariadb\r\n\r\nsystemctl enable mariadb<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"Install_PHP_7\"><\/span>Install PHP 7<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>PHP 7 is not provided by the official repository, but you can install is from \u201cWebtatic\u201d.<\/p>\n<p>For adding \u201cWebtatic\u201d repo you need to install \u201cEPEL\u201d first:<\/p>\n<pre>yum install epel-release<\/pre>\n<p>Then you can execute the following command to add the Webtatic repository as well:<\/p>\n<pre>rpm -Uvh https:\/\/mirror.webtatic.com\/yum\/el7\/webtatic-release.rpm<\/pre>\n<p>Now you can install PHP 7 and the needed extensions with the following command:<\/p>\n<pre>yum install php70w php70w-curl php70w-gd php70w-pear php70w-mbstring php70w-xml php70w-phar php70w-json php70w-mysql php70w-opcache<\/pre>\n<h4><span class=\"ez-toc-section\" id=\"Creating_Database\"><\/span>Creating Database<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>First of all, we need to do some initial configuration for MariaDB.<\/p>\n<p>Run the Mysql installer script with the following command:<\/p>\n<pre>mysql_secure_installation<\/pre>\n<p>Set a password for the \u201croot\u201d user and answer all other question with \u201cy\u201d<\/p>\n<p>Login to root user with the following command:<\/p>\n<pre>mysql -u root -p<\/pre>\n<p>Now we can create our database with the command below (Make sure to replace the red parts with your preferred values):<\/p>\n<pre>create database HS;\r\ngrant all privileges on HS.* to 'username'@'localhost' identified by 'password';\r\nflush privileges;<\/pre>\n<h4><span class=\"ez-toc-section\" id=\"Download_and_install_Drupal\"><\/span>Download and install Drupal<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Download the <a href=\"https:\/\/www.coimbatorewebhosting.com\/unlimited-coimbatore-web-hosting\/\">Drupal<\/a> source from its official <a href=\"https:\/\/www.drupal.org\/\" rel=\"nofollow noopener\" target=\"_blank\">website<\/a> in your document root:<\/p>\n<pre>cd \/var\/www\r\nwget https:\/\/ftp.drupal.org\/files\/projects\/drupal-8.3.7.tar.gz<\/pre>\n<p>Extract the file:<\/p>\n<pre>tar xvzf drupal-8.3.7.tar.gz<\/pre>\n<p>Switch to Drupal source directory:<\/p>\n<pre>cd drupal-8.3.7<\/pre>\n<p>Move everything to the correct document root:<\/p>\n<pre>mv .\/* \/var\/www\/html<\/pre>\n<p>You have to set \u201cApache\u201d as the owner of the Drupal Files with the following command:<\/p>\n<pre>chown -R apache:apache \/var\/www\/html<\/pre>\n<p>Now you can open your browser and enter your server Domain name or IP address to see the following page:<\/p>\n<div id=\"attachment_1054\" style=\"width: 1375px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-1054\" class=\"wp-image-1054 size-full\" src=\"https:\/\/www.coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2018\/07\/drupal-1.jpg\" alt=\"drupal\" width=\"1365\" height=\"707\" srcset=\"https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2018\/07\/drupal-1.jpg 1365w, https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2018\/07\/drupal-1-300x155.jpg 300w, https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2018\/07\/drupal-1-768x398.jpg 768w, https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2018\/07\/drupal-1-1024x530.jpg 1024w\" sizes=\"auto, (max-width: 1365px) 100vw, 1365px\" \/><p id=\"caption-attachment-1054\" class=\"wp-caption-text\">https:\/\/www.drupal.org\/<\/p><\/div>\n<p>Next step enter all the details and configure and go ahead,finally after the installation is complete you will get the page like that,<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1056\" src=\"https:\/\/www.coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2018\/07\/drupal1-2.jpg\" alt=\"\" width=\"1345\" height=\"699\" srcset=\"https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2018\/07\/drupal1-2.jpg 1345w, https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2018\/07\/drupal1-2-300x156.jpg 300w, https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2018\/07\/drupal1-2-768x399.jpg 768w, https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2018\/07\/drupal1-2-1024x532.jpg 1024w\" sizes=\"auto, (max-width: 1345px) 100vw, 1345px\" \/><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Drupal is one of the greatest free and open-source content management systems that used to make many of the websites you see every day. Easy content authoring, excellent security, and reliable performance are some of the most important benefits of using Drupal, but the most important feature of Drupal [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1058,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[153],"tags":[86,63,84,85],"class_list":["post-1048","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos-7-rhel-7","tag-drupal","tag-mariadb","tag-repository","tag-webtatic"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2018\/07\/drupallogo-768x432.jpg","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pa2YU7-gU","_links":{"self":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1048","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/comments?post=1048"}],"version-history":[{"count":0,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1048\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/media\/1058"}],"wp:attachment":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/media?parent=1048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/categories?post=1048"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/tags?post=1048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}