Contents
- 1 Boot into the LiveDVD
- 2 Create your filesystems
- 3 Copy the DVD to your new filesystem
- 4 Configure the new system
- 4.1 Bind the LivDVD proc and dev filesystems to the new filesystem
- 4.2 Chroot in to the new filesystem
- 4.3 Remove the autoconfig service from default boot otherwise your root password is reset every time it starts
- 4.4 Configure FSTAB
- 4.5 Copy kernel image and initramfs from the LiveDVD to your new system
- 4.6 Configure and install GRUB
- 5 reboot in to your newly installed Gentoo System
Boot into the LiveDVD
From Terminal, become root
sudo su -
Create your filesystems
Partition the HDD
- If your harddrive is larger then 2TB, you'll have to use "parted".
- If your harddrive is less them 2TB, you can use "fdisk" (which is a little easier).
- If you are not familiar with partitioning your harddrive in Linux, refer to the Gentoo Handbook for more information and directions.
- Using parted to Partition your Disk
- Using fdisk to Partition your Disk
fdisk /dev/sda
- Create a primary partition for boot (/boot) that is 512M. E.g.
Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-62914559, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-62914559, default 62914559): +512M Partition 1 of type Linux and of size 512 MiB is set
- Create a swap partition (usually somewhere between 512M and 2G). E.g.
Command (m for help): n Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): p Partition number (1-4, default 2): 2 First sector (1050624-62914559, default 1050624): Using default value 1050624 Last sector, +sectors or +size{K,M,G} (1050624-62914559, default 62914559): +2G Partition 2 of type Linux and of size 2 GiB is set
- Create a primary partition for the root filesystem (/) that is at least 15G. E.g.
Command (m for help): n Partition type: p primary (2 primary, 0 extended, 2 free) e extended Select (default p): p Partition number (1-4, default 3): 3 First sector (5244928-62914559, default 5244928): Using default value 5244928 Last sector, +sectors or +size{K,M,G} (5244928-62914559, default 62914559): Using default value 62914559 Partition 3 of type Linux and of size 27.5 GiB is set
- Write the changes to the disk using "w". E.g.
Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. Gentoo-2012 ~ #
Format the filesystems
mkfs.ext2 -L BOOT /dev/sda1
mkswap /dev/sda2
mkfs.ext4 -L ROOT /dev/sda3
Mount the filesystems
mount /dev/sda3 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/sda1 /mnt/gentoo/boot
Copy the DVD to your new filesystem
- Will take around 12GB
eval `grep '^ROOT_' /usr/share/genkernel/defaults/initrd.defaults`
cd /
cp -avx /$ROOT_LINKS /mnt/gentoo
cp -avx /$ROOT_TREES /mnt/gentoo
mkdir /mnt/gentoo/proc
mkdir /mnt/gentoo/dev
mkdir /mnt/gentoo/sys
mkdir -p /mnt/gentoo/run/udev
Then run these two commands... tar cvf - -C /dev/ . | tar xvf - -C /mnt/gentoo/dev/
tar cvf - -C /etc/ . | tar xvf - -C /mnt/gentoo/etc/
- You might want to drop the "-v"s on the cp operations in order to not jam important error messages.
- Apparently due to the underlying aufs messing up inode numbers, it has been observed that cp attempts to make hardlinks in strange places.
- If you encounter this, try copying the affected subtrees once more, over the first attempt.
- If the copyin' failes (ex. /emul) - then remove the folder name (ex. emul) in /usr/share/genkernel/defaults/initrd.defaults
Configure the new system
Bind the LivDVD proc and dev filesystems to the new filesystem
mount -t proc none /mnt/gentoo/proc
mount -o bind /dev /mnt/gentoo/dev
Chroot in to the new filesystem
chroot /mnt/gentoo /bin/bash
env-update && source /etc/profile
cd /dev
rm null
mknod console c 5 1
chmod 600 console
mknod null c 1 3
chmod 666 null
mknod zero c 1 5
chmod 666 zero
Remove the autoconfig service from default boot otherwise your root password is reset every time it starts
rc-update del autoconfig default
rc-update del fixinittab boot
Configure FSTAB
File: nano -w /etc/fstab
/dev/sda3 / ext4 defaults,noatime 1 1 /dev/sda1 /boot ext2 defaults,noatime 1 2 /dev/sda2 none swap sw 0 0 /dev/cdrom /mnt/cdrom auto noauto,user 0 0 proc /proc proc defaults 0 0 shm /dev/shm tmpfs nodev,nosuid,noexec 0 0
Copy kernel image and initramfs from the LiveDVD to your new system
mkdir -p /mnt/cdrom/
mount /dev/cdrom /mnt/cdrom/
cp /mnt/cdrom/boot/gentoo /boot/kernel
cp /mnt/cdrom/boot/gentoo.igz /boot/initramfs
Configure and install GRUB
File: nano -w /boot/grub/grub.conf
default 0 timeout 30 title Gentoo Linux root (hd0,0) kernel /boot/kernel real_root=/dev/sda3 vga=791 splash=silent,theme:livecd-12.0 console=tty1 quiet initrd /boot/initramfs
grub
grub> root (hd0,0)
grub> setup (hd0)
grub> quit