What is a LAMP Stack?
LAMP stands for Linux, Apache, MySQL (or MariaDB), and PHP. It is the most widely deployed web server stack in the world and the foundation for millions of PHP applications including WordPress, Drupal, and Joomla.
Step 1: Install Apache
apt update && apt upgrade -y
apt install apache2 -y
systemctl enable apache2
systemctl start apache2
ufw allow 'Apache Full'
Step 2: Install MySQL / MariaDB
apt install mariadb-server -y
systemctl enable mariadb
mysql_secure_installation
Run mysql_secure_installation and answer: set root password (Yes), remove anonymous users (Yes), disallow root remote login (Yes), remove test database (Yes), reload privilege tables (Yes).
Step 3: Install PHP
apt install php libapache2-mod-php php-mysql php-curl php-gd php-mbstring php-xml php-zip -y
systemctl restart apache2
# Test PHP
echo "<?php phpinfo(); ?>" > /var/www/html/info.php
Visit http://YOUR_VPS_IP/info.php to verify PHP is working. Delete this file after testing: rm /var/www/html/info.php
Step 4: Configure Virtual Host
mkdir -p /var/www/yourdomain.com
nano /etc/apache2/sites-available/yourdomain.com.conf
Paste:
<VirtualHost *:80>
ServerName yourdomain.com
ServerAlias www.yourdomain.com
DocumentRoot /var/www/yourdomain.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
a2ensite yourdomain.com.conf
a2dissite 000-default.conf
systemctl reload apache2
Step 5: Install Free SSL
apt install certbot python3-certbot-apache -y
certbot --apache -d yourdomain.com -d www.yourdomain.com
Certbot automatically configures Apache for HTTPS and sets up auto-renewal.
Deploy Your LAMP Stack VPS in Amsterdam
Linux VPS from $3/month — install LAMP in minutes
Deploy Netherlands VPS Now