Monday, April 7, 2008

Installation of Gentoo Linux 2008.0 Beta 1 with LiveCD

I just started yet another process of installing Gentoo Linux, and following is my record of the installation step by step. Previously I preferred to install from stage 1/3 following this guide. I decided to try LiveCD this time.

1. Boot the machine.

Download the 2008.0 LiveCD from here. Burn the CD and boot the machine with it.

Caveat: in my case, the boot process is stalled. I solved it (according to this article) by appending kernel options during GRUB screen (press e to edit and append all-generic-ide irqpoll pci=nommconf).

2. Installation.

After boot, I click icon "Gentoo Linux Installation (GTK+)" in the desktop.

Partitioning: I selected Recommended Layout.

Local Mounts: accept the defaults without any changes.

Timezone: Asia/Shanghai.

Networking: Dhcp is used. Appropriate host and domain name are provided.

Users: Just add the regular user for daily usage.

Extra Packages: I selected screen and slocate. In my first installation I also selected xorg-x11, gdm, firefox etc. However the installation simply failed when emerging x11-apps/xinit (and I cannot rescue the system since even /etc/fstab is not correctly setup), therefore my second try is quite conservative.

Startup services: I selected sshd.

Other Settings: Although I have not installed X11 or Gnome yet, I selected as following:

  • Display Manager: gdm
  • Clock: local
  • XSession: Gnome

3. Post Installation.

This section is similar as what I have described for coLinux (see here), but is modified specifically for a standalone Gentoo Linux installation.

3.0 Tiny Cleanups.

After rebooting, perform the following steps. Note that if your system was stalled as described before, you can use same trick in GRUB screen and you should add the kernel options to /boot/grub/grub.conf after login.

To avoid some warning, you might need to perform following steps.

# mkdir -p /usr/local/portage

To change host name (according to Gentoo Handbook), edit file /etc/conf.d/hostname, if you call your coLinux machine as tux, then set the following line.

HOSTNAME="tux"

In addition, remove string .\O from file /etc/issue to get rid of the annoying unknown_domain in the welcome message "This is host.unknown_domain ...".

3.1 Network

We have already specified using DHCP. It works but the configuration files is using old syntax. Let's clean it up to avoid future complaints. Edit file /etc/conf.d/net as follows.

config_eth0=( "dhcp" )
3.1.1 Proxy

If you connect to Internet directly, you can skip this section.

To use proxy server, add the following lines into /etc/env.d/99local:

http_proxy="http://proxy.server.com:8080"
ftp_proxy="http://proxy.server.com:8080"

Replace the port and domain name according to your situation. Then run:

env-update && source /etc/profile

3.2 Add additional locales

Modify file /etc/locale.gen, select appropriate locales. For me, the locales are:

en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8

Then run command locale-gen.

3.3 Modify /etc/make.conf

This is specific for your computer type and other factors. Following is my configuration (I'm using a Core 2 Duo CPU). Please refer to Gentoo documentation for your own reference. GENTOO_MIRRORS reflects the fastest mirrors for my connection, as discussed below.

CFLAGS="-march=nocona -O2 -fomit-frame-pointer -pipe -fno-ident"
CXXFLAGS="${CFLAGS}"
CHOST="x86_64-pc-linux-gnu"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j3"
ACCEPT_KEYWORDS="amd64"
FEATURES="parallel-fetch"
LINGUAS="en zh zh_CN"
INPUT_DEVICES="keyboard mouse"
VIDEO_CARDS="i810"
PORTDIR_OVERLAY="/usr/local/portage"
GENTOO_MIRRORS="http://ftp.iij.ad.jp/pub/linux/gentoo/ http://ftp.kaist.ac.kr/pub/gentoo/"

USE_DEV="bash-completion doc emacs latex ruby sbcl source spell"
USE_HW="cpudetection mmx sse sse2"
USE_LIB="curl gd glibc-omitfp ncurses readline zlib"
USE_MM="aac alsa encode ffmpeg flac midi mp3 ogg pulseaudio quicktime theora xvid"
USE_PIC="gif jpeg png raw svg tiff xpm"
USE_SECURITY="crypt pam ssl tcpd"
USE_SW="bzip2"
USE_SYS="cjk nls nptl nptlonly opengl truetype unicode xinerama xml"
USE_X11="cairo gnome gtk X xft xorg"
USE="-* ${USE_DEV} ${USE_HW} ${USE_LIB} ${USE_MM} \
     ${USE_PIC} ${USE_SECURITY} ${USE_SW} ${USE_SYS} ${USE_X11}"

3.4 Synchronize Portage

Use either emerge --sync or emerge-webrsync -v to update the portage.

3.5 Mirror selection

First run emerge mirrorselect. To select the fastest mirror. I use the following command mirrorselect -D -H -s2 to select the mirror. It means that:

  • -D: actual file will be downloaded from the mirror to test speed.
  • -H: test http mirrors only.
  • -s2: only select 2 mirrors.

After running the command, original /etc/make.conf will be backed up as /etc/make.conf.backup and your selected mirrors will be reflected in make.conf. Type mirrorselect -h for details.

3.6 Update system

Run the following suites of commands (we need the -p argument to check what the commands are supposed to do since they're somehow "dangerous"):

emerge -uDNpv world
emerge -uDNv world
emerge --depclean -pv 
emerge --depclean -v
revdep-rebuild -pv
revdep-rebuild -v

Caveat: if you encounter circular dependency when emerge -uDNv world, try to remove gtk USE flag from /etc/make.conf. After successful emerging, add gtk flag again and run emerge -uDNv world again.

After update, run dispatch-conf to update the configuration files.

3.7 Install X11 and GNOME.

Run command emerge xorg-x11 to install X11. Then use xorgcfg -textmode to configure X server.

I'm using a LCD with resolution of 1680x1050, which is not listed in standard configurations. To use it, first run gtf 1680 1050 60, copy the output to the Monitor section of /etc/X11/xorg.conf, and modify section Screen to the resolution 1680x1050.

For GNOME, I prefer to install gnome-light to avoid the gigantic full GNOME installation. To do so, simply run emerge gnome-light.

If one use startx to run X11, one can simply type echo "exec gnome-session" > ~/.xinitrc to configure so.

To make gdm the default login screen, run the following commands:

# emerge gdm
# rc-update add xdm default

And then edit /etc/conf.d/xdm, changing DISPLAYMANAGER to gdm.

3.8 Install Other programs.

This section is left empty intentionally :-)


Conclusion

It is quite convenient to install with LiveCD. There are some hassles during installation, but I assume the reason is that I'm using a beta version. Since beta version is not stable, my suggestion is to install minimal components therefore you can quickly finish the installation and boot from hard drive.

Although GRP install is not so optimal, the pre-compiled packages should be quite close to optimal ones for 64-bit machines. Also as a Gentoo user, I'm always in the process of customization the OS to suit my needs, therefore a not-so-ideal-initial-setup is not an issue. In summary, livecd approach can save a lot of time, with almost similar end result as installing from stage 1/3.

2 comments:

  1. nice guide, its refreshing to see a gentoo user giving a little praise to the gtk installer instead of bashing it to death ;]

    ReplyDelete
  2. @talonz: this is the first time I use GTK installer. It actually crashed several times, each time in a different location; and I have to restart from scratch each time. But I finally managed to install it. Hope the final version will be more stable. Graphical installer can save you a lot of time if it is robust.

    ReplyDelete