How To Install WordPress on Contabo VPS (WITHOUT cPanel)

 

In this Guide, I will show you how to Install WordPress on Contabo VPS server with LAMP without using cPanel or Webmin. In this way, you can save cPanel monthly costs and Webmin Resources that are not required.


WordPress is the most popular CMS (content management system) on the internet. It allows you to easily set up flexible blogs and websites.


Why and What is Contabo VPS?

Since WordPress is a Web Application, then obviously it must be hosted somewhere publicly. What do we mean by hosting?


Hosting a website or a web application simply means uploading the files and database into a public server so it can be accessibly Online over the internet.



Install WordPress on Contabo

Hosting Options.

Now when you want to host a web application (WordPress in our scenario), you have mainly 2 options:


Shared Hosting:

Which means publishing your website on hosting services like Godaddy, Bluehost, Hostinger… where your website will be hosted with hundreds of other websites on the same server.


VPS Hosting

In this setup, you will host your website on your own server, so you will have a server only for you! which is called a VPS or a Virtual Private Server.


Which one is better?

I don't want to go in depth now and explain technical stuff, but in few works, VPS is Definitely better where you will have your own server with full manageability and better performance.


And if you think that shred hosting is a lot cheaper, then you are wrong, as with Contabo VPS services you can start with a 3.99 € per month Only which is the same pricing for almost 90% of shared hosting services.


Maybe the only drawback here, is that it requires some more technical skills to set up and configure, but fortunately, you are here in the step-by-step guide, where you will see how things will go really easy!


Install WordPress on Contabo: Let's Start!

So now we are ready to Install WordPress on Contabo VPS.


Just one tiny note: there are a lot of VPS companies other than Contabo, and I already created tutorials on how to install WordPress on. example Digital Ocean.


You can check the Full Tutorial here.


Anyway, Let's Start our work!


Get a Domain Name.

Getting a Domain is as simple as eating a piece of chocolate cake. you need to go to any Domain registrar company like Godaddy, Enom, Freenom, Namecheap…. and Buy a Domain Name, you can even get one for 1$ per year.


I do recommend to get a .com domain that reflects your business. and if you already have one, as I think so, you can just skip this, and continue to get a VPS Server.


Watch this 3 Minutes Video and see how to get and buy a domain name from Godaddy:



This video is part of my Top Rated Course On Udemy:

Build Your Own SMTP and Send Unlimited Emails

Get a VPS Server From Contabo.

1: Open Contabo Website.

Open your web browser and navigate to Contabo VPS Page.



Install WordPress on Contabo VPS

You will see multiple VPS configuration to start with. You can simply start with the cheapest option to Install WordPress, it will be more than enough.


Later on, when you grow your business, you can scale up and get a more powerful VPS with Higher resources.


2: Set VPS Options

On the Next Page, you will need to select some options


In the Operating System Option, Select Ubuntu 18.04



Install WordPress on Contabo VPS Ubuntu

Select Ubuntu 18.04

Then in the Administration Panel, Select LAMP



Install WordPress on Contabo VPS LAMP

SELECT LAMP

And last option, In the Addons, check “Individual reverse DNS”



Install WordPress on Contabo VPS 

Add PTR

If you were promoted to enter the PTR record, enter your domain name, and That's it.


Now, Just Continue to the billing page, and confirm your order. I think other steps are simple and self explanatory.


In like 24 hours, Contabo Team will setup the Server and send the details to your email like this:



Install WordPress on Contabo VPS 

Login Info

Great! You Got Your Server. 



Map Domain Name to your VPS Server.

Ok Friend, Now we have a Domain and a VPS Server. But they are not connected!


Your VPS Server can be accessed now through the IP address that Contabo Team sent you by email. but of course, we don't want to access our WordPress website though an IP! we want to use our domain name.


So simply, we are going to map the domain name to our VPS IP, so then we access the VPS and the WordPress website through both the domain and the IP.


Configure your DNS Records:

Simply open DNS management zone in your Domain Provider (Godaddy in my case) and edit the main  A record like this:


host: @ points: YOUR SERVER IP.



map domain to vps

Done? Great! 



Install WordPress on VPS.

Now our server is ready for the installation! You see, it's not that complicated


😀


Let's Connect to our server to start our work.


Connect to your VPS server using any SSH client like putty. and Let's start!




Just open Putty and enter the Server IP or Name, and Press Open.


It will ask you to login, just enter “root” as the user, then enter your password which is sent to you by email.


Note: while typing the password, putty will now show it for security reasons, but It's there, just type it!



install wordpress on contabo

Login with putty

And you are In! 



Step 1 – Creating a MySQL Database and User for WordPress

WordPress uses MySQL to manage and store site and user information. We have MySQL installed already as part of the LAMP Stack, but we need to make a database and a user for WordPress to use.


To get started, log into the MySQL root (administrative) account by issuing this command:


mysql -u root -p

You will be prompted for the root password, just write or paste it and press Enter.


First, create a separate database that WordPress will control. You can call this whatever you would like, but we will be using wordpress in this guide to keep it simple. Create the database for WordPress by running this command:


CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Note: Every MySQL statement must end in a semi-colon (;)


Next, we are going to create a separate MySQL user account that we will use exclusively to operate on our new database. Creating one-function databases and accounts is a good idea from a management and security standpoint. We will use the name wordpressuser in this guide. Feel free to change this if you’d like.


We are going to create this account, set a password, and grant access to the database we created. We can do this by typing the following command. Remember to choose a strong password here for your database user:


CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'Enter_Your_Password_Here';

GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'enter_a_custom_password_here';

You now have a database and user account, each made specifically for WordPress. We need to flush the privileges so that the current instance of MySQL knows about the recent changes we’ve made:


FLUSH PRIVILEGES;

Exit out of MySQL by typing:


EXIT;

Done! 



Step 2 – Installing Additional PHP Extensions.

WordPress and many of its plugins leverage additional PHP extensions.


We can download and install some of the most popular PHP extensions for use with WordPress by typing:


sudo apt update

Then:


sudo apt install php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip

We will restart the Apache web service to load these new extensions in the next section. If you are returning here to install additional plugins, you can restart Apache now by typing:


sudo systemctl restart apache2

Step 4 – Downloading WordPress

Now that our server software is configured, we can download and set up WordPress. For security reasons, in particular, it is always recommended to get the latest version of WordPress from their site.


change the current directory to /html by running the following command:


cd /var/www/html

The Download WordPress Files:


curl -O https://wordpress.org/latest.tar.gz

Extract the compressed file to create the WordPress directory structure:


tar xzvf latest.tar.gz

So now we have WordPress Downlaoded, our server is configured, we need to attach thins together.


Since here there are some several tiny tasks to do, I felt that it's better to show you this in a small video, and all commands used in the video will be attached here in the guide, so please just follow up!



Check Also: How to host a PHP script online in 10 minutes? example: Xerochat from Codecanyon


Step 5 – Adjusting Apache’s Configuration

Well Done, Now WordPress is installed, we just need to configure apache so we can access our website using our domain name. To do so, open WinSCP (mentioned in the video) again and navigate to this directory: /etc/apache2/sites-available/


Now, create a new empty file and name it “domain.conf” (Change “domain” to your domain)


Open domain.conf Then copy and paste the content below into the file and save.


<VirtualHost *:80>

     ServerAdmin admin@domain

     DocumentRoot /var/www/html/

     ServerName domain

     ServerAlias domain

     <Directory /var/www/html/>

        Options +FollowSymlinks

        AllowOverride All

        Require all granted

     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log

     CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

IMPORTANT: replace “domain” with your domain


Enable configuration in apache and restart the service.

Now simply, run the following commands to finish the setup:


sudo a2ensite domain.conf

sudo a2enmod rewrite

sudo systemctl restart apache2.service 

GREAT! You are almost done 


😀


Step 6 – Configuring the WordPress Directory

Before we open WordPress in browser and finish the installation, we need to adjust some items in our WordPress directory.


Adjusting the Ownership and Permissions

One of the big things we need to accomplish is setting up reasonable file permissions and ownership.


We’ll start by giving ownership of all the files to the www-data user and group. This is the user that the Apache webserver runs as, and Apache will need to be able to read and write WordPress files in order to serve the website and perform automatic updates.


Update the ownership with chown:


sudo chown -R www-data:www-data /var/www/html

Next we will run two find commands to set the correct permissions on the WordPress directories and files:


sudo find /var/www/html/ -type d -exec chmod 750 {} \;

sudo find /var/www/html/ -type f -exec chmod 640 {} \;

These should be reasonable permission set to start with. Some plugins and procedures might require additional tweaks.


Setting up the WordPress Configuration File

Now, we need to make some changes to the main WordPress configuration file (wp-config mentioned in the video above)


When we open the file, our first order of business will be to adjust some secret keys to provide some security for our installation. WordPress provides a secure generator for these values so that you do not have to try to come up with good values on your own. These are only used internally, so it won’t hurt usability to have complex, secure values here.


To grab secure values from the WordPress secret key generator, type in putty:


curl -s https://api.wordpress.org/secret-key/1.1/salt/

You will get back unique values that look something like this:


Outputdefine('AUTH_KEY',         '1jl/vqfs<XhdXoAPz9 DO NOT COPY THESE VALUES c_j{iwqD^<+c9.k<J@4H');

define('SECURE_AUTH_KEY',  'E2N-h2]Dcvp+aS/p7X DO NOT COPY THESE VALUES {Ka(f;rv?Pxf})CgLi-3');

define('LOGGED_IN_KEY',    'W(50,{W^,OPB%PB<JF DO NOT COPY THESE VALUES 2;y&,2m%3]R6DUth[;88');

define('NONCE_KEY',        'll,4UC)7ua+8<!4VM+ DO NOT COPY THESE VALUES #`DXF+[$atzM7 o^-C7g');

define('AUTH_SALT',        'koMrurzOA+|L_lG}kf DO NOT COPY THESE VALUES  07VC*Lj*lD&?3w!BT#-');

define('SECURE_AUTH_SALT', 'p32*p,]z%LZ+pAu:VY DO NOT COPY THESE VALUES C-?y+K0DK_+F|0h{!_xY');

define('LOGGED_IN_SALT',   'i^/G2W7!-1H2OQ+t$3 DO NOT COPY THESE VALUES t6**bRVFSD[Hi])-qS`|');

define('NONCE_SALT',       'Q6]U:K?j4L%Z]}h^q7 DO NOT COPY THESE VALUES 1% ^qUswWgn+6&xqHN&%');

These are configuration lines that we can paste directly in our configuration file to set secure keys. Copy the output you received now.


Now, open the WordPress configuration file with WinSCP and replace the lines like in the image below:



install wordpress on contabo

Step 7 (last step)– Completing the Installation Through the Web Interface.




Now that the server configuration is complete, we can complete the installation through the web interface.


In your web browser, navigate to your server’s domain name or public IP address:


http://server_domain

Select the language you would like to use:



install wordpress on contabo

Great! This is WordPress Installed and ready on Your Contabo VPS!


Feel free to ask any question in the comments section.