{"id":313,"date":"2019-02-09T01:02:28","date_gmt":"2019-02-09T00:02:28","guid":{"rendered":"http:\/\/hentati.org\/?p=313"},"modified":"2020-12-06T21:00:13","modified_gmt":"2020-12-06T20:00:13","slug":"how-to-install-lamp-on-centosrhel-7-linux-apache-mysql-phpphpmyadmin","status":"publish","type":"post","link":"https:\/\/hentati.org\/index.php\/2019\/02\/09\/how-to-install-lamp-on-centosrhel-7-linux-apache-mysql-phpphpmyadmin\/","title":{"rendered":"HOW TO INSTALL LAMP ON CENTOS\/RHEL 7 (Linux, Apache, MySQL, PHP)"},"content":{"rendered":"<header class=\"entry-header\">\n<div class=\"post-title post-title-full clearfix\">\n<div class=\"title-wrap\">\n<p class=\"title single-title\"><span style=\"color: #000000; font-family: 'Open Sans', Helvetica, Arial, sans-serif; font-size: 16px;\">LAMP stands for Linux, Apache, MySQL and PHP. Its is used for hosting websites written with PHP programming language and using MySQL as backend database server. This article will help you to install LAMP stack on CentOS 7 and RedHat 7 systems.<\/span><\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<h3><span style=\"color: #000000;\">Step 1: Install Apache Server with Basic Configurations<\/span><\/h3>\n<\/div>\n<\/header>\n<p><span style=\"color: #000000;\">fter performing a minimal system installation and configure your server network interface with a Static IP Address, Install Apache package :<\/span><\/p>\n<pre><span style=\"color: #000000;\"># yum install httpd<\/span><\/pre>\n<p><span style=\"color: #000000;\">To manage httpd service, we can use those commands\u00a0 :<\/span><\/p>\n<pre><span style=\"color: #000000;\"># systemctl status|start|stop|restart|reload httpd<\/span><\/pre>\n<p><span style=\"color: #000000;\">OR<\/span><\/p>\n<pre><span style=\"color: #000000;\"># service httpd status|start|stop|restart|reload<\/span><\/pre>\n<p><span style=\"color: #000000;\">OR<\/span><\/p>\n<pre><span style=\"color: #000000;\"># apachectl configtest| graceful<\/span><\/pre>\n<p>&nbsp;<\/p>\n<h5><span style=\"color: #000000;\">Don&#8217;t forget to\u00a0authorize httpd service\u00a0permanently on firewall :<\/span><\/h5>\n<pre><span style=\"color: #000000;\"># firewall-cmd --permanent --add-service=http<\/span>\r\n<span style=\"color: #000000;\"># systemctl restart firewalld<\/span><\/pre>\n<p><span style=\"color: #000000;\">Other important Firewalld options are presented below:<\/span><\/p>\n<pre><span style=\"color: #000000;\"># firewall-cmd --state<\/span>\r\n<span style=\"color: #000000;\"># firewall-cmd --list-all<\/span>\r\n<span style=\"color: #000000;\"># firewall-cmd --list-interfaces<\/span>\r\n<span style=\"color: #000000;\"># firewall-cmd --get-service<\/span>\r\n<span style=\"color: #000000;\"># firewall-cmd --query-service service_name<\/span>\r\n<span style=\"color: #000000;\"># firewall-cmd --add-port=8080\/tcp<\/span><\/pre>\n<p>&nbsp;<\/p>\n<h5><span style=\"color: #000000;\">To verify Apache functionality open a remote browser and type\u00a0(<b>http:\/\/server_IP<\/b>)<\/span><\/h5>\n<p><span style=\"color: #000000;\">Apache\u00a0<b>DocumentRoot<\/b>\u00a0path it\u2019s set to\u00a0<b>\/var\/www\/html<\/b>\u00a0system path, to modify it :<\/span><\/p>\n<pre><span style=\"color: #000000;\"># nano \/etc\/httpd\/conf.d\/welcome.conf<\/span>\r\n\r\n<span style=\"color: #000000;\"># systemctl restart httpd<\/span>\r\n\r\n\r\n<\/pre>\n<h3><span style=\"color: #000000;\">Step 2: Install PHP5 Support for Apache<\/span><\/h3>\n<pre><span style=\"color: #000000;\"># yum search php<\/span>\r\n\r\n<span style=\"color: #000000;\"># yum install php php-mysql php-pdo php-gd php-mbstring<\/span><\/pre>\n<p><span style=\"color: #000000;\">To get a full information list on PHP from your browser, create a\u00a0<b>info.php<\/b>\u00a0file on Apache Document Root using the following command from root account, restart httpd service and direct your browser to the\u00a0<b>http:\/\/server_IP\/info.php<\/b>\u00a0address.<\/span><\/p>\n<pre><span style=\"color: #000000;\"># echo \"&lt;?php phpinfo(); ?&gt;\" &gt; \/var\/www\/html\/info.php<\/span>\r\n<span style=\"color: #000000;\"># systemctl restart httpd<\/span><\/pre>\n<p>&nbsp;<\/p>\n<h3><span style=\"color: #000000;\">Step 3: Install and Configure MYSQL Database<\/span><\/h3>\n<pre><span style=\"color: #000000;\"># rpm -Uvh https:\/\/repo.mysql.com\/mysql80-community-release-el7-1.noarch.rpm<\/span>\r\n\r\n<span style=\"color: #000000;\"># yum install mysql-server<\/span>\r\n\r\n<span style=\"color: #000000;\"># systemctl enable mysqld.service<\/span>\r\n\r\n<span style=\"color: #000000;\"># systemctl start mysqld.service<\/span>\r\n\r\n<span style=\"color: #000000;\"># grep \"A temporary password\" \/var\/log\/mysqld.log | tail -n1<\/span><\/pre>\n<p><span style=\"color: #000000;\">A temporary password is generated for root@localhost: EX;By2h#<\/span><\/p>\n<pre><span style=\"color: #000000;\"># mysql_secure_installation<\/span><\/pre>\n<div class=\"pretty-label\"><span style=\"color: #000000;\">MySQL security wizzard<\/span><\/div>\n<pre class=\"pretty\"><span style=\"color: #000000;\">Change the password for root?   - y\r\nRemove anonymous users?   - y\r\nDisallow root login remotely?    - y\r\nRemove test database and access to it?    - y\r\nReload privilege tables now?   - y<\/span><\/pre>\n<p><span style=\"color: #000000;\">MySQL has been installed on your system. After this install PHP.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span style=\"color: #000000;\">Step 4: Install Php<\/span><\/h3>\n<p><span style=\"color: #000000;\">Now, install PHP packages with enabling EPEL and REMI repositories using the following command.<\/span><\/p>\n<pre><span style=\"color: #000000;\"># yum --enablerepo=epel,remi-php73 install php<\/span><\/pre>\n<p><span style=\"color: #000000;\">Then install required PHP modules. Use the following command to list available modules and install it.<\/span><\/p>\n<pre><span style=\"color: #000000;\"># yum --enablerepo=remi-php73 list php-*<\/span>\r\n\r\n<span style=\"color: #000000;\"># yum --enablerepo=remi-php73 install php-mysql php-xml php-xmlrpc php-soap php-gd<\/span><\/pre>\n<p><span style=\"color: #000000;\">After installing php and other php modules restart Apache service.<\/span><\/p>\n<pre><span style=\"color: #000000;\"># systemctl restart httpd.service<\/span><\/pre>\n<p>&nbsp;<\/p>\n<h3 class=\"heading1\"><span style=\"color: #000000;\">Step 5 : Check Installed Version<\/span><\/h3>\n<p><span style=\"color: #000000;\">Let\u2019s check the installed versions of packages on the system using following commands one by one.<\/span><\/p>\n<pre><span style=\"color: #000000;\"><strong># php -v<\/strong>\r\n\r\nPHP 7.3.1 (cli) (built: Jan  8 2019 13:55:51) ( NTS )\r\nCopyright (c) 1997-2018 The PHP Group\r\nZend Engine v3.3.1, Copyright (c) 1998-2018 Zend Technologies\r\n<\/span><\/pre>\n<pre><span style=\"color: #000000;\"><strong># httpd -v<\/strong>\r\n\r\nServer version: Apache\/2.4.6 (CentOS)\r\nServer built:   Nov  5 2018 01:47:09\r\n<\/span><\/pre>\n<pre><span style=\"color: #000000;\"><strong># mysql -V<\/strong>\r\n\r\nmysql  Ver 8.0.13 for Linux on x86_64 (MySQL Community Server - GPL)\r\n<\/span><\/pre>\n<p><span style=\"color: #000000;\">Now you have successfully configured LAMP setup on your CentOS or RedHat 7 system.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>LAMP stands for Linux, Apache, MySQL and PHP. Its is used for hosting websites written with PHP programming language and using MySQL as backend database server. This article will help &#8230;<\/p>\n","protected":false},"author":1,"featured_media":323,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[8],"tags":[],"_links":{"self":[{"href":"https:\/\/hentati.org\/index.php\/wp-json\/wp\/v2\/posts\/313"}],"collection":[{"href":"https:\/\/hentati.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hentati.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hentati.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hentati.org\/index.php\/wp-json\/wp\/v2\/comments?post=313"}],"version-history":[{"count":13,"href":"https:\/\/hentati.org\/index.php\/wp-json\/wp\/v2\/posts\/313\/revisions"}],"predecessor-version":[{"id":656,"href":"https:\/\/hentati.org\/index.php\/wp-json\/wp\/v2\/posts\/313\/revisions\/656"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hentati.org\/index.php\/wp-json\/wp\/v2\/media\/323"}],"wp:attachment":[{"href":"https:\/\/hentati.org\/index.php\/wp-json\/wp\/v2\/media?parent=313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hentati.org\/index.php\/wp-json\/wp\/v2\/categories?post=313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hentati.org\/index.php\/wp-json\/wp\/v2\/tags?post=313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}