« Previous - Version 3/4 (diff) - Next » - Current version
Vlad Glagolev, 05/15/2012 04:18 pm


ChrootInstallGuide

Here's a complete guide to install Source Mage GNU/Linux using chroot tarballs.

Contents

What?

Chroot image -- is a compressed archive of a live system. It contains everything you need to extract on your disk and start using Source Mage.
Here we have a few official images to start with, which contain all the essential programs and libraries to boot from any modern hardware and specific networking setup (PPPoE, Wi-Fi, etc.).
It is usually based on specific Grimoire release, and inside our project is used for testing purposes and Grimoire upgrading process.

The latest stable version is 20120510 (based on 0.60-stable Grimoire). Download links for both architectures:

Master mirror: Original mirror (FTP links are also available respectively):

NOTE: this release uses Linux version 3.0.0.

How?

Chroot image is just an archive, so to make your system up and running, you need to boot from some LiveCD/LiveUSB/LiveLAN Linux-based media to partition your drive, extract image, install bootloader and configure some basic stuff like network interface, hostname, etc.
These steps will help you to do so in a proper order:

1. Get some bootable media

It can be our installation ISO, any compact (I hope so :) Linux media distribution image, or even ISO of Mathieu's favourite operating system ever.

Personally I recommend Arch Netinstall Image. It supports all modern hardware, and it's easy to find the nearest mirror to you and to get it pretty quickly. Also Archboot is perfect for booting via network (PXE).
But, as told above, it can be any Linux boot media you'd like to use.

2. Boot it

Burn ISO image or ``dd'' prepared boot image to USB-key, or prepare TFTP-server to boot via network, and boot into its minimal environment.

3. Get chroot image

Almost all modern Linux distributions support network configuration and have download programs available when boot process is complete.
So it's usually not a problem. Though if you don't have (or you know that you won't have Internet-connection inplace for some reason) such ability, you can put desired chroot image on USB-key, or CD/DVD disc.

Let's imagine there's no trouble with our Ethernet adapter, and we know how networking works in Linux on a very basic level :)

# ifconfig eth0 1.2.3.4 netmask 255.255.255.0
# route add default gw 5.6.7.8
# echo "nameserver 9.10.11.12" > /etc/resolv.conf
# wget http://download.sourcemage.org/image/official/smgl-stable-0.60-basesystem-x86_64.tar.bz2

4. Partition your drive

This is done mostly with fdisk and/or parted. Disk drives (SATA) are usually /dev/sda, /dev/sdb, etc., but that completely depends on hardware (for example it could be /dev/cciss/c0d0 if you know what SMART RAID Controller is).

More complex disk setup (RAID/LVM) is also fine, but out of the topic.

Here we start:

# parted /dev/sda
> mklabel gpt
> unit mb
> mkpart primary 0g 128
> mkpart primary 128 2048
> mkpart primary 2048 4096
> mkpart primary 4096 6000
> mkpart primary 6000 8000
> mkpart primary 8000 20000
> mkpart primary 20000 -1
> name 1 boot
> toggle 1 boot
> name 2 swap
> name 3 root
> name 4 home
> name 5 temp
> name 6 usr
> name 7 var

look at them:

> p free

and quit parted:

> quit
#

then create filesystems on these partitions (in example below we use XFS for /):

# mkfs.xfs -l internal,size=64m -d agcount=8 /dev/sda3

swap is organised with mkswap command:

# mkswap /dev/sda2

5. Mount partitions

Now you're almost ready to extract Source Mage from chroot image. The last step before it is to mount partitions you've made in the previous step:

# mkdir /mnt/drive
# mount /dev/sda3 /mnt/drive
# mkdir /mnt/drive/{boot,home,tmp,usr,var}
# mount /dev/sda1 /mnt/drive/boot
# swapon /dev/sda2
# mount /dev/sda4 /mnt/drive/home
# mount /dev/sda5 /mnt/drive/tmp
# mount /dev/sda6 /mnt/drive/usr
# mount /dev/sda7 /mnt/drive/var

6. Extract from chroot

Finally, assuming you've downloaded x86_64 chroot image to writable /root directory, extract it to your future mainspace:

# cd /mnt/drive
# tar xvjf /root/smgl-stable-0.60-basesystem-x86_64.tar.bz2

Done!

7. Finalize installation

Here are few final steps that were mentioned at the beginning of this guide.

  • Prepare chroot environment
# mount --bind /dev /mnt/drive/dev
# mount --bind /sys /mnt/drive/sys
# mount -t proc none /mnt/drive/proc
# mount -t devpts none /mnt/drive/dev/pts
  • Chroot into it
# chroot /mnt/drive
  • Set root password
# passwd root

NOTE: don't skip this substep. Root password in chroot images isn't installed. No, it doesn't mean you can login with empty password, it means you won't be able to login at all.

  • Configure network and set hostname

This is usually done with editing /etc/network/interfaces file. For more info see interfaces(5).
For simple setups there's already a template where you only need to replace 'X'-values with real IPs of machine's primary address, netmask and default route.

To set your hostname type this:

# echo "yourhostname.yourdomain.tld" > /etc/hostname
# echo "yourdomain.tld" > /etc/defaultdomain

DNS servers are located in /etc/resolv.conf file.
Chroot images use Comodo's as primary and Google's as secondary DNS server. Feel free to use desired/own ones.

  • Set up static information about the filesystems

Edit /etc/fstab file according to your disk setup in step №4:

# nano /etc/fstab
  • Install bootloader

Chroot images come with 2 bootloaders: LILO and GRUB2. Feel free to use any.
For example there's ready /etc/lilo.conf, where you only need to check 'root=' and 'boot=' values and install it to HDD:

# nano /etc/lilo.conf
# lilo -A /dev/sda 1
# lilo
  • Configure your localization settings

Chroot images come with only one locale -- en_US, and use UTF-8 version of it by default.
If you need to change it, type:

# cast -r locale

select those you want, and then -- change LANG variable in /etc/sysconfig/locale file to the one you'd like to use.

By default timezone is set to UTC. To change it, you need to choose timezone file and symlink it with /etc/localtime.
For example to set GMT-4 timezone:

# ln -sf /usr/share/zoneinfo/Etc/GMT-4 /etc/localtime

All timezone files are located in /usr/share/zoneinfo directory.

  • Get back to real environment

This is usually done with 'CTRL+D' or by typing:

# exit

8. Reboot

Now you're ready to boot into Source Mage GNU/Linux system, so type:

# reboot

and follow post-boot recommendations.

Don't forget to set HDD as a primary media in boot priority list of BIOS.

9. Report

Feel free to report back, comment and yell on this guide by dropping me a mail to or notifying me on IRC.