+ -
当前位置:首页 → 问答吧 → 高级潜水员也冒出来一下 刚刚配置好Gentoo[重新编辑为了更好的帮助小白]

高级潜水员也冒出来一下 刚刚配置好Gentoo[重新编辑为了更好的帮助小白]

时间:2009-10-07

来源:互联网

为了更好的帮助小小白快速进入Gentoo世界,我把帖子慢慢完善一下,以我的拙见帮助小小白理解。

我是小白,努力了半个月终于把Gentoo完美的配置到本本上了,速度果然很快阿~~我还是小白,对Gentoo的理解不够,只是把重要的配置文件贴出来给大家看看,有什么问题可以问我。

[笔记本配置]
型号 HP Compaq Presario V3416TX
处理器 Intel酷睿2双核 T5300
显卡 NVIDIA GeForce Go 7200
网卡 集成的10/100M局域网
无限网卡 英特尔 Pro/无线3945ABG无线局域网

总体来说只要配置好Kernel其他都没什么问题。
贴出来我的Linux CP 2.6.30-gentoo-r6内核配置,和我同样笔记本的就可以直接使用了。经我测试还没有法现什么问题,fbsplash、virtualbox、nvidia等等都成功配置,没有出错。

[安装准备]
制作LiveUSB (livecd使用起来速度太慢,不适合Gentoo这种长时间编译的系统安装)
参考文章:
http://icnpunk.wordpress.com.cn/2009...6%B9%E6%B3%95/
我使用的LiveUSB系统:Pentoo (http://www.pentoo.ch/ Pentoo基于Gentoo制作,是个安全监测用系统)
提前下载好stage3(http://mirrors.kernel.org/gentoo/rel...shots/current/) 放到U盘里面。
制作好LiveUSB之后启动

[安装过程]
参考文章:
http://www.gentoo.org/doc/zh_cn/hand...?part=1&chap=4

以下是我的磁盘情况:
CP ~ # fdisk /dev/sda

The number of cylinders for this disk is set to 38913.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x80c580c5

Device Boot Start End Blocks Id System
/dev/sda1 * 1 3188 25607578+ c W95 FAT32 (LBA)
/dev/sda2 3189 38913 286961062+ f W95 Ext'd (LBA)
/dev/sda5 3189 12112 71681998+ 7 HPFS/NTFS
/dev/sda6 12113 21036 71681998+ 7 HPFS/NTFS
/dev/sda7 21037 27411 51207156 7 HPFS/NTFS
/dev/sda8 27412 30599 25607578+ 7 HPFS/NTFS
/dev/sda9 30600 30661 497983+ 82 Linux swap / Solaris
/dev/sda10 30662 38913 66284158+ 83 Linux

我没有使用Boot分区,因为只是做桌面,Boot分区本身并不是那么容易出问题。

具体可以依照自己的情况接合HandBook进行修改。

# /etc/init.d/net.eth0 start
# mount /dev/sda10 /mnt/gentoo
# cp /mnt/livecd/other/stage* /mnt/gentoo
# cp /mnt/livecd/other/portage* /mnt/gentoo
# cd /mnt/gentoo ; tar -xf stage*
# mv portage* usr/ ; tar -xf portage*
# cp /etc/resolv.conf /mnt/gentoo/resolv.conf
# cp /etc/X11/xorg.conf /mnt/gentoo/root
# mount -t proc proc /mnt/gentoo/proc
# mount -o bind /dev /mnt/gentoo/dev
# chroot /mnt/gentoo /bin/bash
# env-update
# . /etc/profile

到这里就可以准备安装了,要不然就现在emerge --sync 要不就先不要更新,否则比较容易出问题。
# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# nano /etc/conf.d/clock
CLOCK="local"
TIMEZONE="Asia/Shanghai"
# nano /etc/conf.d/net
dnc_domain_lo="GenBox"
config_eth0=( "dhcp" )
# rc-update add net.eth0 default
# nano /etc/conf.d/hostname
HOSTNAME="CP"
# nano /etc/hosts
127.0.0.1 CP.GenBox cp localhost
# hostname CP
# hostname -f
CP.GenBox
# eselect profile list (设置默认profile为For desktop)
[1] default/linux/x86/10.0
[2] default/linux/x86/10.0/desktop
[3] default/linux/x86/10.0/developer
[4] default/linux/x86/10.0/server
[5] hardened/linux/x86/10.0
[6] selinux/2007.0/x86
[7] selinux/2007.0/x86/hardened
[8] selinux/v2refpolicy/x86
[9] selinux/v2refpolicy/x86/desktop
[10] selinux/v2refpolicy/x86/developer
[11] selinux/v2refpolicy/x86/hardened
[12] selinux/v2refpolicy/x86/server
# eselect profile set 2
nano /etc/make.conf
贴入我的make.conf 进行修改。(USE参考usr/portage/profiles/use.desc 或者 http://gentoo-portage.com/USE ,其中安装初期不要使用minimal的USE,使用-minimal,不然emerge的xorg-x11会没有调试程序,我的USE已经是比较基础的了,不会安装太多没用的软件。)
# nano -w /etc/locale.gen
en_US ISO-8859-1
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
zh_CN.GBK GBK
zh_CN GB2312
zh_CN.GB18030 GB18030
# locale-gen
# emerge gentoo-sources
# cd /usr/src/linux
# make menuconfig (同机器配置的可以直接复制我的config进去,不同机器的需要到http://62.3.120.141/~pappy/ 下载适合自己内核版本的基础config文件进行修改,他已经把不必要的东西基本上清除掉了。内核配置有什么问题可以问我,我配置内核就花了好几天的时间,算是比较熟悉了。)
# make -j7 ; make modules install
# cp .config /boot/config_backup ; cp arch/x86/boot/bzImage /boot/kernel
# nano /boot/grub/menu.list
default 0
timeout 3
splashimage=(hd0,9)/boot/grub/grub-fingerprint-0.11.xpm.gz

title Gentoo Linux
root (hd0,9)
# 使用fbsplash的配置 (刚装系统先不用折腾这个)
#kernel /boot/kernel vga=0x317 video=vesafb:mtrr:3,ywrap splash=silent,fadein,theme:emerge-world quiet CONSOLE=/dev/tty1
#initrd /boot/emerge-world-1024x768
# 不使用fbsplash的配置
kernel /boot/kernel vga=0x317 quiet

title Windows XP
rootnoverify (hd0,0)
makeactive
chainloader +1

# emerge grub
# grub --no-floppy
grub> find /boot/grub/stage1
(hd0,9)

grub> root (hd0,9)
Filesystem type is ext2fs, partition type 0x83

grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 17 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+17 p (hd0,9)/boot/grub/stage2
/boot/grub/menu.lst"... succeeded
Done.

grub> quit
启动做好了!
# emerge syslog-ng
# rc-update add syslog-ng boot
# emerge vixie-cron
# rc-update add vixie-cron default
# emerge slocate
最好别安装EVMS工具,后来装别的软件因为冲突把这个删掉了
# emerge dhcpcd
# emerge ppp

好了,目前为止,一个能够使用的minigentoo就安装好了。重启系统
# exit ; cd /
# umount /mnt/gentoo/proc /mnt/gentoo/dev /mnt/gentoo
# reboot

启动以后可能会出现提示你/etc/{init.d,conf.d} 或者 /etc/rc.conf 中有文件有时间方面的错误,具体错误信息我忘记了。只要把那几个文件“摸”一下就好了:
# touch /etc/{init.d,conf.d}/*
# touch /etc/rc.conf

使用ccache加速编译过程,使用以后重复的编译会提升很大的速度。我已经再make.conf里面加入了ccache的设置。只需要
# emerge ccache

现在到了老大难安装图形界面的时候,以前老在这个地方出问题。我的经验是通过一下过程进行:
# emerge --sync
# emerge -uvpD --newuse world
先检查一下有没有要更改USE的包
# emerge -uvD --newuse world
这个操作会把部分图型显示方面的lib安装到系统,注意看下安装了哪些。
# emerge -va x11-base/xorg-x11
我执行这个操作的时候把nvidia显卡驱动也安装了进去。如果没有再安装nvidia显卡驱动:
# emerge -va x11-drivers/nvidia-drivers
# eselect opengl list
[1] nvidia
[2] xorg-x11 *
# eselect opengl set 1

配置xorg.conf
直接复制刚才pentoo自动生成的xorg.conf进去就行。
# cp ~/xorg.conf /etc/X11/xorg.conf
如果启动有logo,加入:
Option "NO LOGO"

Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "NO LOGO"
Option "TwinView" "0"
Option "metamodes" "1280x800_60 +0+0"
SubSection "Display"
Depth 24
EndSubSection
EndSection
里面
想启动透明特效的加入
Section "Extensions"
Option "Composite" "Enable"
EndSection
到任意位置

安装xfce4
参考文章: http://www.gentoo.org/doc/zh_cn/xfce-config.xml
这个就文章上讲解的做法去做就行了。

安装完成后测试如果没办法用鼠标键盘等等的,看你make.conf里面有没有写这句话:
INPUT_DEVICES="keyboard mouse"

先写这么多,有时间再继续=================================

帖子附件config.txt为我的内核设置。可以直接复制到/usr/src/linux

内核配置是参照http://62.3.120.141/~pappy/ 进行优化配置的。没用的东西都没有添加,内核编译出来的大小为3.5M

再贴下我的make.conf
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
LINGUAS="en en_US en_GB zh zh_CN"
MAKEOPTS="-j4"
ALSA_CARDS="hda-intel"
INPUT_DEVICES="keyboard mouse"
VIDEO_CARDS="nvidia"
FEATURES="ccache"
CCACHE_SIZE="2G"
CCACHE_DIR="/var/tmp/ccache"
#GENTOO_MIRRORS="ftp://gentoo.anheng.com.cn/gentoo/"
GENTOO_MIRRORS="http://gentoo.cs.nctu.edu.tw/gentoo/"
SYNC="rsync://mirror.averse.net/gentoo-portage"
USE="X -livecd -gnome -nls gtk -kde -kde4 -eds gtk2 -pam -minimal dvdr oss 3dnow 3dnowext
mmx sse sse2 ssse3 mpi firefox xulrunner -mozilla
wifi injection lzma bash-completion truetype unicode xft usb startup-notification xscreensaver laptop -apm
quicktime -qt3 -test qt3support -qt4 -webkit -cups -spell lua -debug -ipv6 curl
png jpeg gif dri svg aac nsplugin xrandr
alsa esd -jack mp3 wma png oss
dvd mpeg ogg rtsp x264 xvid sqlite truetype
opengl dbus binary-drivers -hal acpi"

具体还有些单独配置的use在/etc/portage/package.use

x11-wm/fluxbox -gnome -kde truetype vim-syntax
x11-terms/mrxvt jpeg menubar png session truetype -debug -utempter -xpm
xfce-base/xfwm4 startup-notification xcomposite -debug
media-sound/mpd aac flac mp3 wma ogg vorbis
media-gfx/splashutils gpm mng png truetype fbcondecor -hardened
media-sound/ncmpc -help-screen artist-screen colors -debug key-screen lyrics-screen mouse nls search-screen song-screen
media-sound/sonata dbus trayicon lyrics taglib
sys-fs/ntfs3g hal suid -debug
media-video/mplayer 3dnow 3dnowext X a52 aac alsa ass cddb cdio dirac dts dv dvd dvdnav enca encode esd faac faad gif iconv jpeg live mad mmx mp2 mp3 network opengl osdmenu oss png quicktime rar real rtc schroedinger sdl shm speex sse sse2 ssse3 theora tremor truetype unicode vorbis win32codecs x264 xscreensaver xv xvid gmplayer -aalib (-altivec) -bidi -bindist -bl -cdparanoia -cpudetection -custom-cflags -custom-cpuopts -debug -dga -directfb -doc -dvb -dxr3 -fbcon -ftp -ggi -ipv6 -jack -joystick -ladspa -libcaca -lirc -lzo -md5sum -mmxext -mng -nas -openal -pnm -pulseaudio -pvr -radio -samba -svga -teletext -tga -v4l -v4l2 -vdpau -vidix -xanim -xinerama -xvmc -zoran
dev-libs/cyrus-sasl berkdb crypt ldap ssl -authdaemond -java -gdbm -kerberos -mysql -ntlm_unsupported_patch -pam -postgres -sample -srp -urandom

需要使用keyword的包通过修改/etc/portage/package.keywords实现
app-arch/q7z ~x86
xfce-extra/xfce4-playercontrol-plugin ~x86
xfce-extra/xfce4-power-manager ~x86

/etc/X11/xorg.conf文件如下
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
EndSection

Section "Files"
EndSection

Section "Module"
Load "dbe"
Load "extmod"
Load "type1"
Load "freetype"
Load "glx"
EndSection

Section "ServerFlags"
Option "Xinerama" "0"
EndSection

Section "InputDevice"

# generated from data in "/etc/conf.d/gpm"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol"
Option "Device" "/dev/input/mice"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"

# generated from default
Identifier "Keyboard0"
Driver "kbd"
EndSection

Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "LPL"
HorizSync 30.0 - 75.0
VertRefresh 60.0
Option "DPMS"
EndSection

Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "GeForce Go 7200"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "NO LOGO"
Option "TwinView" "0"
Option "metamodes" "1280x800_60 +0+0"
SubSection "Display"
Depth 24
EndSubSection
EndSection

Section "Extensions"
Option "Composite" "Enable"
EndSection

已经加入窗口透明特效,对于xorg.conf的配置我的作法一般是通过启动一个版本比较接近的Linux发型版,比如我用Pentoo启动以后复制LiveCD里面的xorg.conf文件出来稍加修改就可以使用了。

启动管理:
CP ~ # rc-update -s
alsasound | boot
bootmisc | boot
checkfs | boot
checkroot | boot
clock | boot
consolefont | boot
dbus | default
fbcondecor | boot
gpm | boot
hald | default
hostname | boot
keymaps | boot
local | default nonetwork
localmount | boot
modules | boot
net.lo | boot
rmnologin | boot
syslog-ng | boot
urandom | boot
vixie-cron | default

我的安装过程是翻墙到Youtube上下载的一个好像叫Gentoo minimal install in 10 mins的视频进行的,同时也参考了Gentoo的HandBook,我在外面把Handbook打印成了书,参考起来十分方便。具体配置还有很多,我用的xfce4的图形界面。效果很美,速度也很棒,真是没有白费这半个月的工夫。
桌面就不秀了,没什么意思,用Gentoo就是为了加深Linux的理解,我觉着目的差不多达到了,非常感谢论坛的高手们无私的帮助,虽然我一直潜水,但问题几乎都能在论坛里找到解决的办法。再次感谢各位。今天比我考过RHCE还高兴(小吹下自己),嘿嘿!~

刚编辑完帖子,还是上个图吧,毕竟美化也弄了几个小时呢。
上传的图像
screenshot_001.gif (125.4 KB, 47 次查看)
上传的附件
config.txt (57.1 KB, 7 次查看)

作者: zeronenorez   发布时间: 2009-10-07

一出手就是好帖,果然超级潜水。

作者: zhou3345   发布时间: 2009-10-07

还是觉得参考价值不大
没有讲why,而只是how
楼主精神不错

作者: Havanna   发布时间: 2009-10-07

那个 xorg.conf 只需要:

Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "GeForce Go 7200"
EndSection

Section "Extensions"
Option "Composite" "Enable"
EndSection

就可以了。可以参考 xorg 升级指南。

作者: LiYanrui   发布时间: 2009-10-07

不错,顶一下

作者: suddenkiller   发布时间: 2009-10-07

引用:
作者: LiYanrui
那个 xorg.conf 只需要:

Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "GeForce Go 7200"
EndSection

Section "Extensions"
Option "Composite" "Enable"
EndSection

就可以了。可以参考 xorg 升级指南。
我的配置文件是nvidia-xconfig生成的,多久多吧,也没影响到使用,没关系

作者: zeronenorez   发布时间: 2009-10-07

08年註冊現在1帖也叫超級潛水……

不過要支持一下。

作者: 亞利艾爾   发布时间: 2009-10-07

引用:
作者: 亞利艾爾
08年註冊現在1帖也叫超級潛水……

不過要支持一下。
06年还有个马甲不过后来忘了密码了。。。。

作者: zeronenorez   发布时间: 2009-10-07