{"id":5853,"date":"2017-07-11T14:11:38","date_gmt":"2017-07-11T14:11:38","guid":{"rendered":"https:\/\/www.hostinger.com\/tutorials\/?p=5853"},"modified":"2025-12-22T15:11:54","modified_gmt":"2025-12-22T15:11:54","slug":"how-to-install-lamp-on-ubuntu","status":"publish","type":"post","link":"\/tutorials\/how-to-install-lamp-on-ubuntu","title":{"rendered":"How to install LAMP on Ubuntu automatically and manually"},"content":{"rendered":"<p>LAMP is an acronym for Linux, Apache, MySQL, and PHP &ndash; a popular stack for creating and deploying dynamic web applications.<\/p><p>In this web stack, Linux serves as the web application&rsquo;s operating system. Apache acts as the web server that processes and retrieves content from the MySQL database. Meanwhile, PHP enables your system to process dynamic content.<\/p><p>Other LAMP stack variants may use Perl or Python as the interpreter instead of PHP. In this tutorial, we will teach how to install LAMP on Ubuntu 22.04 VPS with PHP, as it is the most popular choice for this stack.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/Linux-Commands-Cheat-Sheet.pdf\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" width=\"2048\" height=\"566\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet.png\/public\" alt=\"\" class=\"wp-image-69262\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet.png\/w=2048,fit=scale-down 2048w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 2048px) 100vw, 2048px\" \/><\/a><\/figure><\/div><p>\n\n\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-prerequisites-for-installing-lamp\">Prerequisites for Installing LAMP<\/h2><p>Before you read this Ubuntu LAMP tutorial further, ensure that all the required tools are prepared for a smooth installation process.<\/p><p>You will need a virtual private server (VPS) running a new version of <a href=\"\/tutorials\/what-is-ubuntu\">Ubuntu<\/a>. In this tutorial, we will use <strong>Ubuntu 22.04<\/strong>. If unsure, <a href=\"\/tutorials\/how-to-check-ubuntu-version\/\">check your system&rsquo;s Ubuntu version<\/a> by running the following command in Terminal:<\/p><pre class=\"wp-block-preformatted\">lsb_release -d<\/pre><p>Ensure your server supports connection via secure shell (SSH) for remote installation. Also, your local machine must have a Terminal or software like <strong>PuTTY<\/strong> installed to run <a href=\"\/tutorials\/ssh\/basic-ssh-commands\">SSH commands<\/a> on your VPS.<\/p><p>We recommend Hostinger&rsquo;s VPS solution as it is compatible with the newest Ubuntu version and various software, including the LAMP web stack. It also supports full root access via SSH to help avoid permission issues during installation. Visit our <a href=\"https:\/\/www.hostinger.com\/vps\/lamp-hosting\">LAMP VPS hosting<\/a> page to explore the available plans.<\/p><p>Users can also access Hostinger VPS remotely from their web browser via the <strong>Browser terminal<\/strong>. Moreover, they can use an operating system template to easily install various software, including a web stack, in one click via <strong>hPanel<\/strong>.&nbsp;<\/p><figure class=\"wp-block-image size-large\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-vps-hosting\" href=\"\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/public\" alt=\"\" class=\"wp-image-77934\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-how-to-install-lamp-on-ubuntu-at-hostinger\">How to Install LAMP on Ubuntu at Hostinger<\/h2><p>At Hostinger, you can easily install LAMP using an operating system template via hPanel. This method is suitable for newcomers since it doesn&rsquo;t require any command, making the process easier and safer.<\/p><p>\n\n\n<div><p class=\"important\"><strong>Important!<\/strong> <a href=\"https:\/\/support.hostinger.com\/en\/articles\/1583232-how-to-back-up-or-restore-a-vps-server\" target=\"_blank\" rel=\"noopener\">Back up your VPS files<\/a> before installing an operating system template since this process will delete your data permanently.<\/p><\/div>\n\n\n\n<\/p><p>Here are the steps to install LAMP on Ubuntu at Hostinger:<\/p><ol class=\"wp-block-list\">\n<li>Log in to <strong>hPanel <\/strong>and click<strong> VPS<\/strong> on the top menu.<\/li>\n\n\n\n<li>Select the VPS hosting plan on which you want to install LAMP.<\/li>\n\n\n\n<li>From the sidebar, click<strong> OS &amp; Panel<\/strong> &rarr; <strong>Operating system<\/strong>.<\/li>\n\n\n\n<li>In the <strong>Change OS<\/strong> section, click <strong>Application<\/strong>.<\/li>\n\n\n\n<li>Select <strong>LAMP stack<\/strong> from the list of options, then click <strong>Change OS<\/strong> to confirm.<\/li>\n<\/ol><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2017\/07\/vps-os.png\"><img decoding=\"async\" width=\"1908\" height=\"802\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/07\/vps-os.png\/public\" alt=\"Confirmation box to change OS to LAMP Stack\" class=\"wp-image-125772\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/07\/vps-os.png\/w=1908,fit=scale-down 1908w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/07\/vps-os.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/07\/vps-os.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/07\/vps-os.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/07\/vps-os.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/07\/vps-os.png\/w=1536,fit=scale-down 1536w\" sizes=\"(max-width: 1908px) 100vw, 1908px\" \/><\/a><\/figure><\/div><ol start=\"6\" class=\"wp-block-list\">\n<li>You will see a confirmation window about data deletion. Check the box to acknowledge the warning and click <strong>Next.<\/strong><\/li>\n\n\n\n<li>Enter a new root password and click<strong> Confirm<\/strong> to proceed.<\/li>\n<\/ol><p>Once the installation process is finished, you should see a confirmation message on the top of the operating system installation page. If you enter your server&rsquo;s IP address into a web browser, you should see the Apache welcome page.<\/p><p>In addition to LAMP, Hostinger VPS offers OS templates for other popular stacks. You can check them from the OS management menu or ask our <a href=\"https:\/\/www.hostinger.com\/blog\/kodee\">AI assistant, Kodee<\/a>, to list them. To do this, simply open the Kodee chat interface and enter, &ldquo;Do you have other OS templates similar to LAMP?&rdquo;<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-install-lamp-on-ubuntu-manually\">How to Install LAMP on Ubuntu Manually<\/h2><p>If you prefer a particular version of each software in your stack, consider installing LAMP manually using commands. Before proceeding, connect to your server <a href=\"\/tutorials\/how-to-use-putty-ssh\">using the PuTTY SSH client<\/a> and enter the login credentials found in the <strong>VPS overview<\/strong> menu&rsquo;s <strong>SSH access <\/strong>tab.<\/p><h3 class=\"wp-block-heading\" id=\"h-1-install-apache-web-server\">1. Install Apache Web Server<\/h3><p>Start the installation by updating your system&rsquo;s package manager to ensure you have the latest software versions. Here are the commands:<\/p><pre class=\"wp-block-preformatted\">sudo apt update\nsudo apt upgrade<\/pre><p>Now install Apache2 with the following command<\/p><pre class=\"wp-block-preformatted\">sudo apt-get install apache2<\/pre><p>Check whether Apache is successfully installed by opening your browser on your local machine and entering the following address in the address bar.<\/p><pre class=\"wp-block-preformatted\">http:\/\/&lt;your_vps_ip_address_here&gt;<\/pre><p>For example, if your VPS IP address is <strong>185.185.185.185<\/strong>, your address should be:<\/p><pre class=\"wp-block-preformatted\">http:\/\/185.185.185.185<\/pre><p>You should see a page that looks like this:<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/04\/image4-3.png\"><img decoding=\"async\" width=\"900\" height=\"784\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/04\/image4-3.png\/public\" alt=\"Installing LAMP on Ubuntu - Apache 2 Default Page\" class=\"wp-image-107351\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/04\/image4-3.png\/w=900,fit=scale-down 900w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/04\/image4-3.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/04\/image4-3.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/04\/image4-3.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><\/a><\/figure><\/div><p>If you don&rsquo;t know your VPS IP address, check it via the SSH access tab on hPanel&rsquo;s VPS overview menu. Alternatively, run the following command to print the information on your Terminal:<\/p><pre class=\"wp-block-preformatted\">dig -4 TXT +short o-o.myaddr.l.google.com @ns1.google.com<\/pre><p>If the screen above doesn&rsquo;t show up, check the Apache server status by running the following to ensure it is enabled and running:<\/p><pre class=\"wp-block-preformatted\">sudo systemctl status apache2<\/pre><p>Also, the welcome screen might not display if your firewall blocks Apache from serving web requests on port 80 and port 443. To resolve it, install <a href=\"\/tutorials\/how-to-configure-firewall-on-ubuntu-using-ufw\">Ubuntu&rsquo;s Uncomplicated Firewall<\/a> to manage your server&rsquo;s connection rules. Here&rsquo;s the command:<\/p><pre class=\"wp-block-preformatted\">sudo apt-get install ufw<\/pre><p>Then, allow HTTP and HTTPS traffic through the firewall.<\/p><pre class=\"wp-block-preformatted\">sudo ufw allow http\n\nsudo ufw allow https<\/pre><p>Enter your VPS IP address in your browser to check the installation.<\/p><p>Instead of UFW, you can manage Hostinger VPS firewall configuration via hPanel. To do so, open the <strong>VPS overview menu<\/strong> and navigate to <strong>Security<\/strong> &rarr; <strong>Firewall <\/strong>section from the sidebar:<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/04\/image1-3.png\"><img decoding=\"async\" width=\"364\" height=\"447\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/04\/image1-3.png\/public\" alt=\"The Firewall menu in hPanel's VPS overview sidebar\" class=\"wp-image-107352\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/04\/image1-3.png\/w=364,fit=scale-down 364w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/04\/image1-3.png\/w=244,fit=scale-down 244w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/04\/image1-3.png\/w=122,fit=scale-down 122w\" sizes=\"(max-width: 364px) 100vw, 364px\" \/><\/a><\/figure><\/div><p>On the configuration screen, create a new firewall setting, give it a name, set your preferred rules, and click the toggle to <strong>activate<\/strong> it. To enable Apache, set it to accept<strong> TCP<\/strong> from port<strong> 80<\/strong> and <strong>443<\/strong>.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2017\/07\/vps-firewall-rules.png\"><img decoding=\"async\" width=\"1418\" height=\"625\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/07\/vps-firewall-rules.png\/public\" alt=\"hPanel firewall rules opening Apache ports\" class=\"wp-image-125773\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/07\/vps-firewall-rules.png\/w=1418,fit=scale-down 1418w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/07\/vps-firewall-rules.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/07\/vps-firewall-rules.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/07\/vps-firewall-rules.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2017\/07\/vps-firewall-rules.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 1418px) 100vw, 1418px\" \/><\/a><\/figure><\/div><h3 class=\"wp-block-heading\" id=\"h-2-install-mysql\">2. Install MySQL<\/h3><p>MySQL is the database for your application. To install it, enter the following command.<\/p><pre class=\"wp-block-preformatted\">sudo apt-get install mysql-server<\/pre><p>During installation, Terminal will prompt you for the MySQL root user. Since this account has the highest privilege over your database, use a secure credential with a combination of numbers and symbols. Hit <strong>Enter<\/strong> to confirm.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/04\/image6-3.png\"><img decoding=\"async\" width=\"900\" height=\"698\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/04\/image6-3.png\/public\" alt=\"Installing LAMP on Ubuntu - MySQL Password\" class=\"wp-image-107355\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/04\/image6-3.png\/w=900,fit=scale-down 900w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/04\/image6-3.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/04\/image6-3.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/04\/image6-3.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><\/a><\/figure><\/div><p>You will use the root user to create other accounts in the databases. Separating roles in MySQL is a recommended practice when developing a new web application to improve security and organization.<\/p><p>Once installed, check the MySQL service status with the following command.<\/p><pre class=\"wp-block-preformatted\">sudo systemctl status mysql<\/pre><p>You should see the status as <strong>loaded<\/strong>, <strong>running<\/strong>, and <strong>active<\/strong>, similar to the following:<\/p><pre class=\"wp-block-preformatted\">&#9679; mysql.service - MySQL Community Server\n\n&nbsp;&nbsp;&nbsp;Loaded: loaded (\/lib\/systemd\/system\/mysql.service; enabled; vendor preset: enabled)\n\n&nbsp;&nbsp;&nbsp;Active: active (running) since Tue 2017-07-11 09:39:40 EDT; 1min 39s ago\n\n&nbsp;Main PID: 9579 (mysqld)\n\n&nbsp;&nbsp;&nbsp;CGroup: \/system.slice\/mysql.service\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#9492;&#9472;9579 \/usr\/sbin\/mysqld\n\nJul 11 09:39:39 abandoned-plate systemd[1]: Starting MySQL Community Server...\n\nJul 11 09:39:40 abandoned-plate systemd[1]: Started MySQL Community Server.\n<\/pre><p>\n\n\n<div class=\"protip\">\n                    <h4 class=\"title\">Pro Tip<\/h4>\n                    <p>Check out our tutorial to learn other methods to check and <a href=\"\/tutorials\/how-to-list-installed-packages-on-ubuntu\/\">list installed packages on Ubuntu<\/a>.<\/p>\n                <\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-3-install-php\">3. Install PHP<\/h3><p>PHP interprets your application&rsquo;s code, allowing it to display in the web browser. You can <a href=\"\/tutorials\/how-to-install-install-php-ubuntu\">install PHP<\/a> and other essential modules with the following command<\/p><pre class=\"wp-block-preformatted\">sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql php-cgi php-curl php-json<\/pre><p>This command will install the latest stable version of PHP and additional modules required for the web application&rsquo;s functionality.<\/p><p>Once installed, check whether PHP is working correctly by creating a test file and opening it in your web browser. Begin by installing the <a href=\"\/tutorials\/how-to-install-and-use-nano-text-editor\">nano text editor<\/a>, which we will use to create the mockup script:<\/p><pre class=\"wp-block-preformatted\">sudo apt-get install nano<\/pre><p>Once installed, enter the following command to create a blank test PHP file and open the nano text editor:<\/p><pre class=\"wp-block-preformatted\">sudo nano \/var\/www\/html\/test.php<\/pre><p>Note that we created the file inside the<strong> \/var\/www\/html<\/strong> directory known as <strong>webroot<\/strong>. Apache will look for files requested in the website URL in this folder by default. Check out the <a href=\"https:\/\/help.ubuntu.com\/lts\/serverguide\/httpd.html\" target=\"_blank\" rel=\"noopener\">Apache Ubuntu documentation page<\/a> for information about the path configuration.<\/p><p>Also, since you need root privileges to write to this directory, ensure to add sudo before the command. Once the text editor shows up, enter the following:&nbsp;<\/p><pre class=\"wp-block-preformatted\">&lt;?php\n\nphpinfo();\n\n?&gt;<\/pre><p>This <strong>phpinfo() <\/strong>function will display information about PHP installation and configuration, ensuring it works properly.<\/p><p>After adding the code, save the changes by pressing <strong>Ctrl + X<\/strong> &rarr; <strong>Y <\/strong>&rarr; <strong>Enter<\/strong>. Now open the following web address in your browser. Remember to use your server&rsquo;s actual IP address.<\/p><pre class=\"wp-block-preformatted\">http:\/\/&lt;your_vps_ip_adress&gt;\/test.php<\/pre><p>You should see a page that looks similar to the image below.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/04\/image5-2.png\"><img decoding=\"async\" width=\"900\" height=\"583\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/04\/image5-2.png\/public\" alt=\"LAMP on Ubuntu Installed\" class=\"wp-image-107356\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/04\/image5-2.png\/w=900,fit=scale-down 900w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/04\/image5-2.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/04\/image5-2.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/04\/image5-2.png\/w=768,fit=scale-down 768w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><\/a><\/figure><\/div><p>After confirming that your server&rsquo;s PHP works correctly, return to Terminal and remove the test file by entering the following command:<\/p><pre class=\"wp-block-preformatted\">sudo rm \/var\/www\/html\/test.php<\/pre><p>\n\n\n<div><p class=\"important\"><strong>Important!<\/strong> It is crucial to remove the test file after checking installation because it can expose critical information about the server configuration for cyber attackers.<\/p><\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>LAMP stands for Linux, Apache, MySQL, and PHP, or LAMP, a popular web stack for creating and deploying applications. It provides a complete hosting infrastructure, including a web server, database, and a PHP interpreter.<\/p><p>The easiest way to install LAMP on Ubuntu is using Hostinger&rsquo;s operating system template. To do so, log in to hPanel and open your VPS operating system configuration menu. Select <strong>Ubuntu 22.04 with LAMP stack <\/strong>and click <strong>Change OS<\/strong>.<\/p><p>You can also install LAMP manually by running the apt install command for each software via SSH. To check if it&rsquo;s configured properly, use systemd to check Apache and MySQL status. For PHP, create a test file using nano and access it via your web browser.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>LAMP is an acronym for Linux, Apache, MySQL, and PHP &ndash; a popular stack for creating and deploying dynamic web [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/tutorials\/how-to-install-lamp-on-ubuntu\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":71,"featured_media":107360,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to Install LAMP Stack on Ubuntu","rank_math_description":"Linux, Apache, MySQL, PHP (LAMP) stack is one of the most popular stacks. See our tutorial and learn to install LAMP on Ubuntu.","rank_math_focus_keyword":"install lamp on ubuntu","footnotes":""},"categories":[22646,22644],"tags":[],"class_list":["post-5853","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-pre-installed-applications","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-install-lamp-on-ubuntu","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/lamp-ubuntu","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/instalar-lamp-en-ubuntu","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/cara-install-lamp-ubuntu","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-install-lamp-on-ubuntu","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-install-lamp-on-ubuntu","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-install-lamp-on-ubuntu","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/instalar-lamp-en-ubuntu","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/instalar-lamp-en-ubuntu","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/instalar-lamp-en-ubuntu","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-install-lamp-on-ubuntu","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-install-lamp-on-ubuntu","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-install-lamp-on-ubuntu","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-install-lamp-on-ubuntu","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/5853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/users\/71"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/comments?post=5853"}],"version-history":[{"count":48,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/5853\/revisions"}],"predecessor-version":[{"id":138352,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/posts\/5853\/revisions\/138352"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/media\/107360"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/media?parent=5853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/categories?post=5853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/tutorials\/wp-json\/wp\/v2\/tags?post=5853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}