Before installing WordPress on Ubuntu, the server needs to have LAMP installed.

3 Steps to install WordPress
1, Download WordPress
Go to www folder (or folder containing website content)
cd / var / www /
wget http://wordpress.org/latest.tar.gz
Decompression
tar -xzvf latest.tar.gz
2, Creat WordPress MySQL Database and User
See how to create mysql database using the command line . For example, create a your_database , user your_user with password your_password to use.
3, Install WordPress
Tạo file wp-config.php
cp ./wordpress/wp-config-sample.php ./wordpress/wp-config.php
Edit the file
sudo nano ./wordpress/wp-config.php
Fill in the database, user, and password information
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'your_database');
/** MySQL database username */
define('DB_USER', 'your_user');
/** MySQL database password */
define('DB_PASSWORD', 'your_password');
Save and exit.
Copy all the files in the wordpress folder outside the www folder
sudo rsync -avP ./wordpress/ .
Change the ownership folder containing WordPress
sudo chown www-data:www-data * -R sudo usermod -a -G www-data wordpress
Now you can proceed to install WordPress by going to http://site.com/wp-admin/install.php and then.