Tweetegy On the edge of chaos with Ruby, Rails, JavaScript and AngularJS.

| About | Search | Archive | Github | RSS |

Install WordPress on Ubuntu 10.04 Slicehost

Here is a quick step by step for setting up a new Slicehost slice and installing WordPress on that slice. In this example we will use a Ubuntu 10.04 (Lucid Lynx) 32-bit 256 MB slice. The first part is a condensed version of these instructions. The second part introduces a bash script that will install and configure a LAMP stack in order to run WordPress.

Part 1: Fire up and configure your new Slice!

Goto slicehost, sign up, and pick your slice by selecting “Ubuntu 10.04 LTS (lucid) 32-bit” from the Linux Distribution drop down menu. Wait for the slice to fire up and then when it is marked active in your control panel you can ssh into the slice using the root username and password.


First change the password of root


Add a new user and group. Follow the instructions on the screen.

adduser demouser

Open visudo


Add this line to the bottom of the file:

demouser  ALL=(ALL) ALL

On your LOCAL machine generate an ssh key

mkdir ~/.ssh
ssh-keygen -t rsa

Copy this key to your new slicehost slice using scp on your LOCAL machine

scp ~/.ssh/

Back on the SERVER – your new Slicehost slice, run the following commands. This simply moves your local machine public key to the authorized_keys file for demouser.

mkdir /home/demouser/.ssh
mv /home/demouser/.ssh/authorized_keys
chown -R demouser:demouser /home/demouser/.ssh
chmod 700 /home/demouser/.ssh
chmod 600 /home/demouser/.ssh/authorized_keys

Make ssh more secure by editing /etc/ssh/sshd_config and changing the following three properties:

nano /etc/ssh/sshd_config

Load custom rules into your server iptables. The easiest thing to do is copy paste the Slicehost iptables rules to a new file /etc/iptables.up.rules and then load these rules. Remember to open the port that you selected in the previous step for ssh.

nano /etc/iptables.up.rules

Now run the following to update rules from the new file

/sbin/iptables-restore < /etc/iptables.up.rules

You want to ensure that these rules are loaded on every instance boot. So create a new file /etc/network/if-pre-up.d/iptables and add the following script into this file:

/sbin/iptables-restore < /etc/iptables.up.rules

Run this to make the file executable

chmod +x /etc/network/if-pre-up.d/iptables

Reload SSHD

/etc/init.d/ssh reload

Now you can try logging in as the new user (demouser in this exampe) from your LOCAL machine

ssh -p 30000

If all goes well, you can log out of root at this point and continue to use demouser going forward. If you do get locked out, Slicehost have a browser based console, which you can use to attempt to fix any issues with SSH.

In Part 2 we will prepare a bash script for installing WordPress.