In this post I will provide instructions to install WordPress on ubuntu server. Â This tutorial is aimed at those users who may want to install WordPress on a virtual server for development purposes.
A prerequisite for installing WordPress on your server, you will need to configure a LAMP server. Â Once you have a configured your LAMP server, I also recommend you install PHPMyAdmin.
With the prerequisites out the way, you're ready to get underway with installing WordPress on your ubuntu server.
I recommend connecting to your server via SSH, and executing the following commands:
Download the latest release of WordPress your user home directory.
Once the download is complete, uncompress the folder.
tar -xvzf latest.tar.gz
Delete the Index.html from the default Apache folder.
rm -f index.html
Move the uncompressed contents to the default Apache folder
sudo mv wordpress/* /var/www/html/
We will need to create the WordPress database. We'll do this directly in mySQL.
mysql -u root -p
Create the database and call it whatever you want. In my case I have just called it wordpress
CREATE DATABASE wordpress;
Create a User, again this can be any name of your choice, I have chosen wpusr and any password of your choice
CREATE USER wpusr@localhost IDENTIFIED BY 'new_password_here';
Give the user full access to the newly created database
GRANT ALL ON wordpress.* to wpusr@localhost;
Refresh the database permissions table and exit.
FLUSH PRIVILEGES; exit
We will now need to make amendments to the WordPresss configuration. First, we'll need to make a copy of wp-config-sample.php and create a new wp-config.php file.
sudo cp /var/www/html/wp-config-sample.php /var/www/html/wp-config.php
Now edit the config file using the any text editor, in my example I have used nano
sudo nano /var/www/html/wp-config.php
// ** MySQL settings â€“ You can get this info from your web host ** // /** The name of the database for WordPress */ define(â€˜DB_NAMEâ€™, â€˜wordpressâ€˜); /** MySQL database username */ define(â€˜DB_USERâ€™, â€˜wpusrâ€˜); /** MySQL database password whatever your chosen password was */ define(â€˜DB_PASSWORDâ€™, â€˜passwordâ€˜);
Change the permission of WordPress folder so that it functions correctly.
sudo chown -R www-data:www-data /var/www/html/ sudo chmod -R 755 /var/www/html/
In order to be able to install any plugins or new themes on WordPress install you will need to enable the FTP server settings.
sudo chown -R www-data:www-data wordpress
We're almost ready to go now, all we need to do is restart the web server.
sudo service apache2 restart
You're now ready to access the WordPress site by navigating to it in your browser Â i.e. Â http://192.168.0.3 , Â or whatever the address of DNS of your server is configured to.
- How to add Fathom Analytics to Nuxt 3 - May 19, 2023
- How to use Azure Blob Storage - May 8, 2023
- How to use Azure Key Vault to manage secrets - April 30, 2023