Gentoo installation tips and tricks/zh-cn

Gentoo 安装允许非常灵活地使用各种安装方法. 由于几乎不可能在安装说明中插入每个提示或技巧，因此本文档将尝试处理所有已提交的提示和技巧，以供参考.

准备工作
本文档包含有关 Gentoo/x86 安装的各种提示和技巧. 它们中大多都集中地进行了讨论——它们只是安装说明的附录，而不是替代品.

软件磁盘阵列 （Software RAID）
Once you are booted from the Installation CD, load the appropriate RAID modules. For instance, if you plan on using RAID-1:

When you partition your disks, make sure that your partitions use  (Linux RAID autodetect) as Partition Type instead of   (Linux native). You can alter the partition type using the  command in.

在我们开始创建 RAID 阵列之前，我们需要创建元设备节点：

After partitioning, create the file (yes, indeed, on the Installation CD environment) using , an advanced tool for RAID management. For instance, to have your boot, swap and root partition mirrored (RAID-1) covering and, you can use:

The Linux Software RAID driver will start creating the metadevices. You can see its progress in. Wait until the metadevices are completely finished before proceeding.

From now onwards, use for the boot partition,  for the swap partition and  for the root partition.

Right before chrooting, don't forget to copy over to.

When you're configuring your kernel, make sure you have the appropriate RAID support in your kernel and not as module.

When installing extra tools, emerge as well. Note that this isn't available on all Installation CDs so you might not be able to install Gentoo on a Software RAID when using a networkless installation!

When configuring your bootloader, make sure it gets installed in the MBR of both disks if you use mirroring.

ATA RAID using 2.4 kernels
Make sure you boot your Installation CD using the  option. Once booted, check the contents of. It should contain various directories for each hard disk available in the ATA RAID. An entire disk is displayed as while partitions are.

Write down the various device files that you use to install Gentoo on. You will need to substitute the examples in the installation with this path.

Before chrooting, bind-mount the structure in the new environment:

When configuring your kernel, make sure you enable support for your ATA RAID chipset and options. For instance, a popular ATA RAID system is a Promise FastTrack built-in RAID in which case you definitely need  built in into your kernel.

When configuring GRUB, you first have to create a GRUB bootdisk. This is not as hard as you think. First install GRUB as you would, but when you come to the part where GRUB is getting installed in the MBR, follow the following instructions:

You still need to write your file. This is no different from the installation instructions, just make sure that your  points to the ATA RAID device.

After finishing the installation, boot with your GRUB bootdisk. You will be greeted by a GRUB prompt. Now configure GRUB to boot from the ATA RAID device:

现在重新启动（删除 GRUB 引导软盘）.

LILO users can safely use the instructions mentioned in the installation instructions.

使用安装 CD 的内核
如果你不想自己编译内核，你可以把安装 CD 的内核复制到你的系统使用. 当要求你编译内核时，请转到另一个终端（按 +  ），然后使用你在开始安装时提供的 root 密码登录.

将内核和模块复制到你的 Gentoo 系统：

要在 Gentoo 系统启动期间，加载当前正在运行的所有模块（从安装 CD 启动），请从 chroot 环境中运行以下命令：

验证 的内容并且适当地更新.

离开终端
Many people want to leave their system when it's compiling. In certain cases this is rather difficult as the installation is done in a public environment where you cannot trust everyone. If this is the case, you want to be able to perform the compilation in the background and log out from all terminals.

There are several possible solutions for this. The first one is to use. After booting the Installation CD, set the root password and start a session:

Once inside the screen session you can perform the entire installation. When leaving a terminal, press +,  (that is,  and  at the same time, then followed by a ) to detach the screen session. It is now safe log out of the system (without losing work).

若要重新访问你的终端，请使用 root 再次登录，并且“附加”到正在运行的 screen 会话：

If screen is not an option, there is still a way to leave the terminal. Follow the installation instructions, but when a long-term compilation begins (for instance the step), use   which allows for a process to continue even when the session closed with a log out. Don't forget the trailing "&", otherwise the process will not be placed in the background! Remember where you are (the command will show you that) as you will need to know this later on.

Now exit the chrooted environment and the Installation CD session. The compilation will continue in the background.

To check the compilation, log in as root (on the Installation CD) and chroot back into the environment, then go to the directory where the session was left off:

Now use the command on the  file that is situated inside that directory. The compilation will append its output to that file, so if you want to follow the compilation progress, run and press  to follow the changes. When the compilation is finished, continue with the next step of the installation instructions.

When finished following the changes, press +  followed by a. This won't stop the compilation process, only the process.

全面测试磁盘
If you think your disk needs to be thoroughly checked for consistency (bad sectors and such), you can use the  (that's lowercase c) option while placing the ext2/ext3/ext4 filesystem on it (using  ). This will format, perform a read-test and mark all bad blocks as such. If you are really paranoid, use  to format your disk and perform an extensive read/write test.

从故障的安装中恢复
If for some reason your Gentoo installation fails, you don't have to redo the installation all over again. Instead, you can safely "go" to the point where you think you made a mistake (or where you think the instructions are flawed) and try a different approach.

First of all you need to chroot back into your Gentoo Linux environment. Follow the instructions again, but ignore the partitioning steps as your partitions are already created and even populated. You can therefore immediately mount those partitions at. You should also ignore the steps about stage extraction and modifying - you don't want to overwrite your files do you?

Once chrooted inside your Gentoo Linux environment, immediately go to the step where you think you should try a different approach. Don't redo all the steps like bootstrapping and such unless that is the place where you think things went wrong.

For instance, if you believe that you have a wrongly configured, you can immediately fire up your editor to update.

Once you have tried a different approach for your situation, you should consider how much of the subsequent steps you need to perform again. If the subsequent steps are depending on your change, you will need to redo those.

例如，


 * if you have changed a variable inside you will need to do all subsequent compiling since those depend on the settings inside
 * if you have altered you can immediately exit the chrooted environment and reboot as no subsequent steps are depending on
 * if you have recompiled your kernel you only need to make sure that your bootloader configuration points to the correct kernel image (double-check that you mounted your !), then you can exit the chrooted environment and reboot
 * if you have altered you can exit the chrooted environment and reboot

As you can see, for most recovery operations you can immediately reboot. Only in certain cases will you need to redo the subsequent installation steps.