{"id":9139,"date":"2021-06-17T20:43:03","date_gmt":"2021-06-17T17:43:03","guid":{"rendered":"https:\/\/kifarunix.com\/?p=9139"},"modified":"2024-03-18T20:58:28","modified_gmt":"2024-03-18T17:58:28","slug":"install-lamp-stack-on-rocky-linux-8","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-lamp-stack-on-rocky-linux-8\/","title":{"rendered":"Install LAMP Stack on Rocky Linux 8"},"content":{"rendered":"\n<p>This guide describes a step by step tutorial on how to install LAMP stack on Rocky Linux 8.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing LAMP Stack on Rocky Linux 8<\/h2>\n\n\n\n<p>LAMP stack is a group of opensource web development softwares;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Linux OS,&nbsp;<\/li>\n\n\n\n<li><a rel=\"noreferrer noopener\" href=\"https:\/\/httpd.apache.org\/\" target=\"_blank\">Apache http server<\/a>,<\/li>\n\n\n\n<li><a rel=\"noreferrer noopener\" href=\"https:\/\/mariadb.org\/\" target=\"_blank\">MariaDB<\/a>\/<a href=\"https:\/\/www.mysql.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">MySQL<\/a>&nbsp;relational database management systems<\/li>\n\n\n\n<li><a rel=\"noreferrer noopener\" href=\"https:\/\/www.php.net\/\" target=\"_blank\">PHP<\/a>&nbsp;web scripting language<\/li>\n<\/ul>\n\n\n\n<p>Run system package update.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf update<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Install Rocky Linux 8 Linux System<\/h3>\n\n\n\n<p>In this case, the first component of the LAMP stack is our Rocky Linux 8 Linux system. To install Rocky Linux 8, see our guide on how to install it on VirtualBox by following the link below;<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-rocky-linux-8-on-virtualbox\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install Rocky Linux 8 on VirtualBox<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Install Apache HTTP Server on Rocky Linux 8<\/h3>\n\n\n\n<p>Apache http server can be installed on Rocky Linux 8 as easily as running the command below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf install httpd<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Running Apache on Rocky Linux 8<\/h4>\n\n\n\n<p>Once the installation is done, you can start and enable Apache to run on system reboot by executing;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl enable --now  httpd<\/code><\/pre>\n\n\n\n<p>To check the status;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl status httpd<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\u25cf httpd.service - The Apache HTTP Server\n   Loaded: loaded (\/usr\/lib\/systemd\/system\/httpd.service; disabled; vendor preset: disabled)\n   Active: active (running) since Thu 2021-06-17 19:27:04 EAT; 1s ago\n     Docs: man:httpd.service(8)\n Main PID: 5969 (httpd)\n   Status: \"Started, listening on: port 80\"\n    Tasks: 213 (limit: 4938)\n   Memory: 24.7M\n   CGroup: \/system.slice\/httpd.service\n           \u251c\u25005969 \/usr\/sbin\/httpd -DFOREGROUND\n           \u251c\u25005970 \/usr\/sbin\/httpd -DFOREGROUND\n           \u251c\u25005971 \/usr\/sbin\/httpd -DFOREGROUND\n           \u251c\u25005972 \/usr\/sbin\/httpd -DFOREGROUND\n           \u2514\u25005973 \/usr\/sbin\/httpd -DFOREGROUND\n\nJun 17 19:27:04 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...\nJun 17 19:27:04 localhost.localdomain httpd[5969]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set &gt;\nJun 17 19:27:04 localhost.localdomain systemd[1]: Started The Apache HTTP Server.\nJun 17 19:27:04 localhost.localdomain httpd[5969]: Server configured, listening on: port 80\n<\/code><\/pre>\n\n\n\n<p>To verify if it is enabled to run on boot, run the command below. The output should&nbsp;<code><strong>enabled<\/strong><\/code>;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl is-enabled httpd<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Allow External Access to Apache on Firewall<\/h4>\n\n\n\n<p>To enable external access to Apache web server, you need to allow web traffic on FirewallD. If you are serving just HTTP traffic, just open port 80\/tcp otherwise, open port 443\/tcp<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>firewall-cmd --add-port=80\/tcp --permanent\nfirewall-cmd --reload<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Testing Apache on Rocky Linux 8<\/h4>\n\n\n\n<p>To confirm that Apache is ready to server HTTP content, simply open your browser and enter the server IP address as&nbsp;<strong><code>http:\/\/Server.IP<\/code><\/strong>. You should land on Apache HTTP server test page.<\/p>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/06\/rocky-8-lamp-stack.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1177\" height=\"840\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/06\/rocky-8-lamp-stack.png\" alt=\"Install LAMP Stack on Rocky Linux 8\" class=\"wp-image-9148\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/06\/rocky-8-lamp-stack.png?v=1623950435 1177w, https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/06\/rocky-8-lamp-stack-768x548.png?v=1623950435 768w\" sizes=\"(max-width: 1177px) 100vw, 1177px\" \/><\/figure><\/a><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Install MariaDB Database Server on Rocky Linux 8<\/h3>\n\n\n\n<p>The default Rocky Linux upstream repos provides MariaDB 10.3. To install the latest MariaDB on Rocky Linux, follow the link below;<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-mariadb-10-x-on-rocky-linux-8\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install MariaDB 10.x on Rocky Linux 8<\/a><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>mysql -V<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql  Ver 15.1 Distrib 10.5.10-MariaDB, for Linux (x86_64) using readline 5.1<\/code><\/pre>\n\n\n\n<p>Once you have installed MariaDB server, start and enable it to run on system boot.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl enable --now  mariadb<\/code><\/pre>\n\n\n\n<p>Next, run the security script to disable remote root login, remove test databases, remove anonymous user accounts, if not already done.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>mysql_secure_installation<\/code><\/pre>\n\n\n\n<p>You can login to your MariaDB server and create your databases.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"php-rocky-linux\"><a href=\"#php-rocky-linux\">Install PHP on Rocky Linux 8<\/a><\/h3>\n\n\n\n<p>By default, the AppStream repos on Rocky Linux provides PHP 7.2, 7.3 and 7.4;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf module list php<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>Rocky Linux 8 - AppStream\nName                             Stream                              Profiles                                              Summary                                          \nphp                              7.2 [d]                             common [d], devel, minimal                            PHP scripting language                           \nphp                              7.3                                 common [d], devel, minimal                            PHP scripting language                           \nphp                              7.4                                 common [d], devel, minimal                            PHP scripting language\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Install PHP 7.2 on Rocky Linux 8<\/h4>\n\n\n\n<p>The PHP 7.2 modules is enabled by default. Thus to install PHP 7.2 and MySQL PHP 7.2 module on Rocky Linux 8, run the command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf install php php-mysqlnd<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"php-7.3-rock-linux\"><a href=\"#php-7.3-rock-linux\">To install PHP 7.3 Rocky Linux 8<\/a><\/h4>\n\n\n\n<p>Enable PHP 7.3 module on Rocky Linux 8<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf module enable php:7.3<\/code><\/pre>\n\n\n\n<p>Install PHP 7.3 Rocky Linux 8<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf install php php-mysqlnd<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"php-7.4-rocky\"><a href=\"#php-7.4-rocky\">To install PHP 7.4 Rocky Linux 8<\/a><\/h4>\n\n\n\n<pre id=\"block-fdbdba26-7245-4b30-bf47-2a58f64ca0e2\" class=\"wp-block-preformatted\">dnf module reset php<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf module enable php:7.4<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf install php php-mysqlnd<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"php-8.0-rocky\"><a href=\"#php-8.0-rocky\">Install PHP 8.0 on Rocky Linux 8<\/a><\/h4>\n\n\n\n<p>Install PHP Remi Repository on Rocky Linux 8.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf install epel-release<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf install https:\/\/rpms.remirepo.net\/enterprise\/remi-release-8.rpm<\/code><\/pre>\n\n\n\n<p>Reset PHP module;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf module reset php<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf module enable php:remi-8.0<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf install php php-mysqlnd<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Install PHP Extensions on Rocky Linux 8<\/h4>\n\n\n\n<p>If you need to install other PHP extensions for your web applications, simply install by running;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf install php-<strong>EXTENSION<\/strong><\/code><\/pre>\n\n\n\n<p>Replacing <strong>EXTENSION<\/strong> with your respective PHP module.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Testing PHP on Rocky Linux 8<\/h4>\n\n\n\n<p>You can test PHP to confirm that is working as required as well check the version and installed modules using the simple PHP info script.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat &gt; \/var\/www\/html\/test.php &lt;&lt; EOL\n&lt;?php \nphpinfo(); \n?&gt;\nEOL<\/code><\/pre>\n\n\n\n<p>Save the file and exit the file.<\/p>\n\n\n\n<p>Restart Apache<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl restart httpd<\/code><\/pre>\n\n\n\n<p>Navigate to the browser and enter the address,&nbsp;<strong>http:\/\/&lt;server-IP&gt;\/test.php<\/strong><\/p>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/06\/php-8.0-rocky-linux.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"939\" height=\"939\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/06\/php-8.0-rocky-linux.png\" alt=\"Install LAMP Stack on Rocky Linux 8\" class=\"wp-image-9147\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/06\/php-8.0-rocky-linux.png?v=1623950354 939w, https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/06\/php-8.0-rocky-linux-768x768.png?v=1623950354 768w\" sizes=\"(max-width: 939px) 100vw, 939px\" \/><\/figure><\/a><\/div>\n\n\n\n<p>There you go, your LAMP stack is ready for your web development tasks.<\/p>\n\n\n\n<p>Be sure to remove PHP test page.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>rm -rf \/var\/www\/html\/test.php<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Related Tutorials<\/h3>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-lamp-stack-on-ubuntu-20-04\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install LAMP Stack on Ubuntu 20.04<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-lamp-stack-on-centos-8\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install LAMP Stack on CentOS 8<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-lamp-stack-with-mariadb-10-on-debian-10-buster\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install LAMP Stack with MariaDB 10 on Debian 10 Buster<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This guide describes a step by step tutorial on how to install LAMP stack on Rocky Linux 8. Installing LAMP Stack on Rocky Linux 8<\/p>\n","protected":false},"author":1,"featured_media":9150,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[201,254,299,121,928],"tags":[255,3694,3695,204,136,203,3587],"class_list":["post-9139","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-lamp-stack","category-apache","category-database","category-howtos","category-mariadb","tag-apache2","tag-install-lamp-stack-rocky-linux-8","tag-install-php-8-rocky-linux","tag-lamp-stack","tag-mariadb","tag-php","tag-rocky-linux-8","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/9139"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=9139"}],"version-history":[{"count":10,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/9139\/revisions"}],"predecessor-version":[{"id":21792,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/9139\/revisions\/21792"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/9150"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=9139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=9139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=9139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}