从stage1安装Gentoo
* 从网上下载mini版的安装包install-x86-minimal-2007.0-r1.iso和最新的stage 1包stage1-x86-2007.0.tar.bz2 刻盘
在安装的时候应为我是装的双系统,所以stage1-x86-2007.0.tar.bz2就从别的分区mount过来的
* 放入刻好的光盘,重起机器
* 启动完成之后,检查网络是否通畅(嘿嘿,前提是要插好网线哦)
可以输入ping -c 3 [url]www.163.com[/url]试试看,如果成功则略过这步,否则:
首先用ifconfig检查网卡是否识别出来,是否已经有了IP地址
如果没有自动获得IP地址,则手工指定
# ifconfig eth0 192.168.xxx.xxx netmask 255.255.xxx.xxx
具体网络IP和掩码怎么配,请找你们的网络管理员
确认路由正确
# netstat -rn
如果网关不正确,则手工添加
# route add -net default gw 192.168.xxx.xxx
编辑主机名 vi /etc/hostname (有vi就用,没有就用nano)
设置DNS解析 vi /etc/resolv.conf
在里面添加如下内容
nameserver 202.106.46.151
nameserver 202.106.0.20
这个时候可以ping -c 3 [url]www.163.com[/url] 看看是否成功了
* 用date设置系统日期和时间,这对后来同步的时候有影响的,关系到下载的包的新旧程度
* 分区,用fdisk -l 检查现有硬盘分区情况
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1984 15936448+ c W95 FAT32 (LBA)
/dev/sda2 1985 5171 25599577+ f W95 Ext'd (LBA)
/dev/sda3 5172 9598 35559877+ 83 Linux
/dev/sda4 9599 9729 1052257+ 82 Linux swap / Solaris
/dev/sda5 1985 3896 15358108+ b W95 FAT32
/dev/sda6 3897 5171 10241406 b W95 FAT32
这是我的显示串口的一般显示是sd,并口的显示是hd,a就表示这是你的第一块硬盘,要是还有就是sdb之类的啦
上面的sda3,4是linux的,其他是windows 的
这个时候用fdisk /dev/sda来分区,可以用m来查看帮助,具体怎么分自己看着办,至少要分两个,一个交换分区
一个/分区,一般交换分区划分成内存的2倍左右就行了,可以单独分一个boot分区,也可以不分,反正我是没有
单独分
(按照我的来看sda4是交换分区,sda3是linux的/分区)分好了之后就格式化吧,注意备份重要数据哦
# mkswap /dev/sda4 格式化交换分区
# mkfs -t ext3 /dev/sda3 格式化/分区,也可以换成别的格式的文件系统,如:mkfs -t reiserfs /dev/sda3
根据自己喜欢吧
* 挂接分区和porc
# swapon /dev/sda4 激活交换分区
# mount /dev/sda3 /mnt/gentoo
# mount -o bind /proc /mnt/gentoo/proc
* 开始安装最基本的系统
cd /mnt/gentoo
把stage1-x86-2007.0.tar.bz2复制过来(我是先放在windows分区)
# tar jxvf stage1-x86-2007.0.tar.bz2
* 启用DNS配置文件
# cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
* 切换root环境
# chroot /mnt/gentoo /bin/bash
# mkdir /usr/loacl/portage
* 设置编译选项
# vi /etc/make.conf
CFLAGS="-march=prescott -O3 -pipe -fomit-frame-pointer -funroll-loops"
CXXFLAGS="${CFLAGS}"
AUTOCLEAN="yes"
# This should not be changed unless you know exactly what you are doing. You
# should probably be using a different stage, instead.
CHOST="i686-pc-linux-gnu"
USE="cjk apache2 tcltk aalib xv bonobo gstreamer slang readline gpm berkdb mmx 3dnow gdbm tcpd pam libwww ssl nls perl python gif imlib sdl oggvorbis gnome gtk2 X opengl avi png tiff"
这是我的设置,可以参照着写,copy也行,嘿嘿:)注意其中的march需要根据自己的cpu 的类型来
进行设置,如果不知道的话可以查看:
[url]http://gentoo-wiki.com/Safe_Cflags[/url]
* 创建并加载新的环境变量
# env-update
# source /etc/profile
一般在装完软件或更新了系统之后最好做一下这俩个操作
* 从因特网同步获取最新的portage安装管理信息
# emerge-webrsync -v
# emerge --sync --verbose
* 编译关键的系统软件包,主要是glibc、gcc、zlib、binutils、textinfo、ncurses、gettext、sed、emerge、portage等
# cd /usr/portage
# scripts/bootstrap.sh
# source /etc/profile
* 构建系统,编译没有替代物的系统软件包
# emerge -e system (耐心等待吧)
* 安装内核源代码
对台式机就# emerge gentoo-sources
对笔记本就# emerge suspend2-sources
我是在笔记本上装的,所以就用了第二个
* 配置内核
在上一步做完之后就该配置内核了
我的机器的配置是:
cpu:T2050酷睿双核
内存:512M
主板:Intel i945PM Express
显卡集成:Intel Graphics Media Accelerator 950 with up to 128MB shared memory
网卡:Intel PRO/100 VE 10/100Mbs
无线网卡:Intel 3945BG 802.11a/b/g mini pci wireless card (WEP, WPA, 802.1x)
显示器:14宽屏
好了,你要是自己不是很清楚就lspci看看吧
# make menuconfig
配置 CPU:
[*] Symmetric multi-processing support
Subarchitecture Type (PC-compatible) --->
Processor family (Pentium-4/Celeron(P4-based)/Pentium-4 M/Xeon) --->
(2) Maximum number of CPUs (2-255)
[ ] SMT (Hyperthreading) scheduler support
[*] Multi-core scheduler support
配置cpu的核心数,使得内核支持双核
[*] CPU Frequency scaling
[*] Enable CPUfreq debugging
<*> CPU frequency translation statistics
Default CPUFreq governor (performance) --->
<*> 'ondemand' cpufreq policy governor
--- CPUFreq processor drivers
<*> Intel Enhanced SpeedStep
[*] Use ACPI tables to decode valid frequency/voltage pairs
[*] Built-in tables for Banias CPUs
配置cpu的频率调节,使得支持自动降频功能
记得要emerge sys-power/cpufrequtils安装这个软件来管理cpu降频操作
同时要rc-update add cpufrequtils boot
配置显卡:
--- /dev/agpgart (AGP Support)
--- Intel 440LX/BX/GX, I8xx and E7x05 chipset support
<M> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)
<M> Intel 830M, 845G, 852GM, 855GM, 865G
<M> i915 driver
[*] Enable firmware EDID
<*> Support for frame buffer devices
<*> Intel 830M/845G/852GM/855GM/865G/915G/945G support (EXPERIMENTAL)
[*] DDC/I2C for Intel framebuffer support
安装xorg
# echo "VIDEO_CARDS=\"i810\"" >> /etc/make.conf
# emerge xorg-x11
配置声卡
<M> Sound card support
Advanced Linux Sound Architecture --->
Open Sound System --->
< > Advanced Linux Sound Architecture
< > Open Sound System (DEPRECATED)
安装驱动
# echo "media-sound/alsa-driver" >> /etc/portage/package.keywords
# echo "media-sound/alsa-headers" >> /etc/portage/package.keywords
# echo "media-libs/alsa-lib" >> /etc/portage/package.keywords
# echo "media-sound/alsa-utils" >> /etc/portage/package.keywords
# echo "ALSA_CARDS=\"hda-intel\"" >> /etc/make.conf
# emerge media-sound/alsa-driver media-sound/alsa-utils
# rc-update add alsasound boot
# alsaconf
让系统自动加在模块
# echo "options snd-hda-intel model=laptop single_cmd=1 enable_msi=1" >> /etc/modules.d/alsa
# modules-update -f
# /etc/init.d/alsasound restart
配置有线网卡:
[*] Ethernet (10 or 100Mbit)
<*> Generic Media Independent Interface device support
[*] EISA, VLB, PCI and on board controllers
<M> Intel(R) PRO/100+ support
# echo "e100" >> /etc/modules.autoload.d/kernel-2.6
# emerge sys-apps/netplug net-misc/dhcpcd net-analyzer/arping
编辑/etc/conf.d/net
加入modules=( "ifconfig" )
plug_timeout="15"
config_eth0=( "dhcp" )
dhcpcd_eth0="-t 10"
fallback_eth0=( "apipa" )
# rc-update add net.eth0 default
# /etc/init.d/net.eth0 restart
配置Linux上的无线网卡:3945abg
Networking --->
[ ] Generic IEEE 802.11 Networking Stack
Device Drivers --->
Network Device support --->
Wireless LAN (non-hamradio) --->
[*] Wireless LAN drivers (non-hamradio) & Wireless Extensions
Cryptographic options --->
[*] Cryptographic API
<*> AES cipher algorithms
<*> ARC4 cipher algorithm
<*> Michael MIC keyed digest algorithm
Networking --->
<*> Generic IEEE 802.11 Networking Stack
[ ] Enable full debugging output
<*> IEEE 802.11 WEP encryption (802.1x)
<*> IEEE 802.11i CCMP support
<*> IEEE 802.11i TKIP encryption
< > Software MAC add-on to the IEEE 802.11 networking stack
# echo "net-wireless/ipw3945" >> /etc/portage/package.keywords
# echo "net-wireless/ipw3945d" >> /etc/portage/package.keywords
# echo "net-wireless/ieee80211" >> /etc/portage/package.keywords
# emerge ipw3945 wireless-tools wpa_supplicant
# rc-update add ipw3945d default
# /etc/init.d/ipw3945d start
编辑/etc/conf.d/net
加入modules=( "wpa_supplicant" )
wpa_supplicant_eth1="-Dwext"
config_eth1=( "dhcp" )
dhcp_eth1="nontp nonis"
depend_eth1() {
need ipw3945d
}
创建初始化脚本
# ln -s /etc/init.d/net.lo /etc/init.d/net.eth1
# rc-update add net.eth1 default
配置 ACPI
[*] ACPI Support
[*] Sleep States
[ ] /proc/acpi/sleep (deprecated)
<*> AC Adapter
<*> Battery
<*> Button
<*> Video
<*> Generic Hotkey (EXPERIMENTAL)
< > Fan
< > Dock
<*> Processor
<*> Thermal Zone
# emerge sys-power/acpid
# rc-update add acpid default
软唤醒
--- Suspend2
--- Image Storage (you need at least one allocator)
[ ] File Allocator
[*] Swap Allocator
--- General Options
(/dev/sda4) Default resume device name
[ ] Allow Keep Image Mode
[*] Replace swsusp by default
--- Cryptographic API
<*> LZF compression algorithm
编译内核
# make && make modules_install
# mv /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-2.6
要是自己不会配置内核,那可以用工具配置一个通用的内核
# genkernel --config
注意,采用这个方法配置后,genkernel会自动把新内核放在/boot下
* 安装配置grub
# emerge grub
# grub
grub> root (hd0,2) (boot 分区的位置,在sda3处,也就是在(hd0, 2))
grub> setup (hd0)
grub> quit
编辑/boot/grub/grub.conf
这是我的,参考着写就行了
# Boot automatically after 30 secs.
timeout 30
# By default, boot the first entry.
default 0
# Fallback to the second entry.
fallback 1
# Splash image to show behind grub.(grub后面的背景)
splashimage=(hd0,2)/boot/grub/splash.xpm.gz
# For booting Linux
title Linux-2.6.19
root (hd0,2)
kernel /boot/vmlinux-2.6 root=/dev/sda3
# For booting Windows NT or Windows95
title Windows XP
rootnoverify (hd0,0)
makeactive
chainloader +1
如果是用genkernel编译的则:
kernel (hd0,2)/bzImage-2.6.x.jfs.k.support
initrd (hd0,2)/initrd-2.6.x
* 其他分区自动挂接
为了让系统启动的时候就能自动挂接windows下的分区
编辑/etc/fstab,这是我的,注意sda5和sda6这两行的写法就行了,你可以换成你的windows分区
# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/sda3 /boot ext2 noauto,noatime 1 2
/dev/sda3 / ext2 noatime 0 1
/dev/sda4 none swap sw 0 0
/dev/sda5 /media/sda5 vfat defaults,utf8,umask=0,exec 0 0
/dev/sda6 /media/sda6 vfat defaults,utf8,umask=0,exec 0 0
/dev/cdrom /mnt/cdrom audo noauto,ro 0 0
#/dev/fd0 /mnt/floppy auto noauto 0 0
* 收尾工作
这么辛苦装的系统就不要随便用root登录了,创建一个普通用户吧
# useradd <用户名> -m -G users,wheel,audio -s /bin/bash
# passwd <用户名>
# etc-update
# umount /mnt/gentoo/proc
# umount /mnt/gentoo
# reboot
呵呵,安装到此结束,一个自己打造的Gentoo就在你的机器上安家了