Skip to content

J-insights

Home » Blog » How to Install wordpress on ubuntu (No Cpanel)

How to Install wordpress on ubuntu (No Cpanel)

In our last tutorial, I showed you how to install WordPress on CyberPanel. Today, you will learn how to Install wordpress on ubuntu on contabo without any control panel. I want you to understand in our last tutorial, where we installed wordpress on cyberpanel, cyberpanel already came with all the server resources and stack needed to run your wordpress website. It came with the LiteSpeed web server, database, etc. So, if you’re aiming for a no-control-panel setup, you’ll also need an environment with a web server, a database, and the programming language for handling dynamic content installed. Now, let’s go into how to Install wordpress on ubuntu proper.

Table of Contents

  1. Introduction
  2. What is the LAMP Stack
  3. Purchasing Requirements
  4. Contabo Server configuration
  5. Configuring rDNS and Domain Mapping.
  6. Installing wordpress on your server
  7. Setting up a Database
  8. Installing SSL certificate via certbot
  9. Conclusion

What is the LAMP Stack

LAMP is an acronym representing a popular open-source web server stack. It stands for Linux (The operating system eg ubuntu), Apache (The web server), MySQL (The database), and PHP/Perl/Python (programming language). This combination provides a powerful and flexible platform for hosting websites and web applications. Lamp is widely used due to its performance, cost-effectiveness, and community support. The components work together, with Linux as the foundation which; in our own case is ubuntu on our VPS, Apache handling web requests, MySQL storing data, and PHP/Perl/Python processing dynamic content. Without the LAMP Stack we will have to install Apache, MySQL and PHP independently will can be way technical and hectic.

By the end, you’ll have WordPress running on an Ubuntu server with a clean setup, ready for customization.

Purchasing Requirements

To Install wordpress on ubuntu, we need two things:

  1. A domain name: You can get on from one from Namecheap.
  2. A Contabo VPS server: You can use any VPS provider of your choice. I Chose contabo because, they offer the best server resources at a very affordable price.

Contabo Server configuration

Vist the VPS Pricing page of Contabo. You can sart with any price of your choice and scale later, but I recommend the ~$14/month plan.

Install wordpress on ubuntu

Go to next page where you wil configure your server Imagery and APPs. Ensure to choose, LAMP on Ubuntu 20.04 upwards. In my case I chose Ubuntu 22.04. Add a strong password to your server.

Install wordpress on ubuntu

Click on Next to login or register and checkout.

Configuring rDNS and Domain Mapping.

On your Contabo dashboard, locate yor PTR record and add your domain name. This is the domain you will use to access your wordpress website.

Next is to perform your domain mapping. This is the process of pointing your domain to your server IP address. This verifies you are the real owner of the domain and allows you access to resources on the VPS.

This is a namecheap Sample domain mapping. Using the basic namcheap DNS, go to Advanced DNS. Select A record, at the host section add @, then at the IP placeholder part add your VPS IP address. Save changes and you are done.

Note: rDNS is technically the oppsite of domain mapping. Domain maps your domain name to your server IP address. rDNS maps your server IP is mapped to your domain name. The both process verifies you are the owner of the domain and the server and allows you to access the server resources using the domain name instead of the server IP.

Installing wordpress on your server

Now, you are all set to install wordpress on your server. let’s see the steps to getting this down quickly.

Step 1: Download the wordpress file.

Go to wordpress.org and download the latest version of wordpress. The file you downloaded is going to be a zip file. Connect to the file system of your VPS. You can use any FTP client of your choice. I recommend you download, install and use termius. I use it alot because, it is both an FTP client and an SSH client. If you use the mac terminal or putty as your ssh client, you will still need to download another ftp client like filezilla; you will use to access your file system. So, I see this as alot of stress. I prefer using termius as I can easily switch between ssh and file system within same application.

Step 2: Uploading the wordpress zip file

Open your termius or any FTP client of your choice and upload the wordpress zip file. Esure you upload it on the following path var/www/html. This is the root of your website. If you found any other file or folder in that directory, delete it. Just for the record, you may find a file named ‘logo’ ensure you delete it. Just delete anything you find in that path and upload your the wordpress file you downloaded from wordpress.org.

Install wordpress on ubuntu

Now un the following commands via ssh:

cd /var/www/html

This navigates you to the path you uploaded your wordpress zip file. To confirm this, run the following command:

ls

You can see the wordpress file below.

install wordpress on ubuntu.

Step 3: Unzipping the wordpress file

The next step we are taking is to unzip your wordpress file and to do it run the following command:

unzip wordpress-6.8.2.zip

makw sure the ‘wordpress-6.8.2.zip‘ is your own wordpress file name. If it is not it won’t work. That said , if all things go well you see ta screen like this:

how to unzip wordpress file on ubuntu.

No go back to the path you uploaded the wordpress file in your file system and refresh. You will see that the file is now unzipped.

now delete the zip file and leave only folder that is unzipped.

now remember that the core wordpress files are inside the ‘wordpress‘ folder. To access wordpress, you have to go to go to yourdomainname.com/wordpress or slash any folder that contains your wordpress file.

Now there is an issue now. we want to access wordpress right at the root of our domain name. We simpy have to move the core wordpress files inside the ‘wordpress‘ folder to the following path var/www/html. To perform this action; run the following command:

sudo mv /var/www/html/wordpress/* /var/www/html/

Now, all contents are now inside the html folder. To delete the now empty ‘wordpress’ folder, right-click on it in your file system and delete or run the following command via SSH:

sudo rmdir /var/www/html/wordpress

Refresh /var/www/html/ directory and you will see wordpress folder has been removed.

Completing Installation in your Browser

Now visit your domain name and you will see the wordpress setup prompt.

wordpress setup installer

You will prompted to fill in the following:

  1. Database name
  2. Database username
  3. Database password
  4. Database host
  5. Table prefix (if you want to run more than one WordPress in a single database)

WordPress is just like other we application that need database to run and store information. Let’s see how to setup database and connect and run wordpress.

Setting up a Database

To create a database you need to login to mySQL (An open-source database software). Remember when you installed LAMP on your VPS MySQL was installed alongside. Run the following command to create a database: 

mysql -u root -p

You will be asked to input your mySQL root password. Supply it. Ensure the dash in the above command is the regular minus sign and not the en dash

Run the following command to create the database:

create database wordpress;

What this does is; it creates a database with the username ‘wordpress‘. Please feel free to use any name of your choice.

Now create a user to access the database:

create user 'wordpress'@'localhost' identified by 'PASSWORD';

What the above command does is to create a user with the name ‘wordpress‘ with a password you will define at the ‘PASSWORD‘ placeholder in the above command.

Note: Input a very strong password by replacing PASSWORD in the command above. Ensure your password is enslosed inside the double apostrophe. Also , understand that every command inside mySQL ends with semi-colon (;).

Now give the database user access to the WordPress database with this command:

GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost';
FLUSH PRIVILEGES;
EXIT;

The above command does the following: Here’s what happens:

  1. GRANT ALL PRIVILEGES...; → gives all privileges to the user.
  2. FLUSH PRIVILEGES; → reloads the privileges so they take effect immediately.
  3. EXIT; → closes the MySQL/MariaDB shell and returns you to your normal terminal.

Now that we have created our databse, go supply it and continue your installation.

Quick Note:

Just in the case, your webservers is not able to write the wp-config.php file automatically during the installation process. If that is the case with you, wordpress won’t automatically create the wp-config.php file for you during installation. It will prompt you to creat the file manually then generate the wp-config.php content for you. All you have to do is to copy the code exactly and create wp-config.php and paste it and save.

To create the the wp-config.php file go to your teminal and run the following command:

sudo nano wp-config.php

It will create and open the file using the Nano editor. Paste the content of the wp-config.php given to you by the installer and save.

To save and exit Nano Save and exit nano.

  • Press COMMAND + S → Enter (to save)
  • Press CTRL + X
  • Y the hit on enter.

The go back and finish up the installation. Add your site title, username, password etc.

Note: Just like I said; you may not face this issue. I just have to walk you through this so that if you face it in any way you can know how to go about it.

That said, their is one issue left, our website is not secured with SSL.

installing SSL certificate on wordpress on ubuntu

Installing SSL certificate via certbot

Securing the internet data, login and data transfer is a huge part of cybersecurity. Ensuring there is SSL Certificate on your website will not only secure you and your user but will give you a higher ranking on google. Here we will run certbot, which lets you generate free Let’s Encrypt certificates that are valid for 90 days. To fetch and install certbot run this command to install Certbot:

apt install certbot python3-certbot-apache -y 

After the installation Certbot, start certbot with this command:

certbot --apache 

Note: that when you start the program for the first time, you’ll need to agree to some license terms & conditions (choose Y in all prompt). 

You should see a list to define site you want certificate to be installed. If you have more than one domain, just list them with comma separating them.

install ssl certificate on wordpress.

So, this is how to Install wordpress on ubuntu manually and run your website. You have to be really proud of yourself for how far you have come. I know even if you are not. atechnical person, you must have learned one or two things. Remember you are not alone. If you have any question or issue, let me know in the comment section or open a question in the forum.

Leave a Reply

Your email address will not be published. Required fields are marked *

Enjoy Solid server resources at affordable price with Contabo
This is default text for notification bar