How Install WordPress on Digital Ocean

Make a website on Digital ocean with cloud hosting. So now i tell you how you can easily install WordPress on digital ocean using terminal.

How to Do

  • Make an account on Digital ocean first.
  • Now create a project and create Droplet.
  • When you have successfully created droplet, So now tab on Access then click to Launch Droplet Console.

Lets start MySQL installation using command

Use these command one by one after you login in host using terminal

  1. sudo apt update
    sudo apt upgrade
  2. sudo apt install apache2 mysql-server php php-mysql
  3. sudo mysql_secure_installation
  4. sudo mysql

Create Database for wordpress using command

structure

CREATE DATABASE <your-database>;
CREATE USER ‘<your-user>‘@’localhost’ IDENTIFIED BY ‘<your-password>‘;
GRANT ALL PRIVILEGES ON <your-database>.* TO ‘<your-user>‘@’localhost’;
FLUSH PRIVILEGES;
EXIT;

example

CREATE DATABASE TK_SPL;
CREATE USER ‘TK_SPL123’@’localhost’ IDENTIFIED BY ‘TKSPL@123JaiHo’;
GRANT ALL PRIVILEGES ON TK_SPL.* TO ‘TK_SPL123’@’localhost’;
FLUSH PRIVILEGES;
EXIT;

Now Install WordPress after Database creation on MySql

  1. cd /var/www/html
  2. sudo wget https://wordpress.org/latest.tar.gz
  3. sudo tar -zxvf latest.tar.gz
  4. sudo mv wordpress/* .
  5. sudo rm -rf wordpress latest.tar.gz
  6. sudo mv wp-config-sample.php wp-config.php
  7. sudo nano wp-config.php

Then Replace Database Name, Database Username and Database password

structure

define(‘DB_NAME’, ‘<your-database>‘);
define(‘DB_USER’, ‘<your-user>‘);
define(‘DB_PASSWORD’, ‘<your-password>‘);

example

define(‘DB_NAME’, ‘TK_SPL’);
define(‘DB_USER’, ‘TK_SPL123’);
define(‘DB_PASSWORD’, ‘TKSPL@123JaiHo’);

Set permission and restart server using given command

  1. sudo chown -R www-data:www-data /var/www/html/
  2. sudo chmod -R 755 /var/www/html/
  3. sudo systemctl restart apache2

How you have Done successfully WordPress installation using given command on Apache Server. Thanks for Reading this article.