Live Software Developer Ltd Logo
HomeServicesWeb HostingDomainsEmail HostingArticlesContact UsAbout Us

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

Created On:
Mon Jul 24 2023 (10:10:05 AM)
Updated On:
Mon Jul 24 2023 (10:10:05 AM)
This article provides a step-by-step guide on how to set up and run WordPress or multiple instances of WordPress on a Linux distribution like Ubuntu. Whether you're a seasoned developer or just starting with WordPress, this guide will help you get up and running quickly and easily. From installing the necessary packages to configuring Apache, MySQL, and PHP, we'll walk you through the entire process.

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

  1. 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
  1. 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
  1. 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
  1. 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

  1. Download wordpress from
https://bitnami.com/stack/xampp?utm_source=bitnami&utm_medium=installer&utm_campaign=XAMPP%2BModule
  1. Go into downloads folder or use the command below to navigate there
cd Downloads
  1. Make sure your xampp server is running (Mysql database and apache webserver are running)

  2. Give read write permissions to the installer using:

chmod 755 ./bitnami-wordpress-6.0.2-0-module-linux-x64-installer.run
  1. Run the installer using
sudo ./bitnami-wordpress-6.0.2-0-module-linux-x64-installer.run
  1. Complete the installation using the graphical UI that comes up after running the above command

  2. Visit http://localhost/wordpress to view your installation

  • https://localhost/wordpress/wp-admin - To get to the admin side.
  1. Uninstalling WordPress
cd /opt/lampp/apps/wordpress
sudo ./uninstall

Pros and Cons of this method Pros

  1. Everything is set for you, no hassle.
  2. Easy to follow through during the installation.

Cons

  1. This method only holds a single INSTANCE of WordPress. Method 2

  2. Make sure your xampp server is running (Mysql database and apache webserver are running)

  3. Navigate to /opt/lampp/

cd /opt/lampp/
  1. Give read write execute permissions to the htdocs folder
sudo chmod -R a+rwx htdocs
  1. Navigate to htdocs
cd htdocs
  1. Make a wordpress website directory (Its crucial to make a directory that has no spaces as a domain name)
mkdir my-first-website
  1. Navigate to the directory
cd my-first-website
  1. Download wordpress zip file
wget http://wordpress.org/latest.tar.gz
  1. Unzip the tar file in the directory
tar xzvf latest.tar.gz
  1. Move all the files from the WordPress directory to the main website directory (my-first-website)
sudo mv ./wordpress/* ./
  1. Navigate to htdocs
cd ..
  1. 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
  1. Open your browser and navigate to the url below to create database and user details for installation
http://localhost/phpmyadmin
  1. Create a new database using the interface
dbname - myfirstwebsite
username - myfirstwebsite
pass - 5u!h0qQBZiqtFgQM
  1. 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
  1. 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
  1. Navigate to htdocs/my-first-website and edit wp-config.php Add this after wp-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

  1. Allows installation of multiple WordPress Instances

Cons

  1. Requires a lot of manual work to setup
  2. 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

  1. Click on the webhosting link on the navigation menu
  2. Select your plan and click 'Host Now'
  3. Select the domain you want to host your site on and click 'Continue'
  4. Make your payment and your hosting will be setup automatically
  5. Install 'All in One wp migration plugin' on your local wordpress instance and export your site
  6. Login to cPanel with the credentials sent to the email you used to register your domain and hosting
  7. Search for 'Softaculous Apps Installer' and click on it
  8. Search for 'WordPress' and click on it
  9. Install a new instance of wordpress and login to the admin dashboard
  10. Install 'All in One wp migration plugin' on your wordpress instance and import the site you exported from your local wordpress instance
  11. 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.