Install Gentoo
https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Media
Choosing the right installation medium
https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Media
Download ISO
http://mirrors.stuhome.net/gentoo/releases/amd64/autobuilds/20150820/install-amd64-minimal-20150820.iso
http://mirrors.xmu.edu.cn/gentoo/releases/amd64/autobuilds/20150820/install-amd64-minimal-20150820.iso
Verifying the downloaded files
Windows
http://www.gpg4win.org/download.html
Linux
gpg --recv-keys 0xBB572E0E2D182910
gpg --verify install-amd64-minimal-20141204.iso.DIGESTS.asc
grep -A 1 -i sha512 install-amd64-minimal-20141204.iso.DIGESTS.asc
sha512sum install-amd64-minimal-20141204.iso
Configuring the network
https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Networking
ip addr
net-setup eth0
ping 8.8.8.8
Preparing the disks
https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Disks
fdisk /dev/sda
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 83886079 83884032 40G 5 Extended
/dev/sda5 4096 8392703 8388608 4G 83 Linux
/dev/sda6 8394752 50337791 41943040 20G 83 Linux
/dev/sda7 50339840 83886079 33546240 16G 83 Linux
Applying a filesystem to a partition
mkfs.ext4 /dev/sda6
mkfs.ext4 /dev/sda7
Activating the Swap Partition
mkswap /dev/sda5
swapon /dev/sda5
Mounting
mount /dev/sda6 /mnt/gentoo
mkdir /mnt/gentoo/home
mount /dev/sda7 /mnt/gentoo/home
Installing the Gentoo installation files
https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Stage
For instance, to set the date to March 29th, 16:21 in the year 2014:
date 032916212014
cd /mnt/gentoo
Downloading the stage tarball
links https://www.gentoo.org/downloads/mirrors/
links http://mirrors.stuhome/gentoo/
links http://mirrors.stuhome.net/gentoo/releases/amd64/autobuilds/20150820/stage3-amd64-20150820.tar.bz2
links http://mirrors.stuhome.net/gentoo/snapshots/portage-latest.tar.bz2
tar -xjvf stage3-amd64-20150820.tar.bz2
tar -xjvf portage-latest.tar.bz2 -C usr/
Configuring compile options
nano -w /mnt/gentoo/etc/portage/make.conf
Installing the Gentoo base system
https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Base
Copy DNS info
mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf
Mounting the necessary filesystems
cp -L /etc/resolv.conf /mnt/gentoo/etc/
mount -t proc proc /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --make-rslave /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev
mount --make-rslave /mnt/gentoo/dev
rm /dev/shm && mkdir /dev/shm
mount -t tmpfs -o nosuid,nodev,noexec shm /dev/shm
chmod 1777 /dev/shm
Entering the new environment
chroot . /bin/bash
env-update
source /etc/profile
Configuring portage
export PS1="(chroot) $PS1"
emerge --sync
Choosing the right profile
eselect profile list
eselect profile set 4
nano /etc/portage/make.conf
USE="$USE alsa dvd gnome pluseaudio -kde"
Optional: Using systemd
Timezone
ls /usr/share/zoneinfo
cp /usr/share/zoneinfo/US/Central /etc/localtime
echo "US/Central" > /etc/timezone
emerge --config sys-libs/timezone-data
Configure locales
locale -a | less
nano -w /etc/locale.gen
eselect locale list
eselect locale set 5
nano -w /etc/env.d/02locale
LANG="zh_CN.UTF-8"
LC_COLLATE="C"
locale-gen
env-update && source /etc/profile
Configuring the Linux kernel
https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Kernel
Installing the sources
automatically
emerge gentoo-sources
emerge genkernel # Optional: Building an initramfs
genkernel all # Alternative: Using genkernel
Manually
emerge --ask sys-kernel/gentoo-sources
emerge --ask sys-apps/pciutils
emerge --ask sys-kernel/linux-firmware
ls /boot/kernel*
ls /boot/initramfs*
find /lib/modules/4.0.1-gentoo/ -type f -iname '*.o' -or -iname '*.ko' | less
Configuring the system
nano -w /etc/conf.d/modules
Filesystem information
nano -w /etc/fstab
/dev/sda6 / ext4 noatime 0 1
/dev/sda7 /home ext4 defaults 0 2
/dev/sda5 none swap sw 0 0
/dev/cdrom /mnt/cdrom auto noauto,ro 0 0
Networking information
nano -w /etc/conf.d/hostname
nano -w /etc/hosts # add hostname
nano -w /etc/conf.d/net # config_enp0s3="dhcp"
emerge dhcpcd
cd /etc/init.d/
ln -s net.lo net.enp0s3
rc-update add net.enp0s3 default
System information
passwd
nano -w /etc/conf.d/keymaps
nano -w /etc/conf.d/hwclock
nano -w /etc/locale.gen
env-update && source /etc/profile
export PS1="(chroot) $PS1"
Installing system tools
https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Tools
emerge --ask app-admin/syslog-ng
rc-update add syslog-ng default
emerge --ask sys-process/cronie
rc-update add cronie default
emerge --ask sys-apps/mlocate
rc-update add sshd default
emerge --ask net-misc/dhcpcd
emerge --ask net-dialup/ppp
Configuring the bootloader
https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Bootloader
emerge --ask sys-boot/grub
emerge grub
grub-install /dev/sda
grub2-install /dev/sda
grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-mkconfig -o /boot/grub/grub.cfg
grub -v rootfs /proc/mounts > /etc/mtab
exit
cd /
umount -l /mnt/gentoo/dev{/shm,/pts}
umount -l /mnt/gentoo{/home,/proc}
Finalizing
https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Finalizing
useradd -m -G users,wheel,audio -s /bin/bash nixawk
passwd nixawk
Portage
https://wiki.gentoo.org/wiki/Handbook:AMD64/Working/Portage
https://wiki.gentoo.org/wiki/GENTOO_MIRRORS
mirrorselect -s3 -D -o >> /etc/portage/make.conf
/etc/make.conf
/etc/portage/make.conf
GENTOO_MIRRORS="http://mirrors.xmu.edu.cn/gentoo http://gentoo.netnitco.net http://mirror.bytemark.co.uk/gentoo/ ftp://ftp.mirrorservice.org/sites/distfiles.gentoo.org/"
# for portage
SYNC="rsync://mirrors.xmu6.edu.cn/gentoo-portage"
# for distfile
GENTOO_MIRRORS="http://mirrors.xmu6.edu.cn/gentoo"
genli ~ # cat /etc/portage/repo.postsync.d/gentoo.conf
[gentoo]
location=/usr/postage
sync-type=rsync
sync-uri=rsync://mirrors.xmu6.edu.cn/gentoo-portage
auto-sync=yes
emerge --sync
emerge --search pdf
emerge --searchdesc pdf
emerge --ask app-office/gnumeric
emerge --pretend gnumeric # handles dependencies
emerge --fetchonly gnumeric # download the sources without installing them
emerge -vp alsa-lib
emerge --unmerge
emerge --unmerge gnumeric
emerge --update --ask @world
emerge --update --deep @world
emerge --update --deep --with-bdeps=y @world
SERVICE MANAGEMENT
rc-service sshd start
rc-service sshd stop
rc-service sshd restart
DESKTOP ENVIRONMENT
# emerge -av xorg-server xorg-x11 xorg-drivers udev
emerge x11-base/xorg-server
emerge --ask awesome
~/.xinitrc
exec ck-launch-session dbus-launch --sh-syntax --exit-with-session awesome
mkdir -p ~/.config/awesome
cp /etc/xdg/awesome/rc.lua ~/.config/awesome/
vim ~/.config/awesome/
chmod u+x ~/.xinitrc
startx
References
http://wuyuans.com/2012/12/gentoo-installation/
https://wiki.gentoo.org/wiki/Handbook:AMD64
https://www.gentoo.org/downloads/mirrors/
http://mirrors.xmu.edu.cn/howto/
https://www.gentoo.org.cn/mirrorlist/