Instructions to install Wordpress by Linux command from A - Z vs any Cloud

Follow the instructions below to install WordPress on Ubuntu 18.04 server with LEMP Stack (Nginx, MariaDB, PHP) and Let Encrypt's free SSL (HTTPS) certificate.

Instruction steps:

WordPress on Ubuntu - Required

Let's start with the requirements. You do not need much.

  • An Ubuntu 18.04 server. You can buy one for $ 5 (1GB RAM) at Vultr. You can directly deploy Ubuntu 18.04 at Vultr when writing this tutorial, you don't have to upgrade from 16.04.
  • You need root access to the server. You have root access with Vultr and other unmanaged cloud storage providers. Note that some managed VPS providers will not give you root access to the server, but they will anyway install WordPress for you. All of the following commands should be executed by the root user or with sudo.
  • A LEMP stack (Linux, Nginx, MariaDB, PHP). We will show you how to install this stack below.
  • An SSH client so you can connect to your server.
  • WordPress itself does not have any special requirements. We recommend using at least 1GB of RAM. If your site is smaller and has fewer visitors, you may receive less.

Before we continue, these instructions are for people who plan to install and manage a WordPress server. If you don't know how to manage servers, manage WordPress hosting and skip this guide.

Read more: Create WordPress automatically on the Cloud with EasyEngine or WordOps (you just need to sit in a sip of coffee)

How to install WordPress with Nginx, MariaDB, PHP 7.2 and free SSL on Ubuntu 18.04

The instructions below will work on other versions of Ubuntu, including 16.04 and 14.04, but they were written specifically for April 18.

1. Update the server

Before doing anything, you should update the server and its packages with the following commands:

apt-get update && apt-get upgrade -y

2. Install Nginx

To install Nginx on Ubuntu 18.04, run the following command:

apt-get install nginx -y

Check if Nginx is installed with:

nginx -v

Which will give you an output similar to this:

nginx version: nginx/1.14.0 (Ubuntu)

If you use a firewall, you will need additional rules to allow Nginx.

3. Install MariaDB

MariaDB is quite similar to MySQL, so don't be confused with this name. To install MariaDB, run the following command:

apt-get install mariadb-server -y

To check if it has been installed, log into your MariaDB server by running:


If you can login, it is already installed. You will receive the specific version of MariaDB you are running in the welcome message:

Server version: 10.1.29-MariaDB-6 Ubuntu 18.04

Exit the database server by running:


You should run the following code to secure and configure your database server:


And follow the prompts. Use a strong password. You can enter Y (default) for all reminders.

4. Install PHP

Ubuntu 18.04 uses PHP 7.2, so make sure the plugins you plan to use will work well with PHP 7.2.

To install PHP with all the necessary dependencies and modules, run the following commands:

apt-get install php-fpm php-curl php-mysql php-gd php-mbstring php-xml php-xmlrpc -y

Check if PHP is installed with:

php -v

Which will give you an output similar to this:

PHP 7.2.3-1ubuntu1 (cli) (built: Mar 14 2018 22:03:58) ( NTS )

LEMP Stack is installed. Continue.

5. Configure PHP

First, start by editing the php.ini file.

We will use the Nano text editor (easiest for beginners). After you edit something with Nano, press CTRL + X, then Y and press enter to save the changes. You can search for files with CTRL + W version.

So open the file:

nano /etc/php/7.2/fpm/php.ini

And search for this line:


Uncomment by removing; and update to 0:


Find all the following lines in the php.ini file and update them accordingly:

upload_max_filesize = 500M
post_max_size = 2000M
memory_limit = 2000M
max_execution_time = 120

You can use different values ​​depending on your server.

6. Create the database

First, log into the MariaDB server with the password you previously set:

mysql -u root -p

And create your WordPress database by running the following commands:

CREATE USER wpuser@localhost IDENTIFIED BY 'EnterStrongPassword';
GRANT ALL ON wordpress.* TO wpuser@localhost;

With these commands, you will create the database and the user and authorize the user. You can use your own names instead of these. Remember to use a strong password.

7. Download WordPress

Start by navigating to the directory in which you want to download WordPress. We will use Nginx's default directory:

cd /var/www/html

And download the latest version:


Extract the archive in the directory you are currently in:

tar -zxvf latest.tar.gz --strip-components=1

Delete an archive:

rm -f latest.tar.gz

And update permissions:

chown -R www-data:www-data /var/www/html/
chmod -R 755 /var/www/html/

8. Configuring Nginx

First, create the Nginx configuration file:

nano /etc/nginx/sites-available/

And paste the following (after updating into your domain)

server {
listen 80;
listen (: :): 80;
root / var / www / html;
index index.php index.html index.htm;

client_max_body_size 500M;

location / {
try_files $ uri $ uri / /index.php?$args;

location = /favicon.ico {
log_not_found off;
access_log off;

location ~ * . (js | css | png | jpg | jpeg | gif | ico) $ {
expires max;
log_not_found off;

location = /robots.txt {
allow all;
log_not_found off;
access_log off;

location ~ .php $ {
include snippets / fastcgi-php.conf;
fastcgi_pass unix: /var/run/php/php7.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
include fastcgi_params;

And activate the configuration file:

 ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/

Disable the default configuration file if you are not using it:

rm -f /etc/nginx/sites-enabled/default

Run the following command to check and see if everything is fine with Nginx:

nginx -t

Now restart Nginx and PHP-FPM for the changes to take effect

systemctl restart nginx.service
systemctl restart php7.2-fpm.service

9. Configure WordPress

There is a default wp-config file that we need to edit. So first rename the file:

mv /var/www/html/wp-config-sample.php /var/www/html/wp-config.php

Open it:

nano /var/www/html/wp-config.php

And update the following lines with your database information:

define('DB_NAME', 'wordpress');
define('DB_USER', 'wpuser');
define('DB_PASSWORD', 'EnterYourDatabasePassword');

Save and close the file.

For security reasons, you should update the security keys in your wp-config file.

First, on here to create them.

Reopen the wp-config.php file:

nano /var/www/html/wp-config.php

And update the following lines with the ones you created:

define('AUTH_KEY', 'put your unique phrase here');
define('SECURE_AUTH_KEY', 'put your unique phrase here');
define('LOGGED_IN_KEY', 'put your unique phrase here');
define('NONCE_KEY', 'put your unique phrase here');
define('AUTH_SALT', 'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT', 'put your unique phrase here');
define('NONCE_SALT', 'put your unique phrase here');

Save and close the file.

You can get it done here if you don't plan to use HTTPS, but we'll show you how to set up a free SSL certificate from Let Encrypt.

10. Install and configure a free SSL certificate (HTTPS)

We will use Let Encrypt and certbot for automatic installation and configuration.

First, install certbot:

apt-get install python-certbot-nginx -y

Then install the certificate for your domain:

certbot --nginx -m (email protected) -d -d

At the prompt, agree to the Terms and Conditions by entering a game and then optionally registering to ETF to life.

IMPORTANT: The certbot will ask if you redirect all traffic to HTTPS (option 2) or not (option 1), you need to select option 2. So enter 2.

Certbot will automatically update your Nginx configuration file. Let Encrypt certificates exist for 90 days by default. You will be notified before it expires, so you can renew.

To manually renew your certificate, run:

certbot renew

To automatically update your certificate, set up recurring jobs by running:

crontab -e

And add the following line:

0 1 * * * /usr/bin/certbot renew & > /dev/null

Which will automatically renew your certificate every 30 days.

11. Complete the installation of WordPress

Navigate to and follow the steps to complete installing WordPress.

First, you will need to choose a language.

You will then need to enter the site information such as title, username, password, etc.

Click on ‘Install WordPress’ and that's it! You are done. You have successfully installed WordPress on Ubuntu 18.04 with Nginx, PHP 7.2, MariaDB and Let Encrypt SSL (HTTPS).

What to do next after installing WordPress on Ubuntu

Here is what you should do next:

  • You are using an Ubuntu server, so you will need to consider securing and optimizing your server. There are lots of online tutorials with step-by-step guides for beginners on how to secure your Ubuntu server. So follow them up.
  • You also need to update your server or get a Linux server management package
  • You should also set up some kind of caching. There are many options out there, so choose what works best for your site and server. Redis cache is quite easy to install on Ubuntu and WordPress. Not recommended for beginners.
  • Optimize services running on your server - including the LEMP stack. Again, lots of tutorials online.

Frequently asked questions and install WordPress

Some frequently asked questions (with answers!) And common issues related to installing WordPress on Ubuntu:

Do I have to use HTTPS?

No, but it is definitely recommended because it's free and easy to install anyway. If you do not plan to use an SSL certificate, you can skip to step 10.

I got an error Error establishing database connection Error

It can be caused by many things, but most likely it's an error in your wp-config.php file. Make sure you are using the right information (user, password, etc.)

Where is the .htaccess file?

We used Nginx so there was no .htaccess file. This can be confusing for beginners as many tutorials include instructions for Apache by default. Nginx .htaccess files, which are / etc / nginx / sites-av Available /, you created earlier. Note that you cannot use the same .htaccess code in your Nginx configuration file.

Can I install the control panel?

Better not. You have installed everything manually. Anyway, you don't need it. If you plan to use the control panel, it is better to start new and completely not follow this guide.

Why should I install WordPress on my own when the server provides pre-installation or with the 1-click installer?

It gives you more control over everything. You decide what you use and how you use it. There's always an option to just need WordPress cloud storage without having to install or do anything yourself, but what's the fun in it? 🙂

Can I use a tool like EasyEngine?

Sure you can! And the process is easier - you'll install everything in this guide (and more) with a single command if you use a tool like EasyEngine or Centmin Mod.

I cannot install WordPress myself! Can you help me?

Feel free to leave a comment below if you are stuck somewhere. If you want the extended work to be done on your server then you can contact us here.

Any more questions? Comment below.

Follow our guide and make sure you read everything. If you have any questions or have any errors, please comment below.


seo marketing wordpress seo seo hosting seo and marketing word press seo wordpress and seo wordpress marketing hosting seo seo press pro market seo seo & marketing seo e marketing e marketing seo seo pro wordpress marketing & seo seo di wordpress wordpress seo host hosting and seo wordpress hosting seo wordpress seo wordpress wordpress for marketing seo press wordpress marketing for seo