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
- sudo apt update
sudo apt upgrade - sudo apt install apache2 mysql-server php php-mysql
- sudo mysql_secure_installation
- 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 –
- cd /var/www/html
- sudo wget https://wordpress.org/latest.tar.gz
- sudo tar -zxvf latest.tar.gz
- sudo mv wordpress/* .
- sudo rm -rf wordpress latest.tar.gz
- sudo mv wp-config-sample.php wp-config.php
- 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 –
- sudo chown -R www-data:www-data /var/www/html/
- sudo chmod -R 755 /var/www/html/
- sudo systemctl restart apache2
How you have Done successfully WordPress installation using given command on Apache Server. Thanks for Reading this article.