{"id":9097,"date":"2021-08-09T18:09:59","date_gmt":"2021-08-09T18:09:59","guid":{"rendered":"https:\/\/linuxways.net\/?p=9097"},"modified":"2021-08-09T18:09:59","modified_gmt":"2021-08-09T18:09:59","slug":"how-to-install-lamp-stack-on-centos-8","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/how-to-install-lamp-stack-on-centos-8\/","title":{"rendered":"How to Install LAMP Stack on CentOS 8"},"content":{"rendered":"<p>LAMP is an open-source web solution stack that is used in web application development. It stands for Linux (L), Apache (A), MySQL (M), and PHP (P). Apache server processes and serves web requests via HTTP. MySQL is a database management system that stores information in a structured format. PHP is a backend scripting language that get information from the database and hand over the processed content to Apache for display.<\/p>\n<p>Today\u2019s post is about how to install LAMP stack on the CentOS system.<\/p>\n<p><strong>Note<\/strong>: The method shown here has been tested on <strong>CentOS 8<\/strong>.<\/p>\n<h2><strong>Step 1: Install Apache<\/strong><\/h2>\n<p>Apache is available in the default CentOS repositories. Therefore, you can simply install it using the Yum package manager. Here is the command to install Apache on CentOS:<\/p>\n<pre>$ sudo yum install httpd<\/pre>\n<p>As you are running the above command as sudo, therefore you will be required to enter the sudo password. After that the Terminal might prompt you for confirmation, hit <strong>y<\/strong> to confirm, and Apache will be installed on your system. <strong><img loading=\"lazy\" decoding=\"async\" width=\"812\" height=\"597\" class=\"wp-image-9098\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-141.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-141.png 812w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-141-300x221.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-141-768x565.png 768w\" sizes=\"auto, (max-width: 812px) 100vw, 812px\" \/><\/strong><\/p>\n<p>After the installation is finished, use the command below to start the Apache service:<\/p>\n<pre>$ sudo systemctl start httpd.service<\/pre>\n<p>Then use the command below to verify the status of the service:<\/p>\n<pre>$ sudo systemctl status httpd.service<\/pre>\n<p>The output below verifies that the Apache HTTP server has been started and running.<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"809\" height=\"153\" class=\"wp-image-9099\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-142.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-142.png 809w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-142-300x57.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-142-768x145.png 768w\" sizes=\"auto, (max-width: 809px) 100vw, 809px\" \/><\/strong><\/p>\n<p>You can also verify the working of the Apache server by visiting the address below:<\/p>\n<pre>http:\/\/ip-address<\/pre>\n<p>If everything is functioning well, the following default web page should appear on your browser.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"867\" height=\"521\" class=\"wp-image-9100\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-143.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-143.png 867w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-143-300x180.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-143-768x462.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-143-501x300.png 501w\" sizes=\"auto, (max-width: 867px) 100vw, 867px\" \/><\/p>\n<h2>Step 2: Install MySQL (MariaDB)<\/h2>\n<p>Now in this step, we will install the MariaDB database (drop-in replacement of MySQL). It is also available in the default CentOS repositories, so we can simply install it using the command below in the Terminal:<\/p>\n<pre>$ sudo yum install mariadb-server mariadb<\/pre>\n<p>The Terminal might prompt you for confirmation. Press <strong>y<\/strong> to confirm. Now the installation of mentioned packages will be started on your system.<\/p>\n<h2><img loading=\"lazy\" decoding=\"async\" width=\"1016\" height=\"597\" class=\"wp-image-9101\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-144.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-144.png 1016w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-144-300x176.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-144-768x451.png 768w\" sizes=\"auto, (max-width: 1016px) 100vw, 1016px\" \/><\/h2>\n<p>After the installation is finished, use the command below to start the MariaDB service:<\/p>\n<pre>$ sudo systemctl start mariadb.service<\/pre>\n<p>To verify the status of the service, use the command below:<\/p>\n<pre>$ sudo systemctl status mariadb.service<\/pre>\n<p>The output below verifies that MariaDB has been started and running.<\/p>\n<h2><img loading=\"lazy\" decoding=\"async\" width=\"810\" height=\"118\" class=\"wp-image-9102\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-145.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-145.png 810w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-145-300x44.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-145-768x112.png 768w\" sizes=\"auto, (max-width: 810px) 100vw, 810px\" \/><\/h2>\n<h2>Step 3: Install PHP<\/h2>\n<p>PHP can also be installed using the CentOS Yum package manager. Here is the command to install the PHP packages:<\/p>\n<pre>$ sudo yum install php php-mysqlnd.x86_64<\/pre>\n<p>The Terminal might prompt you for confirmation. Press <strong>y<\/strong> to confirm. Now the installation of mentioned packages will be started on your system.<\/p>\n<h2><img loading=\"lazy\" decoding=\"async\" width=\"1010\" height=\"532\" class=\"wp-image-9103\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-146.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-146.png 1010w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-146-300x158.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-146-768x405.png 768w\" sizes=\"auto, (max-width: 1010px) 100vw, 1010px\" \/><\/h2>\n<p>Now to make the Apache web server function with PHP, restart the Apache web server:<\/p>\n<pre>$ sudo systemctl restart httpd.service<\/pre>\n<p>Now to verify that your system is configured properly for PHP, create a file named <strong>info.php<\/strong> at \/var\/www\/html\/.<\/p>\n<pre>$ sudo nano \/var\/www\/html\/info.php<\/pre>\n<p>Add the below line in the <strong>info.php<\/strong> file:<\/p>\n<pre>&lt;?php phpinfo(); ?&gt;<\/pre>\n<p>Then save and close the file.<\/p>\n<p>Now access the following address in your web browser:<\/p>\n<pre>http:\/\/ip-address\/info.php<\/pre>\n<p>If everything is working well, you should see the following default web page on your screen.<\/p>\n<h2><img loading=\"lazy\" decoding=\"async\" width=\"871\" height=\"569\" class=\"wp-image-9104\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-147.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-147.png 871w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-147-300x196.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-147-768x502.png 768w\" sizes=\"auto, (max-width: 871px) 100vw, 871px\" \/><\/h2>\n<p>After verifying that PHP is working well, you can remove the <strong>info.php<\/strong> file using the command below:<\/p>\n<pre>$ sudo rm \/var\/www\/html\/info.php<\/pre>\n<p>In this post, you have learned how to install the LAMP stack on the CentOS system. If are using another Linux distribution, visit how to install LAMP stack on <a href=\"https:\/\/linuxways.net\/de\/debian\/how-to-install-linux-apache-mariadb-php-lamp-stack-on-debian-10\/\">Debian<\/a>, <a href=\"https:\/\/linuxways.net\/de\/red-hat\/install-lamp-stack-on-red-hat-enterprise-linux-8\/\">Red Hat<\/a>, and <a href=\"https:\/\/linuxways.net\/de\/red-hat\/how-to-install-lamp-stack-on-rocky-linux\/\">Rocky Linux.<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>LAMP is an open-source web solution stack that is used in web application development. It stands for Linux (L), Apache (A), MySQL (M), and PHP (P). Apache server&hellip;<\/p>","protected":false},"author":1,"featured_media":9173,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[93,101],"class_list":["post-9097","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","tag-centos-8","tag-lamp-stack"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/9097","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=9097"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/9097\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/9173"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=9097"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=9097"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=9097"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}