当前位置:操作系统 > Unix/Linux >>

GentooLinux实战!

一、为什么要用Gentoo:

  Linux?在这里:[url]http://www.linuxsir.com/bbs/showthread.php?s=&threadid=15399 [/url]有一个讨论。对我个人而言,我是一个软件的“版本狂”,只要有什么新的我喜欢的软件或软件版本出来,我都会马上去DOWNLOAD下来装上试试,也因此经常为找一些关联的包而大伤脑筋。而这个正好是GENTOO的常项,它是从网上DOWNLOAD源码下来编译,而且更新很快,并且它的可以自己解决包的关联。以前我也装过几次,但是都不是很理想,这次决定重头再来!!!

  [注:我选择的是从别的Linux系统下安装,关于别的安装方法:http://www.linuxsir.com/bbs/showthread.php?s=&threadid=23311]

  级别: 大天使

  注册时间: 2002-05-24

  最后登录: 2003-10-08

  帖子总数: 1878

  精华帖子: 32

  原创精华: 2

  在线状态: ...离线...

  

  发表于: 2003-06-11 11:06 发表主题:

  二、安装基本系统:

  [其过程主要参照: http://www.linuxsir.com/bbs/showthread.php?s=&threadid=11918 ]

  1,下载最新的包1.4RC4: http://distro.ibiblio.org/pub/linux/distributions/gentoo/releases/1.4_rc4/x86/x86/stages/stage3-x86-1.4_rc4.tar.bz2

  2,用现有的Linux启动登录至字符界面,打开硬盘的DMA,用事先分好的区来安装Gentoo Linux系统

  代码:

  #hdparm -c 1 -d 1 /dev/hda

  我们把root分区格式化为reiserfs 文件系统

  #mkreiserfs /dev/hda7 [如果想用EXT3:mke2fs -j /dev/hda7]

  #mkswap /dev/hda3

  #swapon /dev/hda3

  2.挂装分区到新建的目录:

  代码:

  #mkdir /mnt/gentoo

  #mount /dev/hda7 /mnt/gentoo

  3.解压stage3放到gentoo的根分区也就是/mnt/gentoo (假设原stage3放在Mandrake根分区)

  代码:

  #cp /stage3-x86-1.4_rc4.tar.bz2 /mnt/gentoo

  #cd /mnt/gentoo

  #tar -xvjpf stage3-x86-1.4_rc4.tar.bz2

  4.挂装/proc分区以及cp resolv.conf文件到Gentoo Linux系统

  代码:

  #mount -o bind /proc /mnt/gentoo/proc

  #cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf

  5.进入chroot环境,升级Portage软件列表及全面更新系统

  代码:

  #chroot /mnt/gentoo /bin/bash

  #env-update

  #source /etc/profile (真正进入Gentoo环境)

  #emerge rsync (下载Portage软件列表)

  #nano -w /etc/make.conf (编辑make.conf ,优化Portage相关参数,主要是以下几项)

  a. 修改编译针对CPU的编译优化参数

  代码:

  CHOST="i686-pc-linux-gnu"

  CFLAGS="-march=pentium3 -O3 -pipe -fomit-frame-pointer"

  CXXFLAGS="-march=pentium3 -O3 -pipe -fomit-frame-pointer"

  (这是我的优化参数,你可以根据自己的CPU类型选择不同的参数,详情请参考下表)

  代码:

  ×Safe flags to use for gentoo-1.4

  Those flags are for gcc-3.x and alike (mostly gcc-3.0, gcc-3.1.1 and gcc-3.2), you may check which gcc you're using with the following command :

  How to know your gcc version

  #gcc --version

  You can know which CPU you have with the following command :

  How to know your CPU type

  cat /proc/cpuinfo

  This page is for those who don't want to experiment, want a stable system, but still optimized for their processor. Be careful, by using those flags, binaries from your system might not work on another one. So if you compiled with those flags optimized for p4, you cant send a tbz2 or share a hard disk with a friend who only has a pentium MMX.

  i386 (Intel), do you really want to install gentoo on that ?

  CHOST="i386-pc-linux-gnu"

  CFLAGS="-march=i386 -O3 -pipe -fomit-frame-pointer"

  CXXFLAGS="-march=i386 -O3 -pipe -fomit-frame-pointer"

  i486 (Intel), do you really want to install gentoo on that ?

  CHOST="i486-pc-linux-gnu"

  CFLAGS="-march=i486 -O3 -pipe -fomit-frame-pointer"

  CXXFLAGS="-march=i486 -O3 -pipe -fomit-frame-pointer"

  Pentium 1 (Intel)

  CHOST="i586-pc-linux-gnu"

  CFLAGS="-march=pentium -O3 -pipe -fomit-frame-pointer"

  CXXFLAGS="-march=pentium -O3 -pipe -fomit-frame-pointer"

  Pentium MMX (Intel)

  CHOST="i586-pc-linux-gnu"

  CFLAGS="-march=pentium-mmx -O3 -pipe -fomit-frame-pointer"

  CXXFLAGS="-march=pentium-mmx -O3 -pipe -fomit-frame-pointer"

  Pentium PRO (Intel)

  CHOST="i686-pc-linux-gnu"

  CFLAGS="-march=pentiumpro -O3 -pipe -fomit-frame-pointer"

  CXXFLAGS="-march=pentiumpro -O3 -pipe -fomit-frame-pointer"

  Pentium II (Intel)

  CHOST="i686-pc-linux-gnu"

  CFLAGS="-march=pentium2 -O3 -pipe -fomit-frame-pointer"

  CXXFLAGS="-march=pentium2 -O3 -pipe -fomit-frame-pointer"

  Celeron (Mendocino), aka Celeron1 (Intel)

  CHOST="i686-pc-linux-gnu"

  CFLAGS="-march=pentium2 -O3 -pipe -fomit-frame-pointer"

  CXXFLAGS="-march=pentium2 -O3 -pipe -fomit-frame-pointer"

  Pentium III (Intel)

  CHOST="i686-pc-linux-gnu"

  CFLAGS="-march=pentium3 -O3 -pipe -fomit-frame-pointer"

  CXXFLAGS="-march=pentium3 -O3 -pipe -fomit-frame-pointer"

  Celeron (Coppermine) aka Celeron2 (Intel)

  CHOST="i686-pc-linux-gnu"

  CFLAGS="-march=pentium3 -O3 -pipe -fomit-frame-pointer"

  CXXFLAGS="-march=pentium3 -O3 -pipe -fomit-frame-pointer"

  Celeron (Willamette?) (Intel)

  CHOST="i686-pc-linux-gnu"

  CFLAGS="-march=pentium4 -O3 -pipe -fomit-frame-pointer"

  CXXFLAGS="-march=pentium4 -O3 -pipe -fomit-frame-pointer"

  Pentium 4 (Intel)

  CHOST="i686-pc-linux-gnu"

  CFLAGS="-march=pentium4 -O3 -pipe -fomit-frame-pointer"

  CXXFLAGS="-march=pentium4 -O3 -pipe -fomit-frame-pointer"

  Eden C3/Ezra (Via)

  CHOST="i586-pc-linux-gnu"

  CFLAGS="-march=i586 -m3dnow -O3 -pipe -fomit-frame-pointer"

  CXXFLAGS="-march=i586 -m3dnow -O3 -pipe -fomit-frame-pointer"

  quote : the ezra doesn't have any special instructions that you could optimize for, just consider is a K6-3...basically a p2 with 3dnow

  K6 (AMD)

  CHOST="i586-pc-linux-gnu"

  CFLAGS="-march=k6 -O3 -pipe -fomit-frame-pointer"

  CXXFLAGS="-march=k6 -O3 -pipe -fomit-frame-pointer"

  K6-2 (AMD)

  CHOST="i586-pc-linux-gnu"

  CFLAGS="-march=k6-2 -O3 -pipe -fomit-frame-pointer"

  CXXFLAGS="-march=k6-2 -O3 -pipe -fomit-frame-pointer"

  K6-3 (AMD)

  CHOST="i586-pc-linux-gnu"

  CFLAGS="-march=k6-3 -O3 -pipe -fomit-frame-pointer"

  CXXFLAGS="-march=k6-3 -O3 -pipe -fomit-frame-pointer"

  Athlon (AMD)

  CHOST="i686-pc-linux-gnu"

  CFLAGS="-march=athlon -O3 -pipe -fomit-frame-pointer"

  CXXFLAGS="-march=athlon -O3 -pipe -fomit-frame-pointer"

  Athlon-tbird, aka K7 (AMD)

  CHOST="i686-pc-linux-gnu"

  CFLAGS="-march=athlon-tbird -O3 -pipe -fomit-frame-pointer"

  CXXFLAGS="-march=athlon-tbird -O3 -pipe -fomit-frame-pointer"

  Athlon-tbird XP (AMD)

  CHOST="i686-pc-linux-gnu"

  CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer"

  CXXFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer"

  Athlon 4(AMD)

  CHOST="i686-pc-linux-gnu"

  CFLAGS="-march=athlon-4 -O3 -pipe -fomit-frame-pointer"

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,