在VirtualBox 3.2.10中安装Gentoo
使用VirtualBox有些日子了,玩GNU/Linux也有点时间了,不过怕破坏本本文件,GNU/Linux一直都活在VirtualBox里的。
从Slax、Ubuntu、Fedora、到Read Hat Enterprise Linux 5.5,貌似没有一个GNU/Linux合胃口,总是添加了很多我 不着的东西,为了创建一个干净的GNU/Linux系统,开始尝试Gentoo了。
*安装前说明:
1.这个是我自己总结的,参照了官方的手册和很多国内的Linux论坛和博客
2.我只列出了必要的步骤和操作,其实官方的很多指导没必要都去做,很可能卡在那些指导里出不来(虽然一次安装只花了49小时,但是成功安装之前花了近一个月的时间爬手册、论坛和博客,其中很多时间是被官方的一些指导浪费了!)
从网易的开源镜像站下载了install-x86-mini最小安装镜像,和stage3、portage-latest;
用UltraISO将stage3和portage-latest追加到安装镜像中得到了需要的安装镜像;
在VirtualBox中创建一个Gentoo的虚拟机,添加得到的安装镜像;
启动Gentoo虚拟机开始安装;
一路回车,直到出现livecd~:
-----------------------------------------------------------------------------------------------------------------------------------
启用网络:
dhcpcd eth0
磁盘分区:
VDISK="/dev/sda"
fdisk ${VDISK} &> /dev/null <<EOF
n
p
+32M
a
1
n
p
2
+512M
t
2
82
n
p
3
w
EOF
格式化磁盘:
mke2fs /dev/sda1
mke2fs -j /dev/sda3
mkswap /dev/sda2
swapon /dev/sda2
挂载分区:
mount /dev/sda3 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/sda1 /mnt/gentoo/boot
复制stage3和portage:
cp /mnt/cdrom/*.tar.bz2 /mnt/gentoo/
解压stage3和portage:
tar xvjpf stage3-*.tar.bz2
tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr
配置编译选项:
nano -w /mnt/gentoo/etc/make.conf
[
CFLAGS="-O2 -march=i686 -pipe"
CXXFLAGS="${CFLAGS}"
CHOST="i686-pc-linux-gnu"
MAKEOPTS="-j2"
USE="-qt3 -qt4 -kde X gtk gnome hal dbus unicode"
LINGUAS="zh_CN"
INPUT_DEVICES="virtualbox evdev"
VIDEO_CARDS="virtualbox"
]
选择镜像站点和SYNC站点:
mirrorselect -i -o >> /mnt/gentoo/etc/make.conf
mirrorselect -i -r -o >> /mnt/gentoo/etc/make.conf
拷贝DNS信息:
cp -L /etc/resolv.conf /mnt/gentoo/etc/
挂载/proc和/dev文件系统:
mount -t proc none /mnt/gentoo/proc
mount -o bind /dev /mnt/gentoo/dev
CHROOT:
chroot /mnt/gentoo /bin/bash
env-update
source /etc/profile
export PS1="(chroot) $PS1"
更新Portage树:
emerge --sync
选择正确的Profile:
eselect profile list
eselect profile set 3
设置locales:
nano -w /etc/locale.gen
[
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
]
locale-gen
复制时区设置;
cp /usr/share/zoneinfo/Asia/Chongqing /etc/localtime
安装内核源码:
emerge -f gentoo-sources;emerge -k gentoo-sources
手动配置内核:
cd /usr/src/linux
make menuconfig
[
Bus options (PCI, PCMCIA, EISA, MCA, ISA) --->
PCCARD (PCMCIA/CardBus) support --->
<*> PCCard (PCMCIA/CardBus) support
--- PC-card bridges
<*> CardBus yenta-compatible bridge support (NEW)
<*> Cirrus PD6729 compatible bridge support (NEW)
<*> i82092 compatible bridge support (NEW)
File Systems -->
Native Language Support -->
(utf8) Default NLS Option
<*> NLS UTF8
(Also <*> other character sets that are in use in your FAT filesystems or Joilet CD-ROMs.)
DOS/FAT/NT Filesystems -->
(437) Default codepage for fat
<*>Second extend fs support
Processor type and features --->
[*] Tickless System (Dynamic Ticks)
Power management and ACPI options --->
[*] Power Management support
[*] ACPI (Advanced Configuration and Power Interface) Support --->
Device Drivers --->
< > ATA/ATAPI/MFM/RLL support
<*> Serial ATA and Parallel ATA drivers
<*> AHCI SATA Support
[*] ATA SFF support
<*> Intel ESB, ICH, PIIX3, PIIX4 PATA/SATA support
[*] Network device support --->
[*] Ethernet (10 or 100Mbit) --->
[*] EISA, VLB, PCI and on board controllers
<M> AMD PCnet32 PCI support
[*] Ethernet (1000 Mbit) --->
<M> Intel(R) PRO/1000 Gigabit Ethernet support
Graphics support --->
<*> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) --->
< > all options can be empty
<M> Sound card support --->
<M> Advanced Linux Sound Architecture --->
[*] PCI sound Devices --->
<M> Intel/SiS/nVidia/AMD/ALi AC97 Controller
Input device support --->
[*] Mice --->
<*> PS/2 mouse
Device Drivers --->
Input device support --->
<*> Event interface
Device Drivers --->
Graphics support --->
Support for frame buffer devices --->
(Disable all drivers, including VGA, Intel, nVidia, and ATI)
(Further down, enable basic console support. KMS uses this.)
Console display driver support --->
<*> Framebuffer Console Support
(Enable DRM)
Device Drivers --->
Graphics support --->
<*> Direct Rendering Manager --->
(Nouveau is currently in the Staging drivers section)
Device Drivers --->
Staging drivers --->
[ ] Exclude Staging drivers from being built
<*> Nouveau (nVidia) cards
]
编译内核:
make && make modules_install
安装内核;
cp arch/i386/boot/bzImage /boot/kernel-2.6.34-gentoo-r12
配置文件系统信息::
nano -w /etc/fstab
[
/dev/sda1 /boot ext2 defaults,noatime 1 2
/dev/sda2 none swap sw 0 0
/dev/sda3 / ext3 noatime 0 1
/dev/cdrom /mnt/cdrom auto noauto,user 0 0
]
配置网络:
nano -w /etc/conf.d/net
[
config_eth0=( "dhcp" )
]
设置root密码;
passwd
安装系统工具:
emerge -f syslog-ng;emerge -f vixie-cron;emerge -f dhcpcd
emerge -k syslog-ng;emerge -k vixie-cron;emerge -k dhcpcd
rc-update add syslog-ng default
rc-update add vixie-cron default
配置引导:
emerge -f grub;emerge -k grub
nano -w /boot/grub/grub.conf
[
default 0
timeout 10
title Gentoo Linux 2.6.34-r12
root (hd0,0)
kernel /boot/kernel-2.6.34-gentoo-r12 root=/dev/sda3
]
grep -v rootfs /proc/mounts > /etc/mtab
grub-install --no-floppy /dev/sda
准备重启:
exit
cd
umount /mnt/gentoo/boot /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo
poweroff
关闭虚拟机后,不加载安装镜像启动
--------------------------------------------
清理不用的文件:
rm *.tar.bz2
启用网络:
dhcpcd eth0
配置VirtualBox驱动:
mkdir /etc/portage
cd /etc/portage/
nano -w package.keywords
[
=app-emulation/virtualbox-guest-additions-3.2.8
=x11-drivers/xf86-input-virtualbox-3.2.8
=x11-drivers/xf86-video-virtualbox-3.2.8
]
安装xorg驱动:
emerge -f xorg-drivers;emerge -k xorg-drivers
emerge -f xf86-video-virtualbox xf86-input-virtualbox virtualbox-guest-additions
emerge -k xf86-video-virtualbox xf86-input-virtualbox virtualbox-guest-additions
启用必要的服务:
rc-update add virtualbox-guest-additions default
rc-update add hald default
/etc/init.d/virtualbox-guest-additions start
/etc/init.d/hald start
安装xorg:
emerge -f xorg-server;emerge -k xorg-server
env-update
source /etc/profile
/etc/init.d/hald restart
获得驱动授权:
cp /usr/share/hal/fdi/policy/10osvendor/10-input-policy.fdi /etc/hal/fdi/policy
cp /usr/share/hal/fdi/policy/10osvendor/10-x11-input.fdi /etc/hal/fdi/policy
生成xorg的配置文件:
Xorg -configure
cp /root/xorg.conf.new /etc/X11/xorg.conf
安装python:
USE="sqlite" emerge -f python
USE="sqlite" emerge -k python
启用gnome启动屏:
echo "gnome-base/gnome-session branding" >> /etc/portage/package.us
安装gnome:
emerge -f gnome-light;emerge -k gnome-light
env-update && source /etc/profile
开机自动启动gnome:
nano -w /etc/init.d/local
[
#在eend $? "Failed to start local"后添加
gdm
]
-----------------------------------------------------------------------------------------------------------------------------------
reboot
开始享受简洁的Gentoo吧!
PS:全过程花了49小时……