{"id":261,"date":"2024-02-08T12:26:12","date_gmt":"2024-02-08T12:26:12","guid":{"rendered":"https:\/\/webhostingpune.co.in\/blog\/?p=261"},"modified":"2024-02-08T12:26:14","modified_gmt":"2024-02-08T12:26:14","slug":"lamp-in-centos-7-easy-steps-to-install","status":"publish","type":"post","link":"https:\/\/webhostingpune.co.in\/blog\/lamp-in-centos-7-easy-steps-to-install\/","title":{"rendered":"LAMP in Centos 7 Easy steps to install and configure"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In my previous post I have posted the LAMP configuration in centos 6 and also how to install the wordpress.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here I took joomla open source for installing and configuring of LAMP for centos 7.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There is no difference between centos 6 and centos 7 the version only changed. And there is slight difference in commands used in SSH.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"lamp-indicates-linux-apache-mysql-and-php\">LAMP-indicates Linux, Apache, mysql and php.<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The LAMP Components includes,<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Operating system \u2013 Linux (e.g. <a href=\"https:\/\/www.centos.org\/download\/\" target=\"_blank\" rel=\"noopener\">CentOS<\/a>)<\/li>\n\n\n\n<li>Web server \u2013 Apache<\/li>\n\n\n\n<li>Database \u2013 MySQL<\/li>\n\n\n\n<li>Programming language \u2013 PHP (Hypertext Preprocessor)<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"steps-to-install-apache\">Steps to Install Apache:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Installing and configuring a LAMP (Linux, Apache, MySQL, PHP) stack on CentOS 7 involves a series of steps. Here&#8217;s a simplified guide to help you set it up:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-1-update-system\">Step 1: Update System<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Make sure your system is up-to-date:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo yum update<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-2-install-apache\">Step 2: Install Apache<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Install the Apache web server:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo yum install httpd<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Start and enable Apache to run on system boot:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl start httpd\n<br>sudo systemctl enable httpd<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-3-install-my-sql\">Step 3: Install MySQL<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Install the MySQL (MariaDB) server:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo yum install mariadb-server<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Start and enable MySQL:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl start mariadb\r<br>sudo systemctl enable mariadb<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Run the MySQL secure installation script to set a root password and secure your installation<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo mysql_secure_installation\r<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-4-install-php\">Step 4: Install PHP<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Install PHP and necessary modules<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo yum install php php-mysql<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-5-configure-apache-to-use-php\">Step 5: Configure Apache to use PHP<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Edit the Apache configuration file to enable PHP:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo nano \/etc\/httpd\/conf\/httpd.conf\r<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the following lines at the end of the file:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;FilesMatch \\.php$>\r<br>    SetHandler application\/x-httpd-php\r<br>&lt;\/FilesMatch><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Save and exit the editor.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-6-restart-apache\">Step 6: Restart Apache<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Restart Apache to apply the changes:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl restart httpd<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-7-test-your-lamp-stack\">Step 7: Test Your LAMP Stack<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Create a PHP info file to test your installation:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">echo \"&lt;?php phpinfo(); ?>\" | sudo tee \/var\/www\/html\/info.php\r<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Open your web browser and navigate to <code>http:\/\/your_server_ip\/info.php<\/code>. You should see a PHP info page.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"step-8-firewall-configuration\">Step 8: Firewall Configuration<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you have a firewall enabled, allow HTTP and HTTPS traffic:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo firewall-cmd --permanent --add-service=http\r<br>sudo firewall-cmd --permanent --add-service=https\r<br>sudo firewall-cmd --reload<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now, your LAMP stack on CentOS 7 should be set up and ready for use. Keep in mind that this is a basic configuration, and you may need to adjust settings based on your specific requirements and security considerations.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Further need to know how to do Rsync using Command in Linux <a href=\"https:\/\/webhostingpune.co.in\/blog\/rsync-basic-command-in-linux\/\">click here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my previous post I have posted the LAMP configuration in centos 6 and also how to install the wordpress. Here I took joomla open source for installing and configuring of LAMP for centos 7. There is no difference between centos 6 and centos 7 the version only changed. And there is slight difference in commands used in SSH. LAMP-indicates Linux, Apache, mysql and php. The LAMP Components includes, Steps to Install Apache: Installing and configuring a LAMP (Linux, Apache, MySQL, PHP) stack on CentOS 7 involves a series of steps. Here&#8217;s a simplified guide to help you set it up: Step 1: Update System Make sure your system is up-to-date: sudo yum update Step 2: Install Apache Install the Apache web server: sudo yum install httpd Start and enable Apache to run on system boot: sudo systemctl start httpd sudo systemctl enable httpd Step 3: Install MySQL Install the MySQL (MariaDB) server: sudo yum install mariadb-server Start and enable MySQL: sudo systemctl start mariadb sudo systemctl enable mariadb Run the MySQL secure installation script to set a root password and secure your installation sudo mysql_secure_installation Step 4: Install PHP Install PHP and necessary modules sudo yum install php php-mysql Step 5: Configure Apache to use PHP Edit the Apache configuration file to enable PHP: sudo nano \/etc\/httpd\/conf\/httpd.conf Add the following lines at the end of the file: &lt;FilesMatch \\.php$> SetHandler application\/x-httpd-php &lt;\/FilesMatch> Save and exit the editor. Step 6: Restart Apache Restart Apache to apply the changes: sudo systemctl restart httpd Step 7: Test Your LAMP Stack Create a PHP info file to test your installation: echo &#8220;&lt;?php phpinfo(); ?>&#8221; | sudo tee \/var\/www\/html\/info.php Open your web browser and navigate to http:\/\/your_server_ip\/info.php. You should see a PHP info page. Step 8: Firewall Configuration If you have a firewall enabled, allow HTTP and HTTPS traffic: sudo firewall-cmd &#8211;permanent &#8211;add-service=http sudo firewall-cmd &#8211;permanent &#8211;add-service=https sudo firewall-cmd &#8211;reload Now, your LAMP stack on CentOS 7 should be set up and ready for use. Keep in mind that this is a basic configuration, and you may need to adjust settings based on your specific requirements and security considerations. Further need to know how to do Rsync using Command in Linux click here.<\/p>\n","protected":false},"author":2,"featured_media":277,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[1,18,21],"tags":[17,16],"class_list":["post-261","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-command","category-information","tag-command","tag-linux"],"_links":{"self":[{"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/posts\/261","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/comments?post=261"}],"version-history":[{"count":12,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/posts\/261\/revisions"}],"predecessor-version":[{"id":278,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/posts\/261\/revisions\/278"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/media\/277"}],"wp:attachment":[{"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/media?parent=261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/categories?post=261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/tags?post=261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}