Thursday, 3 April 2014

How To Install Wordpress on Ubuntu

How To Install Wordpress on Ubuntu

Step One—Download WordPress

We can download Wordpress straight from their website:

# wget

This command will download the zipped wordpress package straight to your user's home directory. You can unzip it the the next line:

# tar -xzvf latest.tar.gz

Step Two—Create the WordPress Database and User

After we unzip the wordpress files, they will be in a directory called wordpress in the home directory. 

Now we need to switch gears for a moment and create a new MySQL directory for wordpress. 

Go ahead and log into the MySQL Shell:

# mysql -u root -p

First, let's make the database (I'm calling mine wordpress for simplicity's sake; feel free to give it whatever name you choose):

mysql > CREATE DATABASE wordpress;
Query OK, 1 row affected (0.00 sec)

Then we need to create the new user. You can replace the database, name, and password, with whatever you prefer:

mysql > CREATE USER wordpressuser@localhost;
Query OK, 0 rows affected (0.00 sec)

Set the password for your new user:

mysql > SET PASSWORD FOR wordpressuser@localhost=PASSWORD("password");
Query OK, 0 rows affected (0.00 sec)

Finish up by granting all privileges to the new user. Without this command, the wordpress installer will not be able to start up:

mysql > GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)

Then refresh MySQL:

Query OK, 0 rows affected (0.00 sec)

Exit out of the MySQL shell:
mysql > exit

Step Three—Setup the WordPress Configuration

The first step to is to copy the sample wordpress configuration file, located in the wordpress directory, into a new file which we will edit, creating a new usable wordpress config:

# cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php

Then open the wordpress config:

# nano ~/wordpress/wp-config.php

Find the section that contains the field below and substitute in the correct name for your database, username, and password:

Step Four—Copy the Files

We are almost done uploading Wordpress to the virtual private server. The final move that remains is to transfer the unzipped WordPress files to the website's root directory.

# rsync -avP ~/wordpress/ /var/www/

No comments:

Post a Comment