I am writing this guide mainly for my own use so I have a place to look at when I want to install Ubuntu Server and WordPress from scratch again with some basic settings. I have a habit of breaking things with my servers when playing around. I also want to have automatic updates to work flawlessly, permalinks and things like that. I do not take credit for all this information, a lot have been found by googling around. Checking forums etc. I am just placing it here for easy access for myself and others.
Install Ubuntu Server
First I downloaded Ubuntu Server and installed it with the following selections: LAMP Server (Linux, Apache, MySQL and PHP) and Open SSH Server so I could remote into the computer with Putty from my Windows computer or with the included ssh client on my Mac. Somewhere in this install you will be asked to create a password for MySQL. Do that and make sure to remember it.
I wont go into networking setup, I assume we have Internet and networking working, logged in and ready to go!
Now I update the system with:
sudo apt-get update
sudo apt-get upgrade
This ensures that the system is up to date and you are getting the latest software.
Download WordPress and set permissions
Now download wordpress using this link: http://wordpress.org/latest.tar.gz this ensures you are getting the latest stable version available at this time. Wget is good enough to use downloading this. Like so:
sudo wget http://wordpress.org/latest.tar.gz
To unpack this file I use something called Midnight Commander. It is a graphical file manager for the command line. Install it with this command:
sudo apt-get install mc
Unpack the wordpress files to:
When using WordPress it is important to keep it and any plugins up to date. To get this auto-update working apache (the webserver) needs write access to the WordPress installation. To make this happen is easy in Ubuntu Server 12.04, just type:
sudo chown -R www-data /var/www/ (or the folder where your WordPress installation lives)
To manage my database I like to use phpmyadmin. Install it with the following command and select apache2 when it asks which webserver you are going to use:
sudo apt-get install phpmyadmin
I know it is possible to create a database using the command line but some times a GUI is just nicer. Navigate to http://yoursite.com/phpmyadmin and log in with username root and your password. Create a database for your WordPress install.
This is not really needed to get everything up and running but, enabling permalinks makes the URLs from WordPress look a lot better. It is said that it may have some slight impact on SEO but I am not the one to claim to know anything about that.
Enough talk, to get this working you will have to enable the rewrite module in apache. Do this by executing the following command:
sudo a2enmod rewrite
Now you have to edit this configuration file:
/etc/apache2/sites-enabled/000-default and change AllowOverride None to AllowOverride All.
sudo service apache2 restart
Ready to Go!
Now you can install WordPress by loading up the URL to your server in your favourite browser. Then enable permalinks in Settings -> Permalinks in the admin dashboard menu to the left. Automatic updates should work fine and your blog is ready to go. If this guide helped you that’s great! If you found something wrong or really bad practices here please let me know in the comments.