Install WordPress on Ubuntu 18.04
Before we begin, let’s update and upgrade the system. Login as the root user to your system and update the system to update the repositories.
apt update && apt upgrade
apt-get install nano
Setup extra nic for bridging connection
Add to config file 10-lxc.yaml
sudo netplan try
Step 1: Install Apache
Let’s jump right in and install Apache first. To do this, execute the following command.
apt install apache2
To confirm that Apache is installed on your system, execute the following command.
systemctl status apache2
To verify further, open your browser and go to your server’s IP address.
Step 2: Install MySQL
Next, we are going to install the MariaDB database engine to hold our WordPress files. MariaDB is an open-source fork of MySQL and most of the hosting companies use it instead of MySQL.
apt install mariadb-server mariadb-client
Let’s now secure our MariaDB database engine and disallow remote root login.
Step 3: Install PHP
Lastly, we will install PHP as the last component of the LAMP stack.
apt install php php-mysql
To confirm that PHP is installed , created a info.php file at /var/www/html/ path
Append the following lines:
Save and Exit.
—TEST YOUR URL—
Step 4: Create WordPress Database
Now it’s time to log in to our MariaDB database as root and create a database for accommodating our WordPress data.
mysql -u root -p
Create a database for our WordPress installation.
CREATE DATABASE wordpress_db;
Next, create a database user for our WordPress setup.
CREATE USER ‘root’@’localhost’ IDENTIFIED BY ‘Pimpc$’;
Grant privileges to the user
Next, grant the user permissions to access the database
GRANT ALL ON wordpress_db.* TO ‘root’@’localhost’ IDENTIFIED BY ‘Pimpc$’;
Step 5: Install WordPress CMS
Go to your temp directory and download the latest WordPress File
cd /tmp && wget https://wordpress.org/latest.tar.gz
Next, Uncompress the tarball which will generate a folder called “wordpress”.
tar -xvf latest.tar.gz
Copy the wordpress folder to /var/www/html/ path.
cp -R wordpress /var/www/html/
Run the command below to change ownership of ‘wordpress’ directory.
chown -R www-data:www-data /var/www/html/wordpress/
change File permissions of the WordPress folder.
chmod -R 755 /var/www/html/wordpress/
Create ‘uploads’ directory.
Finally, change permissions of ‘uploads’ directory.
chown -R www-data:www-data /var/www/html/wordpress/wp-content/uploads/
Open your browser and go to the server’s URL. In my case it’s
—TEST YOUR URL—
Click on the ‘Login’ button to get to access the Login page of your fresh WordPress installation.
Provide your login credentials and hit ‘Login.’
Voila! There goes the WordPress dashboard that you can use to create your first blog or website!
Congratulations for having come this far. You can now proceed to discover the various features, plugins, and themes and continue setting up your first blog/website!