- 论坛徽章:
- 0
|
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磁盘管理工具对磁盘分区。
这里本人对磁盘分区如下:
设备 大小 挂载点- /dev/sda1 30G NFTS
- /dev/sda2 300M /boot
- /dev/sda3 60G /
- /dev/sda5 2G swap
- /dev/sda6 60G /home
复制代码 fdisk详细使用如下,摘自官方文档Gentoo安装过程中fdisk的使用
2.5 挂载分区- view plaincopy to clipboardprint?
- 01.mount /dev/sda3 /mnt/gentoo/
- 02.mount /dev/sda2 /mnt/gentoo/boot
- 03.mount /dev/sda6 /mnt/gentoo/home
- mount /dev/sda3 /mnt/gentoo/
- mount /dev/sda2 /mnt/gentoo/boot
- mount /dev/sda6 /mnt/gentoo/home
复制代码 2.6 下载解压stage3
view plaincopy to clipboardprint?
01.cd /mnt/gentoo
cd /mnt/gentoo然后使用- view plaincopy to clipboardprint?
- 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文件- view plaincopy to clipboardprint?
- 01.nano -w /mnt/gentoo/etc/make.conf
- nano -w /mnt/gentoo/etc/make.conf
复制代码 设置CFLAGS和CXXFLAGS如下- view plaincopy to clipboardprint?
- 01.CFLAGS="-O2 -march=nocona -pipe"
- 02.# 两个变量使用相同的设置
- 03.CXXFLAGS="${CFLAGS}"
- 04.CHOST="i686-pc-linux-gnu"
- 05.MAKEOPTS="-j3"
- 06.USE="-gtk -gnome3 qt3qt4 kde alsa cdr"
- 07.GENTOO_MIRRORS="http://mirrors.sohu.com/gentoo"
- CFLAGS="-O2 -march=nocona -pipe"
- # 两个变量使用相同的设置
- CXXFLAGS="${CFLAGS}"
- CHOST="i686-pc-linux-gnu"
- MAKEOPTS="-j3"
- USE="-gtk -gnome3 qt3qt4 kde alsa cdr"
- GENTOO_MIRRORS="http://mirrors.sohu.com/gentoo"
复制代码 三、安装Gentoo基本系统
3.1 COPY DNS信息并挂载proc和dev文件系统- view plaincopy to clipboardprint?
- 01.# cp -L /etc/resolv.conf /mnt/gentoo/etc/
- 02.# mount -t proc none /mnt/gentoo/proc
- 03.# mount -o bind /dev /mnt/gentoo/dev
- # cp -L /etc/resolv.conf /mnt/gentoo/etc/
- # mount -t proc none /mnt/gentoo/proc
- # mount -o bind /dev /mnt/gentoo/dev
复制代码 3.2 进入新的Gentoo环境- view plaincopy to clipboardprint?
- 01.# chroot /mnt/gentoo /bin/bash
- 02.# env-update
- 03.>> Regenerating /etc/ld.so.cache...
- 04.# source /etc/profile
- 05.# export PS1="(chroot) $PS1"
- # chroot /mnt/gentoo /bin/bash
- # env-update
- >> Regenerating /etc/ld.so.cache...
- # source /etc/profile
- # export PS1="(chroot) $PS1"
复制代码 3.3 更新Portage树- view plaincopy to clipboardprint?
- 01.emerge --sync
- emerge --sync
复制代码 3.4 选择profile
- view plaincopy to clipboardprint?
- 01.# eselect profile list
- 02.# eselect profile set n
- # eselect profile list
- # eselect profile set n
复制代码 3.5 设置LOCALE- view plaincopy to clipboardprint?
- 01.# nano -w /etc/locale.gen
- # nano -w /etc/locale.gen
复制代码 添加如下:
- view plaincopy to clipboardprint?
- 01.en_US ISO-8859-1
- 02.en_US.UTF-8 UTF-8
- 03.
- 04.zh_CN GB18030
- 05.zh_CN.GBK GBK
- 06.zh_CN.GB2312 GB2312
- 07.zh_CN.UTF-8 UTF-8
- en_US ISO-8859-1
- en_US.UTF-8 UTF-8
- zh_CN GB18030
- zh_CN.GBK GBK
- zh_CN.GB2312 GB2312
- zh_CN.UTF-8 UTF-8
复制代码 3.6 安装源码- view plaincopy to clipboardprint?
- 01.emerge gentoo-sources
- emerge gentoo-sources
复制代码 3.7 配置内核- view plaincopy to clipboardprint?
- 01.make menuconfig
- make menuconfig
复制代码 这里根据自己的电脑特点来选择,比如本人将内核选项中的CPU类型家族改成CORE2,由于不是大内存(大于4G),这里将支持大内存的功能删除,将PAE功能裁剪掉,还可以根据自己的硬件类型适当修改硬件的驱动,建议如果明确可以修改,不是很明确的地方保持默认。配置内核对以后系统的性能有很大影响。
3.8 然后编译内核和驱动,并安装驱动- view plaincopy to clipboardprint?
- 01.make && make modules_install
- make && make modules_install
复制代码 3.9 安装内核- view plaincopy to clipboardprint?
- 01.cp arch/x86/boot/bzImage /boot/kernel-3.0.6-gentoo
- cp arch/x86/boot/bzImage /boot/kernel-3.0.6-gentoo
复制代码 注意修改内核的名字对应自己的内核版本
四、配置系统
4.1 修改/etc/fstab- view plaincopy to clipboardprint?
- 01.# /etc/fstab: static file system information.
- 02.#
- 03.# noatime turns off atimes for increased performance (atimes normally aren't
- 04.# needed); notail increases performance of ReiserFS (at the expense of storage
- 05.# efficiency). It's safe to drop the noatime options if you want and to
- 06.# switch between notail / tail freely.
- 07.#
- 08.# The root filesystem should have a pass number of either 0 or 1.
- 09.# All other filesystems should have a pass number of 0 or greater than 1.
- 10.#
- 11.# See the manpage fstab(5) for more information.
- 12.#
- 13.
- 14.# <fs> <mountpoint> <type> <opts> <dump/pass>
- 15.
- 16.# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
- 17./dev/sda2 /boot ext3 defaults,noatime 1 2
- 18./dev/sda3 / ext3 noatime 1 1
- 19./dev/sda5 none swap sw 0 0
- 20./dev/sda6 /home ext3 defaults,noatime 1 2
- 21./dev/cdrom /mnt/cdrom auto noauto,ro 0 0
- # /etc/fstab: static file system information.
- #
- # noatime turns off atimes for increased performance (atimes normally aren't
- # needed); notail increases performance of ReiserFS (at the expense of storage
- # efficiency). It's safe to drop the noatime options if you want and to
- # switch between notail / tail freely.
- #
- # The root filesystem should have a pass number of either 0 or 1.
- # All other filesystems should have a pass number of 0 or greater than 1.
- #
- # See the manpage fstab(5) for more information.
- #
- # <fs> <mountpoint> <type> <opts> <dump/pass>
- # NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
- /dev/sda2 /boot ext3 defaults,noatime 1 2
- /dev/sda3 / ext3 noatime 1 1
- /dev/sda5 none swap sw 0 0
- /dev/sda6 /home ext3 defaults,noatime 1 2
- /dev/cdrom /mnt/cdrom auto noauto,ro 0 0
复制代码 4.2 配置网络- view plaincopy to clipboardprint?
- 01.<span style="font-size:18px;"># nano -w /etc/conf.d/hostname
- 02.
- 03.(将HOSTNAME的变量值设定为主机名)
- 04.HOSTNAME="yan-laptop"
- 05.
- 06.</span>
- <span style="font-size:18px;"># nano -w /etc/conf.d/hostname
复制代码 (将HOSTNAME的变量值设定为主机名)
HOSTNAME="yan-laptop"- </span>
- view plaincopy to clipboardprint?
- 01.<span style="font-size:18px;"># nano -w /etc/conf.d/net
- 02.
- 03.(设定dns_domain的变量值为你的域名)
- 04.dns_domain_lo="homenetwork"
- 05.
- 06.config_eth0=( "192.168.0.2 netmask 255.255.255.0 brd 192.168.0.255" )
- 07.routes_eth0=( "default via 192.168.0.1" )
- 08.config_eth0=( "dhcp" )</span>
- <span style="font-size:18px;"># nano -w /etc/conf.d/net
- (设定dns_domain的变量值为你的域名)
- dns_domain_lo="homenetwork"
- config_eth0=( "192.168.0.2 netmask 255.255.255.0 brd 192.168.0.255" )
- routes_eth0=( "default via 192.168.0.1" )
- config_eth0=( "dhcp" )</span>
- view plaincopy to clipboardprint?
- 01.<span style="font-size:18px;"># cd /etc/init.d
- 02.# ln -s net.lo net.eth0
- 03.# rc-update add net.eth0 default
- 04.
- 05.</span>
- <span style="font-size:18px;"># cd /etc/init.d
- # ln -s net.lo net.eth0
- # rc-update add net.eth0 default
- </span>
- view plaincopy to clipboardprint?
- 01.<span style="font-size:18px;"># nano -w /etc/hosts
- 02.127.0.0.1 localhost yan-laptop
- 03.</span>
- <span style="font-size:18px;"># nano -w /etc/hosts
- 127.0.0.1 localhost yan-laptop
- </span>
复制代码 最后安装一个DHCP客户端,让机器自动配置网络- view plaincopy to clipboardprint?
- 01.<span style="font-size:18px;">emerge dhcpcd</span>
- <span style="font-size:18px;">emerge dhcpcd</span>
复制代码 五、安装GRUB引导- view plaincopy to clipboardprint?
- 01.<span style="font-size:18px;">emerge grub</span>
- <span style="font-size:18px;">emerge grub</span>
复制代码 5.1 修改/boot/grub/grub.cfg- view plaincopy to clipboardprint?
- 01.<span style="font-size:18px;">nano -w /etc/boot/grub/grub.cfg</span>
- <span style="font-size:18px;">nano -w /etc/boot/grub/grub.cfg</span>
复制代码 文件内容如下:- view plaincopy to clipboardprint?
- 01.<span style="font-size:18px;"># This is a sample grub.conf for use with Genkernel, per the Gentoo handbook
- 02.# http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=10#doc_chap2
- 03.# If you are not using Genkernel and you need help creating this file, you
- 04.# should consult the handbook. Alternatively, consult the grub.conf.sample that
- 05.# is included with the Grub documentation.
- 06.
- 07.default 0
- 08.timeout 5
- 09.#splashimage=(hd0,0)/boot/grub/splash.xpm.gz
- 10.
- 11.title Gentoo Linux 3.0.6
- 12.root (hd0,1)
- 13.kernel /boot/kernel-3.0.6-gentoo root=/dev/sda3
- 14.
- 15.title Windows 7
- 16.rootnoverify(hd0,0)
- 17.makeactive
- 18.chainloader +1
- 19.
- 20.# vim:ft=conf:</span>
- <span style="font-size:18px;"># This is a sample grub.conf for use with Genkernel, per the Gentoo handbook
- # http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=10#doc_chap2
- # If you are not using Genkernel and you need help creating this file, you
- # should consult the handbook. Alternatively, consult the grub.conf.sample that
- # is included with the Grub documentation.
- default 0
- timeout 5
- #splashimage=(hd0,0)/boot/grub/splash.xpm.gz
- title Gentoo Linux 3.0.6
- root (hd0,1)
- kernel /boot/kernel-3.0.6-gentoo root=/dev/sda3
- title Windows 7
- rootnoverify(hd0,0)
- makeactive
- chainloader +1
- # vim:ft=conf:</span>
复制代码 5.2 创建mtab- view plaincopy to clipboardprint?
- 01.<span style="font-size:18px;">grep -v rootfs /proc/mounts > /etc/mtab</span>
- <span style="font-size:18px;">grep -v rootfs /proc/mounts > /etc/mtab</span>
复制代码 5.3 安装grub- view plaincopy to clipboardprint?
- 01.<span style="font-size:18px;">grub-install --no-floppy /dev/sda</span>
- <span style="font-size:18px;">grub-install --no-floppy /dev/sda</span>
复制代码 重启,选择Gentoo,启动成功,基本系统安装完成。
有空将KDE桌面装上。不过编译得有一天的时间。这就是Gentoo的特点,高度的定制性,才能获得高的效率。这就是Gentoo的Philosopy。 |
|