
Table of Contents
Download wordpress
wget -q -O - "http://wordpress.org/latest.tar.gz" | tar -xzf - -C /var/www --transform s/wordpress/your-wp-site.com/
The above command will download and extract the WordPress archive file in the /var/www/your-wp-site.com directory
Change permissions
chown www-data: -R /var/www/your-wp-site.com
Create MySQL database
mysql -u root -p CREATE DATABASE yourwpdb CHARACTER SET utf8 COLLATE utf8_general_ci; GRANT ALL PRIVILEGES ON yourwpdb.* TO yourwpuser@localhost IDENTIFIED BY 'yourwpdbpass'; FLUSH PRIVILEGES;
Apache virtual host
Open/create a new file
nano /etc/apache2/sites-available/your-wp-site.com
Add the following content:
<VirtualHost *:80>
ServerName your-wp-site.com
ServerAlias www.your-wp-site.com
DocumentRoot /var/www/your-wp-site.com
DirectoryIndex index.php
<Directory /var/www/your-wp-site.com/>
Options FollowSymLinks
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
The command below symbolically links your virtual host file from sites-available to the sites-enabled directory.
a2ensite your-wp-site.com
Restart Apache with the following command:
/etc/init.d/apache2 restart
Finally, open up your browser, navigate to http://your-wp-site.com and finish the installation wizard.
Neat and easy. Thanks.