分享
 
 
 

GentooLinux1.4RC2硬盘安装参考指南(第二修订版)

王朝system·作者佚名  2008-05-18
窄屏简体版  字體: |||超大  

你可以从任何一个Linux发行版下安装Gentoo。

硬盘安装Gentoo,只要下载一个stage3的tbz2包就行了(你是什么CPU的就下相应的包).

×注:以下具体的数据都以你自己机器的实际情况为主×

用现有的Linux启动登录至字符界面 (原有Linux启动时root=/bin/bash参数可不加,经本人试验,完全没问题)

1.首先,打开硬盘的DMA,用事先分好的区来安装Gentoo Linux系统

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

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

#mkreiserfs /dev/hda8 (如果没有mkreiserfs命令,那可能是你没装reiserfsprogs,可从这里下载后编译安装 http://www.namesys.com/pub/reiserfs...gs-3.6.4.tar.gz 或从这里下载

http://rpmseek.com/download/mandrak...l=com&nid=11766 )

#mkswap /dev/hda10

#swapon /dev/hda10

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

#mkdir /mnt/gentoo

#mount /dev/hda8 /mnt/gentoo

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

#cp /stage3-athlon-1.4_rc2.tbz2 /mnt/gentoo

#cd /mnt/gentoo

#tar -xvjpf stage3--athlon-1.4_rc2.tbz2(我用的是Duron你是什么CPU的就下相应的包).

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的编译优化参数

# Host and optimization settings

# ==============================

#

# For optimal performance, enable a CFLAGS setting appropriate for your CPU

#

# -mcpu=<cpu-type> means optimize code for the particular type of CPU without

# breaking compatibility with other CPUs.

#

# -march=<cpu-type> means to take full advantage of the ABI and instructions

# for the particular CPU; this will break compatibility with older CPUs (for

# example, -march=athlon-xp code will not run on a regular Athlon, and

# -march=i686 code will not run on a Pentium Classic.

#

# CPU types supported in gcc-3.2 and higher: athlon-xp, athlon-mp, athlon-4,

# athlon-tbird, athlon, k6, k6-2, k6-3, i386, i486, i586 (Pentium), i686

# (PentiumPro), pentium, pentium-mmx, pentiumpro, pentium2 (Celeron), pentium3,

# and pentium4. Note that Gentoo Linux 1.4 and higher include at least gcc-3.2.

#

# CPU types supported in gcc-2.95*: k6, i386, i486, i586 (Pentium), i686

# (Pentium Pro), pentium, pentiumpro Gentoo Linux 1.2 and below use gcc-2.95*

#

# Decent examples:

#

CFLAGS="-mcpu=athlon-tbird -O3 -pipe"

CFLAGS="-march=athlon-tbird -O3 -pipe"(这是我的优化参数,你可以根据自己的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"

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

Athlon 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 MP (AMD)

CHOST="i686-pc-linux-gnu"

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

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

603 (PowerPC)

CHOST="powerpc-unknown-linux-gnu"

CFLAGS="-O3 -pipe -fsigned-char -mpowerpc-gfxopt"

CXXFLAGS="-O3 -pipe -fsigned-char -mpowerpc-gfxopt"

603e (PowerPC)

CHOST="powerpc-unknown-linux-gnu"

CFLAGS="-O3 -pipe -fsigned-char -mpowerpc-gfxopt"

CXXFLAGS="-O3 -pipe -fsigned-char -mpowerpc-gfxopt"

604 (PowerPC)

CHOST="powerpc-unknown-linux-gnu"

CFLAGS="-O3 -pipe -fsigned-char -mpowerpc-gfxopt"

CXXFLAGS="-O3 -pipe -fsigned-char -mpowerpc-gfxopt"

604e (PowerPC)

CHOST="powerpc-unknown-linux-gnu"

CFLAGS="-O3 -pipe -fsigned-char -mpowerpc-gfxopt"

CXXFLAGS="-O3 -pipe -fsigned-char -mpowerpc-gfxopt"

750 aka as G3 (PowerPC)

CHOST="powerpc-unknown-linux-gnu"

CFLAGS="-mcpu=750 -O3 -pipe -fsigned-char -mpowerpc-gfxopt"

CXXFLAGS="-mcpu=750 -O3 -pipe -fsigned-char -mpowerpc-gfxopt"

Note: do not use -march=

7400, aka G4 (PowerPC)

CHOST="powerpc-unknown-linux-gnu"

CFLAGS="-mcpu=7400 -O2 -pipe -fsigned-char -maltivec

-mabi=altivec -mpowerpc-gfxopt"

CXXFLAGS="-mcpu=7400 -O2 -pipe -fsigned-char -maltivec

-mabi=altivec -mpowerpc-gfxopt"

-fsigned-char -maltivec -mabi=altivec -mpowerpc-gfxopt"

Note: do not use -march=

Note: -O3 is unstable on G4

7450, aka G4 second generation (PowerPC)

CHOST="powerpc-unknown-linux-gnu"

CFLAGS="-mcpu=7450 -O2 -pipe -fsigned-char

-maltivec -mabi=altivec -mpowerpc-gfxopt"

CXXFLAGS="-mcpu=7450 -O2 -pipe -fsigned-char

-maltivec -mabi=altivec -mpowerpc-gfxopt"

Note: do not use -march=

Note: -O3 is unstable on G4

PowerPC (If you don't know which one)

CHOST="powerpc-unknown-linux-gnu"

CFLAGS="-O3 -pipe -fsigned-char -mpowerpc-gfxopt"

CXXFLAGS="-O3 -pipe -fsigned-char -mpowerpc-gfxopt"

Sparc

CHOST="sparc-unknown-linux-gnu"

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

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

Sparc 64

CHOST="sparc64-unknown-linux-gnu"

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

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

c emerge Gentoo Linux的最新unstable版本

# Advanced Masking

# ================

#

# Gentoo is using a new masking system to allow for easier stability testing

# on packages. KEYWORDS are used in ebuilds to mask and unmask packages based

# on the platform they are set for. A special form has been added that

# indicates packages and revisions that are expected to work, but have not yet

# been approved for the stable set. '~arch' is a superset of 'arch' which

# includes the unstable, in testing, packages. Users of the 'x86' architecture

# would add '~x86' to ACCEPT_KEYWORDS to enable unstable/testing packages.

# '~ppc', '~sparc', '~sparc64' are the unstable KEYWORDS for their respective

# platforms. DO NOT PUT ANYTHING BUT YOUR SPECIFIC ~ARCHITECTURE IN THE LIST.

# IF YOU ARE UNSURE OF YOUR ARCH, OR THE IMPLICATIONS, DO NOT MODIFY THIS.

#

ACCEPT_KEYWORDS="~x86"(去掉ACCEPT_KEYWORDS="~x86"前的注释符即可)

b打开PROZILLA的多线程下载功能,加快下载速度(在做这一步之前应该先emerge prozilla,这样才能用prozilla来下载。如果是stage1,因为没有c++编译器,可以先不emerge prozilla和修改下面这一步,到stage2以后再改。)

# Fetching files

# ==============

#

# If you need to set a proxy for wget or lukemftp, add the appropriate "export

# ftp_proxy=<proxy>" and "export http_proxy=<proxy>" lines to /etc/profile if

# all users on your system should use them.

#

# Portage uses wget by default. Here are some settings for some alternate

# downloaders -- note that you need to merge these programs first before they

# will be available.

#

# Lukemftp (BSD ftp):

#FETCHCOMMAND="/usr/bin/lukemftp -s -a -o \${DISTDIR}/\${FILE} \${URI}"

#RESUMECOMMAND="/usr/bin/lukemftp -s -a -R -o \${DISTDIR}/\${FILE} \${URI}"

#

# Prozilla (turbo downloader)

FETCHCOMMAND='/usr/bin/proz --no-getch -s ${URI} -P ${DISTDIR}'

(请注意,b和c优化项在执行完emerge -u world系统更新命令前是没有的,你可以把上述的内容cp到make.conf文件里稍做修改即可)

#emerge prozilla(因为stage3解压的基本系统里没有prozilla命令,如果我们要使用多线程下载软件包的话,就必需先把prozilla dwon下来)

#emerge -u world(全面更新系统,需要很长时间)

6.安装编译内核

#emerge gentoo-sources

#cd /usr/src/linux

#make menuconfig

#make dep

#make bzImage

#make modules

#make modules_install

#cp /usr/src/linux/System.map /boot/System.map-2.4.20

#cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-2.4.20

(关于2.4内核的详悉配置方法,请参阅以下文章 http://www.tldp.org/linuxfocus/Chin...rticle252.shtml

7.安装vcron和metalog以及update modules

#emerge vcron

#rc-update add vcron default

#emerge metalog

#rc-update add metalog default

#update-modules

8.安装ADSL拨号软件。

#emerge ppp

#USE="-X" emerge rp-pppoe (因为rp-pppoe和xfree 等X软件包存在倚赖关系,我们要先在字符环境下使用,就要用USE="-X" 参数来安装rp-pppoe)

9.设置时区和Host主机名

#cd /usr/share/zoneinfo/Asia

#ln –sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

#nano –w /etc/hostname

10.加入文件系统工具(如果是使用ext2或ext3,可以忽略这一步,系统自带了e2fsprogs)

#emerge reiserfsprogs

11.在Gentoo Linux系统里打开硬盘的DMA

#nano -w /etc/conf.d/local.start

在文件末尾加上 hdparm -c 1 -d 1 /dev/hda

12.设置root用户密码

#passwd

13.修改/etc/fstab文件,以符合你实际的分区情况,这是我的fstab文件,参考一下:)

#nano -w /etc/fstab

# <fs> <mountpoint> <type> <opts> <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

/dev/ROOT / reiserfs noatime 0 0

/dev/SWAP none swap sw 0 0

/dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,owner,ro,iocharset=cp936 0 0 0 0

proc /proc proc defaults 0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for

# POSIX shared memory (shm_open, shm_unlink). Adding the following

# line to /etc/fstab should take care of this:

# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will use almost no

# memory if not populated with files)

tmpfs /dev/shm tmpfs defaults 0 0

/dev/hda1 /winc vfat defaults,rw,iocharset=cp936 0 0

/dev/hda5 /wind vfat defaults,rw,iocharset=cp936 0 0

dev/hda6 /wine ntfs defaults,rw,iocharset=cp936 0 0

/dev/hda7 /winf ntfs defaults,rw,iocharset=cp936 0 0

#mkdir /iwnc /wind /wine /winf(根据自己机器的情况加载windows分区)

qing兄补充道:

quote:修改/etc/fstab文件很重要的

ROOT

BOOT

SWAP

都换成你具体的分区

在启动时

若出现Activating swap [ok]

这是假相

并没有加载swap分区

要出现

Activating swap xxxxxxxk -swap space [ok]

xxxxxx是具体数字,才是真的加载了swap分区

说这么多的目的是,SWAP很重要

14.配置Grub,以便启动系统。

#nano -w grub.conf (建立Grub启动列表文件)

以下是我的menu.lst

default 0

timeout 30

splashimage=(hd0,7) /boot/grub/splash.xpm.gz

title Mandrake Linux 9.0 (Kernel-2.4.19-16mdk)

root (hd0,8)

kernel (hd0,8) /boot/vmlinuz root=/dev/hda9 quiet devfs=mount hdc=ide-scsi vga=788

initrd (hd0,8) /boot/initrd.img

title Gentoo Linux 1.4 RC2 (Kernel-2.4.20gentoo)

root (hd0,7)

kernel /boot/vmlinuz-2.4.20gentoo ro root=/dev/hda8 hdc=ide-scsi

#cp /usr/share/grub/i386-pc/* /boot/grub (cp升级过的grub的stage文件到/boot/grub目录)

#grub (配置Grub,让Grub写入MBR,管理整个机器里所有系统的启动)

grub> root (hd0,7) (指定root分区位置)

grub> kernel /boot/vmlinuz-2.4.20gentoo ro root=/dev/hda8 hdc=ide-scsi (指定系统内核的位置以及加入其他参数选项)

grub>setup (hd0) (写入MBR)

grub>quit (退出)

15.进入Gentoo Linux字符环境,配置ADSL。

#adsl-setup

//以下是屏幕显示:

Welcome to the Roaring Penguin ADSL client setup. First, I will run some checks on your system to make sure the PPPoE client is installed properly...

Looks good! Now, please enter some information:

USER NAME

>>> Enter your PPPoE user name :

输入连入宽带网的账号

>>> Enter the Ethernet interface connected to the ADSL modem

For Linux, it will be ethn, where 'n' is a number.

(default eth0):

输入准备接入互联网的网卡名,如果是缺省的就直接敲回车键。

>>> Enter the demand value (default no):

直接回车。

DNS

>>> Enter the DNS information here:

输入有服务商提供的域名服务器地址,或输入server,由服务商自动提供。

PASSWORD

>>> Please enter your PPPoE password:

>>> Please re-enter your PPPoE password:

输入上网密码。

FIREWALLING

>>> Choose a type of firewall (0-2):

选择防火墙,选0。

** Summary of what you entered **

Ethernet Interface: eth0

User name: xxxx //你的用户名

Activate-on-demand: No

DNS: server

Firewalling: NONE

>>> Accept these settings and adjust configuration files (y/n)?

最后,对上述配置进行确认。确认后的配置系统会写入/etc/ppp/pppoe.conf文件,熟练的用户可直接对其进行修改。

拨号

配置完成后,就可以进行拨号了。

#adsl-start

如果屏幕上出现:“... Connected!”就说明拨号成功了。一般而言做到这一步是没什么问题的。这时可以用ifconfig命令查看,结果除了原本有的eth0、lo外又增添了ppp0。

13.安装配置最新的XFree和KDE3

#emerge xfree qt arts

#USE="-gnome -gtk" emerge kdelibs kdebase (去掉gnome和gtk以及多余kde组件的支持,安装最小化的KDE)

#xf86config (检测配置XFree86,根据自己具体配置选择,配置完毕会在/etc/X11/下生成XF86Config )

#echo "exec startkde" > ~/.xinitrc (让我们直接用startx命令进入KDE而不是原来的twm)

保存修改退出后,用startx命令就可以进入KDE了。

#reboot

OK,Gentoo现在就落户你的硬盘了.Enjoy Your

Gentoo

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有