Cheap VPS & Xen Server


Residential Proxy Network - Hourly & Monthly Packages

How To Install A Debian Based Distro On An EasySpeedy Server


Introduction

This is a copy & paste howto. The easiest way to follow this tutorial is to copy paste the commands directly into your ssh client. Be careful when you’re required to provide your own custom data, like IP addresses, hostnames or passwords.

The following tutorial is a detailed description of how to install a Debian based distro (Debian Etch in this example) on an EasySpeedy server. EasySpeedy offers dedicated server hosting with the ability for customers to perform remote recovery and maintenance over ssh. This is exactly what we need to install our debian based distro from scratch, using debootstrap.

I want to say first that this is not the only way of setting up such a system. There are many ways of achieving this goal and there are no guarantees that this howto will work for you.

 

The Server

I will be using a standard EasySpeedy server:

Processor AMD Athlon 64 3500+
RAM 1 GB DDR2 RAM
Hard drive 250 GB SATA

After you’ve logged in to your server control panel on the EasySpeedy website, you’re presented with an automated system for installing several linux distributions. Although this is very handy, I wanted Debian Etch on my server. Sadly, it hasn’t been added yet to the list of available distributions for automated installation. Because of this, I decided to try the Debian Sarge installation and then dist-upgrade to Etch. This should have been fairly easy to do, but the default partition scheme that came with Sarge didn’t meet my needs.

 

The Handy Rescue System

To install Debian Etch using deboostrap we’re going to use one of the rescue systems that EasySpeedy provides. The one I chose for doing this, is described as follows:

“This is our Forensic Recovery Tool. It boots a minimal Linux distro into RAM, and allows SSH login. Using this recovery tool it is possible to perform most recovery operations, as well as more complex forensic tasks. It includes a complete build environment, and is capable of using slackware packages. It also includes a pre-built version of chkrootkit (from the slackware project).”

As it provided a build environment, I thought this tool was the best one for this task. Select the Forensic Recovery Tool and press the install button. An email will be sent to you after the system is rebooted and ready to use. This process takes no time.

We need to log in to our little rescue friend now. If you don’t have an ssh client, you can install it with aptitude or apt-get.

aptitude install openssh-client

Now let’s connect to the rescue system:

ssh 82.103.XXX.XXX

 

The Partition Scheme

At this point, we need to plan a partition scheme for our new Etch system. What we’re going to do now is to delete the existing partition scheme and create a new one. We’re going to do so with fdisk.

First of all, this is the partition scheme I had in mind:

/ => /dev/sda5
/home => /dev/sda6
/usr => /dev/sda7
/tmp => /dev/sda8
/var => /dev/sda9
swap => /dev/sda10

Now lets execute fdisk on /dev/sda:

fdisk /dev/sda

We need to erase the existing partitions. To do this, you must press d and then enter the partition number for the partition you want to delete. You’ll have to delete all partitions.

Command (m for help): d
Partition number (1-7): 7

Command (m for help): d
Partition number (1-6): 5

Command (m for help): d
Partition number (1-5): 5

Command (m for help): d
Selected partition 1

Now that you have erased your existing partitions, you need to create your new partition scheme. Press n and then enter e to make a new extended partition. Answer 1 when you’re required to enter a partition number. Next, you’ll be asked about what should be the first cylinder for the extended partition. Default value is 1. Accept it and press enter. Then, you will be asked for the last cylinder. Accept the default value too, and press enter. This will make a new extended partition starting at cylinder 1 to the last cylinder. When you’ve done this, you’ll have to create logical partitions for sda5 through sda10, though sda10 will be our swap.

For setting up the size of the partitions you can answer with cylinders or with size in MB. For answering with MB size, you use the following syntax: for example, 10000M would be 10GB.

In this tutorial I use the cylinder approach, but you’re free to use the M approach also.

Please notice that the first command I enter is p. This should show an empty partition set, as is shown now:

Command (m for help): p

Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

No we create the extended partition.

Command (m for help): n
Command action
e extended
p primary partition (1-4)
e
Partition number (1-4): 1
First cylinder (1-30401, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-30401, default 30401):
Using default value 30401

To create the logical partitions, press n key, and then l. Accept default first cylinder and then for the last cylinder you can either enter the size like in 10000M, or specify the exact last cylinder number. I will enter cylinder numbers.

Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (1-30401, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-30401, default 30401): 366

Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (367-30401, default 367):
Using default value 367
Last cylinder or +size or +sizeM or +sizeK (367-30401, default 30401): 1583

Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (1584-30401, default 1584):
Using default value 1584
Last cylinder or +size or +sizeM or +sizeK (1584-30401, default 30401): 2192

Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (2193-30401, default 2193):
Using default value 2193
Last cylinder or +size or +sizeM or +sizeK (2193-30401, default 30401): 2497

Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (2498-30401, default 2498):
Using default value 2498
Last cylinder or +size or +sizeM or +sizeK (2498-30401, default 30401): 29915

Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (29916-30401, default 29916):
Using default value 29916
Last cylinder or +size or +sizeM or +sizeK (29916-30401, default 30401): 30401

Now you must change /dev/sda10 to Linux swap / Solaris. To accomplish this press t, and select the partition number (10). Then enter 82. This should make /dev/sda10 a swap.

Command (m for help): t
Partition number (1-10): 10
Hex code (type L to list codes): 82

To save changes to the disk, press w key.

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

At this point, we’re finished with fdisk.

You can exit fdisk with q:

Command (m for help): q

This is what my partition scheme looked like when I finished:

Device Boot Start End Blocks Id System
/dev/sda1 1 30401 244196001 5 Extended
/dev/sda5 1 366 2939832 83 Linux
/dev/sda6 367 1583 9775521 83 Linux
/dev/sda7 1584 2192 4891761 83 Linux
/dev/sda8 2193 2497 2449881 83 Linux
/dev/sda9 2498 29915 220235053+ 83 Linux
/dev/sda10 29916 30401 3903763+ 82 Linux swap / Solaris

Install And Configure locales And console-data

aptitude install locales
dpkg-reconfigure locales
aptitude install console-data
dpkg-reconfigure console-data

 

Installing A Kernel And Grub

First, create /etc/kernel-img.conf file with nano and save it with the contents inside the following box.

nano /etc/kernel-img.conf

# Kernel image management overrides
# See kernel-img.conf(5) for details
do_symlinks = yes
relative_links = yes
do_bootloader = no
do_bootfloppy = no
do_initrd = yes
link_in_boot = no

aptitude search linux-image
aptitude install linux-image-2.6.18-4-k7

Now it’s time to install Grub. It’s easy, don’t worry!

cp /proc/mounts /etc/mtab
aptitude install grub
grub-install /dev/sda
update-grub

Now you’ll have to add to more lines to /etc/kernel-img.conf.

This will ensure that /boot/grub/menu.lst is updated when you upgrade or delete a Debian kernel. You must do this, or you may have problems in the future.

nano /etc/kernel-img.conf

postinst_hook = update-grub
postrm_hook   = update-grub

The final /etc/kernel-img.conf should look like this:

# Kernel image management overrides
# See kernel-img.conf(5) for details
do_symlinks = yes
relative_links = yes
do_bootloader = no
do_bootfloppy = no
do_initrd = yes
link_in_boot = no
postinst_hook = update-grub
postrm_hook   = update-grub

 

Making Your Installation More Mature

This is an optional step, but it is recommended that you install standard priority packages. You can do so with tasksel. This occurs in a standard new Etch install, too.

tasksel install standard

 

Installing An SSH Server For Your New System

Remember that you are in a chroot environment. Although you have an open ssh session, an ssh server does not exist yet on your Debian Etch. You must install the openssh-server package.

aptitude install openssh-server

 

Create An Unprivileged User And Set The root Password

At this point you don’t have users on the system. Root is there, but it has no password set. To resolve this issue, you must add an unprivileged user account and set the root password. Change ‘user’ with whatever username you like.

adduser user
passwd root

 

The Installation Has Finished

Exit the chroot environment.

exit

Now reboot the system to your new Debian Etch!

shutdown -r now

 

  • Empresa en linea
  • EasySpeedy

Preparing The Chroot Environment

Enable swap:

mkswap /dev/sda10

swapon /dev/sda10

Format your partitions to ext3:

mke2fs -j /dev/sda5
mke2fs -j /dev/sda6
mke2fs -j /dev/sda7
mke2fs -j /dev/sda8
mke2fs -j /dev/sda9

Mount your formatted partitions.

mkdir /mnt/debian
mount /dev/sda5 /mnt/debian/
mkdir /mnt/debian/home
mkdir /mnt/debian/usr
mkdir /mnt/debian/tmp
mkdir /mnt/debian/var
mount /dev/sda6 /mnt/debian/home
mount /dev/sda7 /mnt/debian/usr
mount /dev/sda8 /mnt/debian/tmp
mount /dev/sda9 /mnt/debian/var

Download and install a basic Debian installation with debootstrap:

mkdir /root/work
cd /root/work
wget http://ftp.ch.debian.org/debian/pool/main/d/debootstrap/debootstrap_0.3.3.2_all.deb
ar -x debootstrap_0.3.3.2_all.deb
cd /
zcat /root/work/data.tar.gz | tar xv
debootstrap –arch i386 etch /mnt/debian/ ftp://ftp.de.debian.org/debian/

Now let’s get in the chroot:

mount -t proc proc /mnt/debian/proc
mount -o bind /dev /mnt/debian/dev
LC_ALL= chroot /mnt/debian /bin/bash
export TERM=xterm-color

Ok, so now we’re in the chroot.

 

Configuring Your Basic System

Edit /etc/fstab:

nano /etc/fstab

The file should look something like this:

# /etc/fstab: información estática de sistema de ficheros.
#
# file system    mount point   type    options                           dump pass
proc             /proc         proc    defaults                            0    0
/dev/sda5        /             ext3    defaults                            0    1
/dev/sda6        /home         ext3    defaults                            0    2
/dev/sda7        /usr          ext3    defaults                            0    2
/dev/sda8        /tmp          ext3    defaults                            0    2
/dev/sda9        /var          ext3    defaults                            0    2
/dev/sda10       none          swap    sw                                  0    0
/dev/fd0         /media/floppy auto    noauto,rw,sync,user,exec            0    0
/dev/cdrom       /media/cdrom  iso9660 udf,iso9660,user,noauto             0    0

For backward compatibility reasons, it is recommended doing this:

cd /media
mkdir cdrom0
ln -s cdrom0 cdrom
cd /
ln -s media/cdrom

Now log in to the EasySpeedy control panel again and click on server details. You should see a lot of information related to the network environment of your server. For editing /etc/networks, you need the IP address that is labeled network.

nano /etc/networks

localnet 82.103.XXX.X

Now, let’s move on to configure /etc/network/interfaces.

nano /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
        address 82.103.XXX.XXX
        netmask 255.255.240.0
        network 82.103.XXX.X
        broadcast 82.103.XXX.XXX
        gateway 82.103.XXX.X
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 82.103.XXX.X
        dns-search easyspeedy.com

nano /etc/resolv.conf

search easyspeedy.com
nameserver 82.103.XXX.X

If you dont want to use UTC (Coordinated Universal Time) enter no as UTC value in the following config file:

editor /etc/default/rcS

#
# /etc/default/rcS
#
# Default settings for the scripts in /etc/rcS.d/
#
# For information about these variables see the rcS(5) manual page.
#
# This file belongs to the "initscripts" package.
TMPTIME=0
SULOGIN=no
DELAYLOGIN=no
UTC=no
VERBOSE=no
FSCKFIX=no
RAMRUN=no
RAMLOCK=no

Now its time to configure your timezone. In my case I selected 2 (for America), and then Santiago (de Chile).

tzconfig

Configure /etc/hostname:

nano /etc/hostname

e82-XXX-1XX-49s

Now it’s /etc/hosts‘ turn.

nano /etc/hosts

127.0.0.1       localhost
82.XXX.XXX.49   e82-XXX-1XX-49s.easyspeedy.com  e82-XXX-1XX-49s
# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

As we will be needing additional software, we must add the Etch repositories to include more packages and security updates.

nano /etc/apt/sources.list

deb http://ftp.de.debian.org/debian/ etch main
deb-src http://ftp.de.debian.org/debian/ etch main
deb http://security.debian.org/ etch/updates main contrib
deb-src http://security.debian.org/ etch/updates main contrib

aptitude update

Comments

comments