Gentoo

来自百合仙子's Wiki
跳转到导航 跳转到搜索

安装

下载启动镜像

首先下载安装光盘,如从网易的镜像 http://mirrors.163.com/gentoo/releases/x86/current-iso/ 下载。[1]

配置网络

使用ifconfig命令查看网络状况。如果网络没有自动配置好,可使用配置脚本[2]

net-setup eth0

使用DHCP的话使用这个命令:

dhcpcd eth0

开始安装

准备安装

使用以下命令启动 sshd

/etc/init.d/sshd start

使用 fdisk 或者 cfdisk 来分区。使用 mkswapmkfs 等创建文件系统。使用 swapon 命令可激活交换分区。然后挂载它们(示例代码):[3]

mount /dev/sda2 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/sda1 /mnt/gentoo/boot

通过 date 命令确认系统时间的正确性(UTC 时区)。

下载 stage3 文件,比如从网易的镜像 http://mirrors.163.com/gentoo/releases/x86/current-stage3/ 。然后解压之:

tar xvjpf stage3-*.tar.bz2

接下来安装 Portage。下载最新的 Portage 文件(如从 http://mirrors.163.com/gentoo/releases/snapshots/current/portage-latest.tar.xz )。然后将其解压到系统中:

tar xvJf /mnt/gentoo/portage-latest.tar.xz -C /mnt/gentoo/usr

使用 nano(没有 vi,不过有 busybox)编辑编译选项[4]

nano -w /mnt/gentoo/etc/make.conf

其中 -w 选项告诉 nano 不要折行。

选择镜像站点:

mirrorselect -i -o >> /mnt/gentoo/etc/make.conf    #GENTOO_MIRRORS变量
mirrorselect -i -r -o >> /mnt/gentoo/etc/make.conf #rsync

配置系统

chroot 到新系统中

cp -L /etc/resolv.conf /mnt/gentoo/etc/
mount -t proc none /mnt/gentoo/proc
mount -o bind /dev /mnt/gentoo/dev

chroot /mnt/gentoo /bin/bash
env-update
source /etc/profile
export PS1="(chroot) $PS1"

配置 Portage。先同步下:

emerge --sync #可以添加 --quiet 选项来禁止输出,从而加速这个过程

选择 profile:

eselect profile list  #列出可用的 profile
eselect profile set 2 #选择第二个

注意:注意: 子profile developer是专为Gentoo Linux开发任务而准备的,而不是用来帮助构建一般性的开发环境的。

配置 USE 变量。详细介绍文件在 /usr/portage/profiles/use.desc 。编辑 /etc/make.conf 来设置 USE 标记。

编辑 /etc/locale.gen 来指定 locale。然后运行 locale-gen

选定时区

ls /usr/share/zoneinfo
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

安装内核源码

emerge gentoo-sources

要手动配置内核,cd 到 /usr/src/linux配置即可。也可以使用 emerge genkernel 命令来安装。[5]

注意事项

默认 openssl 包启用了 bindist 标志,这会导致它不支持 ECDSA 密钥。会导致使用 ECDSA 密钥 ssh 时失败。[6]

参见

外部链接

参考资料