Details of Gentoo system installation steps

Time:2021-3-2

With so many online tutorials or resources, what else do you write? The main reason is that the technology update is too fast, there are a lot of things have been changing, so I write out the latest, which will surely make your installation successful~
Download Image
Generally, I use domestic image sources. Whether it’s CentOS, Ubuntu or Gentoo, the image in China is faster than that in foreign countries

Copy code

The code is as follows:

#Download address
mirrors.163.com/gentoo/
#I use x86
http://mirrors.163.com/gentoo/releases/x86/current-iso/

#Need to download, for example, the latest version of the country, this address http://mirrors.163.com/gentoo/releases/x86/current-iso/

Copy code

The code is as follows:

install-x86-minimal-20140318.iso
stage3-i486-20140318. tar.bz2 </p>

  
My general installation habit is like this, I put stage3-i486-20140318 tar.bz2 And portage- latest.tar.bz2 The package is added to the image install-x86-minimum-20140318.iso to save the trouble of later installation. For example, I use UltraISO to compress those two packages into the image, as shown in the following figure
20151027110717240.png (970×390)

Then you can write to the USB flash disk, boot up and load the livecd. Then we start the installation

start-up
Boot appears in the startup interface: you can press enter directly, or enter the hardware options corresponding to your startup. See the most underground appendix
20151027110904630.png (641×193)

configure network

Copy code

The code is as follows:

Ifconfig # check the network card, because not all network cards are called eth0. For example, I use iwconfig for wireless network card</p>

20151027110926071.png (622×334)

Copy code

The code is as follows:

>Ifconfig enp0s3 192.168.1.127 netmask 255.255.255.0
>Route add default gw 192.168.1.1 gateway
>echo “nameserver 192.168.1.1”>>/etc/ resolv.conf #Configure DNS
>ping www.baidu.com #The test network is not working

Start SSH

Copy code

The code is as follows:

/Etc / init.d/sshd start? Start SSH or use service sshd start
Passwd root # enter your account number and password, then you can use SSH to log in remotely. Of course, you don’t need a computer at all

partition

Copy code

The code is as follows:

Fdisk – L # check the hard disk and capacity that can be partitioned. I tested it with 8g, SATA

20151027110943489.png (516×121)

Copy code

The code is as follows:

>fdisk /dev/sda</p>
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default P): P # select primary partition
Partition number (1-4, default 1): # enter
Using default value 1
First sector (2048-16777215, default 2048): Enter
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-16777215, default 16777215): +200M #200M boot
Partition 1 of type Linux and of size 200 MiB is set

20151027111007222.png (680×354)

The last and last input W are saved

Copy code

The code is as follows:

Command (m for help): w
The partition table has been altered!</p>
<p>Calling ioctl() to re-read partition table.
Syncing disks.

According to the above method, you can partition by yourself. My partition is 200m boot 7g / 512M swap
20151027111026496.png (645×193)

format partition

Copy code

The code is as follows:

mkfs.ext4 /dev/sda1
mkfs.ext4 /dev/sda2
Mkswap / dev / sda3 # format swap
Swap / dev / sda3 ᦇ mount swap

Mount partition

Copy code

The code is as follows:

Mount / dev / sda2 / MNT / Gentoo/
mkdir /mnt/gentoo/boot
Mount / dev / sda1 / MNT / Gentoo / boot

Install stage tarball

Copy code

The code is as follows:

#Configuration time
Date 032714382014

Because before we put stage3-i686-20140304 tar.bz2 And portage-20140310 tar.bz2 It’s compressed into the image, so we don’t need to download it

Copy code

The code is as follows:

cd /mnt/cdrom
cp *. tar.bz2 /MNT / Gentoo? Copy two files to / MNT / Gentoo</p>
tar xvjpf stage3-*. tar.bz2 #Decompress stage3</p>

According to the official documents make.conf In / MNT / Gentoo / etc/ make.conf But I am in / MNT / Gentoo / etc / portage/ make.conf Please pay attention to your position
#The single core configuration is as follows to limit the number of parallel compilers

Copy code

The code is as follows:

MAKEOPTS=”-j2″
Chroot
mirrorselect -i -o >> /mnt/gentoo/etc/portage/ make.conf #This one in the back is my own make.conf I choose 163, and then enter</p>

Mounting / proc and / dev file systems

Copy code

The code is as follows:

mount -t proc none /mnt/gentoo/proc

Entering a new system environment

Copy code

The code is as follows:

chroot /mnt/gentoo /bin/bash
env-update
source /etc/profile

20151027111052341.png (496×84)

Update portage tree

Copy code

The code is as follows:

emerge –sync –quiet</p>
eselect profile list

Configure time zone

Copy code

The code is as follows:

Ls / usr / share / zoneinfo # view time zone
CP / usr / share / zoneinfo / Asia / Shanghai / etc / Localtime

Install kernel

Copy code

The code is as follows:

Emergency Gentoo sources ා install kernel source code
LS – L / usr / SRC / Linux # view kernel connections

20151027111118744.png (648×111)

Manual configuration

Copy code

The code is as follows:

cd /usr/src/linux
make menuconfig

Note: I am a 32-bit system. So the * in front of 64 bit kernel must be removed
20151027111937423.png (631×146)

To configure, press ↓ to enter the file system. Because I use ext4, I select ext4 debugging support
Then tab select Save enter, then OK, exit enter, and then exit
Compile kernel

Copy code

The code is as follows:

make && make modules_ Install # enter and wait for the compilation to complete. After the compilation, there will be the location information of bzimage

20151027111133943.png (545×243)

Install kernel

Copy code

The code is as follows:

cd /usr/src/linux
cp arch/x86/boot/bzImage /boot/kernel-3.12.13-gentoo

Configuration system
Configuration file system

Copy code

The code is as follows:

Nano – w / etc / fstab # according to its own partition configuration</p>
/dev/sda2 / ext4 noatime 0 1
/dev/sda3 none swap sw 0 0
/dev/cdrom /mnt/cdrom auto noauto,ro 0 0</p>
<p>

Modify host name

Copy code

The code is as follows:

nano -w /etc/conf.d/hostname

20151027111149914.png (552×82)

configure network

Copy code

The code is as follows:

Nano – w / etc / conf.d/net # according to my network card configuration, my ifconfig network card is enp0s3</p>
routes_ enp0s3=( “default via 192.168.1.1” )</p>

Configure root password

Copy code

The code is as follows:

Passwd root # enter your account password

Install system tools

Copy code

The code is as follows:

Emergency syslog ng # system log tool
rc-update add syslog-ng default
Emerge vixie Cron # cron Daemons
rc-update add vixie-cron default
Emergency sys apps / mlocate # install file index locate. Remember to update DB to create a new library after restart

Configure bootloader
Install grub

Copy code

The code is as follows:

Emergency grub # install grub

Configure grub
After I install emergency grub, I install Grub2. If it is Grub2, the configuration is as follows

Copy code

The code is as follows:

/Usr / SBIN / Grub2 install — no floppy / dev / SDA # install
/usr/sbin/grub2-mkconfig -o /boot/grub/ grub.cfg #Build configuration

20151027111210998.png (544×77)

Restart installation complete

Copy code

The code is as follows:

Exit # launch chroot
Reboot # restart

20151027112809944.png (708×181)

Copy code

The code is as follows:

RC update add sshd default # set SSH startup
Service sshd start

Appendix start items

acpi=on
Load the support for ACPI, start acpid background program at the same time of starting the CD. This option is only required if your system needs ACPI to work properly. This option is not required to enable hyper threading support.
acpi=off
Close ACPI completely. This is useful on older systems and is a necessary option to use advanced power management (APM). This will also turn off hyper threading support for your processor.
console=X
This option can set the serial port access of the CD. The first option is device, usually ttys0 on X86, which can be followed by other options and separated by commas. The default options are 9600,8, N, 1.
dmraid=X
This option is used to pass parameters to the device mapper RAID subsystem. Arguments passed must be enclosed in quotation marks.
doapm
This option loads advanced power management (APM) driver support. This requires you to use the ACPI = off option at the same time.
dopcmcia
This option loads support for PCMCIA and CardBus hardware, and also enables cardmgr of PCMCIA card to run when the CD starts. This option is only required when booting from a PCMCIA / CardBus device.
doscsi
This option loads support for most SCSI controllers. This option is also needed when most USB devices start up, because USB devices use the SCSI subsystem in the kernel.
sda=stroke
This option allows you to partition the entire hard disk, even if your BIOS can’t handle large hard disks. This option is only used on machines that use the old BIOS. When using, replace SDA with the device that needs this option.
ide=nodma
This option forces DMA in the kernel to be turned off. Some IDE and CDROM drivers need this option. If your system has trouble reading the IDE interface CD-ROM, you can try this option. This option also turns off the default setting for hdparm.
noapic
This option turns off the advanced programmable interrupt controllers that exist on some new motherboards. It can cause problems on some old hardware.
nodetect
This option will turn off all automatic detection of the CD, including device detection and DHCP detection. This is useful when debugging a problem disc or driver.
nodhcp
This option will disable DHCP probing on the detected network card. This is useful for networks with only static addresses.
nodmraid
Support for device mapped raid is turned off, such as the controller for on-board ide / SATA raid.
nofirewire
This option turns off FireWire module loading. This option is only required if your FireWire hardware causes problems with CD startup.
nogpm
This option turns off GPM console mouse support.
nohotplug
This option turns off the loading of hot plug and cold plug startup scripts at startup. This option is useful when debugging failed discs and drives.
nokeymap
This option prevents keyboard layout selection.
nolapic
This option turns off the local APIC on the single processor core.
nosata
This option turns off loading of serial ATA (SATA) modules. This option is useful when there is a problem with your system’s SATA subsystem.
nosmp
This option turns off the SMP function in a kernel that supports SMP (symmetric multiprocessing). This option is used to debug SMP related issues on specific drivers and motherboards.
nosound
This option turns off sound support and volume settings. This option is useful on systems where voice support is problematic.
nousb
This option turns off automatic loading of USB module. This option is useful when debugging USB problems.
slowusb
This option adds some extra pauses during startup, mainly for some slow USB CDROMs, such as IBM BladeCenter.