{"id":3432,"date":"2017-03-24T17:55:16","date_gmt":"2017-03-24T17:55:16","guid":{"rendered":"https:\/\/qbytes.cloud\/?p=3432"},"modified":"2017-03-24T17:55:16","modified_gmt":"2017-03-24T17:55:16","slug":"install-linux-apache-mysql-php-lamp-stack-centos-7","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2017\/03\/24\/install-linux-apache-mysql-php-lamp-stack-centos-7\/","title":{"rendered":"How To Install Linux, Apache, MySQL, PHP (LAMP) stack On CentOS 7"},"content":{"rendered":"<p>Update your system:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# sudo yum update\n<\/pre>\n<p>Install Apache Server with Basic Configurations<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# sudo yum install httpd\n<\/pre>\n<p>Once it installs, you can start Apache:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# sudo systemctl start httpd.service\n\n<\/pre>\n<p>Check the installation:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nhttp:\/\/your_server_IP_address\/\n<\/pre>\n<p>You will see the default CentOS 7 Apache web page, which is there for informational and testing purposes. If you cannot load &#8211; see firewall info below. Also check selinux:<\/p>\n<p>Selinux in CentOS7<\/p>\n<p>For permanent disabling after reboot do:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# sudo nano \/etc\/selinux\/config\nSELINUX=permissive or disabled\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# sudo setenforce 0\n\n<\/pre>\n<p>and check with<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# sestatus\n\n<\/pre>\n<p>The last thing you will want to do is enable Apache to start on boot. Use the following command to do so:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# sudo systemctl enable httpd.service\n\n<\/pre>\n<p>For the database, I am installing Maria:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# sudo yum install mariadb-server mariadb\n<\/pre>\n<p>When the installation is complete, we need to start MariaDB with the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# sudo systemctl start mariadb\n\n<\/pre>\n<p>Secure MySql<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# sudo mysql_secure_installation\n<\/pre>\n<p>Enable it:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# sudo systemctl enable mariadb.service\n<\/pre>\n<p>Install PHP<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# sudo yum install php php-mysql php-pdo php-gd php-mbstring\n# sudo yum install php php-pear\n<\/pre>\n<p>Edit \/etc\/php.ini for better error messages and logs, and upgraded performance. <\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\nnano \/etc\/php.ini\nerror_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR\nerror_log = \/var\/log\/php\/error.log\nmax_input_time = 30\n\n<\/pre>\n<p>Create the log directory for PHP and give the Apache user ownership:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# sudo mkdir \/var\/log\/php\n# sudo chown apache \/var\/log\/php\n\n<\/pre>\n<p>Locate and change date.timezone line to look like this, using <a href=\"http:\/\/php.net\/manual\/en\/timezones.php\" target=\"_blank\" rel=\"noopener\">PHP Supported Timezones list<\/a>.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\ndate.timezone = Continent\/City\n\n<\/pre>\n<p>Restart<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# sudo systemctl restart httpd.service\n<\/pre>\n<p>Install PHP Modules<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# yum search php\nphp-bcmath.x86_64 : A module for PHP applications for using the bcmath library\nphp-cli.x86_64 : Command-line interface for PHP\nphp-common.x86_64 : Common files for PHP\nphp-dba.x86_64 : A database abstraction layer module for PHP applications\nphp-devel.x86_64 : Files needed for building PHP extensions\nphp-embedded.x86_64 : PHP library for embedding in applications\nphp-enchant.x86_64 : Enchant spelling extension for PHP applications\nphp-fpm.x86_64 : PHP FastCGI Process Manager\nphp-gd.x86_64 : A module for PHP applications for using the gd graphics library\n. . .\n<\/pre>\n<p>To get more information about what each module does, you can either search the internet, or you can look at the long description in the package by typing:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# sudo yum info package_name\n\n<\/pre>\n<p>If you are running a firewall, run the following commands to allow HTTP and HTTPS traffic:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\nsudo firewall-cmd --permanent --zone=public --add-service=http \nsudo firewall-cmd --permanent --zone=public --add-service=https\nsudo firewall-cmd --reload\n\n<\/pre>\n<p>Other important Firewalld options are presented below:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# firewall-cmd --state\n# firewall-cmd --list-all\n# firewall-cmd --list-interfaces\n# firewall-cmd --get-service\n# firewall-cmd --query-service service_name\n# firewall-cmd --add-port=8080\/tcp\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Update your system: # sudo yum update Install Apache Server with Basic Configurations # sudo yum install httpd Once it installs, you can start Apache: # sudo systemctl start httpd.service Check the installation: http:\/\/your_server_IP_address\/ You will see the default CentOS 7 Apache web page, which is there for informational and testing purposes. If you cannot &#8230; <a title=\"How To Install Linux, Apache, MySQL, PHP (LAMP) stack On CentOS 7\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2017\/03\/24\/install-linux-apache-mysql-php-lamp-stack-centos-7\/\" aria-label=\"Read more about How To Install Linux, Apache, MySQL, PHP (LAMP) stack On CentOS 7\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-3432","post","type-post","status-publish","format-standard","hentry","category-administration"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/3432","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=3432"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/3432\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=3432"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=3432"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=3432"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}