{"id":12446,"date":"2022-04-30T18:29:07","date_gmt":"2022-04-30T15:29:07","guid":{"rendered":"https:\/\/kifarunix.com\/?p=12446"},"modified":"2024-05-12T21:55:12","modified_gmt":"2024-05-12T18:55:12","slug":"install-lamp-stack-on-ubuntu-22-04","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-lamp-stack-on-ubuntu-22-04\/","title":{"rendered":"Install LAMP Stack on Ubuntu 22.04"},"content":{"rendered":"\n<p>Welcome to our guide on how to install LAMP Stack on Ubuntu 22.04. If you are looking at building some web application, LAMP stack is the first thing you might need. 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=\"#install-lamp-stack-on-ubuntu-22-04\">Install LAMP Stack on Ubuntu 22.04<\/a><ul><li><a href=\"#run-system-update\">Run System Update<\/a><\/li><li><a href=\"#install-apache-web-server-on-ubuntu-22-04\">Install Apache Web Server on Ubuntu 22.04<\/a><\/li><li><a href=\"#install-my-sql-database-server-on-ubuntu-22-04\">Install MySQL Database Server on Ubuntu 22.04<\/a><\/li><li><a href=\"#install-php-on-ubuntu-22-04\">Install PHP on Ubuntu 22.04<\/a><ul><li><a href=\"#installing-php-modules-on-ubuntu-22-04\">Installing PHP Modules on Ubuntu 22.04<\/a><\/li><li><a href=\"#testing-php-processing-on-ubuntu-22-04\">Testing PHP Processing\u00a0on Ubuntu 22.04<\/a><\/li><\/ul><\/li><li><a href=\"#related-tutorials\">Related Tutorials<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"install-lamp-stack-on-ubuntu-22-04\">Install LAMP Stack on Ubuntu 22.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 22.04 is our first component of LAMP stack.<\/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\"><code>apt update<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt upgrade<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-apache-web-server-on-ubuntu-22-04\">Install Apache Web Server on Ubuntu 22.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\"><code>apt install apache2<\/code><\/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\"><code>systemctl enable --now apache2<\/code><\/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 (\/lib\/systemd\/system\/apache2.service; enabled; vendor preset: enabled)\n     Active: active (running) since Sat 2022-04-30 17:59:47 EAT; 1min 31s ago\n       Docs: https:\/\/httpd.apache.org\/docs\/2.4\/\n   Main PID: 18168 (apache2)\n      Tasks: 55 (limit: 4579)\n     Memory: 5.4M\n        CPU: 73ms\n     CGroup: \/system.slice\/apache2.service\n             \u251c\u250018168 \/usr\/sbin\/apache2 -k start\n             \u251c\u250018170 \/usr\/sbin\/apache2 -k start\n             \u2514\u250018171 \/usr\/sbin\/apache2 -k start\n\nApr 30 17:59:47 jellyfish systemd[1]: Starting The Apache HTTP Server...\nApr 30 17:59:47 jellyfish apachectl[18167]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' &gt;\nApr 30 17:59:47 jellyfish systemd[1]: Started 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\"><code>ufw allow Apache<\/code><\/pre>\n\n\n\n<p>or simply run&nbsp;<strong><code>ufw allow 80\/tcp<\/code><\/strong>&nbsp;to allow HTTP traffic or <strong><code>ufw allow 443\/tcp<\/code><\/strong> for HTTPS traffic.<\/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\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/04\/ubuntu-22.04-apach-test-page.png\" class=\"td-modal-image\"><div class=\"wp-block-image\"><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 22.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><\/a><\/div>\n\n\n\n<p>Great. Proceed to install MySQL\/MariaDB on Ubuntu 22.04.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-my-sql-database-server-on-ubuntu-22-04\">Install MySQL Database Server on Ubuntu 22.04<\/h3>\n\n\n\n<p>In this demo, we are running LAMP stack on Ubuntu 22.04 with MySQL 8. Therefore, follow the link below to install MySQL 8 on Ubuntu 22.04;<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-mysql-8-on-ubuntu\/\">Install MySQL 8 on Ubuntu 22.04<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-php-on-ubuntu-22-04\">Install PHP on Ubuntu 22.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 for our LAMP stack.<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-php-8-on-ubuntu-22-04\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install PHP 8 on Ubuntu 22.04<\/a><\/p>\n\n\n\n<p>If you want to install other PHP versions on Ubuntu 22.04, follow the link below;<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-php-7-1-7-2-7-3-7-4-on-ubuntu-22-04\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install PHP 7.1\/7.2\/7.3\/7.4 on Ubuntu 22.04<\/a><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"installing-php-modules-on-ubuntu-22-04\">Installing PHP Modules on Ubuntu 22.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>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=\"wp-block-code\"><code>PHP 8.1.2 (cli) (built: Apr  7 2022 17:46:26) (NTS)\nCopyright (c) The PHP Group\nZend Engine v4.1.2, Copyright (c) Zend Technologies\n    with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies<\/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\ngettext\nhash\niconv\njson\nlibxml\nmysqli\nmysqlnd\nopenssl\npcntl\npcre\nPDO\npdo_mysql\nPhar\nposix\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-22-04\">Testing PHP Processing&nbsp;on Ubuntu 22.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\"><code>echo \"&lt;?php phpinfo(); ?&gt;\" &gt; \/var\/www\/html\/info.php<\/code><\/pre>\n\n\n\n<p>Restart Apache<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl restart apache2<\/code><\/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\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/04\/install-php-ubuntu-22.04.png\" class=\"td-modal-image\"><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1168\" height=\"950\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/04\/install-php-ubuntu-22.04.png\" alt=\"Install LAMP Stack on Ubuntu 22.04\" class=\"wp-image-12456\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/04\/install-php-ubuntu-22.04.png?v=1651331840 1168w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/04\/install-php-ubuntu-22.04-768x625.png?v=1651331840 768w\" sizes=\"(max-width: 1168px) 100vw, 1168px\" \/><\/figure><\/div><\/a><\/div>\n\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\n\n\n<h3 class=\"wp-block-heading\" id=\"related-tutorials\">Related Tutorials<\/h3>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-php-7-1-7-2-7-3-7-4-on-debian-11\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install PHP 7.1\/7.2\/7.3\/7.4 on Debian 11<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-php-8-on-ubuntu-22-04\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install PHP 8 on Ubuntu 22.04<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Welcome to our guide on how to install LAMP Stack on Ubuntu 22.04. If you are looking at building some web application, LAMP stack is<\/p>\n","protected":false},"author":1,"featured_media":12459,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121,201,929,342],"tags":[4973,4976,204,4974,4412,4975],"class_list":["post-12446","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","category-lamp-stack","category-mysql","category-php","tag-install-lamp-stack-on-ubuntu-22-04","tag-install-lamp-stack-ubuntu-22-04","tag-lamp-stack","tag-lamp-stack-ubuntu-22-04","tag-ubuntu-22-04","tag-ubuntu-22-04-lamp-stack","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\/12446"}],"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=12446"}],"version-history":[{"count":6,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/12446\/revisions"}],"predecessor-version":[{"id":22531,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/12446\/revisions\/22531"}],"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=12446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=12446"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=12446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}