Skip to content

Instantly share code, notes, and snippets.

@huntlyc
Last active December 15, 2015 15:59
Show Gist options
  • Select an option

  • Save huntlyc/5286112 to your computer and use it in GitHub Desktop.

Select an option

Save huntlyc/5286112 to your computer and use it in GitHub Desktop.
Wordpress setup Ubuntu 12.10
#This goes in your #server-config
<VirtualHost *:80>
ServerName bobswordpress.dev
ServerAdmin [email protected]
DocumentRoot /var/www/bobswordpress.dev/
ServerAlias www.bobswordpress.dev
DirectoryIndex index.html index.php
<Directory /var/www/bobswordpress.dev/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/bobswordpress-error.log
CustomLog /var/log/apache2/bobswordpress-access.log common
</VirtualHost>
# Step 1: Get all the software you’ll need
sudo apt-get install lamp-server^
sudo apt-get install subversion git git-svn vim vim-common vim-doc filezilla
# I prefer git for version control and also prefer vim to nano for general sys
# admin stuff although don’t use it as my main code editor of choice. I do use vim in this guide
# but feel free to swap it out for nano or gedit or whatever you use.
# I also personally like Filezilla for S/FTP – many other options are available.
#Step 2: Get WordPress
# You have two options here, you can use the SVN version or just use the latest.
# I prefer to use the latest stock WordPress as #it’s what our clients use.
# At this point you want to be root. Linux die-hards will slate me for this, but having to do ‘sudo !!‘
# every time you forget to prefix your commands with sudo gets old. Fast!
sudo -i
#This elevates you to the root and you can now destroy your system if you’re not careful…
cd /var/www
wget http://wordpress.org/latest.tar.gz
# That will download the latest WordPress.
tar xf latest.tar.gz
mv wordpress bobswordpress.dev
# Step 3: Setup a virtual host
cd /etc/apache2/sites-available
# Create the virtual host file
vim bobswordpress.dev
# Add in the code in the conf file (on the gist)
# This will setup the virtual host for apache as well as providing custom logs.
# This is useful if you’re like me and like to keep #everything nice and organized.
# I also now and again like to try out different CMS systems so you can just
# copy and paste this #for each new virtual host you need.
# Next add an entry to your hosts file (this is basically a local dns – you can ‘hijack’ any domain
# for example you can redirect #all requests going to google.com and point them to your
# local computer if you so wished, but that’s just a bit silly)…
vim /etc/hosts
# add this line just below localhost:
# 127.0.0.1 bobswordpress.dev
# Enable the site in apache:
a2ensite bobswordpress.dev
# Reload Apache for our new virtual host to take effect
service apache2 releoad
# Step4: Configure your wordpress
# Now you need to make a database:
mysql -uroot -p
# at the prompt enter these commands
# CREATE DATABASE wp_bobswp;
# GRANT ALL ON wp_bobswp.* to 'wp'@'localhost' IDENTIFIED BY 'pass';
# Again, hardened DB admins will not like the fact I’ve given all permissions to this database,
# but again, this guide is only for # development machines.
# It’s up to you to secure your production sites!
# Now configure your wordpress install.
cd /var/www/bobswordpress.dev/
mv wp-config-sample.php wp-config.php
vim wp-config.php
# Alter the DB_NAME, DB_USER and DB_PASSWORD fields to suit. While your here set WP_DEBUG to true.
# You can now go to http://bobswordpress.dev/ in your browser and install WordPress as normal.
# Step 5: Fix the permissions
# Permissions and Linux are one of these things that can trip up anyone, even people who have been
# using it for years. If anyone #has a better solution for this, I’d love to know!!
# Quite often I find myself redoing these commands after doing a plugin #update…
cd /var/www
#These are the commands you’ll need to alter the users. Swap out <your username> for the correct value.
chown -R www-data:<your username> bobswordpress.dev
chmod -R g+rw bobswordpress.dev
#Step 6: Take over the world
#You’ve now got everything installed (including subversion) so you can go start creating plugins and themes,
# and if you’re feeling particularly adventurous, go and get the SVN version of WordPress and start hacking
# on the core! The steps are exactly #the same apart from the ‘wget’ which will be
mkdir /var/www/wordpresssvn.dev/
cd /var/www/wordpresssvn.dev/
svn co http://core.svn.wordpress.org/trunk/ .
#Enjoy!! :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment