I used to run my web server at home, but I decided that for traffic reasons it would be better to just rent a VPS (Virtual Private Server). The first one I tried was IT-staden (then called “serverconnect.se”), the best thing that can be said about it is that it was cheap…. I then decided to try something else, so I picked Blanye hosting, which is also cheap, but looks like it has better specification VPS’s, and it looked like it’d actually work reliably. These are my notes from the transfer from one VPS to another, it’s mostly for my own use, should I need to do it again sometime in the future, but maybe someone else can use it too.
1. Move files
This was pretty easy, I just copied everything under /var/www/ to the new server. And made a backup of everything on the server.
2. Move database
First I made copies of all the individual databases with this command:
mysqldump -u USERNAME -pPASSWORD DATABASENAME > FILENAME.sql
Then created the databases in phpmyadmin on the new server and importet the databases with this command:
mysql -u USERNAME -pPASSWORD DATABASENAME < FILENAME.sql
2b. Move user privileges
I have some different users set up for the MySQL database. Instead of creating them again I wanted to move them, luckily it’s pretty easy as described here: Copy export MySQL user priviledges
3. Web server setup
I run multiply websites on the server, so I set up some Virtual Hosts
For the WordPress blog I needed to use a .htaccess file to rewrite the urls (the Apache2 module “mod_rewrite”, this has to be enabled in the Apache2 web server:
This also has to be enabled in the virtual hosts we set up earlier, this change needs to be made:
“None” should be “All”, like it is here:
Options Indexes FollowSymLinks MultiViews
allow from all
The last.fm widget I use on the pages use cURL, so I had to add that to PHP5 too:
apt-get install curl libcurl3 libcurl3-dev php5-curl php5-mcrypt
Now restart the web server and cross your fingers:
4. FTP server
To enable automatic updates in WordPress, it needs to have access to an ftp server it can transfer the files to. So I installed ProFTPD on the VPS:
apt-get install proftpd
I choose to run the server in standalone mode, ‘cos somehow it doesn’t work if I choose the inetd mode…
Now add a new user:
Choose a password for the user and just accept [enter] the rest of the options.
Now we need to let the wordpress user access the blog, first goto the users home director and then make a symbolic link to the website dir:
ln -s /var/www/blog
And we’ll change the owner of the WordPress dir to the wordpress user:
chown wordpress -hR /var/www/blog/
Now WordPress should be able to update itself and its plugins, all you have to do is to input the credentials for the wordpress user we just set up in the WordPress admin panel.