First complete your initial server setup, follow the link below.
Webserver and MySQL Setup (Quick) with User and Privileges on Ubuntu
Now we are ready to start the specific needs for WordPress. First we make sure to give www-data
(Apache2 User) the privileges on the folder we will use to install
sudo chown -R www-data /var/www
Then lets download and extract the latest WordPress (Version 6.4.3 at the time of this writing)
curl https://wordpress.org/latest.tar.gz | sudo -u www-data tar zx -C /var/www
The above is an example of what you will see, as the output from the Curl request.
Next we will setup a Virtual Host for Apache2.
sudo nano /etc/apache2/sites-available/wordpress.conf
Then we paste the following in there. In this example we are using a server name of my.example.com
this should match your domain, or you can comment it out (put a #
in front of ServerName
) if you don’t have one.
<VirtualHost *:80>
ServerName my.example.com
DocumentRoot /var/www/wordpress
<Directory /var/www/wordpress>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Require all granted
</Directory>
<Directory /var/www/wordpress/wp-content>
Options FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
Now we can enable the Virtual Host
sudo a2ensite wordpress
Optionally, you can also disable the default site from Apache.
sudo a2dissite 000-default
Lets restart Apache2 to activate it all.
sudo service apache2 restart
After a restart, we can navigate to our website
Select your language, and click Continue
Seeing this, we can take a moment to ensure we have a database, we can do this either from the CLI , or from PHPMyAdmin, in this example we will use the latter.
Logging in with a user that is allowed to create databases. After logging in, we click the Databases tab, and create our database. At this time you can also choose to create another user and secure it in different ways, but for now we just move on, using the same user we logged in with.
Back to WordPress, we can now click Let’s Go!
Fill in the database name (in our example just wordpress
), our username and password, and we can leave the rest as it is. If we did it right, we can see the following screen
Let’s click Run the Installation, this will be pretty quick, and take us to the next screen, this is where we configure the basics of our new WordPress SIte.
Pick a title, a Username (your new WordPress Admin), and a good password. As you see it gives a very strong suggestion.
And if all goes well, you will see the above and we can also navigate to our actual site
But you can also click Log In to get to the admin login screen
Using our new credentials, we can login and get to the admin portion, and start changing your site.
That’s it already again. See you next time!
Leave a Reply