I have a few problems with my oneandone dedicated server:
-
I don't know my way around Fedora Core and cannot find anything
-
Plesk seems to hide most of the configuration deep in it's own directories, making finding anything even harder.
-
It is Fedora Core 2 which is a year or two old. The packages available are a little long-in-the-tooth (Mysql 3.2, Subversion 1.0.9) and the versions are becoming deprecated. Plesk 7.5.3 only supports Fedora Core 2 so ultimately again Plesk is an annoyance.
So I decided to install debian. Ubuntu, my distribution of choice is derived from debian so I know my way around it. Also there is a complete debian mirror on oneandone's servers that I can access without impact on my bandwidth allocation.
I was inspired by this article about installing debian on a oneandone server which gave me the confidence to give it a try. However I didn't follow these instructions for a few reasons:
-
It requires building a kernel on a running debian system. I don't have one of those and didn't feel like making one. The instructions erroneously say that the network interface has to be built into the kernel but mine is ok as a module.
-
It sets up static ip addresses instead of using dhcp. The oneandone faqs seem very insistant on using dhcp. Getting this going was the most difficult part of this setup but I am glad I have done it this way: my server will not suddenly break if oneandone reconfigure their network.
-
I didn't want to clear out my entire hard disk, I wanted to keep the fedora/plesk system in case I wanted to return to it. The fedora installation allocates 27G to a /home partition. I decided to copy the little of this that is used to the root partition and use the home partition (/dev/hda7) for my new installation. I can always re-use the fedora partitions later, if 27G is not enough for me.
I am still grateful to the author of that article for making me believe it was possible.
These are essentially the steps I took:
Start of logged into the fedora system, copy the old home directory to the root partition:
mkdir /newhome
cp -a /home /newhome
umount /home
If the umount fails because files in /home are open then run
/usr/sbin/lsof | grep home
to see what has the files open and stop or kill the processes (lsof, list open files, damn useful).
Create new file system in partition where /home was:
/sbin/mkfs.ext3 /dev/hda7
Mount the new installation:
mkdir /mnt/new
mount /dev/hda7 /mnt/new
Download debootstrap from debian mirror on oneandone servers. This mirror is only visible to oneandone customers. Untar and try to run
tar xvfz debootstrap-0.3.1.5.tar.gz
cd debootstrap-0.3.1.5
export DEBOOTSTRAP_DIR=`pwd`
./debootstrap --arch i386 sarge /mnt/new http://update.pureserver.info/debian sarge
gives error:
E: no /home/peter/debootstrap-0.3.1.5/devices.tar.gz. cannot create devices
Hum, supposed to be in debootstrap archive from what I can tell. Installed debootstrap under ubuntu and copied the file up.
If you get:
W: Failure trying to run: chroot /mnt/new mount -t proc proc /proc
then log in properly as root to get path set up correctly:
su -l root
rather than
su
Looking good:
I: Base system installed successfully.
Do base configuration. This is essentially the debian setup program, it installs loads of packages, asks you what time zone you are in etc.
chroot /mnt/new
mount /proc
base-config
Mostly obvious stuff but:
-
apt sources set to
deb http://update.pureserver.info/debian unstable main contrib non-free
-
Install the following
-
Web Server
-
Mail Server
-
SQL database
-
Use readline interface for configuring packages: I find the dialog interface invasive, it pops up and stops you seeing anything else on screen which you sometimes need to understand what is going on.
For me the nfs package failed to install so I ran dselect and removed it. Installed openssh server and, most importantly, vim. sshd just works, needs no configuration.
Setup /etc/fstab:
/proc /proc proc defaults 0 0
/dev/hda7 / ext3 defaults,noatime 0 0
/dev/hda2 none swap defaults 0 0
Set up /etc/network/interfaces:
auto lo eth0
iface lo inet loopback
iface eth0 inet dhcp
Use dselect to install Linux kernel image for PPro/Celeron/PII/PIII/P4 machines.
Ensure network card is in /etc/modules (without this we are lost):
My box has via-rhine, you can check in /var/log/messages to see what yours might be and look in /lib/modules/*/kernel/drivers/net to see if there is a module for it.
Install lilo:
Copy /etc/lilo.conf from fedora and modify it:
boot=/dev/hda
# for fedora
#root=/dev/hda1
root=/dev/hda7
install=/boot/boot.b
vga=normal
timeout=10
prompt
lba32
read-only
default=lx
append="console=tty0 panic=30"
#
# Debian install.
#
image=/vmlinuz
initrd=/initrd.img
label=lx
Run lilo to set this up:
Quit out of the chroot and copy the /etc/hosts from fedora to the new install.
exit
cp /etc/hosts /mnt/new/etc/hosts
Now go to oneandone control panel and reboot the system into the recovery system. This will have you box running an emergeny debian install. It's handy because we are installing debian. Once installed, mount your new install so that you can copy some more files to it:
mount /dev/hda7 /mnt
cp /etc/dhcp3/dhclient.conf /mnt/etc/dhcp3
cp /etc/dhcp3/dhclient-exit-hooks.d/local /mnt/etc/dhcp3/dhclient-exit-hooks
chmod 755 /mnt/etc/dhcp3/dbclient-exit-hooks/local
This last step took me hours to figure out, I think the dhcp3/dhclient-exit-hooks.d/local is the trick as it does not exist in a standard debian install. While I was messing around I managed to reset the execute bits on the files which broke dhcp completely, hence the chmod to make sure.
From the oneandone control panel, reboot server in normal mode and enjoy.
What is so damn cool about linux is that doing something like this is possible at all. Reninstall a different operating system on a pc in a different country (Germany) through a command line terminal? Try doing that in windows.