服务器技术

 首页 > 服务器技术 > Linux > Gentoo Linux最小安装 - Linux操作系统:Ubuntu_Centos_

Gentoo Linux最小安装 - Linux操作系统:Ubuntu_Centos_

分享到:
【字体:
导读:
          一、安装方法快速安装方法见,不过本人没有安装成功,可能是光驱有点问题。Gentoo 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. 

 

#                                

 

# 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.cfg

 

nano -w /etc/boot/grub/grub.cfg 

文件内容如下:

 

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

 

摘自 闫明--To Be a Linux Kernel Hacker

      上一篇:Ubuntu下Samba服务器的最简配置 - Linux操作系统: 下一篇:VI的用法 - Linux操作系统:Ubuntu_Centos_Debian - 自学
    分享到:
    VI的用法 - Linux操作系统:Ubuntu_Cento...
         vi是Linux终端下或控制台下常用的编辑器,基本的操作方式为:     vi /路径/文件名     例如,vi /etc/fstab表示显示/etc/fstab文件的内容。使用键盘上的Page Up和Page Down键可以上下   翻页;按下Insert键,可以见到窗口左下角有“Insert”字样,表示当前为插入编辑状态...
    Ubuntu下Samba服务器的最简配置 - Linux...
      一. Samba的安装: # sudo apt-get insall samba   # sudo apt-get install smbfs   二. 创建共享目录:     # mkdir /home/willis/share   # sodu chmod 777 /home/willis/share     三. 创建Samba配置文件:     01. 保存现有的配置文件 ...
    •         php迷,一个php技术的分享社区,专属您自己的技术摘抄本、收藏夹。
    • 在这里……