为了加快安装速度,我是先将需要用到的几个镜象全部下载到本地。所须下载的文件包括:
1、最小安装镜象包:install-x86-minimal-20130528.iso
2、Stage Tarball快照包:stage3-i686-20130528.tar.bz2
3、系统Portage快照包:portage-latest.tar.bz2
网络环境或U盘准备
下载完成之后,我的办法是将上述2与3两个包放置到局域网的web上(web地址为:192.168.1.100),做个简单的页面,便于下载与访问。页面为:index.html,
页面上只有两行简单的代码:
<a href="stage3-i686-20130528.tar.bz2" >stage3</ a >
<br ><a href="portage-latest.tar.bz2" >portage </ a ><br >
如此,准备工作完成。以下开始安装:
或使用Linux文件系统的EXT4格式的U盘存放以上两个文件
用最小安装镜象包install-x86-minimal-20130528.iso启动系统,
1、划分磁盘为了简单方便,还是按wiki的方法,只分为三个区,
如下:
/dev/sda1 启动分区
/dev/sda2 交换分区
/dev/sda3 根分区
以下是具体划分磁盘与步骤:
fdisk /dev/sda首先建立boot分区:Command (m for help):
nCommand action e extended p primary partition
(1-4)pPartition number (1-4): 1First cylinder (1-3876, default 1): (按回车)
Using
default value 1Last cylinder or +size or +sizeM or +sizeK (1-3876,
default 3876):
+100M(这里设定比wiki上稍大一些,便于今后使用多个内核)由于这个分区是将来的boot,所以需要把这个分区设置成可启动的。
键入a来给分区添加启动标志,
然后键入1。如果你再次按p键,你就会注意到,
在“Boot”那一列有个*。下面建立swap分区:同上,
键入n创建一个新分区,然后键入p来告诉fdisk你创建的是主分区。接着输入2来创建第2个主分区,在本例中是/dev/sda2。当提示输入第一个柱面的时候,直接敲回车。当提示输入最后一个柱面的时候,输入+512M来创建一个512MB大小的分区。在这之后,键入t来设置分区类型,键入2选择你刚刚创建的那个分区,然后再输入82,即把分区设置成了“Linux
Swap”。下面,建立根分区:同上,键入n创建一个新分区,然后键入p来告诉fdisk你创建的是主分区。接着输入3来创建第3个主分区,在本例中是/dev/sda3。当提示输入第一个柱面的时候,直接敲回车。当提示输入最后一个柱面的时候,仍然直接回车,把磁盘上的剩余空间创建一个分区。完成以上这些步骤之后,键入p,应该显示一个与下面类似的分区表:
Device BootStart EndBlocks Id
System/dev/sda1 *1 14 105808+83
Linux/dev/sda2 1581 506520 82
Linux swap/dev/sda3 82 3876 28690200 83
Linux2、 格式化分区并挂载分区格式化分区
mkfs.ext3 /dev/sda1
mkfs.ext4 /dev/sda3
mkswap /dev/sda2
挂载分区
swapon /dev/sda2
mount /dev/sda3 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/sda1 /mnt/gentoo/boot
开始安装基本系统
首先安装Stage Tarball进入Gentoo的挂载点#
cd /mnt/gentoo我是预先将Stage包放到了局域网内的web上的,所以直接使用links访问页面并下载:
# links http://192.168.1.100局域网速度很快,几秒就下载完毕,那么现在解开stage包:
# tar xvjpf stage3-*.tar.bz2注意,解包的参数千万不要出错:xvjpf
现在stage已经安装好,下面我们继续安装Portage。小心:要确保执行 *** 作的当前位置是:
#/mnt/gentoo ,如果不是,那么还得执行:
# cd /mnt/gentoo同样使用links访问上述局域网内的页面并下载:
# links http://192.168.1.100以下,解开Portage快照包:
# tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr
小心,上述参数中的“-C”,C为大写!
编译安装
-----------------------------------
以下,配置编译的选项注意:
编译选项放在make.conf中,现在中文wiki上对这个文件位置的说明有错误,现在的位置是在/mnt/gentoo/etc/portage/make.conf,
中文wiki上说的是在/mnt/gentoo/etc/make.conf(英文wiki上是正确的)。所有可参考的变量,都用注释形式罗列在/mnt/gentoo/usr/share/portage/config/make.conf.example里。以下,开始编辑这个配置文件:用你喜欢的编辑器(nano或者vi)打开该文件
# vi /mnt/gentoo/etc/make.conf此时我们只须添加简单点的下三个变量:
CFLAGS="-O2 -march=i686 -pipe"CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j2"
将自己访问时速度最快的镜象站点也加入该文件:
mirrorselect -i -o >>/mnt/gentoo/etc/portage/make.conf
mirrorselect -i -r -o >>/mnt/gentoo/etc/portage/make.conf
----------------------------------拷
贝DNS设置到系统中:
cp -L /etc/resolv.conf /mnt/gentoo/etc/
将几个重要的当前目录,挂载到新系统下去:
# mount -t proc none /mnt/gentoo/proc
# mount --rbind /sys /mnt/gentoo/sys
# mount --rbind /dev /mnt/gentoo/dev
或者下面这样也行:
# mount -t proc none /mnt/gentoo/proc
# mount -o bind /sys /mnt/gentoo/sys
# mount -o bind /dev /mnt/gentoo/dev
----------------------------------以下,切换到新系统:
# chroot /mnt/gentoo /bin/bash
# source /etc/profile# export PS1="(chroot) $PS1"
------------------------------------------------------------------
更新Portage树
# mkdir /usr/portage
# emerge-webrsync 或者:# emerge --sync
定义系统profile运行下面代码,查看可用的profile
# eselect profile list看到列表之后,我选择的是desktop,对应的是3,所以执行:# eselect profile set 3
--------------------------------
查看USE变量的可用列表
# less /usr/portage/profiles/use.desc将自己可能用到的USE变量,加入到编译选项文件中
# nano -w /etc/portage/make.conf
例如我的:USE="gtk alsa xorg nv"
--------------------------------
一系列基本设置:
1、时区设置:
# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
或者:# ln –s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
2、字符编码设置
# nano -w /etc/locale.gen
还是先保留美式英语吧en_US ISO-8859-1en_US.UTF-8 UTF-8保存之后,
执行:# locale-gen
--------------------------------
安装内核码源:
# emerge gentoo-sources安装完毕之后,不要忙着手工配置,毕竟很多选项还弄不明白其含义,所以我选择的是自动配置:
先安装自动配置工具genkernel
# emerge genkernel复制配置文件到新系统(其实也可不复制,自动工具可按默认配置文件进行配置)
# zcat /proc/config.gz >/usr/share/genkernel/arch/x86/kernel-config
下面进行自动配置
# genkernel all于是,慢慢等吧,上个厕所,喝几口茶都行……完成之后,查看一下自动生成的内核和initrd的名字
# ls /boot/kernel* /boot/initramfs*这里要记下来,等会儿安装grub的时候要用到
---------------------------------------
配置系统fstab
# nano -w /etc/fstab如果没有出错,那么几乎不用修改,看看就行。
---------------------------------------
生成主机名等
# nano -w /etc/conf.d/hostname
下面变量指定主机名HOSTNAME="主机名"配置网络
# nano -w /etc/conf.d/net
我用的是DHCPCD,所以加入:
config_eth0=( "dhcp" )固定IP的设定,请参考wiki另外,这里要小心,因为网卡名很可能不是eth0 !
在启动时自动启用网络,执行:
# rc-update add net.eth0 default
同样,这里要注意网卡名!修改网络信息
# nano -w /etc/hosts127.0.0.1 (主机名) localhost
----------------------------------
修改Root根密码:
# passwd输入两次不用说!
修改通用系统配置
# nano -w /etc/rc.conf要改什么东西就自己看着办啦,不改,保持默认也行。不过不要忘了,一旦安装了图形界面,就得安装显示管理器,显示管理器的启动都是在这里加入的。
修改键盘设置
# nano -w /etc/conf.d/keymapsKEYMAP这个变量要特别注意。如果你选择了错误的KEYMAP,在你敲击键盘的时候会有奇怪的结果。
修改时钟选项
#
nano -w
/etc/conf.d/hwclock(中文wiki这里又是错的)如果你机器上的钟不用UTC,你需要在文件钟加上CLOCK="local"。否则,你的时钟就有可能出现偏差。完成对/etc/conf.d/clock的配置后,保存并且退出。上述几项其实都可以暂时保持默认。
安装必要的系统工具
1、系统日志工具
# emerge syslog-ng# rc-update add syslog-ng default
安装引导
安装开机引导程序,还是选grub,这东西我熟悉,呵呵~~~~
# emerge grub安装完成之后,修改grub的配置文件。这里要特别小心,一旦出错就启动不了机子啦。我没有按wiki修改,而是按自己对grub的理解进行的修改:
# nano -w /boot/grub/grub.confdefault 0timeout 5
#
splashimage=(hd0,0)/boot/grub/splash.xpm.gztitle Gentooroot
(hd0,0)kernel /boot/ kernel-genkernel-x86-3.8.13-gentoo
root=/dev/sda3initrd /boot/ initramfs-genkernel-x86-3.8.13-gentoo
# 在有windows,需要双启动时,可输入以下内容:title Windows XProotnoverify (hd0,5) (小心,我这里假设windows是在磁盘的第6个分区)makeactivechainloader +1
创建/etc/mtab#
grep -v rootfs /proc/mounts >/etc/mtab执行grub-install安装GRUB:#
grub-install --no-floppy /dev/sda至此,基本系统安装完成,下面准备结束安装:首先退出挂载:
# exit然后卸载先前挂载到新系统中的目录
# cd
# umount -l /mnt/gentoo/dev{/shm,/pts,}
# umount -l /mnt/gentoo{/boot,/proc,}
或者如下也行:# umount /mnt/gentoo/boot /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo
完成安装:
重启系统
# reboot
或者关闭系统
# poweroff
------------------------------------
gentoo 是一个 linux 的版本,所有软件编译安装,但是这种安装过程耗时太长,已经不适合这个需要快速的时代。但是通过手动安装的过程,可以更深入的了解linux。gentoo 的文档非常全面,大部分的问题都可以通过 *** 作手册解决
https://wiki.gentoo.org/wiki/Handbook:Main_Page
以下为桌面安装部分>>>>>>>>>>>>>>>>>>>>>>>
Linux Kernel Configuration: VMware tools configuration这些是从gentoo的vmware的wiki页上复制下来的
其中光驱相关的是下面几个项,你make menuconfig然后检查下吧:
Device Drivers --->
<*>ATA/ATAPI/MFM/RLL support --->
<*>Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support
<*> Include IDE/ATAPI CDROM support
[*] PCI IDE chipset support
<*>Intel PIIXn chipsets support
下面是安装vmware tools的说明
First, we mount the iso image of the tools. Within vmware player of workstation, connect the CDROM to the iso file. It is located at
/opt/vmware/workstation/lib/vmware/isoimages/linux.iso.
Now we have to mount the image file
mount /dev/cdrom /mnt/cdrom
Then untar the image file
cd /mnt/cdrom tar -zxf VMwareTools-*.tar.gz -C /opt
Here you need to create the /etc/rc{0..6}.d directories because the installation script wants to create symlinks to /etc/init.d/vmware-tools.
mkdir /etc/rc{0..6}.d
You also need to create symlinks to some kernel headers
ln -s /usr/src/linux/include/generated/utsrelease.h /usr/src/linux/include/linux/utsrelease.h ln -s /usr/src/linux/include/generated/autoconf.h /usr/src/linux/include/linux/autoconf.h
Now we run the install script
cd /opt/vmware-tools-distrib ./vmware-install.pl
Respond to the configuration questions on the screen. Press Enter to accept the default value. Once you answer the last question, the installation will start. It will take quite some time... have a cup of tea.
Once the installation is finished, we have to add vmware-tools to the default runlevel
rc-update add vmware-tools default
Now you can start vmware-tools manually by the following command or you can reboot
/etc/init.d/vmware-tools start
-------------------------------下面是vmware下gentoo的内核全部的相关设置-----------------------
------------------如果你觉得不放心自己的设置,可以再和自己的设置对照下-----------------------
Loadable module support --->
[*] Enable loadable module support --->
[*] Module unloading
Linux Kernel Configuration: Intel PCI/ISA Bridge
Bus options (PCI etc.) --->
[*] PCI Support
[*] ISA Support
[*] EISA support
<*>Support for PCI Hotplug
Support for PCI Hotplug --->
<*>SHPC PCI Hotplug driver
Linux Kernel Configuration: IEEE 1394
Device Drivers --->
IEEE 1394 (Firewire) support --->
<*>Stable Firewire stack
<*> OHCI-1394 controllers
<*> Storage devices (SBP-2 protocol)
Linux Kernel Configuration: Parallel port
Device Drivers --->
<*>Parallel port support --->
<*>PC-style hardware
Linux Kernel Configuration: Parallel ATA
Device Drivers --->
<*>Serial ATA (prod) and Parallel ATA (experimental) drivers --->
<*> PCMCIA PATA support
Linux Kernel Configuration: I2C
Device Drivers --->
<*>I2C Support --->
I2C Hardware Bus support --->
<*> Intel PIIX4 and compatible (ATI/Serverworks/Broadcom/SMSC)
Linux Kernel Configuration: Backplane
Device Drivers --->
Sonics Silicon Backplane --->
<*> Sonics Silicon Backplane support
Linux Kernel Configuration: LSI Logic SCSI adapter
Device Drivers --->
[*] Fusion MPT device support --->
<*>Fusion MPT ScsiHost drivers for SPI
<*>Fusion MPT ScsiHost drivers for FC
<*>Fusion MPT ScsiHost drivers for SAS
SCSI device support --->
<*>SCSI device support
<*>SCSI disk support
SCSI low-level drivers --->
<*>SYM53C8XX Version 2 SCSI support
Linux Kernel Configuration: BusLogic
Device Drivers --->
SCSI device support --->
<*>SCSI device support
<*> SCSI disk support
SCSI low-level drivers --->
<*>BusLogic SCSI support
Linux Kernel Configuration: HID support
Device Drivers --->
[*] HID Devices --->
<*> USB Human Interface Device (full HID) support
[*] USB support --->
<*> Support for Host-side USB
<*>SL811HS HCD support
Linux Kernel Configuration: CDROM
Device Drivers --->
<*>ATA/ATAPI/MFM/RLL support --->
<*>Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support
<*> Include IDE/ATAPI CDROM support
[*] PCI IDE chipset support
<*>Intel PIIXn chipsets support
File systems --->
CD-ROM/DVD Filesystems --->
<*>ISO 9660 CDROM file system support
[*] Microsoft Joliet CDROM extensions
We have to disable IPV6, VMware does not support it yet.
Linux Kernel Configuration: Network
Networking --->
[*] Networking support
Networking options --->
<*>Packet socket
<*>Unix domain sockets
[*] TCP/IP networking
<> The IPv6 protocol --->
<*>802.1d Ethernet Bridging
You need to build the network drivers as modules to be able to unload them later and load vmware optimized modules.
Device Drivers --->
Network Device support --->
[*] Network device support
Ethernet (10 or 100Mbit) --->
[*] Ethernet (10 or 100Mbit)
[*] EISA, VLB, PCI and on board controllers
<M> AMD PCnet32 PCI support
Ethernet (1000Mbit) --->
[M] Intel(R) PRO/1000 Gigabit Ethernet support
VMware virtual machine emulates a Creative Labs Sound Blaster® AudioPCI device. If you like to have sound in your virtual Gentoo Linux, you will need to add support for it. See the following section.
Linux Kernel Configuration: Audio
Device Drivers --->
Sound --->
<M>Sound card support
--- Advanced Linux Sound Architecture
<M> Sequencer support
<>Sequencer dummy client
<M> OSS Mixer API
<M> OSS PCM (digital audio) API
[*] OSS PCM (digital audio) API - Include plugin system
[*] OSS Sequencer API
[*] Dynamic device file minor numbers
[*] Support old ALSA API
[*] Verbose procfs contents
[*] Generic sound devices --->
[*] PCI sound devices --->
<M>(Creative) Ensoniq AudioPCI 1371/1373
[*] USB sound devices --->
[*] PCMCIA sound devices --->
Linux Kernel Configuration: Gameport
Device Drivers --->
Input device support --->
Hardware I/O ports --->
<*>Gameport support
Linux Kernel Configuration: Graphics
Device Drivers --->
Graphics support --->
<*>/dev/agpgart (AGP Support) --->
<*> Intel 440LX/BX/GX, I8xx and E7x05 chipset support
Linux Kernel Configuration: Device mapper support
Device Drivers --->
[*] Multiple devices driver support (RAID and LVM) --->
<*> Device mapper support
<*>Snapshot target
<*>Bad Block Relocation Device Target (EXPERIMENTAL)
These other things might be useful for udev. Note: If your kernel has problems mounting udev, you may need to emerge sys-apps/portage, sys-fs/baselayout, and sys-fs/udev to their most current stable versions.
Linux Kernel Configuration: udev support
File Systems --->
Pseudo filesystems --->
-*- /proc file system support
<> /proc/kcore support
<*>Virtual memory file system support (former shm fs)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)