Setup WP on Ubuntu/Apache

Lets create some folders with a meaningful name

cd /var/www
mkdir example.com
mkdir -p example.com/public_html
mkdir -p example.com/log
mkdir -p example.com/backups
mkdir -p example.com/src

Now lets setup the vhost config

cd /etc/apache2/sites-available/
sudo nano example.com.conf

paste this in there (ctrl + o to save, ctrl + x to exit)

<VirtualHost *:80>
 ServerAdmin marc@example.com
 ServerName example.com
 ServerAlias www.example.com
 DirectoryIndex index.html index.php
 DocumentRoot /var/www/example.com/public_html
 LogLevel warn
 ErrorLog /var/www/example.com/log/error.log
 CustomLog /var/www/example.com/log/access.log combined
 </VirtualHost>

<Directory /var/www/example.com/public_html>
 Options Indexes FollowSymLinks MultiViews
 AllowOverride All
 Order allow,deny
 allow from all
 </Directory>

Make that live and restart Apache

a2ensite example.com.conf
 service apache2 restart

Download, decompress and cleanup

cd /var/www/example.com/src
wget http://wordpress.org/latest.tar.gz
tar -zxvf /var/www/example.com/src/latest.tar.gz
mv /var/www/example.com/src/latest.tar.gz /var/www/example.com/src/wordpress-`date "+%Y-%m-%d"`.tar.gz
cp -R /var/www/example.com/src/wordpress/* /var/www/example.com/public_html/
rm -rf /var/www/example.com/src/wordpress/

Correct the the file permissions (as you probably lazily did this all with root)

chown -R www-data:www-data /var/www/example.com/public_html

got to http://example.com and run the setup.

CISSP CISM PMP