How to install Wordpress on VPS Ubuntu 18.04

listen My
3 min readJun 20, 2020
  1. Install WordPress on VPS Ubuntu

1.1 Install Apache Web Server

sudo apt-get install apache2
sudo service apache2 start

Change to another port if PORT 80 is using by another program

sudo vim /etc/apache2/ports.conf

When done, try to access your server by

http://your-ip-serve

1.2 Install mySql

sudo apt-get install mysql-client mysql-server

Configure mySql

sudo mysql_secure_installation
CREATE DATABASE db_name;
GRANT ALL PRIVILEGES ON db_name.* TO 'db_user'@'localhost' IDENTIFIED BY 'db_user_password';
FLUSH PRIVILEGES;
EXIT;

add a new user and password to the database.

1.3 Install PHP

sudo apt install php7.2-cli php7.2-fpm php7.2-mysql php7.2-json php7.2-opcache php7.2-mbstring php7.2-xml php7.2-gd php7.2-curl

Create test.php in /var/www/html

<?php
echo "This is a test";
?>

Save this file and access to URL: http://your-ip-server:PORT/test.php

If you see this:

PHP is running

2. Download WordPress

3. upload to host

We can use FileZilla: https://filezilla-project.org/download.php?type=client
to upload

Copy all file to Apache Server and provide permission for this folder

sudo cp -R wordpress/* /var/www/html/
sudo chmod -R 755 /var/www/html/
sudo chown -R www-data:www-data /var/www/html/

4. Install the WordPress Database

sudo mysqlCREATE DATABASE db_name;
GRANT ALL PRIVILEGES ON db_name.* TO 'db_user'@'localhost' IDENTIFIED BY 'db_user_password';
FLUSH PRIVILEGES;
EXIT;

Notes: change db_name , db_user db_user_password

Rename wp-config-sample.php to wp-config.php

sudo mv wp-config-sample.php wp-config.php

Update wp-config.php file

sudo vim wp-config.php

Restart Apache and MySql

sudo service apache2 restart 
sudo service mysql restart

access to URL: http://your-ip-server:PORT/index.php

Install successfully

--

--