Don’t try this at home!
Well, actually, there are 2 ways you can look at it. Only attempt a remote install if it is absolutely necessary and there are no other practical ways of doing the OS install. It may be fun, and you’ll be impressed with yourself if you succeed, but the downside is that it takes a lot more time to do it remotely, it can be pretty tough on your nerves while you wait for the machine to come back up, eventually, and that’s it ever does. I can imagine a lot of things going wrong…
On the other hand, that’s exactly what you want to do. Do it from home instead of driving to the office, or better yet, to some hosting facility way out somewhere.
Anyway, now you’ve been warned and if you are still reading, here’s the challenge I was facing.
I had a machine (not the fastest, but a machine) with an old version of Linux. So old the distribution is no longer updated, and I’m not really that familiar with it anyway. So I had been itching to reinstall either a version of Debian or a version of Ubuntu Dapper as my choice of late. Plan B is having to drive to the data center, extract the machine, take it back, do the install, drive back to the data center, reinstall the machine, … and Plan B was not something I was looking forward to.
So I did some research, and using Google, it is fairly obvious that the article by Erik Jacobson that you should read first if you want to attempt any remote install of debian is the authority on the subject. Read the HOW-TO.
I could not find anything on Ubuntu, however. And I even found a few reports of people upgrading from debian to Ubuntu having troubles, but mostly from XWindows stuff, but for a server, that’s not something I was interested in. And worst case, I’d be on my driving to that data center…
So I read the HOW-TO carefully, a few times to let it sink in, and got started on my Ubuntu Dapper Drake (6.06) remote install.
Here’s what I did.
I first followed the procedure in the HOW-TO to install debian. At some points, there are a few differences that I’ll highlight. Here are some notes I took while doing the install.
I used the rpm from [http://azhrarn.underhanded.org/debootstrap-0.2.23-1.i386.rpm]()
I used the swap partition as a new boot partition for debian.
The old distribution did not support journaling, so I only used (this is only the boot partition anyway, so journaling is not as important, and that one will be temporary anyway):
NOTE: identify your volume names at the beginning, create a table to help you translate between what the HOWTO uses, what I use and your setup otherwise you might be in for some serious trouble.
debootstrap does not support sarge, so using woody was fine. The only thing we’ll be using the bootstrap is to get apt working.
Follow the steps till you reach the part where you get apt working. Then no need to bother with netselect (didn’t work for me), now is the time to do a bit of tinkering.
Edit /etc/apt/sources.list and replace it with:
vi /etc/apt/sources.list deb http://us.archive.ubuntu.com/ubuntu/ dapper main restricted deb-src http://us.archive.ubuntu.com/ubuntu/ dapper main restricted deb http://us.archive.ubuntu.com/ubuntu dapper universe deb-src http://us.archive.ubuntu.com/ubuntu dapper universe #deb http://mirrors.kernel.org/debian/ stable main non-free contrib #deb-src http://mirrors.kernel.org/debian/ stable main non-free contrib # #deb http://debian.yorku.ca/debian/ stable main non-free contrib #deb-src http://debian.yorku.ca/debian/ stable main non-free contrib #deb http://non-us.debian.org/debian-non-US stable/non-US main contrib non-free #deb-src http://non-us.debian.org/debian-non-US stable/non-US main contrib non-free # ## deb http://security.debian.org/ stable/updates main contrib non-free #deb http://security.debian.org stable/updates main contrib non-free
Next, proceed with the update and dist-upgrade, then install a kernel.
apt-get update apt-get dist-upgrade apt-cache search kernel-image
Find a 2.6 kernel for your system (unless you insist on using 2.4).
Then proceed back with the rest of the script, starting with the install of ssh.
To make sure ssh was configured properly, I configured it on a different port so I could try it before the first reboot. Having everything working, but not ssh would be real bad, so spending some extra time here is worth it.
And one thing you want to take the time to do is to setup a cron job that will reboot the new system after some time (say every 2 hours), as an extra insurance, in case something wrong happens. Here’s a possible line to add to your crontab to reboot every 2 hours:
00 */2 * * * /sbin/shutdown -r now
I did mess up once, and I was really glad to see the machine come back after a very long 2 hours or so (I had almost given up on it and was getting ready to plan B). The second insurance you can take is to setup the reboot on the new kernel as a temporary reboot (as explained in the HOW-TO), you might be glad you did.
Once your reboot is successful, it is a matter of replacing the main partition with ubuntu, do the second reboot, and voila! Phewww! Not something I’d like to do everyday, but I’m glad I did it once.
Now you have a very barebone version of Ubuntu Dapper and you can customize it any which you need.
Good luck on your remote install!