nordelo
Menu

Guides

Install WordPress on a VPS

Run WordPress on your own server with Apache, MariaDB and PHP, plus free HTTPS from Let's Encrypt. For Ubuntu and Debian.

On your own VPS you decide on plugins, performance and backups. A Cloud 4 is enough for most sites. You need a domain whose A record points at the server's IPv4 address. Run the commands as root.

1. Install the web server, database and PHP

apt update && apt install -y apache2 mariadb-server php libapache2-mod-php php-mysql php-curl php-gd php-mbstring php-xml php-zip php-intl

2. Create a database

Replace A-LONG-PASSWORD with your own password and keep it.

mysql -e "CREATE DATABASE wordpress; CREATE USER 'wp'@'localhost' IDENTIFIED BY 'A-LONG-PASSWORD'; GRANT ALL ON wordpress.* TO 'wp'@'localhost';"

3. Download WordPress

cd /tmp && curl -O https://wordpress.org/latest.tar.gz && tar xzf latest.tar.gz
rm /var/www/html/index.html
cp -r wordpress/* /var/www/html/
chown -R www-data:www-data /var/www/html

4. Allow pretty links

cat > /etc/apache2/conf-available/wordpress.conf <<EOF
<Directory /var/www/html>
    AllowOverride All
</Directory>
EOF
a2enconf wordpress && a2enmod rewrite && systemctl reload apache2

5. Open the firewall and turn on HTTPS

Replace example.com with your domain.

ufw allow 'Apache Full'
apt install -y certbot python3-certbot-apache
certbot --apache -d example.com -d www.example.com

Skip the ufw line if you have not turned the firewall on. Certbot renews the certificate by itself.

6. Finish in the browser

Go to your domain. Pick a language and enter the database wordpress, the user wp and the password from step 2. Then choose a site name and an admin account.

Keep it updated

Update WordPress and plugins from the dashboard, and the system with apt update && apt upgrade. Secure your new Linux VPS shows how to get security updates automatically.

See the VPS sizes