A Step-By-Step Guide For Setting Up WordPress On A VPS Without A Domain Name

Do you want to setup a WordPress site, but don’t own a domain name? Well you came to the right place. This article will discuss how to setup a WordPress on a VPS without a domain name just using an IP address.

For this article, I will assume you have a static IP address which only you have access to, and that your IP address for your VPS is 123.456.789.0. You will obviously need to modify the IP address with your own VPS’s IP address. Also, this article assumes that your VPS runs on Debian or Ubuntu, but the steps will be fairly similar in other Linux distros.

Step 1: Install MySQL

You need to use a database software in order to use WordPress, and MySQL is the recommended software to do so. You will need to install the server and client versions of the software. Type:
sudo apt-get install mysql-server mysql-client

(note, mariadb is a fork of mysql, and is increasingly becoming more and more popular. You can substitute mariadb for mysql in the above install line if you want.)

Follow the prompts, and decide on the root password for MySQL when it asks for one. After it is installed, then we can create the database and username.

Step 2: Create A New Database And Username To Go Along With Our WordPress Installation

After installing mysql (or mariadb), you will need to actually create the specific database, username, and password for the username that you will use with your WordPress installation.

**For these MySQL steps it is extremely important to be very precise, otherwise WordPress might not work properly like for example if there is a typo in your MySQL commands.

First, you will need to run the MySQL command and then create a new database. For the following step, type in the root password that you setup with MySQL.

#log into mysql
mysql -u root -p

#create mysql database
The following command creates the database. We want to use UTF-8 encoding when creating the database.
CREATE DATABASE exampledotcomdatabase CHARACTER SET utf8;

Next, after entering the above line, you should see output like:

Query OK, 1 row affected (0.00 sec)

#Now exit MySQL


For the above command, I assumed our database name is exampledotcomdatabase. You can call your database whatever you want, so modify the name exampledotcomdatabase however you like.

We exited mysql after creating the database just to make sure we did everything correctly.

#Log back into mysql
mysql -u root -p

#Next, make sure that our database was created properly
In mysql type:
show databases;

You should see output like:

| Database              |
| exampledotcomdatabase |
| information_schema    |
| mysql                 |
| performance_schema    |

If your database that you created comes up in the output of the previous command, you know you created the database correctly.

#Next, create a username for our database along with a password it
I am going to assume we will choose a username exampleusername and have its password be abcdefg12345. You can modify the username and password however you like.

#type the following commands to create a username and password
CREATE USER 'exampleusername'@'localhost' IDENTIFIED BY 'abcdefg12345';
GRANT ALL PRIVILEGES ON exampledotcomdatabase . * TO 'exampleusername'@'localhost';

If you want to check that you created a username called exampleusername, you can type this command after logging back into mysql:

SELECT User FROM mysql.user;

You should see output something like:

| User |
| root |
| root |
| root |
| debian-sys-maint |
| exampleusername |
| root |

If you see your username, you probably created the username properly.

#If you know or think you created an error with creating the database or an error with creating the username, you can easily undo the steps and then redo them.

#This is how to delete your database (only use if you think there is an error)
#mysql -u root -p
#drop database exampledotcomdatabase;

#This is how to delete the username you made to go along with your database (only use if you think there is an error)
#DROP USER ‘exampleusername’@’localhost’;

If you delete the database, make sure to recreate it with the steps above. Likewise, if you delete your username, make sure to re-create the same username or a different one because you need this with WordPress.

Step 3: Install WordPress Prerequisites

In addition to mysql, you also need to install php, and a few other softwares for WordPress to work. The most convenient way to do so is by simply typing:
sudo apt-get install wordpress
This will automatically install any WordPress software you need without having to lookup all of the prerequisite WordPress software names.

If you do sudo apt-get install wordpress, it will install the following software:

libapache2-mod-php5 libjs-cropper libjs-mediaelement libjs-prototype
libjs-scriptaculous libonig2 libphp-phpmailer libqdbm14 php-getid3 php5-cli
php5-common php5-gd php5-json php5-mysql php5-readline vorbis-tools
wordpress wordpress-l10n wordpress-theme-twentyfifteen

If wordpress isn’t a software available for you to install, you can just install php5, php5-mysql, libapache2-mod-php5, and that should install all necessary dependencies in Debian and Ubuntu.

Step 4: Setup Firewall To Allow Port 80

In order for our site to work, we need to make sure that the correct port is open, otherwise we won’t be able to access the WordPress site.

I will assume that you use ufw firewall. Modify this step if you use a different firewall.

Port 80 is the port that HTTP uses. We need to make sure port 80 is open.
sudo ufw allow 80

After you know that port 80 is open, we will then install our web server.

Step 5: Install Apache Web Server

Apache is the most popular web server for using WordPress. It will be the software that actually serves pages to users for your WordPress site. Without a web server, WordPress will not work.

Install Apache as follows:
sudo apt-get install apache2

After you have installed Apache, we need to make sure it is working properly. Open up a web browser and go to the IP address of your VPS. Remember that I assumed that the IP address for your VPS is 123.456.789.0
Go to the IP address of your VPS in a browser like:

Your IP address will obviously be different. The point here is to make sure that Apache was setup properly. If you see a message like, “It works!” along with lots of technical information, you know we have setup Apache correctly (but haven’t yet setup Apache to use our domain name.)

See picture below for an example of what you should see when you type your IP address into the address bar of your browser.

This article is continued on the next page.

2 thoughts on “A Step-By-Step Guide For Setting Up WordPress On A VPS Without A Domain Name”

Leave a Reply

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