Ubuntu Apache Setup for WordPress

On a Fresh Ubuntu 18.04 server, run following commands to setup Apache, PHP and MySQL needed for WordPress installation.

You can go to each file and manually run the commands if you want to see what commands are executed.

At this stage, you have LAMP server setup and ready to go.

To get your domain work with Apache, first you need to point your domain to server IP. This can be done by editing DNS records with your domain registrar or DNS provider.

In commands below, replace

DOMAIN.COM = replace with your actual domain name
USERNAME = you can use any username you wnat, first 8 chars of domain name for example

Create SFTP User

Set a password for the user. This will be used to login to SFTP

You will be asked to enter password 2 times.

Configure Apache

First lets make Apache run as the user, this will make WordPress upgrade easier.

Create Apache VirtualHost entry


To activate the web site, run

Create document root and set permission

Restart Apache

Create MySQL Database

Login to mysql, on ubuntu, as user root, run

Now you will be in MySQL command promt, run following 2 commands to create a Database and User.

Replace MYSQL_PASSWORD with your own MySQL password. DB_NAME with name of database you need. DB_USER with username for the db.

You will need these when installing WordPress.

Installing LetsEncrypt

First install letsEncrypt with

To get SSL for your domain, run

Replace [email protected] with your actual email address.

Installing WordPress

You can now SFTP/SSH into the server. Upload WordPress into html folder. Make sure you use the newly created USER to do this, if you do it as user root, you will get permission error. Visit the web site, you wil get WordPress install wizzard. Just fill the form to do the install. You will need to enter MySQL login details you created before.

Install WordPress using SSH

First login with SSH user you created with command

You will be asked to enter password. Enter password you created before.

Download wordpress

Extract wordpress files with

This will create a folder “wordpress” with the files.

To make the site live, we need to replace folder html with this new wordpress folder

Now you can go to the site, you will see wordpress install screen.

See WordPress

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *