NOTE: You must have the LAMP stack installed before installing WordPress.
Create the WordPress database, user, and password
mysql -u root -p |
Now, create the database and user for your WordPress installation. You can replace WPdatabase, WPuser, and WPpassword with your own database name, username, and password in the following commands:
CREATE DATABASE wordpressdb; |
Â
CREATE USER WPuser@localhost IDENTIFIED BY 'WPpassword'; |
Â
GRANT ALL PRIVILEGES ON WPdatabase.* TO WPuser@localhost; |
Now, flush the privileges and restart the service:
FLUSH PRIVILEGES; |
Â
exit |
Â
service apache2 restart |
Â
service mysql restart |
Â
Install WordPress
Make a temporary directory to download WordPress into:
mkdir temp |
Now change directories and download the WordPress zip file:
cd temp |
wget http://wordpress.org/latest.zip |
Install Unzip:
apt-get install unzip |
A few libraries need to be installed so that you can use WordPress properly:
apt-get update |
apt-get install php5-gd libssh2-php |
Unzip the WordPress file:
unzip -q latest.zip -d /var/www/html/ |
Grant permissions to the directory:
chown -R www-data.www-data /var/www/html/wordpress |
chmod -R 755 /var/www/html/wordpress |
Now, make the uploads directory:
mkdir -p /var/www/html/wordpress/wp-content/uploads |
Grant the web server permission to write to the directory:
chown -R :www-data /var/www/html/wordpress/wp-content/uploads |
Now copy the default configuration file to the correct filename:
cd /var/www/html/wordpress/ |
cp wp-config-sample.php wp-config.php |
Open the wp-config.php file:
vi wp-config.php |
Look through the wp-config.php file and replace 'wordpressdb' with your wordpress database name, 'wordpressuser' with your username, and 'wordpresspassword' with your password. User the database name, username, and password that you used when creating the database.
Now complete the WordPress setup now located at http://yourdomain.com/wp-admin/install.php, where 'yourdomain.com' is replaced with your actual domain.