免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3001 | 回复: 4
打印 上一主题 下一主题

Gentoo Linux最小安装 . [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-12-03 15:21 |只看该作者 |倒序浏览
Gentoo Linux最小安装 .











一、安装方法
快速安装方法见,不过本人没有安装成功,可能是光驱有点问题。Gentoo Linux 快速安装方法安装

gentoo linux有几种安装方法,下面使用官方最小安装的方法。安装成功。

二、安装步骤
1、准备启动盘
1.1首先下载gentoo最小安装光盘,下载地址http://mirrors.sohu.com/gentoo/r ... inimal-20111129.iso

1.2. 利用UltraISO来刻录镜像
1.3. 插入U盘
1.4. 用UltralISO打开iso文件
1.5. 选择启动 -> 写入硬盘镜像
1.6. 格式化U盘,再点写入
1.7. 在BIOS中选择从USB启动之后就可以用U盘启动系统,进行安装了。

2、正式安装
2.1. BIOS启动选择U盘启动。
2.2. 启动系统 boot

2.3. 磁盘分区

使用fdisk或cfdisk磁盘管理工具对磁盘分区。

这里本人对磁盘分区如下:

设备 大小 挂载点
  1. /dev/sda1 30G NFTS

  2. /dev/sda2 300M /boot

  3. /dev/sda3 60G /

  4. /dev/sda5 2G swap

  5. /dev/sda6 60G /home
复制代码
fdisk详细使用如下,摘自官方文档Gentoo安装过程中fdisk的使用

2.5 挂载分区
  1. view plaincopy to clipboardprint?
  2. 01.mount /dev/sda3 /mnt/gentoo/  
  3. 02.mount /dev/sda2 /mnt/gentoo/boot  
  4. 03.mount /dev/sda6 /mnt/gentoo/home  
  5. mount /dev/sda3 /mnt/gentoo/
  6. mount /dev/sda2 /mnt/gentoo/boot
  7. mount /dev/sda6 /mnt/gentoo/home
复制代码
2.6 下载解压stage3
view plaincopy to clipboardprint?
01.cd /mnt/gentoo  
cd /mnt/gentoo然后使用
  1. view plaincopy to clipboardprint?
  2. 01.wget http://mirrors.sohu.com/gentoo/releases/x86/current-stage3/stage3-i686-20111129.tar.bz2
复制代码
wget http://mirrors.sohu.com/gentoo/r ... 86-20111129.tar.bz2或者使用links命令,点击对应的链接进行下载。

解压

tar xvjpf stage*


2.7 安装Portage

和上面一样,下载http://mirrors.sohu.com/gentoo/snapshots/portage-latest.tar.bz2


并解压

2.8 配置编译选项
打开make.conf文件
  1. view plaincopy to clipboardprint?
  2. 01.nano -w /mnt/gentoo/etc/make.conf  
  3. nano -w /mnt/gentoo/etc/make.conf
复制代码
设置CFLAGS和CXXFLAGS如下
  1. view plaincopy to clipboardprint?
  2. 01.CFLAGS="-O2 -march=nocona -pipe"  
  3. 02.# 两个变量使用相同的设置   
  4. 03.CXXFLAGS="${CFLAGS}"   
  5. 04.CHOST="i686-pc-linux-gnu"  
  6. 05.MAKEOPTS="-j3"  
  7. 06.USE="-gtk -gnome3 qt3qt4 kde alsa cdr"  
  8. 07.GENTOO_MIRRORS="http://mirrors.sohu.com/gentoo"  
  9. CFLAGS="-O2 -march=nocona -pipe"
  10. # 两个变量使用相同的设置
  11. CXXFLAGS="${CFLAGS}"  
  12. CHOST="i686-pc-linux-gnu"
  13. MAKEOPTS="-j3"
  14. USE="-gtk -gnome3 qt3qt4 kde alsa cdr"
  15. GENTOO_MIRRORS="http://mirrors.sohu.com/gentoo"
复制代码
三、安装Gentoo基本系统

3.1 COPY  DNS信息并挂载proc和dev文件系统
  1. view plaincopy to clipboardprint?
  2. 01.# cp -L /etc/resolv.conf /mnt/gentoo/etc/   
  3. 02.# mount -t proc none /mnt/gentoo/proc   
  4. 03.# mount -o bind /dev /mnt/gentoo/dev  
  5. # cp -L /etc/resolv.conf /mnt/gentoo/etc/
  6. # mount -t proc none /mnt/gentoo/proc
  7. # mount -o bind /dev /mnt/gentoo/dev
复制代码
3.2 进入新的Gentoo环境
  1. view plaincopy to clipboardprint?
  2. 01.# chroot /mnt/gentoo /bin/bash   
  3. 02.# env-update   
  4. 03.>> Regenerating /etc/ld.so.cache...  
  5. 04.# source /etc/profile   
  6. 05.# export PS1="(chroot) $PS1"  
  7. # chroot /mnt/gentoo /bin/bash
  8. # env-update
  9. >> Regenerating /etc/ld.so.cache...
  10. # source /etc/profile
  11. # export PS1="(chroot) $PS1"
复制代码
3.3 更新Portage树
  1. view plaincopy to clipboardprint?
  2. 01.emerge --sync  
  3. emerge --sync
复制代码
3.4 选择profile

  1. view plaincopy to clipboardprint?
  2. 01.# eselect profile list   
  3. 02.# eselect profile set n  
  4. # eselect profile list
  5. # eselect profile set n
复制代码
3.5 设置LOCALE
  1. view plaincopy to clipboardprint?
  2. 01.# nano -w /etc/locale.gen  
  3. # nano -w /etc/locale.gen
复制代码
添加如下:

  1. view plaincopy to clipboardprint?
  2. 01.en_US ISO-8859-1  
  3. 02.en_US.UTF-8 UTF-8  
  4. 03.  
  5. 04.zh_CN GB18030  
  6. 05.zh_CN.GBK GBK  
  7. 06.zh_CN.GB2312 GB2312  
  8. 07.zh_CN.UTF-8 UTF-8  
  9. en_US ISO-8859-1
  10. en_US.UTF-8 UTF-8

  11. zh_CN GB18030
  12. zh_CN.GBK GBK
  13. zh_CN.GB2312 GB2312
  14. zh_CN.UTF-8 UTF-8
复制代码
3.6 安装源码
  1. view plaincopy to clipboardprint?
  2. 01.emerge gentoo-sources  
  3. emerge gentoo-sources
复制代码
3.7 配置内核
  1. view plaincopy to clipboardprint?
  2. 01.make menuconfig  
  3. make menuconfig
复制代码
这里根据自己的电脑特点来选择,比如本人将内核选项中的CPU类型家族改成CORE2,由于不是大内存(大于4G),这里将支持大内存的功能删除,将PAE功能裁剪掉,还可以根据自己的硬件类型适当修改硬件的驱动,建议如果明确可以修改,不是很明确的地方保持默认。配置内核对以后系统的性能有很大影响。

3.8 然后编译内核和驱动,并安装驱动
  1. view plaincopy to clipboardprint?
  2. 01.make && make modules_install  
  3. make && make modules_install
复制代码
3.9 安装内核
  1. view plaincopy to clipboardprint?
  2. 01.cp arch/x86/boot/bzImage /boot/kernel-3.0.6-gentoo  
  3. cp arch/x86/boot/bzImage /boot/kernel-3.0.6-gentoo
复制代码
注意修改内核的名字对应自己的内核版本



四、配置系统

4.1 修改/etc/fstab
  1. view plaincopy to clipboardprint?
  2. 01.# /etc/fstab: static file system information.   
  3. 02.#   
  4. 03.# noatime turns off atimes for increased performance (atimes normally aren't   
  5. 04.# needed); notail increases performance of ReiserFS (at the expense of storage   
  6. 05.# efficiency).  It's safe to drop the noatime options if you want and to   
  7. 06.# switch between notail / tail freely.   
  8. 07.#   
  9. 08.# The root filesystem should have a pass number of either 0 or 1.   
  10. 09.# All other filesystems should have a pass number of 0 or greater than 1.   
  11. 10.#   
  12. 11.# See the manpage fstab(5) for more information.   
  13. 12.#   
  14. 13.  
  15. 14.# <fs>            <mountpoint>  <type>        <opts>        <dump/pass>   
  16. 15.  
  17. 16.# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.   
  18. 17./dev/sda2       /boot       ext3        defaults,noatime    1 2  
  19. 18./dev/sda3       /       ext3        noatime     1 1  
  20. 19./dev/sda5       none        swap        sw      0 0  
  21. 20./dev/sda6       /home       ext3        defaults,noatime    1 2  
  22. 21./dev/cdrom      /mnt/cdrom  auto        noauto,ro   0 0  
  23. # /etc/fstab: static file system information.
  24. #
  25. # noatime turns off atimes for increased performance (atimes normally aren't
  26. # needed); notail increases performance of ReiserFS (at the expense of storage
  27. # efficiency).  It's safe to drop the noatime options if you want and to
  28. # switch between notail / tail freely.
  29. #
  30. # The root filesystem should have a pass number of either 0 or 1.
  31. # All other filesystems should have a pass number of 0 or greater than 1.
  32. #
  33. # See the manpage fstab(5) for more information.
  34. #

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

  36. # NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
  37. /dev/sda2                /boot                ext3                defaults,noatime        1 2
  38. /dev/sda3                /                ext3                noatime                1 1
  39. /dev/sda5                none                swap                sw                0 0
  40. /dev/sda6                /home                ext3                defaults,noatime        1 2
  41. /dev/cdrom                /mnt/cdrom        auto                noauto,ro        0 0
复制代码
4.2 配置网络
  1. view plaincopy to clipboardprint?
  2. 01.<span style="font-size:18px;"># nano -w /etc/conf.d/hostname  
  3. 02.  
  4. 03.(将HOSTNAME的变量值设定为主机名)  
  5. 04.HOSTNAME="yan-laptop"  
  6. 05.  
  7. 06.</span>  
  8. <span style="font-size:18px;"># nano -w /etc/conf.d/hostname
复制代码
(将HOSTNAME的变量值设定为主机名)
HOSTNAME="yan-laptop"
  1. </span>
  2. view plaincopy to clipboardprint?
  3. 01.<span style="font-size:18px;"># nano -w /etc/conf.d/net  
  4. 02.  
  5. 03.(设定dns_domain的变量值为你的域名)  
  6. 04.dns_domain_lo="homenetwork"  
  7. 05.  
  8. 06.config_eth0=( "192.168.0.2 netmask 255.255.255.0 brd 192.168.0.255" )  
  9. 07.routes_eth0=( "default via 192.168.0.1" )  
  10. 08.config_eth0=( "dhcp" )</span>  
  11. <span style="font-size:18px;"># nano -w /etc/conf.d/net

  12. (设定dns_domain的变量值为你的域名)
  13. dns_domain_lo="homenetwork"

  14. config_eth0=( "192.168.0.2 netmask 255.255.255.0 brd 192.168.0.255" )
  15. routes_eth0=( "default via 192.168.0.1" )
  16. config_eth0=( "dhcp" )</span>
  17. view plaincopy to clipboardprint?
  18. 01.<span style="font-size:18px;"># cd /etc/init.d  
  19. 02.# ln -s net.lo net.eth0  
  20. 03.# rc-update add net.eth0 default  
  21. 04.  
  22. 05.</span>  
  23. <span style="font-size:18px;"># cd /etc/init.d
  24. # ln -s net.lo net.eth0
  25. # rc-update add net.eth0 default

  26. </span>
  27. view plaincopy to clipboardprint?
  28. 01.<span style="font-size:18px;"># nano -w /etc/hosts  
  29. 02.127.0.0.1 localhost  yan-laptop  
  30. 03.</span>  
  31. <span style="font-size:18px;"># nano -w /etc/hosts
  32. 127.0.0.1 localhost  yan-laptop
  33. </span>
复制代码
最后安装一个DHCP客户端,让机器自动配置网络
  1. view plaincopy to clipboardprint?
  2. 01.<span style="font-size:18px;">emerge dhcpcd</span>  
  3. <span style="font-size:18px;">emerge dhcpcd</span>
复制代码
五、安装GRUB引导
  1. view plaincopy to clipboardprint?
  2. 01.<span style="font-size:18px;">emerge grub</span>  
  3. <span style="font-size:18px;">emerge grub</span>
复制代码
5.1 修改/boot/grub/grub.cfg
  1. view plaincopy to clipboardprint?
  2. 01.<span style="font-size:18px;">nano -w /etc/boot/grub/grub.cfg</span>  
  3. <span style="font-size:18px;">nano -w /etc/boot/grub/grub.cfg</span>
复制代码
文件内容如下:
  1. view plaincopy to clipboardprint?
  2. 01.<span style="font-size:18px;"># This is a sample grub.conf for use with Genkernel, per the Gentoo handbook  
  3. 02.# http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=10#doc_chap2   
  4. 03.# If you are not using Genkernel and you need help creating this file, you   
  5. 04.# should consult the handbook. Alternatively, consult the grub.conf.sample that   
  6. 05.# is included with the Grub documentation.   
  7. 06.  
  8. 07.default 0  
  9. 08.timeout 5  
  10. 09.#splashimage=(hd0,0)/boot/grub/splash.xpm.gz   
  11. 10.  
  12. 11.title Gentoo Linux 3.0.6  
  13. 12.root (hd0,1)  
  14. 13.kernel /boot/kernel-3.0.6-gentoo root=/dev/sda3  
  15. 14.  
  16. 15.title Windows 7  
  17. 16.rootnoverify(hd0,0)  
  18. 17.makeactive  
  19. 18.chainloader +1  
  20. 19.  
  21. 20.# vim:ft=conf:</span>  
  22. <span style="font-size:18px;"># This is a sample grub.conf for use with Genkernel, per the Gentoo handbook
  23. # http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=10#doc_chap2
  24. # If you are not using Genkernel and you need help creating this file, you
  25. # should consult the handbook. Alternatively, consult the grub.conf.sample that
  26. # is included with the Grub documentation.

  27. default 0
  28. timeout 5
  29. #splashimage=(hd0,0)/boot/grub/splash.xpm.gz

  30. title Gentoo Linux 3.0.6
  31. root (hd0,1)
  32. kernel /boot/kernel-3.0.6-gentoo root=/dev/sda3

  33. title Windows 7
  34. rootnoverify(hd0,0)
  35. makeactive
  36. chainloader +1

  37. # vim:ft=conf:</span>
复制代码
5.2 创建mtab
  1. view plaincopy to clipboardprint?
  2. 01.<span style="font-size:18px;">grep -v rootfs /proc/mounts > /etc/mtab</span>  
  3. <span style="font-size:18px;">grep -v rootfs /proc/mounts > /etc/mtab</span>
复制代码
5.3 安装grub
  1. view plaincopy to clipboardprint?
  2. 01.<span style="font-size:18px;">grub-install --no-floppy /dev/sda</span>  
  3. <span style="font-size:18px;">grub-install --no-floppy /dev/sda</span>
复制代码
重启,选择Gentoo,启动成功,基本系统安装完成。

有空将KDE桌面装上。不过编译得有一天的时间。这就是Gentoo的特点,高度的定制性,才能获得高的效率。这就是Gentoo的Philosopy。

论坛徽章:
0
2 [报告]
发表于 2011-12-22 21:39 |只看该作者
谢谢分享....学习鸟

论坛徽章:
2
操作系统版块每日发帖之星
日期:2015-08-05 06:20:0015-16赛季CBA联赛之北控
日期:2019-02-13 22:56:03
3 [报告]
发表于 2013-01-26 10:38 |只看该作者
还是不会这样等于没有说,一看就懂的人,需要具备多少的智商呢,或者他的头本身就是一个机器

论坛徽章:
5
丑牛
日期:2014-01-21 08:26:26卯兔
日期:2014-03-11 06:37:43天秤座
日期:2014-03-25 08:52:52寅虎
日期:2014-04-19 11:39:48午马
日期:2014-08-06 03:56:58
4 [报告]
发表于 2013-01-28 17:24 |只看该作者
高度的定制性,才能获得高的效率。

论坛徽章:
0
5 [报告]
发表于 2013-01-30 23:02 |只看该作者
LZ最后安装出来的系统多大啊。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP