Diff for "Installation/OverSSH"


Differences between revisions 2 and 44 (spanning 42 versions)
Revision 2 as of 2006-10-25 13:51:48
Size: 423
Editor: DSL01
Comment:
Revision 44 as of 2011-05-31 16:43:31
Size: 5743
Editor: cpc1-seac10-0-0-cust324
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
/!\ This is a work in progress, this means that I'm on it right now, it is not finished yet and it may breake your system!

==Partitioning==

{{{
fdisk /dev/hda
}}}


{{{
mkdir /mnt/ubuntu
}}}

{{{
mount -t ext3 /dev/hda1 /mnt/ubuntu
/!\ This is a work in progress, it is not mature yet and it may break your system!

== Caveat ==
As you may already have guessed following this instruction may break your system and you are on your own to fix it again.
apt-get install linux-image-686
== Scenario ==
This instruction describes how to install Ubuntu on a dedicated server over ssh. I assume that your provider provides you with a rescue system from which you can boot and prepare your system. An Online replacement is possible, but it is some more work and a lot more risky if things go bad (the basic idea is to temporarily disable your swap and install a transitional system on it).

== Preparing the Hard Disk ==
=== Partitioning ===
Use {{{fdisk}}} to partition your hard disk.
{{{
# fdisk /dev/hda
}}}

Remember to set the root partition bootable!

For the rest of this instruction we assume the following partition layout.
{{{
/dev/hda1 (83 Linux) - for /,
/dev/hda2 (82 Linux swap) - as swap
}}}

=== Creating File Systems ===
Below is how we get our / populated with ext3.
{{{
# mke2fs -j /dev/hda1
}}}

And the same for our swap partition.
{{{
# mkswap /dev/hda2
# sync; sync; sync
# swapon /dev/hda2
}}}



== The Base System ==

=== Mounting Root ===
{{{
# mkdir /mnt/ubuntu
# mount -t ext3 /dev/hda1 /mnt/ubuntu
}}}

=== Getting Debootstrap ===
Debootstrap is a collection of scripts that we will use in the next step to set up a base system. We need an appropriate version of {{{debootstrap}}} from http://archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/ to make this work.

Make sure that {{{binutils}}} is installed on your system.

On an apt based system we can use {{{dpkg}}} to install it.
{{{
# wget http://archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap_1.0.32_all.deb
# dpkg -i debootstrap_0.3.3.0ubuntu2_all.deb
}}}

If your current system is rpm based, use alien to install it or find a rpm on the web (http://azhrarn.underhanded.org/debootstrap-0.2.23-1.i386.rpm).

If your system is neither, this might work.
{{{
# mkdir /work; cd /work
# wget http://archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap_0.3.3.0ubuntu2_all.deb
# ar -xf debootstrap-udeb_0.3.3.0ubuntu7_i386.udeb
# cd /
# tar zxvf work/data.tar.gz
}}}




=== Installing the Base System ===
{{{
# /usr/sbin/debootstrap --arch i386 dapper /mnt/ubuntu http://archive.ubuntu.com/ubuntu
}}}

(arch may be different for you, e.g. amd64, hppa, ia64, powerpc, or sparc)

== Basic Configuration ==
=== Set the Hostname ===
Change HOSTNAME to whatever suits your environment.
{{{
# echo HOSTNAME > /mnt/ubuntu/etc/hostname
}}}

=== fstab ===
{{{
# vim /mnt/ubuntu/etc/fstab
}}}

Put the following in fstab:
{{{
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/hda1 / ext3 defaults,errors=remount-ro 0 1
/dev/hda2 none swap sw 0 0
}}}

=== Networking ===
Make sure to use your network details instead.
{{{
## /mnt/ubuntu/etc/network/interfaces

#Network Config:
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 10.0.0.10
        network 10.0.0.0
        broadcast 10.0.0.255
        gateway 10.0.0.1
        netmask 255.255.255.0
}}}

Make sure to use your hostname and domain.
{{{
## /mnt/ubuntu/etc/hosts
127.0.0.1 localhost
127.0.0.1 hostname.domain.tld hostname
}}}

You need a valid resolv.conf with at least one valid nameserver, e.g.:

{{{
## /mnt/ubuntu/etc/resolv.conf
nameserver 10.0.0.1
}}}


== Enter the new environment ==
Before we chroot into the new environment we need to mount /proc and /dev
{{{
Line 18: Line 141:
}}}

===Chrooting===
{{{
chroot /mnt/ubuntu /bin/bash
}}}


===Installing GRUB===
{{{
}}}
LANG= chroot /mnt/ubuntu /bin/bash
}}}

=== Change the root password ===
It is just bad if you forget this, so just ....
{{{
# passwd
}}}

=== Create a user and switch shadow password on ===
{{{
# dpkg-reconfigure --default-priority passwd
}}}

== Installing Packages ==

{{{
# apt-get update
}}}

=== Installing OpenSSH Server ===
{{{
# apt-get install openssh-server
}}}

=== Install a Kernel ===
Choose the right kernel for your architecture. I go with:
{{{
# apt-get install linux-image-686
}}}

=== RAID ===

{{{
apt-get install mdadm
}}}

=== Reboot ===

{{{
# exit
# cd /
}}}

{{{
# umount /mnt/ubuntu/proc
# umount /mnt/ubuntu/dev
# umount /mnt/ubuntu
# reboot
}}}


== Finishing ==
After the reboot ssh in again.

=== Generate locales ===
{{{
# locale-gen en_US.UTF-8
# echo 'LANG="en_US.UTF-8"' >> /etc/environment
# echo 'LANGUAGE="en_US:en"' >> /etc/environment
}}}

=== Install some more packages ===
{{{
apt-get install ubuntu-standard
}}}

== References ==
 * [[Installation/FromKnoppix]]

 * [[http://www.gentoo.org/doc/en/handbook/handbook-x86.xml|The Gentoo Handbook]] contains a very good (Gentoo specific) [[http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1|instruction on chrooted installation procedures]].

 * [[http://doc.ubuntu.com/ubuntu/install/i386/apds03.html|An other instruction]] from the [[http://doc.ubuntu.com/ubuntu/install/i386/index.html|Ubuntu Installation Guide]] is somewhat outdated and has shortcomings related to the bootloader installation.
 
 * [[http://www.underhanded.org/papers/debian-conversion/remotedeb.html|HOWTO - Install Debian Onto a Remote Linux System]] - A Debian specific HOWTO.

Warning /!\ This is a work in progress, it is not mature yet and it may break your system!

Caveat

As you may already have guessed following this instruction may break your system and you are on your own to fix it again. apt-get install linux-image-686

Scenario

This instruction describes how to install Ubuntu on a dedicated server over ssh. I assume that your provider provides you with a rescue system from which you can boot and prepare your system. An Online replacement is possible, but it is some more work and a lot more risky if things go bad (the basic idea is to temporarily disable your swap and install a transitional system on it).

Preparing the Hard Disk

Partitioning

Use fdisk to partition your hard disk.

# fdisk /dev/hda

Remember to set the root partition bootable!

For the rest of this instruction we assume the following partition layout.

/dev/hda1 (83  Linux)        - for /, 
/dev/hda2 (82  Linux swap)   - as swap

Creating File Systems

Below is how we get our / populated with ext3.

# mke2fs -j /dev/hda1

And the same for our swap partition.

# mkswap /dev/hda2
# sync; sync; sync
# swapon /dev/hda2

The Base System

Mounting Root

# mkdir /mnt/ubuntu
# mount -t ext3 /dev/hda1 /mnt/ubuntu

Getting Debootstrap

Debootstrap is a collection of scripts that we will use in the next step to set up a base system. We need an appropriate version of debootstrap from http://archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/ to make this work.

Make sure that binutils is installed on your system.

On an apt based system we can use dpkg to install it.

# wget http://archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap_1.0.32_all.deb
# dpkg -i debootstrap_0.3.3.0ubuntu2_all.deb

If your current system is rpm based, use alien to install it or find a rpm on the web (http://azhrarn.underhanded.org/debootstrap-0.2.23-1.i386.rpm).

If your system is neither, this might work.

# mkdir /work; cd /work
# wget http://archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap_0.3.3.0ubuntu2_all.deb
# ar -xf debootstrap-udeb_0.3.3.0ubuntu7_i386.udeb
# cd /
# tar zxvf work/data.tar.gz

Installing the Base System

# /usr/sbin/debootstrap --arch i386 dapper /mnt/ubuntu http://archive.ubuntu.com/ubuntu

(arch may be different for you, e.g. amd64, hppa, ia64, powerpc, or sparc)

Basic Configuration

Set the Hostname

Change HOSTNAME to whatever suits your environment.

# echo HOSTNAME > /mnt/ubuntu/etc/hostname

fstab

# vim /mnt/ubuntu/etc/fstab

Put the following in fstab:

# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
/dev/hda1       /               ext3    defaults,errors=remount-ro 0       1
/dev/hda2       none            swap    sw              0       0

Networking

Make sure to use your network details instead.

## /mnt/ubuntu/etc/network/interfaces

#Network Config:
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 10.0.0.10
        network 10.0.0.0
        broadcast 10.0.0.255
        gateway 10.0.0.1
        netmask 255.255.255.0

Make sure to use your hostname and domain.

## /mnt/ubuntu/etc/hosts
127.0.0.1   localhost
127.0.0.1   hostname.domain.tld hostname

You need a valid resolv.conf with at least one valid nameserver, e.g.:

## /mnt/ubuntu/etc/resolv.conf
nameserver 10.0.0.1

Enter the new environment

Before we chroot into the new environment we need to mount /proc and /dev

mount -t proc none /mnt/ubuntu/proc
mount -o bind /dev /mnt/ubuntu/dev
LANG= chroot /mnt/ubuntu /bin/bash

Change the root password

It is just bad if you forget this, so just ....

# passwd

Create a user and switch shadow password on

# dpkg-reconfigure --default-priority passwd

Installing Packages

# apt-get update

Installing OpenSSH Server

# apt-get install openssh-server

Install a Kernel

Choose the right kernel for your architecture. I go with:

# apt-get install linux-image-686

RAID

apt-get install mdadm

Reboot

# exit
# cd /

# umount /mnt/ubuntu/proc
# umount /mnt/ubuntu/dev
# umount /mnt/ubuntu
# reboot

Finishing

After the reboot ssh in again.

Generate locales

# locale-gen en_US.UTF-8
# echo 'LANG="en_US.UTF-8"' >> /etc/environment
# echo 'LANGUAGE="en_US:en"' >> /etc/environment

Install some more packages

apt-get install ubuntu-standard

References

Installation/OverSSH (last edited 2011-05-31 16:43:31 by cpc1-seac10-0-0-cust324)