{"id":85763,"date":"2026-07-17T07:00:00","date_gmt":"2026-07-17T14:00:00","guid":{"rendered":"https:\/\/dhblog.dream.press\/blog\/?p=85763"},"modified":"2026-07-17T07:00:13","modified_gmt":"2026-07-17T14:00:13","slug":"install-lamp-stack-on-vps","status":"publish","type":"post","link":"https:\/\/www.dreamhost.com\/blog\/install-lamp-stack-on-vps\/","title":{"rendered":"How to Install a LAMP Stack on a VPS"},"content":{"rendered":"<div class=\"tldr-block\" style=\"display: none;\">\n\t<div class=\"svg\">\n\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 119.25 37.8\">\n\t<g>\n\t\t<g>\n\t\t\t<path fill=\"#ffffff\" d=\"M23.4,6.93h-8.1v24.57h-7.2V6.93H0V0h23.4v6.93Z\" \/>\n\t\t\t<path fill=\"#ffffff\" d=\"M45,24.57v6.93h-18.45V0h7.2v24.57h11.25Z\" \/>\n\t\t\t<path fill=\"#ffffff\"\n\t\t\t\td=\"M90.9,15.75c0,8.91-6.61,15.75-15.3,15.75h-12.6V0h12.6c8.68,0,15.3,6.84,15.3,15.75ZM83.97,15.75c0-5.4-3.42-8.82-8.37-8.82h-5.4v17.64h5.4c4.95,0,8.37-3.42,8.37-8.82Z\" \/>\n\t\t\t<path fill=\"#ffffff\"\n\t\t\t\td=\"M105.57,21.15h-3.42v10.35h-7.2V0h12.6c5.98,0,10.8,4.81,10.8,10.8,0,3.87-2.34,7.38-5.81,9.13l6.71,11.56h-7.74l-5.94-10.35ZM102.15,14.85h5.4c1.98,0,3.6-1.75,3.6-4.05s-1.62-4.05-3.6-4.05h-5.4v8.1Z\" \/>\n\t\t<\/g>\n\t\t<path\n\t\t\tfill=\"#0173ec\"\n\t\t\td=\"M53.97,37.8h-5.4l1.8-13.27h7.2l-3.6,13.27ZM49.02,12.55c0-2.34,1.93-4.27,4.27-4.27s4.27,1.94,4.27,4.27-1.93,4.27-4.27,4.27-4.27-1.94-4.27-4.27Z\"\n\t\t \/>\n\t<\/g>\n<\/svg>\n\t<\/div>\n\t<div class=\"tldr-wrap\">\n\t\t\n\n<p class=\"wp-block-paragraph\">A LAMP stack (Linux, Apache, MySQL, and PHP) is the classic open-source web stack, powering <a href=\"https:\/\/w3techs.com\/technologies\/details\/cm-wordpress\/all\/all\" target=\"_blank\" rel=\"noreferrer noopener\">WordPress (41.5% of all websites in June 2026)<\/a> and a huge share of the PHP web.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Installing LAMP on a VPS gives you full root access, predictable pricing, and no per-site fees. The trade-off is that <em>you&#8217;re now the sysadmin<\/em>: security patches, backups, and uptime are on you.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On Ubuntu 24.04 LTS, the base install takes about 30 minutes, the modern Apache and PHP wiring uses PHP-FPM, and a five-step hardening pass covers the production floor. A 4 GB VPS, like <a href=\"https:\/\/www.dreamhost.com\/hosting\/self-managed-vps\/\" target=\"_blank\" rel=\"noreferrer noopener\">DreamHost&#8217;s VPS Stack 4<\/a>, handles a typical PHP app at baseline. Scale up only when the workload demands it.<\/p>\n\n\n\t<\/div>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Your managed-hosting renewal landed in your inbox last week.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Yikes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The number is bigger than you remember. Your $9-a-month plan is somehow $34 a month now. The marketing email called it a &#8220;rate adjustment.&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The price isn&#8217;t even the annoying part. The plan you signed up for three years ago is now a different plan, and nobody asked you. You can&#8217;t <strong>ssh<\/strong> into the box. You can&#8217;t change the PHP version without filing a ticket. The host doesn&#8217;t think of itself as renting you a server. It thinks of itself as renting you <em>permission<\/em> to run a website.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">LAMP is still the default PHP runtime on the public web. Over four out of every 10 websites run a LAMP application called WordPress. What changed over the last decade is that managed hosts wrapped LAMP in a control panel and started charging more for less of it. A VPS takes the control panel back off.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Installing LAMP yourself takes about five steps, plus one key decision (PHP-FPM, not mod_php) that most older tutorials get wrong. Here\u2019s exactly how to do it \u2014 and how to know whether self-managing is the right call for you in the first place.<\/p>\n\n\n\n<h2 id=\"h-what-is-a-lamp-stack\" class=\"wp-block-heading\">What Is a LAMP Stack?<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1600\" height=\"1034\" data-src=\"https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/01_the_four_lamp_layers.webp\" alt=\"LAMP stack architecture: PHP handles application logic, MySQL manages data, Apache serves requests, Linux provides operating system foundation.\" class=\"wp-image-85766 lazyload\" data-srcset=\"https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/01_the_four_lamp_layers.webp 1600w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/01_the_four_lamp_layers-300x194.webp 300w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/01_the_four_lamp_layers-1024x662.webp 1024w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/01_the_four_lamp_layers-768x496.webp 768w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/01_the_four_lamp_layers-1536x993.webp 1536w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/01_the_four_lamp_layers-600x388.webp 600w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/01_the_four_lamp_layers-1200x776.webp 1200w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/01_the_four_lamp_layers-730x472.webp 730w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/01_the_four_lamp_layers-1460x944.webp 1460w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/01_the_four_lamp_layers-784x507.webp 784w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/01_the_four_lamp_layers-1568x1013.webp 1568w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/01_the_four_lamp_layers-877x567.webp 877w\" data-sizes=\"(max-width: 1600px) 100vw, 1600px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1600px; --smush-placeholder-aspect-ratio: 1600\/1034;\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>A LAMP stack is the four-piece runtime that serves most PHP applications on the internet.<\/strong> Linux for the OS, Apache for the web server, MySQL (or MariaDB) for the database, and PHP for the application code. It\u2019s been the default open-source web stack since the early 2000s. Versions changed; the shape hasn&#8217;t.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8220;L&#8221; is flexible: Ubuntu, AlmaLinux, Debian, and Rocky all count. Pick one and move on. For most people in 2026, the right answer for a new deployment is Ubuntu 24.04 LTS. It is the current default for new installs, and plenty of production servers still run 22.04 LTS, which stays supported into 2027.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As of June 2026, according to W3Techs, <a target=\"_blank\" href=\"https:\/\/w3techs.com\/technologies\/details\/pl-php\">PHP runs 70.8% of all websites with a known server-side language<\/a>. (Clearly, <a target=\"_blank\" href=\"https:\/\/www.dreamhost.com\/blog\/is-php-dead\/\">PHP isn\u2019t dead.<\/a>) WordPress alone <a target=\"_blank\" href=\"https:\/\/w3techs.com\/technologies\/details\/cm-wordpress\/all\/all\">powers 41.5% of all websites<\/a>, and it\u2019s a LAMP application by design. In other words, if you run a WordPress site, you&#8217;re already running LAMP. You just may not own the server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Running LAMP on a <a target=\"_blank\" href=\"https:\/\/www.dreamhost.com\/blog\/beginners-guide-vps\/\">VPS<\/a>, versus shared or managed hosting, gets you three things:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Full root access:<\/strong> You decide which PHP modules are installed, which Apache config to ship, and which port the database listens on.<\/li>\n\n\n\n<li><strong>No tenant noise:<\/strong> A VPS gets a guaranteed slice of CPU and RAM. Your traffic spike doesn&#8217;t compete with whoever else is on the host.<\/li>\n\n\n\n<li><strong>Predictable pricing:<\/strong> A flat monthly cost that doesn&#8217;t double when an &#8220;unlimited&#8221; shared plan decides your CPU usage is too high.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The cost is that everything between the kernel and your application is now your job.<\/p>\n\n\n\n<div class=\"article-newsletter article-newsletter--gradient\">\n\n\n<h2>Get Content Delivered Straight to Your Inbox<\/h2><p>Subscribe now to receive all the latest updates, delivered directly to your inbox.<\/p><form class=\"nwsl-form\" id=\"newsletter_block_\" novalidate><div class=\"messages\"><\/div><div class=\"form-group\"><label for=\"input_newsletter_block_\"><input type=\"email\"name=\"email\"id=\"input_newsletter_block_\"placeholder=\"Enter your email address\"novalidatedisabled=\"disabled\"\/><\/label><button type=\"submit\"class=\"btn btn--brand\"disabled=\"disabled\"><span>Sign Me Up!<\/span><svg width=\"21\" height=\"14\" viewBox=\"0 0 21 14\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n<path d=\"M13.8523 0.42524L12.9323 1.34521C12.7095 1.56801 12.7132 1.9304 12.9404 2.14865L16.7241 5.7823H0.5625C0.251859 5.7823 0 6.03416 0 6.3448V7.6573C0 7.96794 0.251859 8.2198 0.5625 8.2198H16.7241L12.9405 11.8535C12.7132 12.0717 12.7095 12.4341 12.9323 12.6569L13.8523 13.5769C14.072 13.7965 14.4281 13.7965 14.6478 13.5769L20.8259 7.39879C21.0456 7.17913 21.0456 6.82298 20.8259 6.60327L14.6477 0.42524C14.4281 0.205584 14.0719 0.205584 13.8523 0.42524Z\" fill=\"white\"\/>\n<\/svg>\n<\/button><\/div><\/form><\/div>\n\n\n<h2 id=\"h-what-vps-do-you-actually-need-for-a-lamp-stack\" class=\"wp-block-heading\">What VPS Do You Actually Need for a LAMP Stack?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A 4 GB VPS with 2 vCPU and NVMe SSD storage runs a typical LAMP application comfortably \u2014 a single WordPress site, small Laravel app, or a couple of low-traffic PHP sites. Scale up only when the workload tells you to.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><strong>Workload<\/strong><\/th><th><strong>RAM<\/strong><\/th><th><strong>vCPU<\/strong><\/th><th><strong>Storage<\/strong><\/th><th><strong>Tier notes<\/strong><\/th><\/tr><\/thead><tbody><tr><td>Single WordPress site, low-medium traffic<\/td><td>2\u20134 GB<\/td><td>2<\/td><td>40-60 GB<\/td><td>Stack 4 baseline<\/td><\/tr><tr><td>Multi-site agency hosting (5\u201315 sites)<\/td><td>4\u20138 GB<\/td><td>2\u20134<\/td><td>80\u2013120 GB<\/td><td>Stack 4 to Stack 8<\/td><\/tr><tr><td>High-traffic WordPress or WooCommerce store<\/td><td>8\u201316 GB<\/td><td>4+<\/td><td>100+ GB<\/td><td>Stack 8 or higher<\/td><\/tr><tr><td>Custom PHP app with a heavy database<\/td><td>8\u201316 GB<\/td><td>4+<\/td><td>100+ GB<\/td><td>Stack 8 or higher<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">A few sizing notes worth knowing:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>NVMe matters more than people expect.<\/strong> MySQL is writing constantly \u2014 the binlog, the InnoDB redo log, the table files. Old SATA SSD technically works, but you\u2019ll feel the slog the first time you run a database import.&nbsp;<\/li>\n\n\n\n<li><strong>RAM is usually the constraint.<\/strong> PHP-FPM holds worker processes in memory; MySQL holds an InnoDB buffer pool. Run out of RAM, and the box starts swapping. And a swapping LAMP server feels broken even when nothing technically is.<\/li>\n\n\n\n<li><strong>Don&#8217;t over-provision on day one.<\/strong> Most operators size up for an imagined future load that never arrives. Start at the workload-appropriate tier and scale when you hit a wall.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">For most LAMP workloads, VPS Stack 4 is the right baseline: 4 GB RAM, NVMe storage, full root access, and unmetered bandwidth. Scale up when the workload tells you to.<\/p>\n\n\n\n<h2 id=\"h-how-do-you-install-a-lamp-stack-on-a-vps\" class=\"wp-block-heading\">How Do You Install a LAMP Stack on a VPS?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A LAMP install on a fresh Ubuntu 24.04 LTS VPS takes about 30 minutes. The shape is the same on AlmaLinux, only the package manager differs (dnf instead of apt). Debian uses apt, just like Ubuntu.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Pick your OS first. <strong>Ubuntu 24.04 LTS<\/strong> is the default for most new deployments. Canonical ships LTS security updates for five years, and most tutorials target it. <strong>AlmaLinux<\/strong> is the right call for a Red Hat-family system without the RHEL price tag.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1600\" height=\"828\" data-src=\"https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/02_steps_to_install_lamp_stack.webp\" alt=\"Sequential installation workflow for LAMP stack: system updates, Apache, database, PHP, then PHP-Apache integration.\" class=\"wp-image-85767 lazyload\" data-srcset=\"https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/02_steps_to_install_lamp_stack.webp 1600w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/02_steps_to_install_lamp_stack-300x155.webp 300w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/02_steps_to_install_lamp_stack-1024x530.webp 1024w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/02_steps_to_install_lamp_stack-768x397.webp 768w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/02_steps_to_install_lamp_stack-1536x795.webp 1536w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/02_steps_to_install_lamp_stack-600x311.webp 600w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/02_steps_to_install_lamp_stack-1200x621.webp 1200w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/02_steps_to_install_lamp_stack-730x378.webp 730w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/02_steps_to_install_lamp_stack-1460x756.webp 1460w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/02_steps_to_install_lamp_stack-784x406.webp 784w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/02_steps_to_install_lamp_stack-1568x811.webp 1568w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/02_steps_to_install_lamp_stack-877x454.webp 877w\" data-sizes=\"(max-width: 1600px) 100vw, 1600px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1600px; --smush-placeholder-aspect-ratio: 1600\/828;\" \/><\/figure>\n\n\n\n<h3 id=\"h-1-update-the-system\" class=\"wp-block-heading\">1. Update the system<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run <strong><code>sudo apt update &amp;&amp; sudo apt upgrade -y<\/code><\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This pulls the current package index and patches the base OS to the latest security release.<\/p>\n\n\n\n<h3 id=\"h-2-install-apache\" class=\"wp-block-heading\">2. Install Apache<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run <strong><code>sudo apt install apache2<\/code><\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The package puts a <strong><code>systemd<\/code><\/strong> service called <strong><code>apache2<\/code><\/strong> on the box, sets it to autostart on boot, drops a docroot at <strong>\/var\/www\/html\/<\/strong>, and writes config to <strong>\/etc\/apache2\/<\/strong>. Visit your VPS&#8217;s IP in a browser. If you see the Ubuntu Apache welcome page, you now have a working web server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Run <strong><code>systemctl status apache2<\/code><\/strong> to confirm. A green \u201cactive (running)\u201d line is what you want.<\/p>\n\n\n\n<h3 id=\"h-3-install-mysql-or-mariadb\" class=\"wp-block-heading\">3. Install MySQL or MariaDB<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run <strong><code>sudo apt install mysql-server<\/code> <\/strong>(or <strong><code>mariadb-server<\/code><\/strong>).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then, run <strong><code>sudo mysql_secure_installation<\/code><\/strong> to set a root password, drop anonymous users, remove the test database, and disallow remote root login. Skipping <strong><code>mysql_secure_installation<\/code><\/strong> is the most common newbie mistake \u2014 don\u2019t skip it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If <code>mysql_secure_installation<\/code> keeps looping on the root password, your root user is on <code>auth_socket<\/code> (the Ubuntu default). Switch it first with: <code>ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password'<\/code>; then run the script, and switch back afterward if you prefer socket auth.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Still deciding between MySQL and MariaDB? <\/strong>For most PHP apps, the choice is irrelevant. Pick MariaDB if you want a permissive open-source license. Go with MySQL if your application\u2019s docs assume it. One practical exception: if you\u2019re migrating from a managed host that ran MySQL 8.0, stay on 8.0. The utf8mb4_0900_ai_ci collation was MySQL-only until <a target=\"_blank\" href=\"https:\/\/mariadb.com\/docs\/release-notes\/community-server\/11.4\/11.4.5\">MariaDB 11.4.5 (early 2025)<\/a> added it as a compatibility alias, so charset edge cases can still bite you on older MariaDB builds.<\/p>\n\n\n\n<h3 id=\"h-4-install-php-and-required-modules\" class=\"wp-block-heading\">4. Install PHP and required modules<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run <strong><code>sudo apt install php php-mysql php-curl php-mbstring php-xml php-zip<\/code><\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Different apps need different modules. WordPress recommends php-imagick for image processing (php-gd works as a fallback). Laravel needs php-mbstring, php-xml, and php-bcmath. Check the app&#8217;s docs if unsure.<\/p>\n\n\n\n<h3 id=\"h-5-wire-php-to-apache-via-php-fpm\" class=\"wp-block-heading\">5. Wire PHP to Apache via PHP-FPM<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Why PHP-FPM instead of mod_php? Mod_php embeds the PHP interpreter inside every Apache process. That&#8217;s fine for a single low-traffic site. But at scale, every Apache worker holds a copy of PHP in memory, whether it&#8217;s serving a PHP request or a static image. RAM gets wasted, and performance flattens.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PHP-FPM separates the two. Apache stays lean and proxies PHP requests to a FastCGI process pool you can tune independently. For a 4 GB VPS running WordPress, the result is lower memory pressure under traffic and better tail latency when traffic spikes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is where most older tutorials get it wrong. The modern recommended setup is PHP-FPM with the Apache event MPM, not the old mod_php.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s the wiring on Ubuntu 24.04 (PHP 8.3):<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"># Install the FPM runtime<br><code>sudo apt install php8.3-fpm<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"># Drop mod_php and the prefork MPM, switch to the event MPM<br><code>sudo a2dismod php8.3<br>sudo a2dismod mpm_prefork<br>sudo a2enmod mpm_event<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"># Hand PHP requests to FPM over a FastCGI proxy<br><code>sudo a2enmod proxy_fcgi setenvif<br>sudo a2enconf php8.3-fpm<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"># Apply it<br><code>sudo systemctl restart apache2<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"># Confirm the wiring took<br><code>sudo apache2ctl -M | grep mpm<\/code> # should show <code>mpm_event<\/code>, not <code>mpm_prefork<\/code><br><code>sudo systemctl status php8.3-fpm<\/code> # should be active (running)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A phpinfo() page will now report Server API: FPM\/FastCGI. If you&#8217;re on a different PHP version, swap the 8.3 in the commands to match.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For pool tuning (worker counts, memory limits, socket vs. TCP), The <a target=\"_blank\" href=\"https:\/\/www.php.net\/manual\/en\/install.fpm.php\">official PHP-FPM install docs<\/a> go deeper. The <a target=\"_blank\" href=\"https:\/\/ubuntu.com\/server\/docs\/how-to\/web-services\/install-apache2\/\">Ubuntu Apache install docs<\/a> and the <a target=\"_blank\" href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-install-lamp-stack-on-ubuntu\">DigitalOcean LAMP tutorial<\/a> are handy component references for a second angle.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> The DigitalOcean tutorial references an Ubuntu 22.04 server; at the time of writing, the information is correct for Ubuntu 18.04 and above.<\/p>\n\n\n\n<h2 id=\"h-how-do-you-secure-a-lamp-stack-after-install\" class=\"wp-block-heading\">How Do You Secure a LAMP Stack After Install?<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1600\" height=\"1155\" data-src=\"https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/03_apache_s_process_based_approach.webp\" alt=\"Apache's security posture combines SSL encryption, authentication lockdown, automatic patching, and firewall protection.\" class=\"wp-image-85768 lazyload\" data-srcset=\"https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/03_apache_s_process_based_approach.webp 1600w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/03_apache_s_process_based_approach-300x217.webp 300w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/03_apache_s_process_based_approach-1024x739.webp 1024w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/03_apache_s_process_based_approach-768x554.webp 768w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/03_apache_s_process_based_approach-1536x1109.webp 1536w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/03_apache_s_process_based_approach-600x433.webp 600w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/03_apache_s_process_based_approach-1200x866.webp 1200w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/03_apache_s_process_based_approach-730x527.webp 730w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/03_apache_s_process_based_approach-1460x1054.webp 1460w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/03_apache_s_process_based_approach-784x566.webp 784w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/03_apache_s_process_based_approach-1568x1132.webp 1568w, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/03_apache_s_process_based_approach-877x633.webp 877w\" data-sizes=\"(max-width: 1600px) 100vw, 1600px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1600px; --smush-placeholder-aspect-ratio: 1600\/1155;\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">A fresh LAMP install isn&#8217;t production-ready. These five steps cover the floor:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Firewall the box:<\/strong> Use UFW (Uncomplicated Firewall, Ubuntu&#8217;s built-in firewall front end) to allow only ports 22 (SSH), 80 (HTTP), and 443 (HTTPS). Two commands: <strong><code>sudo ufw allow OpenSSH &amp;&amp; sudo ufw allow \"Apache Full\"<\/code><\/strong>, then <strong><code>sudo ufw enable<\/code><\/strong>.<br><\/li>\n\n\n\n<li><strong>SSH-key-only logins: <\/strong>Push your public key with <strong>ssh-copy-id<\/strong>, then disable password authentication in <strong>\/etc\/ssh\/sshd_config<\/strong>: <strong>PasswordAuthentication no<\/strong>. Bots scan the internet for password-auth SSH all day. This single change eliminates the vast majority of brute-force attempts.<br><\/li>\n\n\n\n<li><strong>Run <code>mysql_secure_installation<\/code>:<\/strong> If you skipped it during install, run it now.<br><\/li>\n\n\n\n<li><strong>Add Let&#8217;s Encrypt SSL: <\/strong>\u00a0Install <a href=\"https:\/\/certbot.eff.org\/\" target=\"_blank\">Certbot<\/a> and run <strong><code>sudo certbot --apache<\/code><\/strong>. Your site goes from HTTP to HTTPS in five minutes. Certificates auto-renew via a <strong>systemd<\/strong> timer. (Yes, this really is one command. Yes, most managed hosts charge extra for it.)<br><\/li>\n\n\n\n<li><strong>Patch on a schedule: <\/strong>&nbsp;Install <strong>unattended-upgrades<\/strong> and configure it to apply security patches automatically. Set this once. Skip it, and you find out about a CVE because you got hacked.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><em>That&#8217;s the floor.<\/em> Anything more (fail2ban, ModSecurity, intrusion detection, and off-box backups) is good practice, but not required to ship. For OS-level hardening, <a target=\"_blank\" href=\"https:\/\/documentation.ubuntu.com\/security\/\">Ubuntu&#8217;s server security documentation<\/a> covers it well.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Rather not own all of this? <a target=\"_blank\" href=\"https:\/\/www.dreamhost.com\/hosting\/managed-vps\/\">DreamHost&#8217;s managed VPS plans<\/a> handle patching, monitoring, and backups for you.<\/p>\n\n\n\n<h2 id=\"h-how-much-does-running-lamp-on-a-vps-cost-vs-managed-hosting\" class=\"wp-block-heading\">How Much Does Running LAMP on a VPS Cost vs. Managed Hosting?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A self-managed LAMP VPS runs roughly the cost of an entry-level managed plan, but removes every per-site fee, email surcharge, and renewal-creep ceiling. The trade-off is the ops work (patching, backups, monitoring) that managed plans handle for you.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><strong>Approach<\/strong><\/th><th><strong>What you pay for<\/strong><\/th><th><strong>What you control<\/strong><\/th><\/tr><\/thead><tbody><tr><td>Shared\/managed hosting<\/td><td>Pre-configured stack, support, uptime SLAs, backups<\/td><td>Your app and content<\/td><\/tr><tr><td>Self-managed LAMP VPS<\/td><td>The box and bandwidth<\/td><td>The OS, the stack, every config, every site<\/td><\/tr><tr><td>Dedicated server<\/td><td>A whole physical machine<\/td><td>Same as VPS, plus the hardware<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>The honest cost of ops, in human time: <\/strong>a clean LAMP VPS needs about 30 minutes a month of attention if you&#8217;ve automated patching. That&#8217;s less than the time most people spend picking what to watch on Netflix on a Sunday night.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The number nobody publishes is what <em>managed<\/em> hosting actually costs three years in. The renewal-creep pattern most operators hit looks like this.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Year 1:<\/strong> $9\/month introductory rate<\/li>\n\n\n\n<li><strong>Year 2:<\/strong> $19\/month \u2014&nbsp;&#8220;rate adjustment&#8221;<\/li>\n\n\n\n<li><strong>Year 3:<\/strong> $34\/month, plus $3 for SSL, plus $5 for daily backups, plus $15 a year for WHOIS privacy.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">At DreamHost, we price our <a target=\"_blank\" href=\"https:\/\/www.dreamhost.com\/hosting\/self-managed-vps\/\">VPS plans<\/a> to stay flat \u2014 no per-site fees, unmetered bandwidth, and full root access at a predictable monthly rate.<\/p>\n\n\n\n<h2 id=\"h-when-does-running-lamp-on-a-vps-make-sense\" class=\"wp-block-heading\">When Does Running LAMP on a VPS Make Sense?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Running LAMP on a VPS makes sense when you&#8217;ve outgrown what shared or managed hosting will give you, and you&#8217;re comfortable owning what they used to handle.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Good fits:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Leaving managed hosting:<\/strong> Price hikes, CPU throttling, or plugin restrictions you didn&#8217;t agree to.<\/li>\n\n\n\n<li><strong>Running a PHP app:<\/strong> WordPress, Laravel, Magento, Drupal, or a custom codebase that needs predictable resources.<\/li>\n\n\n\n<li><strong>Agency hosting multiple sites:<\/strong> Per-site fees on managed plans get absurd at scale.<\/li>\n\n\n\n<li><strong>Wanting `ssh`, `wp-cli`, and `git`:<\/strong> The tools you actually use to run a site.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">When LAMP on a VPS isn&#8217;t the right call:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Real-time apps with heavy WebSocket traffic:<\/strong> Node.js handles persistent connections better than LAMP&#8217;s request-response loop.<\/li>\n\n\n\n<li><strong>Microservices with autoscaling needs:<\/strong> Containers and Kubernetes fit better when you spin instances up and down on demand.<\/li>\n\n\n\n<li><strong>Zero Linux comfort and no plans to build it:<\/strong> Stay managed.&nbsp;<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">A useful self-test: If you can <strong>ssh<\/strong> into a server and read a config file without panicking, you can run LAMP. If that sentence felt confusing, your managed host is doing real work for you \u2014 and that\u2019s not a bad thing.<\/p>\n\n\n\n<h2 id=\"h-when-should-you-stay-on-managed-hosting-instead\" class=\"wp-block-heading\">When Should You Stay on Managed Hosting Instead?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Stay on managed hosting if any of these sound familiar:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You don\u2019t have the technical staff who can troubleshoot a <strong>systemctl<\/strong> log if WordPress goes down on a Saturday evening.<\/li>\n\n\n\n<li>You don&#8217;t want to write a backup script or audit one a friend wrote.<\/li>\n\n\n\n<li>Uptime is mission-critical, and you don&#8217;t have someone on rotation who can respond to a page.<\/li>\n\n\n\n<li>You&#8217;d save more in time than you&#8217;d spend. A consultant billing $150 an hour and spending two hours a month on server maintenance is paying $300 for the privilege of self-managing. A $30-a-month managed plan looks great at that math.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Somewhere around $50 to $80 a month in managed fees, paired with minimum sysadmin comfort, the math starts favoring self-managed. Below that, managed is fine.<\/p>\n\n\n\n<h2 id=\"h-wrapping-up\" class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">LAMP on a VPS makes sense when you want control and predictable cost more than you want zero ops work. The install is about half an hour. The hardening is another half hour.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The hard part is deciding whether the trade-off is worth it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Remember the renewal email at the top of this guide. A host quietly decided the customer wouldn&#8217;t notice when a $9 plan turned into $34. A self-managed LAMP VPS doesn&#8217;t make pricing changes impossible, but it takes the stack itself off the table. The PHP version, the firewall, the SSL cert, and the backup script. Those are configurations you own, on a box you control.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a target=\"_blank\" href=\"https:\/\/www.dreamhost.com\/blog\/self-hosting\/\">Self-hosting<\/a> your LAMP stack is just a thing you can do now. It used to require a closet full of hardware and a static IP from your ISP. Now, the hardware is rented for the price of a couple of coffees, and the static IP comes with the box.<\/p>\n\n\n\n\n<div class=\"article-cta-shared article-cta-small article-cta--product\">\n\t<div class=\"tr-img-wrap-outer jsLoading\"><img decoding=\"async\" class=\"js-img-lazy \" src=\"https:\/\/www.dreamhost.com\/blog\/wp-content\/themes\/blog2018\/assets\/img\/lazy-loading-transparent.webp\" data-srcset=\"https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/06\/cta_image_a-877x522.webp 1x, https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/06\/cta_image_a.webp 2x\"  \/><\/div>\n\n\t<a href='https:\/\/www.dreamhost.com\/hosting\/vps\/' class='link-top' target='_blank' rel='noopener noreferrer'>\n\t\t<span>VPS<\/span>\n\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 384 512\" width=\"15\"><path d=\"M342.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L274.7 256 105.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z\"\/><\/svg>\n\t<\/a>\n\n\t<div class=\"content-btm\">\n\t\t<h2 class=\"h2--md\">\n\t\t\tOwn Your Entire Stack. Apps, AI, Databases, and More.\n\t\t<\/h2>\n\t\t<p class=\"p--md\">\n\t\t\tKeep every credential and conversation on a server you control, with NVMe speed and unmetered bandwidth built in.\n\t\t<\/p>\n\n\t\t        <a\n            href=\"https:\/\/www.dreamhost.com\/hosting\/vps\/\"\n                        class=\"btn btn--white-outline btn--sm btn--round\"\n                                    target=\"_blank\"\n            rel=\"noopener noreferrer\"\n            >\n                            Explore VPS Hosting Plans                    <\/a>\n\n\t<\/div>\n<\/div>\n\n\n<h2 id=\"h-frequently-asked-questions-about-lamp-on-a-vps\" class=\"wp-block-heading\">Frequently Asked Questions About LAMP on a VPS<\/h2>\n\n\n\n<h3 id=\"h-is-the-lamp-stack-still-relevant-in-2026\" class=\"wp-block-heading\">Is the LAMP stack still relevant in 2026?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes, the LAMP stack is still relevant in 2026. PHP runs <a target=\"_blank\" href=\"https:\/\/w3techs.com\/technologies\/details\/pl-php\">70.8% of all websites with a known server-side language<\/a>, and WordPress alone, a LAMP application, accounts for <a target=\"_blank\" href=\"https:\/\/w3techs.com\/technologies\/details\/cm-wordpress\/all\/all\">41.5% of all websites<\/a>. LEMP and modern JavaScript stacks have eaten share for high-concurrency real-time workloads, but for typical PHP apps and content sites, LAMP is still the default.<\/p>\n\n\n\n<h3 id=\"h-how-much-ram-do-i-need-for-a-lamp-vps\" class=\"wp-block-heading\">How much RAM do I need for a LAMP VPS?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A 4 GB VPS handles a typical LAMP application: a single WordPress site, a small Laravel app, or a few low-traffic PHP sites. DreamHost&#8217;s VPS Stack 4 is sized for that baseline. Step up to 8 GB for multi-site agency hosting or a high-traffic WooCommerce store. Plan for 16 GB on a heavy-database custom PHP app.<\/p>\n\n\n\n<h3 id=\"h-can-i-run-wordpress-on-a-self-managed-lamp-vps\" class=\"wp-block-heading\">Can I run WordPress on a self-managed LAMP VPS?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes, WordPress runs natively on LAMP because LAMP is what it was built on. The install is a virtual host, a MySQL database, the WordPress files in <strong>\/var\/www\/<\/strong>, and WP-CLI for command-line management. Managed WordPress hosts run this same stack under their control panel. The difference is that you can see and tune every layer on a self-managed VPS.<\/p>\n\n\n\n<h3 id=\"h-do-i-need-root-access-to-install-lamp-on-a-vps\" class=\"wp-block-heading\">Do I need root access to install LAMP on a VPS?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes, you need root or <strong><code>sudo<\/code><\/strong> access to install LAMP on a VPS. Most managed and shared hosts don&#8217;t give you root, which is why the question matters. If your current plan blocks<code> <strong>sudo apt install<\/strong><\/code>, you&#8217;re on a managed plan, and a LAMP install on that plan isn&#8217;t possible without moving.<\/p>\n\n\n\n<h3 id=\"h-should-i-install-lamp-manually-or-use-a-one-click-image\" class=\"wp-block-heading\">Should I install LAMP manually or use a one-click image?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Install manually if you want to understand what&#8217;s running on your box. One-click images and meta-packages like <strong>tasksel<\/strong> are fine for prototyping, but they hide the choices: which PHP modules are installed, whether PHP-FPM or mod_php is wired up, and what the firewall looks like. The 30 to 60 minutes manual installation costs pay back the first time something breaks at 11pm.<\/p>\n\n\n\n<h3 id=\"h-what-s-the-difference-between-lamp-and-lemp\" class=\"wp-block-heading\">What&#8217;s the difference between LAMP and LEMP?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">LEMP swaps Apache for Nginx (the &#8220;E&#8221; is pronounced <em>engine-x<\/em>). Same Linux, same database, same PHP \u2014 different web server. Nginx handles high-concurrency static traffic better. Apache wins on <strong>.htaccess<\/strong> flexibility and out-of-the-box WordPress compatibility.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">According to W3Techs, <a target=\"_blank\" href=\"https:\/\/w3techs.com\/technologies\/overview\/web_server\">Nginx leads web server market share at 31.8%<\/a>, with Cloudflare Server at 28.5% and Apache at 23.2% (as of June 2026). Nginx is the new default for API-heavy or static-heavy deployments. Apache is still the better choice if your application expects <strong>.htaccess<\/strong> rules, which most off-the-shelf PHP apps, including WordPress, do.<\/p>\n\n\n<p><script type=\"application\/ld+json\"><br \/>\n{<br \/>\n  \"@context\": \"https:\/\/schema.org\",<br \/>\n  \"@type\": \"FAQPage\",<br \/>\n  \"mainEntity\": [<br \/>\n    {<br \/>\n      \"@type\": \"Question\",<br \/>\n      \"name\": \"Is the LAMP stack still relevant in 2026?\",<br \/>\n      \"acceptedAnswer\": {<br \/>\n        \"@type\": \"Answer\",<br \/>\n        \"text\": \"Yes, the LAMP stack is still relevant in 2026. PHP runs 70.8% of all websites with a known server-side language (W3Techs, June 2026), and WordPress alone, a LAMP application, accounts for 41.5% of all websites (June 2026). LEMP and modern JavaScript stacks have eaten share for high-concurrency real-time workloads, but for typical PHP apps and content sites, LAMP is still the default.\"<br \/>\n      }<br \/>\n    },<br \/>\n    {<br \/>\n      \"@type\": \"Question\",<br \/>\n      \"name\": \"How much RAM do I need for a LAMP VPS?\",<br \/>\n      \"acceptedAnswer\": {<br \/>\n        \"@type\": \"Answer\",<br \/>\n        \"text\": \"A 4 GB VPS handles a typical LAMP application: a single WordPress site, a small Laravel app, or a few low-traffic PHP sites. DreamHost's VPS Stack 4 is sized for that baseline. Step up to 8 GB for multi-site agency hosting or a high-traffic WooCommerce store. Plan for 16 GB on a heavy-database custom PHP app.\"<br \/>\n      }<br \/>\n    },<br \/>\n    {<br \/>\n      \"@type\": \"Question\",<br \/>\n      \"name\": \"Can I run WordPress on a self-managed LAMP VPS?\",<br \/>\n      \"acceptedAnswer\": {<br \/>\n        \"@type\": \"Answer\",<br \/>\n        \"text\": \"Yes, WordPress runs natively on LAMP because LAMP is what WordPress was designed for. The install is a virtual host, a MySQL database, the WordPress files in \/var\/www\/, and wp-cli for command-line management. Managed WordPress hosts run this same stack under their control panel; the difference is that on a self-managed VPS you can see and tune every layer.\"<br \/>\n      }<br \/>\n    },<br \/>\n    {<br \/>\n      \"@type\": \"Question\",<br \/>\n      \"name\": \"Do I need root access to install LAMP on a VPS?\",<br \/>\n      \"acceptedAnswer\": {<br \/>\n        \"@type\": \"Answer\",<br \/>\n        \"text\": \"Yes, you need root or sudo access to install LAMP on a VPS. Most managed and shared hosts don't give you root, which is why the question matters. If your current plan blocks sudo apt install, you're on a managed plan, and a LAMP install on that plan isn't possible without moving.\"<br \/>\n      }<br \/>\n    },<br \/>\n    {<br \/>\n      \"@type\": \"Question\",<br \/>\n      \"name\": \"Should I install LAMP manually or use a one-click image?\",<br \/>\n      \"acceptedAnswer\": {<br \/>\n        \"@type\": \"Answer\",<br \/>\n        \"text\": \"Install manually if you want to understand what's running on your box. One-click images and meta-packages like tasksel are fine for prototyping, but they hide the choices: which PHP modules are installed, whether PHP-FPM or mod_php is wired up, what the firewall looks like. The 30 to 60 minutes manual installation costs pays back the first time something breaks at 11pm.\"<br \/>\n      }<br \/>\n    }<br \/>\n  ]<br \/>\n}<\/p>\n<p>### HowTo Schema<\/p>\n<p>{<br \/>\n  \"@context\": \"https:\/\/schema.org\",<br \/>\n  \"@type\": \"HowTo\",<br \/>\n  \"name\": \"How to Install a LAMP Stack on a VPS\",<br \/>\n  \"step\": [<br \/>\n    {<br \/>\n      \"@type\": \"HowToStep\",<br \/>\n      \"name\": \"Update the system\",<br \/>\n      \"text\": \"Run sudo apt update && sudo apt upgrade -y. Pulls the current package index and patches the base OS to the latest security release.\"<br \/>\n    },<br \/>\n    {<br \/>\n      \"@type\": \"HowToStep\",<br \/>\n      \"name\": \"Install Apache\",<br \/>\n      \"text\": \"Run sudo apt install apache2. The package puts a systemd service called apache2 on the box, sets it to autostart on boot, drops a docroot at \/var\/www\/html\/, and writes config to \/etc\/apache2\/. Visit your VPS's IP in a browser to confirm the welcome page.\"<br \/>\n    },<br \/>\n    {<br \/>\n      \"@type\": \"HowToStep\",<br \/>\n      \"name\": \"Install MySQL or MariaDB\",<br \/>\n      \"text\": \"Run sudo apt install mysql-server (or mariadb-server). Then run sudo mysql_secure_installation to set a root password, drop anonymous users, remove the test database, and disallow remote root login.\"<br \/>\n    },<br \/>\n    {<br \/>\n      \"@type\": \"HowToStep\",<br \/>\n      \"name\": \"Install PHP and required modules\",<br \/>\n      \"text\": \"Run sudo apt install php php-mysql php-curl php-mbstring php-xml php-zip. Different applications need different modules. WordPress recommends php-imagick and php-gd. Laravel needs php-mbstring, php-xml, and php-tokenizer. Check the application's documentation.\"<br \/>\n    },<br \/>\n    {<br \/>\n      \"@type\": \"HowToStep\",<br \/>\n      \"name\": \"Wire PHP to Apache via PHP-FPM\",<br \/>\n      \"text\": \"Use PHP-FPM with the Apache event MPM, not mod_php. PHP-FPM runs PHP in a separate process pool, and Apache hands PHP requests off via a proxy socket. The official PHP-FPM install documentation walks the configuration.\"<br \/>\n    }<br \/>\n  ]<br \/>\n}<br \/>\n<\/script><\/p>","protected":false},"excerpt":{"rendered":"<p>Install a LAMP stack on a VPS the right way. A no-fluff Apache, MySQL, and PHP setup guide for developers and WordPress operators leaving managed hosting.<\/p>\n","protected":false},"author":2,"featured_media":85765,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_yoast_wpseo_opengraph-title":"How to Install a LAMP Stack on a VPS","_yoast_wpseo_opengraph-description":"A no-fluff, five-step guide to installing Apache, MySQL, and PHP on your own VPS.","_yoast_wpseo_twitter-title":"How to Install a LAMP Stack on a VPS","_yoast_wpseo_twitter-description":"A no-fluff, five-step guide to installing Apache, MySQL, and PHP on your own VPS.","toc_headlines":"[[\"h-what-is-a-lamp-stack\",\"What Is a LAMP Stack?\"],[\"h-what-vps-do-you-actually-need-for-a-lamp-stack\",\"What VPS Do You Actually Need for a LAMP Stack?\"],[\"h-how-do-you-install-a-lamp-stack-on-a-vps\",\"How Do You Install a LAMP Stack on a VPS?\"],[\"h-how-do-you-secure-a-lamp-stack-after-install\",\"How Do You Secure a LAMP Stack After Install?\"],[\"h-how-much-does-running-lamp-on-a-vps-cost-vs-managed-hosting\",\"How Much Does Running LAMP on a VPS Cost vs. Managed Hosting?\"],[\"h-when-does-running-lamp-on-a-vps-make-sense\",\"When Does Running LAMP on a VPS Make Sense?\"],[\"h-when-should-you-stay-on-managed-hosting-instead\",\"When Should You Stay on Managed Hosting Instead?\"],[\"h-wrapping-up\",\"Wrapping Up\"],[\"h-frequently-asked-questions-about-lamp-on-a-vps\",\"Frequently Asked Questions About LAMP on a VPS\"]]","hide_toc":false,"show_updated_at":"0","footnotes":""},"categories":[550,807,804],"tags":[],"class_list":["post-85763","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","category-vps-hosting","category-web-hosting"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.3 (Yoast SEO v27.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Install a LAMP Stack on a VPS (2026 Guide) - DreamHost<\/title>\n<meta name=\"description\" content=\"Install a LAMP stack on a VPS the right way. A no-fluff Apache, MySQL, and PHP setup guide for developers and WordPress operators leaving managed hosting.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dreamhost.com\/blog\/install-lamp-stack-on-vps\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install a LAMP Stack on a VPS\" \/>\n<meta property=\"og:description\" content=\"A no-fluff, five-step guide to installing Apache, MySQL, and PHP on your own VPS.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dreamhost.com\/blog\/install-lamp-stack-on-vps\/\" \/>\n<meta property=\"og:site_name\" content=\"DreamHost Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DreamHost\/\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-17T14:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-07-17T14:00:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/1220x628_ogimage_lamp_stack_on_a_vps.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Dallas Kashuba\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"How to Install a LAMP Stack on a VPS\" \/>\n<meta name=\"twitter:description\" content=\"A no-fluff, five-step guide to installing Apache, MySQL, and PHP on your own VPS.\" \/>\n<meta name=\"twitter:creator\" content=\"@http:\/\/twitter.com\/dallas\" \/>\n<meta name=\"twitter:site\" content=\"@dreamhost\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dallas Kashuba\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"13 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Install a LAMP Stack on a VPS (2026 Guide) - DreamHost","description":"Install a LAMP stack on a VPS the right way. A no-fluff Apache, MySQL, and PHP setup guide for developers and WordPress operators leaving managed hosting.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dreamhost.com\/blog\/install-lamp-stack-on-vps\/","og_locale":"en_US","og_type":"article","og_title":"How to Install a LAMP Stack on a VPS","og_description":"A no-fluff, five-step guide to installing Apache, MySQL, and PHP on your own VPS.","og_url":"https:\/\/www.dreamhost.com\/blog\/install-lamp-stack-on-vps\/","og_site_name":"DreamHost Blog","article_publisher":"https:\/\/www.facebook.com\/DreamHost\/","article_published_time":"2026-07-17T14:00:00+00:00","article_modified_time":"2026-07-17T14:00:13+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/1220x628_ogimage_lamp_stack_on_a_vps.webp","type":"image\/webp"}],"author":"Dallas Kashuba","twitter_card":"summary_large_image","twitter_title":"How to Install a LAMP Stack on a VPS","twitter_description":"A no-fluff, five-step guide to installing Apache, MySQL, and PHP on your own VPS.","twitter_creator":"@http:\/\/twitter.com\/dallas","twitter_site":"@dreamhost","twitter_misc":{"Written by":"Dallas Kashuba","Est. reading time":"13 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dreamhost.com\/blog\/install-lamp-stack-on-vps\/#article","isPartOf":{"@id":"https:\/\/www.dreamhost.com\/blog\/install-lamp-stack-on-vps\/"},"author":{"name":"Dallas Kashuba","@id":"https:\/\/www.dreamhost.com\/blog\/#\/schema\/person\/f6a12ad459538e8e418cf31b8b603814"},"headline":"How to Install a LAMP Stack on a VPS","datePublished":"2026-07-17T14:00:00+00:00","dateModified":"2026-07-17T14:00:13+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dreamhost.com\/blog\/install-lamp-stack-on-vps\/"},"wordCount":2770,"publisher":{"@id":"https:\/\/www.dreamhost.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.dreamhost.com\/blog\/install-lamp-stack-on-vps\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/blog_hero_1460x1095_lamp_stack_on_a_vps.webp","articleSection":["Tutorials","VPS Hosting","Web Hosting"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.dreamhost.com\/blog\/install-lamp-stack-on-vps\/","url":"https:\/\/www.dreamhost.com\/blog\/install-lamp-stack-on-vps\/","name":"How to Install a LAMP Stack on a VPS (2026 Guide) - DreamHost","isPartOf":{"@id":"https:\/\/www.dreamhost.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dreamhost.com\/blog\/install-lamp-stack-on-vps\/#primaryimage"},"image":{"@id":"https:\/\/www.dreamhost.com\/blog\/install-lamp-stack-on-vps\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/blog_hero_1460x1095_lamp_stack_on_a_vps.webp","datePublished":"2026-07-17T14:00:00+00:00","dateModified":"2026-07-17T14:00:13+00:00","description":"Install a LAMP stack on a VPS the right way. A no-fluff Apache, MySQL, and PHP setup guide for developers and WordPress operators leaving managed hosting.","breadcrumb":{"@id":"https:\/\/www.dreamhost.com\/blog\/install-lamp-stack-on-vps\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dreamhost.com\/blog\/install-lamp-stack-on-vps\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dreamhost.com\/blog\/install-lamp-stack-on-vps\/#primaryimage","url":"https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/blog_hero_1460x1095_lamp_stack_on_a_vps.webp","contentUrl":"https:\/\/www.dreamhost.com\/blog\/wp-content\/uploads\/2026\/07\/blog_hero_1460x1095_lamp_stack_on_a_vps.webp","width":1460,"height":1095,"caption":"How to Install a LAMP Stack on a VPS"},{"@type":"BreadcrumbList","@id":"https:\/\/www.dreamhost.com\/blog\/install-lamp-stack-on-vps\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.dreamhost.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Install a LAMP Stack on a VPS"}]},{"@type":"WebSite","@id":"https:\/\/www.dreamhost.com\/blog\/#website","url":"https:\/\/www.dreamhost.com\/blog\/","name":"DreamHost Blog","description":"","publisher":{"@id":"https:\/\/www.dreamhost.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dreamhost.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.dreamhost.com\/blog\/#organization","name":"DreamHost","url":"https:\/\/www.dreamhost.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dreamhost.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/dhblog.dream.press\/blog\/wp-content\/uploads\/2019\/01\/dh_logo-blue-2.png","contentUrl":"https:\/\/dhblog.dream.press\/blog\/wp-content\/uploads\/2019\/01\/dh_logo-blue-2.png","width":1200,"height":168,"caption":"DreamHost"},"image":{"@id":"https:\/\/www.dreamhost.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DreamHost\/","https:\/\/x.com\/dreamhost","https:\/\/www.instagram.com\/dreamhost\/","https:\/\/www.linkedin.com\/company\/dreamhost\/","https:\/\/www.youtube.com\/user\/dreamhostusa"]},{"@type":"Person","@id":"https:\/\/www.dreamhost.com\/blog\/#\/schema\/person\/f6a12ad459538e8e418cf31b8b603814","name":"Dallas Kashuba","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/05ab6fb1606be97d16c74efb0fba01b3c11e91501dc5f9661bdfbb5c5b0cd113?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/05ab6fb1606be97d16c74efb0fba01b3c11e91501dc5f9661bdfbb5c5b0cd113?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/05ab6fb1606be97d16c74efb0fba01b3c11e91501dc5f9661bdfbb5c5b0cd113?s=96&d=mm&r=g","caption":"Dallas Kashuba"},"description":"Dallas Kashuba co-founded DreamHost while attending Harvey Mudd College and has spent nearly three decades building infrastructure at scale. Today he serves as an advisor, board member, and investor for various tech startups, with a consistent focus on user privacy, open source, and data portability. When he's not thinking about the Open Web, he's probably making music. Follow Dallas on X.","sameAs":["http:\/\/www.idallas.com\/","https:\/\/x.com\/http:\/\/twitter.com\/dallas"],"url":"https:\/\/www.dreamhost.com\/blog\/author\/dallas\/"}]}},"lang":"en","translations":{"en":85763,"it":85862,"de":85810,"pt":85814,"nl":85816,"fr":85820,"es":85823,"pl":85826,"ru":85828,"uk":85844},"pll_sync_post":{},"_links":{"self":[{"href":"https:\/\/www.dreamhost.com\/blog\/wp-json\/wp\/v2\/posts\/85763","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dreamhost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dreamhost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dreamhost.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"version-history":[{"count":4,"href":"https:\/\/www.dreamhost.com\/blog\/wp-json\/wp\/v2\/posts\/85763\/revisions"}],"predecessor-version":[{"id":85776,"href":"https:\/\/www.dreamhost.com\/blog\/wp-json\/wp\/v2\/posts\/85763\/revisions\/85776"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dreamhost.com\/blog\/wp-json\/wp\/v2\/media\/85765"}],"wp:attachment":[{"href":"https:\/\/www.dreamhost.com\/blog\/wp-json\/wp\/v2\/media?parent=85763"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dreamhost.com\/blog\/wp-json\/wp\/v2\/categories?post=85763"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dreamhost.com\/blog\/wp-json\/wp\/v2\/tags?post=85763"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}