1. Prepare for remote Logon:
/etc/init.d/sshd start
passwd
So that you can use putty and ssh client to remotely log on to the upload stage (sometimes online download is slow, while local area network upload is fast)
Prepare a disk:
fdisk /dev/sda
/Dev/sda1:/boot 100 M (32-100 M) set startup notes-
/Dev/sda2:/20G
/Dev/sda3:/home 20G
/Dev/sda5:/swap 1 GB (memory <512 MB, partitions are allocated 2 times the memory size;> 1024 MB, you can allocate less space or even do not need swap partitions .) -T 82
mkfs.ext4 /dev/sda1mkfs.ext4 /dev/sda2mkfs.ext4 /dev/sda3mkswap /dev/sda5
mount /dev/sda2 /mnt/gentoomkdir /mnt/gentoo/bootmount /dev/sda1 /mnt/gentoo/bootmkdir /mnt/gentoo/homemount /dev/sda3 /mnt/gentoo/homeswapon /dev/sda5
2. Install the system installation stage and portage:
date
If the displayed date/time is incorrect, use the date MMDDhhmmYYYY command.
cd /mnt/gentoolinks http://www.gentoo.org/main/en/mirrors.xml
Select a domestic fast image and go to the releases/x86/autobuilds/directory. You will see all the stage files suitable for your computer architecture (they may also be placed in subdirectories of individual sub-system names ). Select one and press D to download it. After the download, press Q to exit the browser.
Or use SSH Secure Shell to log on and upload the stage3 file.
tar xvjpf stage3-*.tar.bz2
- Download Portage:
links http://www.gentoo.org/main/en/mirrors.xml
Or use SSH Secure Shell to log on and upload the portage file.
tar -xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr (install a Portage snapshot)
Preparations before Compilation:
- Configure compilation options:
nano -w /mnt/gentoo/etc/portage/make.conf
CFLAGS = "-march = native-O2-pipe"
CXXFLAGS = "$ {CFLAGS}" # use the same settings for the two variables
MAKEOPTS = "-j3" # MAKEOPTS defines the number of parallel compilations that can be generated when the software is installed. Adding one to the number of CPUs is a good choice.
View cpu information:
cat proc/cpuinfo
mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.confmirrorselect -i -r -o >> /mnt/gentoo/etc/portage/make.conf
cp -L /etc/resolv.conf /mnt/gentoo/etc/
3. Chroot enters the new system environment: Chroot:
- Mount the/proc,/dev,/sys file system:
mount -t proc none /mnt/gentoo/procmount --rbind /dev /mnt/gentoo/devmount --rbind /sys /mnt/gentoo/sys
- Enter the new system environment:
chroot /mnt/gentoo /bin/bashsource /etc/profileexport PS1="(chroot) $PS1"
New Environment Configuration:
Emerge -- sync (Updating the Portage tree) or emerge-webrsync (fetch the latest portage snapshot)
eselect profile listeselect profile set ×
ls /usr/share/zoneinfoecho "Europe/Brussels" > /etc/timezoneemerge --config sys-libs/timezone-data
nano -w /etc/locale.genlocale-gen
- Update environment variables:
env-update && source /etc/profile
4. Compile the kernel:
- Install the kernel source code:
emerge gentoo-sourcesls -l /usr/src/linux
Manually compile the kernel:cd /usr/src/linuxmake menuconfig
make && make modules_install
- Copy the kernel to the boot partition:
cp arch/x86_64/boot/bzImage /boot/kernel-3.10.10-gentoo
Use genkernel to compile the kernel:emerge genkernel
- Optional. Copy the Kernel configuration file on the installation CD:
zcat /proc/config.gz > /usr/share/genkernel/arch/x86_64/kernel-config
genkernel --menuconfig all
Once genkernel is run, a kernel including all modules and initrd will be created. We will use this kernel and initrd When configuring the boot program later. Write down the name of the kernel and initrd because you will use them when configuring the boot program. Initrd will automatically identify the hardware before starting the real system (just like installing a CD ).
ls /boot/kernel* /boot/initramfs*
5. configure system information:
- File System Information:
nano -w /etc/fstab
Host name, Domainname, etc
nano -w /etc/conf.d/hostname
Grouping Network
nano -w /etc/conf.d/net
Gentoo uses/etc/rc. conf to configure the services, startup, and shutdown of your system.
nano -w /etc/rc.conf
Root Password
passwd
Gentoo uses/etc/conf. d/hwclock to set clock options.
nano -w /etc/conf.d/hwclock
Install system tool software:
- Optional: PCMCIA use lspci to view hardware information:
emerge pcmciautils
emerge syslog-ngrc-update add syslog-ng default
emerge mlocate
rc-update add sshd default
emerge dhcpcd
Configure the startup Item:
emerge sys-boot/grubgrub2-install /dev/sda
Generating GRUB2 configuration:
grub2-mkconfig -o /boot/grub/grub.cfg
- Optional: Using GRUB Legacy:
emerge sys-boot/grub:0
Edit the configuration file:
nano -w /boot/grub/grub.conf
Example grub. conf:
# Which list is selected by default for guidance. 0 indicates the first, 1 indicates the second, and so on. Default 0 # How many seconds to wait before guiding the default list timeout 30 # use a pretty, "bloated" spalsh image to add a little fun :) # If you do not have a video card installed, comment out splashimage = (hd0, 0)/boot/grub/splash.xpm.gz title Gentoo Linux 3.10.10 # root (hd0, 0) partition of the kernel image (or operating system) kernel/boot/kernel-3.10.10-gentoo root =/dev/sda2title Gentoo Linux 3.10.10 (rescue) # root (hd0, 0) partition where the kernel image (or operating system) is located) kernel/boot/kernel-3.10.10-gentoo root =/dev/sda2 init =/bin/bb # The next four lines are required only when you have dual boot with Windows. # In this example, the windows system is located in/dev/sda6. Title Windows XProotnoverify (hd0, 5) makeactivechainloader + 1 # comment out makeactive under win7
Setting up GRUB using grub-install:
Creating/etc/mtab:
grep -v rootfs /proc/mounts > /etc/mtab
Install GRUB:
grub-install --no-floppy /dev/sda
Restart the system:exitcdumount -l /mnt/gentoo/dev{/shm,/pts,}umount -l /mnt/gentoo{/boot,/proc,}reboot
6. install X Desktop Environment: Install Xorg:
- Detect video card information:
dmesg | grep videolspci | grep -i VGA
- Configure the INPUT_DEVICE and VIDEO_CARDS variables:
(For mouse, keyboard, and Synaptics touchpad support) INPUT_DEVICE = "evdev synaptics" (For nVidia graphics cards) VIDEO_CARDS = "nvidia" (or, For ATI Radeon graphics cards) VIDEO_CARDS = "radeon" (vmwarevm) VIDEO_CARDS = "vmware" (VirtualBox VM) VIDEO_CARDS = "virtualbox"
emerge -pv xorg-drivers
First of all, make sure udev is in your USE flags:
echo "x11-base/xorg-server udev" >> /etc/portage/package.use
Note: The keyboard and mouse are replaced with evdev in the latest version of Xorg (later than 1.5) to ensure that the udev flag is enabled when xorg-server is installed.
Next, install Xorg:
emerge -av xorg-server
- Update environment variables:
env-update source /etc/profile
- Use startx:
emerge -v twm xtermstartx
Install the desktop environment: