Gentoo快速安装步骤

Standard

英文原文: http://www.gentoo.org/doc/en/gentoo-x86-quickinstall.xml
中文整理如下:

1.下载ISO
到 http://www.gentoo.org/main/en/mirrors.xml 下载 /gentoo/releases/x86/current-iso/install-x86-minimal-*.iso (约80多兆)

2.配置网卡

livecd root # net-setup eth0
(有界面)

3.为了安装时方便可启动sshd并修改root密码

livecd root # /etc/init.d/sshd start
(有些命令比较长,开了ssh方便你从SecureCRT往上copy代码)
livecd root # passwd

4.分区格式化

livecd root # cfdisk /dev/sda
(有界面)
 
分成下面这样就行了
Disk /dev/sda: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000
 
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          12       96358+  83  Linux
/dev/sda2              13          74      498015   82  Linux swap / Solaris
/dev/sda3              75         652     4642785   83  Linux
 
然后格式化
livecd ~ # mke2fs /dev/sda1
livecd ~ # mke2fs -j /dev/sda3
livecd ~ # mkswap /dev/sda2 && swapon /dev/sda2

5.Mount文件系统

livecd ~ # mount /dev/sda3 /mnt/gentoo
livecd ~ # mkdir /mnt/gentoo/boot
livecd ~ # mount /dev/sda1 /mnt/gentoo/boot
livecd ~ # cd /mnt/gentoo

6.下载stage3文件

cd /mnt/gentoo/
livecd gentoo # links http://www.gentoo.org/main/en/mirrors.xml
(links文字化网页浏览器,找到releases/x86/current/目录,选中stage3文件回车下载)
livecd gentoo # tar xjpf stage3*

7.下载Portage

cd /mnt/gentoo/usr
livecd usr # links http://www.gentoo.org/main/en/mirrors.xml
(找到snapshots/目录并下载portage-latest.tar.bz2)
livecd usr # tar xjf portage-latest*

8.Chroot

livecd usr # cd /
livecd / # mount -t proc proc /mnt/gentoo/proc
livecd / # mount -o bind /dev /mnt/gentoo/dev
livecd / # cp -L /etc/resolv.conf /mnt/gentoo/etc/
livecd / # chroot /mnt/gentoo /bin/bash
livecd / # env-update && source /etc/profile
>>> Regenerating /etc/ld.so.cache...

9.修改时区

livecd / # cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
livecd / # date

10.修改host及域名

livecd / # cd /etc
livecd etc # echo "127.0.0.1 yemaosheng.com yemaosheng localhost" > hosts
livecd etc # sed -i -e 's/HOSTNAME.*/HOSTNAME="yemaosheng"/' conf.d/hostname
(Use defined host name and check)
livecd etc # hostname yemaosheng
livecd etc # hostname -f
yemaosheng.com

11.选最快的镜像站点

livecd etc # emerge mirrorselect
livecd etc # mirrorselect -D -s 5 -b 10

12.内核编译

livecd etc # emerge gentoo-sources
(漫长下载过程)
livecd etc # cd /usr/src/linux
livecd linux # make menuconfig
(有界面)
livecd linux # make -j2
livecd linux # make modules_install
livecd linux # cp arch/i386/boot/bzImage /boot/kernel

13.fstab配置

livecd linux # cd /etc
livecd etc # nano -w fstab
/dev/sda1   /boot     ext2    noauto,noatime     1 2
/dev/sda3   /         ext3    noatime            0 1
/dev/sda2   none      swap    sw                 0 0

14.网络配置

livecd etc # cd conf.d
livecd conf.d # echo 'config_eth0=( "192.168.0.10/24" )' >> net
livecd conf.d # echo 'routes_eth0=( "default via 192.168.0.1" )' >> net
livecd conf.d # rc-update add net.eth0 default
livecd conf.d # rc-update add sshd default

15.设root密码

livecd conf.d # passwd

16.修改/etc/conf.d/clock

livecd conf.d # nano -w /etc/conf.d/clock
TIMEZONE="Asia/Shanghai"

17.安装系统工具

livecd conf.d # emerge syslog-ng vixie-cron
livecd conf.d # rc-update add syslog-ng default
(日志)
livecd conf.d # rc-update add vixie-cron default
(定时)
 
如果需要可安装:
livecd conf.d # emerge slocate
(方便你找文件)
livecd conf.d # emerge dhcpcd
(DHCP客户端)
livecd conf.d # emerge ppp
(PPPoE ADSL拨号)

18.配置系统引导

livecd conf.d # emerge grub
 
livecd conf.d # nano -w /boot/grub/grub.conf
default 0
timeout 10
title Gentoo
root (hd0,0)
kernel /boot/kernel root=/dev/sda3
 
livecd conf.d # grub
grub> root (hd0,0)
grub> setup (hd0)
grub> quit

19.拿出光盘并重启

livecd conf.d # exit
livecd / # umount /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo/boot /mnt/gentoo
livecd / # reboot

20.重启进入系统后建个有su权限的用户

yemaosheng ~ # useradd -m -G users,wheel -s /bin/bash userman
yemaosheng ~ # passwd userman

注:
1.以上安装步骤在真实机器上通过,但VMware上安装后启动失败,解决方法可参考:http://www.gentoo-wiki.info/HOWTO_Install_Gentoo_on_VMware
2.关于VMware克隆虚拟机无法启动网卡的问题.因为VMware虚拟机克隆后变换了虚拟网卡的mac地址,而系统加载网卡驱动后会去读一个缓存文件,此文件包含了克隆前网卡的mac地址,所以现有的网卡mac地址和文件里的不同系统就拒绝启动.只要把这个文件删除后重启系统就可以了.这个文件是: /etc/udev/rules.d/70-persistent-net.rules

转载请注明出处: http://yemaosheng.com

2 thoughts on “Gentoo快速安装步骤

  1. Leo

    在虚拟机上安装编译内核的时候需要手动选上一个模块的。。。具体给忘记了。。。。

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.