Home » Misc » Install Gentoo Linux from a USB Disk …

Install Gentoo Linux from a USB Disk

— Last modified: xiaoke das.xiaoke@hotmail.com 2016/01/04 10:33

For those who wish to install Gentoo, I really recommend Arch. Arch has much better documentation, which in turn makes its installation less painful.

Creating the bootable USB Disk

Download the livecd file, then execute

# dd if=/path/to/livecd.iso of=/dev/sdb

on an existing Linux machine (you must have the root privileges).

Install Arch

  1. Boot the target computer with the live USB disk. Then you will boot into a command line interface (CLI). No installation program is provided (unlike Ubuntu).
  2. Create partitions, do as you like. But pay attention not to erase the whole disk if you do not intend to do so. fdisk can be helpful, if you want to list the existing partitions, or manipulate them, but be careful. According to the documentation, it seems that partitions for boot, /, swap are essential, but you can also create a partition for home.
  3. Start a terminal, execute the following commands. Assume sda11 is the partition for /, sda13 for boot, sda12 for home, sda6 for swap
# mkfs.ext2 /dev/sda13
# mkfs.ext4 /dev/sda12
# mkfs.ext4 /dev/sda11
# mount /dev/sda11 /mnt
# mkdir /mnt/boot
# mkdir /mnt/home
# mount /dev/sda13 /mnt/boot
# mount /dev/sda12 /mnt/home
# swapon /dev/sda6
# dhcpcd enp0s25
# ping -c 3 8.8.8.8
# pacstrap /mnt base
# genfstab -p /mnt >> /mnt/etc/fstab
# arch-chroot /mnt
# vi /etc/hostname
# ln -s /usr/share/zoneinfo/Europe/London /etc/localtime
# vi /etc/locale.gen (then uncomment en_GB.UTF-8 UTF-8)
# locale-gen
# vi /etc/locale.conf (create this file and put the following content)
LANG="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"

(I am not quite sure whether the following file vconsole.conf is needed or not, it's been reported that this file caused 'backspace' problems on virtualbox virtual machines and thus should not be created.)

# vi /etc/vconsole.conf (create this file and put the following content)
KEYMAP=us
FONT=Lat2-Terminus16
FONT_MAP=8859-2
# mkinitcpio -p linux
# passwd
# exit  (exit from the chrooted environment)

Then, install and configure a bootloader, I didn't do that by simply boot into Ubuntu, which is another existing Linux dist and execute

update-grub

, then the grub for ubuntu can automatically find Arch.

# umount /mnt/{boot,home,}

If a brand-new bootloader has to be installed, I haven't been able to work out grub, but syslinux can be used instead. Simply run

# pacman -S syslinux gptfdisk
#syslinux-install_update -i -a -m

It may also be useful to check the configuration file generated at /boot/syslinux/syslinux.cfg and see whether the boot entry has the intended disk partition.

Then reboot, and login with root.

 # useradd -m -g users -G wheel -s /bin/bash xy248 
# passwd xy248
# dhcpcd enp0s25
# pacman -S alsa-utils
# pacman -S xf86-video-nv
# pacman -S kdebase-workspace
# pacman -S archlinux-themes-kdm

the above kde packages have been deprecated, use the following commands instead

# pacman -S plasma-meta
# systemctl enable dhcpcd.service
# pacman -S iw wpa_supplicant
# pacman -S xorg-server xorg-server-utils xorg-xinit
# pacman -S xf86-video-vesa
# pacman -S xf86-input-synaptics
# pacman -S nvidia
# nvidia-xconfig
# pacman -S vim
# systemctl enable kdm
$ cp /etc/skel/.xinitrc ~/.xinitrc
$ vim ~/.xinitrc (add exec startkde)
$ startx

Now I have a basic Arch Linux running KDE, but I know more problems will follow.

Misc tunings

sudo

pacman -S sudo

then add the following to /etc/sudoers

 xy248   ALL=(ALL) ALL 

Nvidia backlight (brightness)

Edit /etc/X11/xorg.conf, add under section Device:

 Option "RegistryDwords" "EnableBrightnessControl=1" 

Mixer in the tray

sudo pacman -S kdemultimedia-kmix 

Network

I haven't worked out how the graphical interface can be used. The following gives the command line. Command iw only works for wireless network with WEP standard or no security support. If the target network has WPA security standard, you'll have to switch to something else, e.g. wpa_applicant. The following gives configurations for both First, turn on the wifi

# ip link set dev wlp3s0 up 

for iw, use the following to connect

# iw dev wlp3s0 scan | less
# iw dev wlp3s0 connect your_essid key 0:your_key

for wpa_applicant, use the following

sudo wpa_supplicant -i wlp3s0 -c wpa_supplicant.conf

wpa_supplicant.conf is generated by

wpa_passphrase essid password > wap_supplicant.conf

then, we need to bound wlp3s0 with a dhcp client.

sudo dhcpcd wlan0