Wiki
Gentoo Linux is a computer operating system based on the Linux kernel and built using the Portage package management system. It is distributed as free and open source software. Unlike a binary software distribution, the source code is compiled locally according to the user's preferences and is often optimized for the specific type of computer. Precompiled binaries are available for some very large packages and for packages whose source code has not been released.
The "Gentoo" name comes from the fast-swimming Gentoo penguin. It was chosen to reflect the potential speed improvements of machine-specific optimization. Gentoo package management is designed to be modular, portable, easy to maintain, and flexible. Gentoo is sometimes described as a meta-distribution, "because of its near-unlimited adaptability", in that the majority of users have configurations and sets of installed programs which are unique to themselves.
Gentoo Linux Official Website www.gentoo.org
- Pure text manually configure system parameters, the kernel, and the GRUB boot, enables personal customization. I have a more profound understanding Linux installation.
- Built-in emerge installation tool, it's very similar to other Linux family systems apt-get and yum and other automated installation tools, it's an online source automatically find the source and its dependencies installed fully automatic compilation tool, eliminates various problems associated with the novice compiler installation process in.
- All file in system root directory and systems software can be download online, customize it more convenient.
Environment
VMware Fusion Professional Version 6.0.3 (1747349)
Part 1 Preparation
Download Gentoo desired boot image and system files archive.
- install-amd64-minimal-20140403.iso
- stage3-amd64-20140403.tar.bz2
- portage-latest.tar.bz2
Download From Sohu(China) Mirror
http://mirror.sohu.com/gentoo/releases/amd64/current-iso/
http://mirror.sohu.com/gentoo/releases/snapshots/current/
http://mirror.sohu.com/gentoo/releases/amd64/current-iso/
Configure VMware Virtual Machine Boot System Image
Select Other Linux 3.x kernel
Part 2 Installation System
Into System Boot Interface by press Enter:
gentoo dopcmcia
Into Livecd Temporary Boot
In this system, we can simple configure the system that we wanna installed, such as a simple network configuration connection, the system partition, compile the kernel driver, system boot production, etc.
Configure Root Account
livecd ~ # passwd root
Open SSH Service
livecd ~ # /etc/init.d/sshd start
Check Network Configure
livecd ~ # ifconfig
Because I install Gentoo in VMware virtual machine, so the network interface names is different with common interfaces eth0, please note here.
SSH Login Shell
Last login: Fri Apr 25 18:07:24 on ttys000 xuris-MacBook-Pro:~ xuri$ ssh -l root 172.16.184.146 Password: Welcome to the Gentoo Linux Minimal Installation CD! The root password on this system has been auto-scrambled for security. If any ethernet adapters were detected at boot, they should be auto-configured if DHCP is available on your network. Type "net-setup eth0" to specify eth0 IP address settings by hand. Check /etc/kernels/kernel-config-* for kernel configuration(s). The latest version of the Handbook is always available from the Gentoo web site by typing "links http://www.gentoo.org/doc/en/handbook/handbook.xml". To start an ssh server on this system, type "/etc/init.d/sshd start". If you need to log in remotely as root, type "passwd root" to reset root's password to a known value. Please report any bugs you find to http://bugs.gentoo.org. Be sure to include detailed information about how to reproduce the bug you are reporting. Thank you for using Gentoo Linux! livecd ~ #
Disk Partition
20GB virtual machine hard disk partition.
/dev/sda1 /Boot 200M /dev/sda2 swap 1024M /dev/sda3 / Remaining Space
Use fdisk Partition
livecd ~ # fdisk -l Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes livecd ~ # fdisk /dev/sda Welcome to fdisk (util-linux 2.22.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0x0673cff2. Command (m for help): p Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0673cff2 Device Boot Start End Blocks Id System 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-41943039, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +200M Partition 1 of type Linux and of size 200 MiB is set 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 (411648-41943039, default 411648): Using default value 411648 Last sector, +sectors or +size{K,M,G} (411648-41943039, default 41943039): +1024M Partition 2 of type Linux and of size 1 GiB is set 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 (2508800-41943039, default 2508800): Using default value 2508800 Last sector, +sectors or +size{K,M,G} (2508800-41943039, default 41943039): Using default value 41943039 Partition 3 of type Linux and of size 18.8 GiB is set Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
Reload Partition Table
livecd ~ # partx -a /dev/sda
Formatted as ext4 File System
livecd ~ # mkfs.ext4 /dev/sda1 mke2fs 1.42.7 (21-Jan-2013) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) Stride=0 blocks, Stripe width=0 blocks 51200 inodes, 204800 blocks 10240 blocks (5.00%) reserved for the super user First data block=1 Maximum filesystem blocks=67371008 25 block groups 8192 blocks per group, 8192 fragments per group 2048 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729 Allocating group tables: done Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done livecd ~ # mkfs.ext4 /dev/sda3 mke2fs 1.42.7 (21-Jan-2013) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 1234576 inodes, 4929280 blocks 246464 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=4294967296 151 block groups 32768 blocks per group, 32768 fragments per group 8176 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done
Formatting & Activate Swap Partition
ivecd ~ # mkswap /dev/sda2 Setting up swapspace version 1, size = 1048572 KiB no label, UUID=a0f1720d-ffdc-4ed9-aaf2-19fa6601a692 livecd ~ # swapon /dev/sda2 livecd ~ # swapon -s Filename Type Size Used Priority /dev/sda2 partition 1048572 0 -1
Create System Temporary Mount Point
livecd ~ # mount /dev/sda3 /mnt/gentoo livecd ~ # mkdir /mnt/gentoo/boot livecd ~ # mount /dev/sda1 /mnt/gentoo/boot
Set System Time
livecd ~ # date 042518482014 Fri Apr 25 18:48:00 UTC 2014
Download System Compiler Package to /mnt/gentoo Directory
Here I use the host SCP upload.
xuris-MacBook-Pro:Downloads xuri$ scp /Volumes/Western\ Digital/Dow nloads/portage-latest.tar.bz2 [email protected]:/mnt/gentoo Password: portage-latest.tar.bz2 100% 66MB 22.2MB/s 00:03 xuris-MacBook-Pro:Downloads xuri$ scp /Volumes/Western\ Digital/Dow nloads/stage3-amd64-20140403.tar.bz2 [email protected]:/mnt/gentoo Password: stage3-amd64-20140403.tar.bz2 100% 177MB 19.6MB/s 00:09
After Download
livecd ~ # cd /mnt/gentoo livecd gentoo # ls boot lost+found portage-latest.tar.bz2 stage3-amd64-20140403.tar.bz2
Unzip File
livecd ~ # tar jxvf stage3-amd64-20140403.tar.bz2 livecd ~ # tar jxvf portage-latest.tar.bz2 -C /mnt/gentoo/usr
Switching Systems /dev/sda3 Root Partition & Update System Environment Variables
livecd gentoo # mount -t proc none /mnt/gentoo/proc livecd gentoo # mount -o bind /dev /mnt/gentoo/dev livecd gentoo # chroot /mnt/gentoo /bin/bash livecd / # env-update >>> Regenerating /etc/ld.so.cache... livecd / # source /etc/profile livecd / # export PS1="(chroot) $PS1"
Set Timezone
(chroot) livecd / # cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
Set Hostname
(chroot) livecd / # sed -i -e's/hostname.*/hostname="gentoo.example.com"/' /etc /conf.d/hostname (chroot) livecd / # echo "127.0.0.1 gentoo.example.com localhost" > /etc/hosts
Set DNS Server
(chroot) livecd / # echo "nameserver 172.16.184.2" >> /etc/resolv.conf
Kernel Configuration
Installing Kernel Source
(chroot) livecd / # emerge gentoo-sources
Installation Automatic Compile Kernel Tools
(chroot) livecd / # emerge genkernel
Copy the installation disc configuration file to the default location of the configuration file genkernel search.
(chroot) livecd / # zcat /proc/config.gz > /usr/share/genkernel/arch/x86_64/ker nel-config
Run genkernel
(chroot) livecd / # cd /usr/src (chroot) livecd src # mv linux linux.bak (chroot) livecd src # ln -s linux-3.12.13-gentoo linux (chroot) livecd src # genkernel all
If compiled successfully, you can see info like this
... * >> Appending base_layout cpio data... * >> Appending auxilary cpio data... * >> Copying keymaps * >> Appending busybox cpio data... * >> Appending modules cpio data... * >> Appending blkid cpio data... * >> Appending modprobed cpio data... * >> Appending linker cpio data... * >> Finalizing cpio... * >> Compressing cpio data (.xz)... * * Kernel compiled successfully! * * Required Kernel Parameters: * root=/dev/$ROOT * * Where $ROOT is the device node for your root partition as the * one specified in /etc/fstab * (chroot) livecd src # * tell your bootloader to use the provided INITRAMFS file. * WARNING... WARNING... WARNING... * Additional kernel cmdline arguments that *may* be required to boot properly... * With support for several ext* filesystems available, it may be needed to * add "rootfstype=ext3" or "rootfstype=ext4" to the list of boot parameters. * Do NOT report kernel bugs as genkernel bugs unless your bug * is about the default genkernel configuration... * * Make sure you have the latest ~arch genkernel before reporting bugs. (chroot) livecd src #
Check Kernel & initrd Version
(chroot) livecd src # ls /boot/kernel* /boot/initramfs* /boot/initramfs-genkernel-x86_64-3.12.13-gentoo /boot/kernel-genkernel-x86_64-3.12.13-gentoo
Install Vim Editor
(chroot) livecd src # emerge vim
Modify fstab File
(chroot) livecd src # vim /etc/fstab
Add the following
/dev/sda1 /boot ext4 defaults 1 2 /dev/sda2 swap swap defaults 0 0 /dev/sda3 / ext4 defaults 1 1
Configure Network
Because I install Gentoo in VMware virtual machine, so the network interface names is different with common interfaces eth0, please note here.
(chroot) livecd src # vi /etc/conf.d/net config_eno16777736="172.16.184.146" routes_eno16777736="default via 172.16.184.1" (chroot) livecd src # ln -s /etc/init.d/net.lo /etc/init.d/net.eno16777736
Boot Load Network Port
(chroot) livecd src # rc-update add net.eno16777736 default * service net.eno16777736 added to runlevel default
Configure DNS
(chroot) livecd src # echo "nameserver 172.16.184.2" >> /etc/resolv.conf
Boot Load sshd Service
(chroot) livecd src # rc-update add sshd default * service sshd added to runlevel default
Setup New Install Gentoo System Root Password
(chroot) livecd src # passwd root New password: BAD PASSWORD: it is based on a dictionary word Retype new password: passwd: password updated successfully
Configure Timezone
(chroot) livecd src # vi /etc/conf.d/clock
Add the following
TIMEZONE = "Asia/Shanghai"
Install Common System Tools
System Log Management
(chroot) livecd src # emerge syslog-ng
Log Formatting Tools
(chroot) livecd src # emerge logrotate
Timer Planning Services
(chroot) livecd src # emerge vixie-cron
DHCP
(chroot) livecd src # emerge dhcpcd
Quick Index
(chroot) livecd src # emerge mlocate
Start Service
(chroot) livecd src # rc-update add syslog-ng default * service syslog-ng added to runlevel default (chroot) livecd src # rc-update add vixie-cron default * service vixie-cron added to runlevel default
Set rontab Default Editor
(chroot) livecd src # echo "export EDITOR='/usr/bin/vim'" >> /etc/profile
Configure GRUB Boot Loader
Install GRUB
(chroot) livecd src # emerge grub
Configure GRUB
(chroot) livecd src # grub2-install --no-floppy /dev/sda Installation finished. No error reported. (chroot) livecd src # grub2-mkconfig -o /boot/grub/grub.cfg Generating grub.cfg ... Found linux image: /boot/kernel-genkernel-x86_64-3.12.13-gentoo Found initrd image: /boot/initramfs-genkernel-x86_64-3.12.13-gentoo done (chroot) livecd src # reboot
After Install
Remove stage3 tarball
gentoo ~ # rm /stage3-*.tar.bz2*
Remove Portage Snapshot files
gentoo ~ # rm /portage-latest.tar.bz2*