Warning: There is absolutely no point in doing what I did other than for the fun of it ;-)
Warning: Repartitioning a server remotely may not be sound advice, foobar your system and foul up your language
I am hosting some servers at the german hosting provider 1&1. Naturally, over time servers age and they run out of steam and are being decommissioned.
So one of these aged servers running Windows 2003 Web Edition was ripe for experimentation. I run Windows servers for historical reasons, and this proved to be a good opportunity to replace it with Linux.
Now, this server sits somewhere in a datacenter in Karlsruhe, Germany and I have no local access to it. In fact, I am writing this as I am at home in Crowthorne in the UK. So I have no USB. No CD. No keyboard. Not even a floppy. So how on earth can you install Linux on a PC running Windows that you don't have access to?!
The answer turned out to be surprisingly easy (although it took me yesterday night until 1AM and half an hour this morning to figure out why GRUB was not redirecting the output to the console). The only piece of remote management that I had access to was a serial console. That was enough.
Remote installation of Opensuse 10 on a 1&1 hosted Windows 2003 server
Installing GRUB for NT
First, you need to grab a copy of GRUB for NT, which can be found here : http://grub4dos.freespaces.com/
You need to unpack the archive and copy
-rw-r--r-- 1 root root 149000 2005-12-14 01:44 grldr
to the root of your first disk / first partition (that should be c:\ normally). We want GRUB to be available to the Windows boot menu, so we need to create a menu.lst and modify boot.ini. This is a system, read-only, hidden file, so you need to attrib -s -h -r \boot.ini to make it writable. Once you did that, use notepad.exe to add an entry to the menu like this:
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
redirect=COM1
redirectbaudrate=57600
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Standard" /fastdetect /redirect /NoExecute=OptOut
C:\grldr="Start Sascha Siekmanns GRUB"
Create the Linux /boot directory as c:\boot
Now, we need to create the Linux /boot directory. This is where Opensuse comes into play. You need to locate the first CD of the Opensuse ISOs, namely SUSE-10.0-CD-OSS-i386-GM-CD1.iso. Mount the ISO to extract the boot directory if it, e.g.
mount -t iso9660 -o loop /media/usbdisk/suse10iso/SUSE-10.0-CD-OSS-i386-GM-CD1.iso /mnt
So, copy the content of /mnt./boot and its subdirectories to the primary partition (typically, c:\boot).
Now you probably wonder how the heck did he copy those files over and the answer is CYGWIN. I had installed CYGWIN on the Windows box and therefore had sshd running on it. So from my Linux box I just scp'ed the files over. In case you do not have that installed (very likely ;-) you can install daemon tools, a freeware CD emulator that can mount ISOs under Windows. You can find it at http://www.daemon-tools.cc
Thinking about it further, I realized how much of a pain this is - a much easier way to read ISOs under Windows is to install WinRAR, which happens to be able to open ISO files ;-)
Creating the GRUB menu.lst
Anyway, now on to the GRUB menu. We will have to create a valid menu.lst entry for GRUB in /boot/grub/menu.lst.
The /boot/grub/menu.lst entry should look like this:
serial --unit=0 --speed=57600 --word=8 --parity=no --stop=1
terminal serial
default=0
timeout=5
title linux
kernel (hd0,0)/boot/linux console=tty0 console=ttyS0,57600 ramdisk_size=65536 acpi=off noapic manual=0 insmod=via-rhine ssh=1 sshpassword=opensuse! install=nfs://212.227.76.210/home/root/suse
initrd (hd0,0)/boot/loader/initrd
A couple of things to note here. First off, one could use VNC for a graphical setup. Security of VNC is weak (non-existant) and this would be an initial compromise of the system you would not be able to recover from. So that is why I opted for ssh based setup.
Obviously, you also need a network based source containing the installation images, in my case I run my own NFS server on the network and serve the ISO this way. You will need to modify the install= line to something of your choosing.
You may have noticed I did not add any network parameters such as IP address and gateway above. This is unneccessary as the DHCP server at 1&1 is MAC address based, so I will always get my primary IP they have on record for me.
More information about the setup line can be found here: http://en.opensuse.org/SDB:Remote_Installation_of_SUSE_LINUX
OK, quick checklist here:
- GRUB for NT installed and copied to c:\
- c:\boot copied over from Opensuse /boot
- boot.ini modified to include GRUB
- menu.lst in c:\boot\grub\menu.lst configured
Booting up for installation
Right, ready to hit the road! Connect to your server local console using the "Serial console", so ssh to sercon.pureserver.info with your username and password and using putty or plain ol' ssh and reboot the server. Magically, this should appear:
Please select the operating system to start:
Windows Server 2003, Web [EMS enabled]
Start Sascha Siekmanns GRUB
Use the up and down arrow keys to move the highlight to your choice.
Press ENTER to choose.
For troubleshooting and advanced startup options for Windows, press F8.
Select option two ...
After a moment of silence ...
GNU GRUB version 0.97 (640K lower / 515008K upper memory)
+-------------------------------------------------------------------------+
| linux |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
+-------------------------------------------------------------------------+
Use the ^ and v keys to select which entry is highlighted.
Press enter to boot the selected OS, 'e' to edit the
commands before booting, or 'c' for a command-line.
Woohoo! Hit enter...
Booting 'linux'
kernel (hd0,0)/boot/linux console=tty0 console=ttyS0,57600 ramdisk_size=65536 a
cpi=off noapic manual=0 insmod=via-rhine ssh=1 sshpassword=opensuse! install=nf
s://212.227.76.210/home/root/suse
[Linux-bzImage, setup=0x1e00, size=0x176657]
initrd (hd0,0)/boot/loader/initrd
[Linux-initrd @ 0x1f108000, 0x6d7854 bytes]
Linux version 2.6.13-15-default (geeko@buildhost) (gcc version 4.0.2 20050901 (prerelease) (SUSE Linux)) #1 Tue Sep 13 14:56:15 UTC 2005
BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 00000000000a0000 (usable)
BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 000000001f7f0000 (usable)
BIOS-e820: 000000001f7f0000 - 000000001f7f3000 (ACPI NVS)
BIOS-e820: 000000001f7f3000 - 000000001f800000 (ACPI data)
BIOS-e820: 00000000fec00000 - 0000000100000000 (reserved)
lotsa output ...
>>> SUSE Linux installation program v1.9.16 (c) 1996-2005 SUSE Linux Products GmbH <<<
Starting hardware detection...
Activating usb devices... done
Searching for info file...
Sending DHCP request to eth0...
Loading Installation System (65750 kB) - 100%
starting udev... ok
starting hald... ok
starting syslogd (logging to /dev/tty4)... ok
starting klogd... ok
sshd found, prepare remote login
generating SSH keys ...
Generating /etc/ssh/ssh_host_key.
Generating public/private rsa1 key pair.
Your identification has been saved in /etc/ssh/ssh_host_key.
Your public key has been saved in /etc/ssh/ssh_host_key.pub.
The key fingerprint is:
fe:88:03:17:c4:7d:9e:fc:47:d5:ac:94:5d:b8:b6:35 root@82.165.39.125
Generating /etc/ssh/ssh_host_dsa_key.
Generating public/private dsa key pair.
Your identification has been saved in /etc/ssh/ssh_host_dsa_key.
Your public key has been saved in /etc/ssh/ssh_host_dsa_key.pub.
The key fingerprint is:
42:b8:d4:72:19:37:e5:b5:8f:2c:90:58:e9:b5:74:f3 root@82.165.39.125
Generating /etc/ssh/ssh_host_rsa_key.
Generating public/private rsa key pair.
Your identification has been saved in /etc/ssh/ssh_host_rsa_key.
Your public key has been saved in /etc/ssh/ssh_host_rsa_key.pub.
The key fingerprint is:
f8:fd:dc:3e:36:5c:cd:29:9c:24:e6:e8:0c:ad:9a:c7 root@82.165.39.125
setting root pwd to 'opensuse!'
Starting SSH daemon ...
eth0:
link/ether 00:40:ca:73:97:50 brd ff:ff:ff:ff:ff:ff
inet 82.165.39.125/32 brd 82.165.39.125 scope global eth0
*** sshd has been started ***
*** login using 'ssh -X root@82.165.39.125' ***
*** run 'yast' to start the installation ***
Connect from client to finish install
OK, off to connect using ssh and check it it really worked...
galadriel:/mnt # ssh demucmail01.scon.de -l root
WARNING: RSA key found for host demucmail01.scon.de
in /root/.ssh/known_hosts:52
RSA key fingerprint 98:6f:f2:9c:c5:89:20:a3:c1:11:ec:17:aa:c5:a4:b6.
The authenticity of host 'demucmail01.scon.de (82.165.39.125)' can't be established
but keys of different type are already known for this host.
DSA key fingerprint is 42:b8:d4:72:19:37:e5:b5:8f:2c:90:58:e9:b5:74:f3.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'demucmail01.scon.de,82.165.39.125' (DSA) to the list of known hosts.
root@demucmail01.scon.de's password:
SUSE Linux Installation
Welcome to the inst-sys...
Linux 82.165.39.125 2.6.13-15-default #1 Tue Sep 13 14:56:15 UTC 2005 i686 i686 i386 GNU/Linux
/root
Probing connected terminal...
Initializing virtual console...
Found an xterm terminal on /dev/pts/0 (135 columns x 60 lines).
run yast to start the installation
inst-sys:~ #
All finished
Fantastic. It worked. Have fun installing Linux over Windows remotely ... Another one bites the dust...
:-)
No comments:
Post a Comment