Virtual SVN and Project Managment
Well I've finally finished my latest venture.
I wanted to have a portable SVN server and apache/mysql server. Why? Well I like to travel a lot and for long periods of time so I take my work with me so leaving a SVN server on my desktop at home isn't really a good idea.
Now I could put it on my laptop but I'm not always using it I like to be able to switch pc. So here's the plan.
1) I have an old laptop with a faulty mouse pad so it's not really useful anymore, it has a 60GB hard drive and a couple of gigs of ram so can handle a virtual machine.
2) Migrate my svn and apache server to a virtual machine on my desktop for testing purposes to make sure it will work
3) Migrate the virtual machine to the laptop
4) Connect the laptop to my network via ethernet and enable wake on lan
5) Enable virtual machine to start on laptop bootup
So firstly, what operating system should I use? The laptop has no OS on it so I looked at linux. I tried Open Suse, Fedora, CentOS, Ubuntu (8.10), Mandriva and Slackware.
In the end I chose Fedora 9, here is why.
Open Suse worked well a little slower than the others but when installing Xampp for linux I kept getting access denied messages for php pages, god knows why so onto the next system.
CentOS, pretty good but Fedora has more up-to-date software which seemed to agree with VirtualBox better.
Ubuntu 8.10, disabled root user as standard didn't help since virtual box doesn't work to well under non root user, and it didn't give me an option to set a static IP at install bleh next!
Mandriva..looks really pretty...crashed when installing virtual box...next!
Slackware...too complciated to install I want simple and quick.
Fedora..just plain works XD Some issues setting a static IP but not hard to resolve.
OK Operating system for the laptop decided...I decided to use fedora for the virtual machine as well.
For the virual machine at first I tried host networking, this isn't so easy on linux since you have to create network bridges etc which is a bit of a pain so I decided to switch it to NAT and just forward the ports it only takes a few minutes to set up.
Migrating the SVN and web server was easy enough that has been covered in a previous post.
The laptop needed wol enabled this has been covered in a previous post, now onto the last part setting the virtual machine to start on boot. I created a script in /etc/init.d/ and here it is:
To add the script to startup use the following command
All done. The only thing left to do is edit the hosts file on my client machine to point to the ip address of the new machine, if I ever move the machine all I need to do is change the ip in the hosts file. Easy as pie!
I wanted to have a portable SVN server and apache/mysql server. Why? Well I like to travel a lot and for long periods of time so I take my work with me so leaving a SVN server on my desktop at home isn't really a good idea.
Now I could put it on my laptop but I'm not always using it I like to be able to switch pc. So here's the plan.
1) I have an old laptop with a faulty mouse pad so it's not really useful anymore, it has a 60GB hard drive and a couple of gigs of ram so can handle a virtual machine.
2) Migrate my svn and apache server to a virtual machine on my desktop for testing purposes to make sure it will work
3) Migrate the virtual machine to the laptop
4) Connect the laptop to my network via ethernet and enable wake on lan
5) Enable virtual machine to start on laptop bootup
So firstly, what operating system should I use? The laptop has no OS on it so I looked at linux. I tried Open Suse, Fedora, CentOS, Ubuntu (8.10), Mandriva and Slackware.
In the end I chose Fedora 9, here is why.
Open Suse worked well a little slower than the others but when installing Xampp for linux I kept getting access denied messages for php pages, god knows why so onto the next system.
CentOS, pretty good but Fedora has more up-to-date software which seemed to agree with VirtualBox better.
Ubuntu 8.10, disabled root user as standard didn't help since virtual box doesn't work to well under non root user, and it didn't give me an option to set a static IP at install bleh next!
Mandriva..looks really pretty...crashed when installing virtual box...next!
Slackware...too complciated to install I want simple and quick.
Fedora..just plain works XD Some issues setting a static IP but not hard to resolve.
OK Operating system for the laptop decided...I decided to use fedora for the virtual machine as well.
For the virual machine at first I tried host networking, this isn't so easy on linux since you have to create network bridges etc which is a bit of a pain so I decided to switch it to NAT and just forward the ports it only takes a few minutes to set up.
Migrating the SVN and web server was easy enough that has been covered in a previous post.
The laptop needed wol enabled this has been covered in a previous post, now onto the last part setting the virtual machine to start on boot. I created a script in /etc/init.d/ and here it is:
#!/bin/bash
#Virtual Box Start up script
PATH=/bin:/usr/bin:/sbin:/usr/sbin
case "$1" in
start)
echo -n "Starting"
VBoxManage starvm VirtualMachine -type vrdp
;;
stop)
echo -n "Stopping"
ssh -oPort=23 -i /root/.ssh/localhost root@localhost -t shutdown now
sleep 30
VBoxManage controlvm VirtualMachine poweroff
sleep 5
VBoxManage snapshot VirtualMachine take snapshot`date +%s`
sleep 2
;;
restart)
$0 stop || true
$0 start
;;
*)
echo "Usage: /etc/init.d/virtualbox {start|stop|restart}"
exit 1
;;
esac
exit 0
To add the script to startup use the following command
/sbin/chkconfig --level 35 virtualbox onOn bootup this will start the machine in vrdp mode which is handy since I can remote in, on shutdown it will ssh into the machine (I port forwarded port 23 (old telnet port which I don't use) to the machine) and tells it to shut down, this is becace acpi shutdown on fedora virtual machines just logs off. Then it runs the power off virtual box command after 30 seconds to make sure it is off, then it takes a snapshot.
All done. The only thing left to do is edit the hosts file on my client machine to point to the ip address of the new machine, if I ever move the machine all I need to do is change the ip in the hosts file. Easy as pie!

0 Comments:
Post a Comment
<< Home