Gentoo Linux最小安装

原创作品,转载请标明出处http://blog.csdn.net/yming0221/article/details/7037248


2012年新年伊始,1月2日,Gentoo Linux 12.0正式版发布了。Gentoo Linux是Linux世界最年轻的操作系统发行版本之一,Gentoo的哲学是自由和选择,它能为几乎任何应用程序或需求自动地作出优化和定制。Gentoo Linux能有这样的优点,完全得益于一种称为Portage的技术。

  据了解,Gentoo Linux最初由Daniel Robbins(FreeBSD的开发者之一)创建,首个稳定版本发布于2002年。由于开发者对FreeBSD的熟识,所以Gentoo拥有媲美FreeBSD的广受美誉的ports系统Portage包管理系统。

  不同于APT和YUM等二进制文件分发的包管理系统,Portage是基于源代码分发的,必须编译后才能运行,对于大型软件而言比较慢,不过正因为所有软件都是在本地机器编译的,在经过各种定制的编译参数优化后,能将机器的硬件性能发挥到极致。

  Gentoo Linux里的Portage是用Python编写的,是一套真正的自动导入系统。并且,Portage具有很多先进的特性,包括文件依赖、精细的包管理、OpenBSD风格的虚拟安装,安全卸载,系统框架文件、虚拟软件包、配置文件管理等等。

  由于Gentoo Linux具有近乎完美的适应性,所以,很多人把Gentoo Linux称作元发行版。同时,Gentoo Linux还具标志性的特点:追求极限的配置、性能以及顶尖的用户和开发者社区等。Gentoo Linux为用户提供大量的应用程序源代码,它的每一部分都可以在最终用户的系统上重新编译建造,甚至包括最基本的系统库和编译器自身,提供了大量软件供用户选择。这种选择不仅在软件整体方面,也存在于软件的内部。由于可以在本地编译软件,参数和变量的选择可以由用户自己指定。

  可以说,Gentoo Linux是所有Linux发行版本里安装最复杂的操作系统之一,但是又是安装完成后最便于管理的版本,也是在相同硬件环境下运行最快的版本。

  所以,Gentoo Linux被业界认为是理想的安全服务器、开发工作站、专业桌面、游戏系统、嵌入式解决方案或者别的东西你想让它成为什么,它就可以成为什么。


一、安装方法

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

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

二、安装步骤

1、准备启动盘

1.1首先下载gentoo最小安装光盘,下载地址http://mirrors.sohu.com/gentoo/releases/x86/current-stage3/install-x86-minimal-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 挂载分区

mount /dev/sda3 /mnt/gentoo/ mount /dev/sda2 /mnt/gentoo/boot mount /dev/sda6 /mnt/gentoo/home

2.6 下载解压stage3

cd /mnt/gentoo 然后使用
wget http://mirrors.sohu.com/gentoo/releases/x86/current-stage3/stage3-i686-20111129.tar.bz2 或者使用links命令,点击对应的链接进行下载。

解压

tar xvjpf stage*

2.7 安装Portage

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

并解压

2.8 配置编译选项

打开make.conf文件

nano -w /mnt/gentoo/etc/make.conf

设置CFLAGS和CXXFLAGS如下

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文件系统

# 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环境

# chroot /mnt/gentoo /bin/bash # env-update >> Regenerating /etc/ld.so.cache... # source /etc/profile # export PS1="(chroot) $PS1"

3.3 更新Portage树

emerge --sync

3.4 选择profile

# eselect profile list # eselect profile set n

3.5 设置LOCALE

# nano -w /etc/locale.gen
添加如下:

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 安装源码

emerge gentoo-sources

3.7 配置内核

make menuconfig


这里根据自己的电脑特点来选择,比如本人将内核选项中的CPU类型家族改成CORE2,由于不是大内存(大于4G),这里将支持大内存的功能删除,将PAE功能裁剪掉,还可以根据自己的硬件类型适当修改硬件的驱动,建议如果明确可以修改,不是很明确的地方保持默认。配置内核对以后系统的性能有很大影响。

3.8 然后编译内核和驱动,并安装驱动

make && make modules_install

3.9 安装内核

cp arch/x86/boot/bzImage /boot/kernel-3.0.6-gentoo

注意修改内核的名字对应自己的内核版本


四、配置系统

4.1 修改/etc/fstab

# /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 配置网络

# nano -w /etc/conf.d/hostname (将HOSTNAME的变量值设定为主机名) HOSTNAME="yan-laptop" # 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" )# cd /etc/init.d # ln -s net.lo net.eth0 # rc-update add net.eth0 default # nano -w /etc/hosts 127.0.0.1 localhost yan-laptop
最后安装一个DHCP客户端,让机器自动配置网络

emerge dhcpcd

五、安装GRUB引导

emerge grub

5.1 修改/boot/grub/grub.conf

nano -w /etc/boot/grub/grub.conf 文件内容如下:

# 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:

5.2 创建mtab

grep -v rootfs /proc/mounts > /etc/mtab

5.3 安装grub

grub-install --no-floppy /dev/sda
重启,选择Gentoo,启动成功,基本系统安装完成。

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值