← Help center · VPS and servers
How to install a LAMP stack on Ubuntu (Apache, MySQL, PHP)
LAMP means Linux, Apache, MySQL and PHP. It runs WordPress and many other PHP apps.
Install
apt update
apt install apache2 mysql-server php libapache2-mod-php php-mysql -y
systemctl enable --now apache2
Secure MySQL
mysql_secure_installation
Test PHP
Create /var/www/html/info.php with <?php phpinfo(); inside. Open it in your browser, check it works, then delete the file. It shows private details.
Next
- Open ports 80 and 443 in the firewall.
- Create a database and a separate database user for each site, with a strong password. Never use the MySQL root account in a website config file.
- Keep PHP, Apache and MySQL updated with your normal
apt upgraderoutine. - Prefer a ready panel? Shared hosting already includes all of this.
More in VPS and servers
- How to connect to your Linux VPS with PuTTY (Windows)
- How to connect to a Linux VPS from Mac or Linux with SSH
- Where to find your server IP address and password
- How to change your root password on Linux
- First steps on a new Linux VPS: a security checklist
Still stuck? Open a support ticket.