How to Run WordPress or Multiple Instances of WordPress on Ubuntu Linux: A Comprehensive Guide
How to Run WordPress or Multiple Instances of WordPress on Ubuntu Linux: A Comprehensive Guide
Running WordPress on a Linux distribution like Ubuntu can be a great way to create and manage websites. Not only is it a cost-effective solution, but it also provides more control and flexibility compared to traditional web hosting services. However, setting up WordPress on Linux can be a daunting task for beginners. In this article, we'll provide a comprehensive guide on how to run WordPress or multiple instances of WordPress on Ubuntu Linux. Prerequisites:
- Php
- Mysql
- Xampp or Mampp -> Xampp
In this article, we are going to use Xampp to do and run the wordpress installations. How to install xampp To install xampp, kindly follow the procedure highlighted in the first link below. https://www.how2shout.com/linux/how-to-install-xampp-on-ubuntu-20-04-lts/ https://www.apachefriends.org/download.html Getting Started Before we get started, there are a few things to take care of in order to have a successful environment to run our wordpress instances
- We need to stop MySQL and Apache2 - Follow the commands below We stop them since by default, Linux already has Apache2 and MySQL and this will hinder xampp from running
sudo service mysql stop
sudo /etc/init.d/apache2 stop
- Allow read, write and execute on htdocs folder for ftp purposes Open the terminal and use the following commands
cd /opt/lampp
chown -R www-data:www-data ./htdocs
- Running xampp - How to run xampp on Ubuntu Linux Use the following commands to run xampp
sudo /opt/lampp/./manager-linux-x64.run // To show the xampp graphical interface
sudo /opt/lampp/lampp start // To start xampp from command line
sudo /opt/lampp/lampp stop // To stop xampp from command line
- If you encounter errors running Xampp for missing tools Run these commands to add the missing libraries required by Xampp
sudo apt install net-tools
sudo apt install libtinfo5
If you did step 4 above, remember to do step 3 to start Xampp
To confirm that Xampp is running, navigate to localhost and see that Xampp is up and running
url: http://localhost
or http://localhost/phpmyadmin
- to see the MySQL database interface
Installation
There are two methods on how to install wordpress on ubuntu linux
Method 1
- Download wordpress from
https://bitnami.com/stack/xampp?utm_source=bitnami&utm_medium=installer&utm_campaign=XAMPP%2BModule
- Go into downloads folder or use the command below to navigate there
cd Downloads
-
Make sure your xampp server is running (Mysql database and apache webserver are running)
-
Give read write permissions to the installer using:
chmod 755 ./bitnami-wordpress-6.0.2-0-module-linux-x64-installer.run
- Run the installer using
sudo ./bitnami-wordpress-6.0.2-0-module-linux-x64-installer.run
-
Complete the installation using the graphical UI that comes up after running the above command
-
Visit
http://localhost/wordpress
to view your installation
https://localhost/wordpress/wp-admin
- To get to the admin side.
- Uninstalling WordPress
cd /opt/lampp/apps/wordpress
sudo ./uninstall
Pros and Cons of this method Pros
- Everything is set for you, no hassle.
- Easy to follow through during the installation.
Cons
-
This method only holds a single INSTANCE of WordPress. Method 2
-
Make sure your xampp server is running (Mysql database and apache webserver are running)
-
Navigate to /opt/lampp/
cd /opt/lampp/
- Give read write execute permissions to the htdocs folder
sudo chmod -R a+rwx htdocs
- Navigate to htdocs
cd htdocs
- Make a wordpress website directory (Its crucial to make a directory that has no spaces as a domain name)
mkdir my-first-website
- Navigate to the directory
cd my-first-website
- Download wordpress zip file
wget http://wordpress.org/latest.tar.gz
- Unzip the tar file in the directory
tar xzvf latest.tar.gz
- Move all the files from the WordPress directory to the main website directory (my-first-website)
sudo mv ./wordpress/* ./
- Navigate to htdocs
cd ..
- Give read write permissions to the website directory
sudo chmod -R g+rw my-first-website
sudo chmod -R a+rwx my-first-website
sudo chown -R www-data:www-data my-first-website
- Open your browser and navigate to the url below to create database and user details for installation
http://localhost/phpmyadmin
- Create a new database using the interface
dbname - myfirstwebsite
username - myfirstwebsite
pass - 5u!h0qQBZiqtFgQM
- Create a new user in the privilleges tab
username: myfirstwebsite
hostname: localhost
password: mypassword
retype pass: mypassword
- Grant all permissions to this user by clicking on
Global privileges
or selecting all privileges shown. - Click
Go
to save the user
- Visit - To Complete the installation now
http://localhost/my-first-website/ - To view the wordpress site
http://localhost/my-first-website/wp-admin - For admin side
- Navigate to htdocs/my-first-website and edit
wp-config.php
Add this afterwp-debug
config - This allows your wordpress admin dashboard to make changes without errors of connection or plugins failing to work properly
define('FS_METHOD', 'direct');
Pros and Cons Pros
- Allows installation of multiple WordPress Instances
Cons
- Requires a lot of manual work to setup
- Time consuming
In conclusion:
Method 1 and 2
can be used in different use cases which fit ones need to use wordpress
I personally prefer method 2 since besides it having about 12 commands to have your site setup, it is also very easy to maintain and update the wordpress instance.
You can use any of the methods above to setup your wordpress instance and start coding locally without the need of an online remote service like cpanel to start developing your wordpress SelectItems.
After you have developed your WordPress site locally, you will need to publish it for your target audience to reach and that is where the next part comes in.
Publishing your WordPress site
- Click on the webhosting link on the navigation menu
- Select your plan and click 'Host Now'
- Select the domain you want to host your site on and click 'Continue'
- Make your payment and your hosting will be setup automatically
- Install 'All in One wp migration plugin' on your local wordpress instance and export your site
- Login to cPanel with the credentials sent to the email you used to register your domain and hosting
- Search for 'Softaculous Apps Installer' and click on it
- Search for 'WordPress' and click on it
- Install a new instance of wordpress and login to the admin dashboard
- Install 'All in One wp migration plugin' on your wordpress instance and import the site you exported from your local wordpress instance
- Your site will be published and you can now access it on the domain you selected during hosting setup
Whooray! ?? you have successfully setup your wordpress site and published it for your target audience to reach. Contact us today if you need help setting up your wordpress site or you need a custom wordpress site developed for your business or personal use.
You might also be interested in

How to Deploy a Django Application to cPanel




