you need to follow these steps.
Step One:
Before install wordpress you need to install following commands.
sudo apt-get update sudo apt-get install apache2 sudo apt-get install mysql-server sudo apt-get install php5
Step Two:
Download latest wordpress
wget http://wordpress.org/latest.tar.gz
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 Three—Create the WordPress Database and User
After we unzip the wordpress files, they will be in a directory called wordpress in the home directory on the virtual private server.
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
Login using your MySQL root password, and then we need to create a wordpress database, a user in that database, and give that user a new password. Keep in mind that all MySQL commands must end with semi-colon.
First, let’s make the database (I’m calling mine wordpress for simplicity’s sake; feel free to give it whatever name you choose):
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:
CREATE USER wordpressuser; Query OK, 0 rows affected (0.00 sec)
Set the password for your new user:
SET PASSWORD FOR wordpressuser= 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:
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser IDENTIFIED BY 'password'; Query OK, 0 rows affected (0.00 sec)
Then refresh MySQL:
FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec)
Exit out of the MySQL shell:
exit
Step Four—Setup the WordPress Configuration
first step copy the wordpress folder to the Apache local server
sudo cp -r wordpress/* /var/www/
second step goto the apache folder
cd /var/www/ ls
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 wp-config-sample.php wp-config.php
Then open the wordpress config:
sudo vim wp-config.php
Find the section that contains the field below and substitute in the correct name for your database, username, and password:
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'wordpress'); /** MySQL database username */ define('DB_USER', 'wordpressuser'); /** MySQL database password */ define('DB_PASSWORD', 'password');
Save and Exit.
Give ownership of the directory to the user, replacing the “username” with the name of your server user.
sudo chown www-data:www-data * -R
goto to browser:
http://localhost
It will show like below image. you need create username and install wordpress.