{"id":22532,"date":"2024-05-12T23:00:47","date_gmt":"2024-05-12T20:00:47","guid":{"rendered":"https:\/\/kifarunix.com\/?p=22532"},"modified":"2024-05-12T23:01:05","modified_gmt":"2024-05-12T20:01:05","slug":"install-lamp-stack-on-ubuntu-24-04","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-lamp-stack-on-ubuntu-24-04\/","title":{"rendered":"Install LAMP Stack on Ubuntu 24.04"},"content":{"rendered":"\n<p>Welcome to our guide on how to install LAMP Stack on Ubuntu 24.04. As you already know, LAMP is a group of opensource web development softwares; Linux OS,\u00a0<a href=\"https:\/\/httpd.apache.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Apache HTTP server<\/a>,\u00a0<a href=\"https:\/\/mariadb.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">MariaDB<\/a>\/<a href=\"https:\/\/www.mysql.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">MySQL<\/a>\u00a0relational database management systems and\u00a0<a href=\"https:\/\/www.php.net\/\" target=\"_blank\" rel=\"noreferrer noopener\">PHP<\/a>\u00a0web scripting language.<\/p>\n\n\n\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>Table of Contents<\/h2><nav><ul><li><a href=\"#installing-lamp-stack-on-ubuntu-24-04\">Installing LAMP Stack on Ubuntu 24.04<\/a><ul><li><a href=\"#run-system-update\">Run System Update<\/a><\/li><li><a href=\"#install-apache-web-server-on-ubuntu-24-04\">Install Apache Web Server on Ubuntu 24.04<\/a><\/li><li><a href=\"#install-my-sql-database-server-on-ubuntu-24-04\">Install MySQL Database Server on Ubuntu 24.04<\/a><\/li><li><a href=\"#install-php-on-ubuntu-24-04\">Install PHP on Ubuntu 24.04<\/a><ul><li><a href=\"#installing-php-modules-on-ubuntu-24-04\">Installing PHP Modules on Ubuntu 24.04<\/a><\/li><li><a href=\"#testing-php-processing-on-ubuntu-24-04\">Testing PHP Processing\u00a0on Ubuntu 24.04<\/a><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"installing-lamp-stack-on-ubuntu-24-04\">Installing LAMP Stack on Ubuntu 24.04<\/h2>\n\n\n\n<p>As per the acronym, Linux system is the first component of LAMP stack. And since you are here, Ubuntu 24.04 is our first component of LAMP stack.<\/p>\n\n\n\n<p>We have already installed an Ubuntu 24.04 system as a virtual machine on VirtualBox.<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-ubuntu-24-04-on-virtualbox\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install Ubuntu 24.04 on VirtualBox<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"run-system-update\">Run System Update<\/h3>\n\n\n\n<p>To begin with, update and upgrade your system packages;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt update<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt upgrade<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-apache-web-server-on-ubuntu-24-04\">Install Apache Web Server on Ubuntu 24.04<\/h3>\n\n\n\n<p>Apache web server can be installed by running the command below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt install apache2<\/pre>\n\n\n\n<p>Once the installation is done, start and enable Apache to run on system boot.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl enable --now apache2<\/pre>\n\n\n\n<p>You can check the status of the service;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl status apache2<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\u25cf apache2.service - The Apache HTTP Server\n     Loaded: loaded (\/usr\/lib\/systemd\/system\/apache2.service; enabled; preset: enabled)\n     Active: active (running) since Sun 2024-05-12 19:00:40 UTC; 2s ago\n       Docs: https:\/\/httpd.apache.org\/docs\/2.4\/\n    Process: 27470 ExecStart=\/usr\/sbin\/apachectl start (code=exited, status=0\/SUCCESS)\n   Main PID: 27474 (apache2)\n      Tasks: 6 (limit: 4614)\n     Memory: 11.5M (peak: 12.0M)\n        CPU: 36ms\n     CGroup: \/system.slice\/apache2.service\n             \u251c\u250027474 \/usr\/sbin\/apache2 -k start\n             \u251c\u250027476 \/usr\/sbin\/apache2 -k start\n             \u251c\u250027477 \/usr\/sbin\/apache2 -k start\n             \u251c\u250027478 \/usr\/sbin\/apache2 -k start\n             \u251c\u250027479 \/usr\/sbin\/apache2 -k start\n             \u2514\u250027480 \/usr\/sbin\/apache2 -k start\n\nMay 12 19:00:40 noble systemd[1]: Starting apache2.service - The Apache HTTP Server...\nMay 12 19:00:40 noble apachectl[27473]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerNam>\nMay 12 19:00:40 noble systemd[1]: Started apache2.service - The Apache HTTP Server.\n<\/code><\/pre>\n\n\n\n<p>If you going to be accessing Apache from your external system, then you need to allow it on firewall, that is, in case UFW is running;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo ufw allow Apache<\/pre>\n\n\n\n<p>or simply run\u00a0<strong><code>ufw allow 80\/tcp<\/code><\/strong>\u00a0to allow HTTP traffic or <strong><code>ufw allow 443\/tcp<\/code><\/strong> for HTTPS traffic.<\/p>\n\n\n\n<p>You can also use IPtables if you want.<\/p>\n\n\n\n<p>Verify external access to Apache by navigating to your browser and entering the server IP address or hostname as&nbsp;<strong><code>http:\/\/Server.IP_or_hostname<\/code><\/strong>. You should land on Apache HTTP server test page.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1017\" height=\"947\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/04\/ubuntu-22.04-apach-test-page.png\" alt=\"Install LAMP Stack on Ubuntu 24.04\" class=\"wp-image-12457\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/04\/ubuntu-22.04-apach-test-page.png?v=1651331906 1017w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/04\/ubuntu-22.04-apach-test-page-768x715.png?v=1651331906 768w\" sizes=\"(max-width: 1017px) 100vw, 1017px\" \/><\/figure><\/div>\n\n\n<p>Apache is confirmed to be working as expected. Proceed to install MySQL\/MariaDB on Ubuntu 24.04.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-my-sql-database-server-on-ubuntu-24-04\">Install MySQL Database Server on Ubuntu 24.04<\/h3>\n\n\n\n<p>In this demo, we are running LAMP stack on Ubuntu 24.04 with MariaDB. <\/p>\n\n\n\n<p>Therefore, follow the link below to install MariaDB 11.3 on Ubuntu 24.04;<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/how-to-install-mariadb-11-on-ubuntu-24-04\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Install MariaDB 11 on Ubuntu 24.04<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-php-on-ubuntu-24-04\">Install PHP on Ubuntu 24.04<\/h3>\n\n\n\n<p>PHP is the last but not least component in LAMP Stack. In this demo, we are going to use PHP 8.3 for our LAMP stack. PHP 8.3 is the version  currently available on the default Ubuntu 24.04 default repositories as of this writing.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install php<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"installing-php-modules-on-ubuntu-24-04\">Installing PHP Modules on Ubuntu 24.04<\/h4>\n\n\n\n<p>Installation of PHP installs with itself other PHP modules such as,&nbsp;<code>libapache2-mod-php, php-common, php-cli, php-common, php-json, php-opcache, php-readline<\/code><\/p>\n\n\n\n<p>Install MySQL module for PHP and any other module you may need for your web application.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install php-mysql<\/code><\/pre>\n\n\n\n<p>Current installed version of PHP;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php -v<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>PHP 8.3.6 (cli) (built: Apr 15 2024 19:21:47) (NTS)\nCopyright (c) The PHP Group\nZend Engine v4.3.6, Copyright (c) Zend Technologies\n    with Zend OPcache v8.3.6, Copyright (c), by Zend Technologies\n<\/code><\/pre>\n\n\n\n<p>Loaded modules;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php -m<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>[PHP Modules]\ncalendar\nCore\nctype\ndate\nexif\nFFI\nfileinfo\nfilter\nftp\ngd\ngettext\nhash\niconv\njson\nlibxml\nmysqli\nmysqlnd\nopenssl\npcntl\npcre\nPDO\npdo_mysql\nPhar\nposix\nrandom\nreadline\nReflection\nsession\nshmop\nsockets\nsodium\nSPL\nstandard\nsysvmsg\nsysvsem\nsysvshm\ntokenizer\nZend OPcache\nzlib\n\n[Zend Modules]\nZend OPcache\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"testing-php-processing-on-ubuntu-24-04\">Testing PHP Processing&nbsp;on Ubuntu 24.04<\/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-preformatted\">echo \"&lt;?php phpinfo(); ?>\" | sudo tee \/var\/www\/html\/info.php<\/pre>\n\n\n\n<p>Restart Apache<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl restart apache2<\/pre>\n\n\n\n<p>Next, navigate to the browser and enter the address,&nbsp;<strong>http:\/\/&lt;server-IP&gt;\/info.php<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"850\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2024\/05\/php-8.3.6.png?v=1715543810\" alt=\"\" class=\"wp-image-22533\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2024\/05\/php-8.3.6.png?v=1715543810 975w, https:\/\/kifarunix.com\/wp-content\/uploads\/2024\/05\/php-8.3.6-768x670.png?v=1715543810 768w\" sizes=\"(max-width: 975px) 100vw, 975px\" \/><\/figure><\/div>\n\n\n<p>If you see this page, then PHP installation is working pretty well.<\/p>\n\n\n\n<p>That marks the end of our guide on how to Install LAMP Stack.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Welcome to our guide on how to install LAMP Stack on Ubuntu 24.04. As you already know, LAMP is a group of opensource web development<\/p>\n","protected":false},"author":10,"featured_media":12459,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121],"tags":[204,7489,7396],"class_list":["post-22532","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","tag-lamp-stack","tag-lamp-stack-ubuntu-24-04","tag-ubuntu-24-04","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\/22532"}],"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\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=22532"}],"version-history":[{"count":2,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/22532\/revisions"}],"predecessor-version":[{"id":22535,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/22532\/revisions\/22535"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/12459"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=22532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=22532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=22532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}