Menu

How to Install WordPress in Ubuntu

3 years ago 3

Here is a quick tutorial on how to install WordPress in Ubuntu Server, of course we could just install it with a simple

sudo apt-get install wordpress

but where is the fun in that.

We will be installing all the dependecies and setting up the database.

Note

This time we will install Apache2, PHP, the PHP MYSQL Module, MYSQL Server, and WordPress

Install

Step 1
Connect to your server via SSH

ssh [email protected]

Step 2 We install all the dependencies

Apache Web Server

sudo apt-get install apache2

PHP

sudo apt-get install php5

MYSQL Server

sudo apt-get install mysql-server

Enter the Mysql password for the root user. Note: For security make this one different than your server’s password, and try not to use this user in any application that requires a database to store and pull data from.
PHP Mysql Module

sudo apt-get install php5-mysql

Step 3

Now We Download and Extract WordPress.

wget https://wordpress.org/latest.zip

We remove the default Apache webpage

 sudo rm -rf /var/www/html/*

Now we extract WordPress to /var/www/html

 sudo unzip latest.zip -d /var/www/html/

Step 4

Now we will configure Apache to use /var/www/html/wordpress/ as the root folder

sudo nano /etc/apache2/sites-enabled/000-default.conf

We will edit the next thing:

 # Change From:
 DocumentRoot /var/www/html/
 # TO
 DocumentRoot /var/www/html/wordpress/

save and close the file with Control +X.

Restart Apache

 sudo service apache2 restart

And Now We give Apache ownership of the files

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

Step 5

Now we will setup the database

We need to create the database and user for WordPress
(Use Password From Earlier)

mysql -u root -p

Once We Log in

CREATE DATABASE wordpress; CREATE USER [email protected] IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON wordpress.* TO [email protected];

FLUSH PRIVILEGES;

exit

Step 6

Now We point the Browses To your Server’s IP and continue with the WordPress installer instructions.

Use the values from earlier

That’s all enjoy your wordpress site.