文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>GENTOO安装

GENTOO安装

时间:2007-01-03  来源:tomcent_2006

引用:http://blog.donews.com/etony/archive/2005/01/10/232902.aspx

************************************

安装之前的准备:

*************************************
 
 核心介绍:
 ---------------------------------------------------------------------------------------------------
 gentoo    预设 2.4核心并且支持 framebuffer
 smp     2.6 核心支持多个CPU
 gentoo-nofb   和 gentoo 一样,但是关闭了对 framebuffer 的支持
 smp-nofb    和 smp 一样,但是关闭了对 framebuffer 的支持
 memtest86   检查你的内存是否有错误
 ----------------------------------------------------------------------------------------------------
 核心参数:
 ----------------------------------------------------------------------------------------------------
 - agpgart    载入 agpart (如果你有显示的问题)
 - doscsi    寻找 scsi 设备 (有时候会让某些网卡无法工作)
 - nodetect    让 hwsetup/kudzu 和 hotplug 无法执行
 - dofirewire   在 initrd 载入 firewire 模块 (firewire 光驱,等等)
 - nousb    从 initrd 关闭 usb 模块,关闭 hotplug
 - nodhcp    如果检测到网卡,让dhcp无法自动分配ip
 - doataraid   从 initrd 载入 raid 模块
 - dopcmcia   启用 pcmicia 服务
 - noapm    关闭 apm 模块的载入
 - noraid    关闭 evms 模块的载入
 - nohotplug   关闭 hotplug 服务
 - ide=nodma   针对无法使用的 ide 设备强迫关闭 dma
 - docache    在执行时将光盘快取到内存,让你可以在安装时更换光盘
 - dokeymap   开启 non-us 键盘的选择
 - noapic    关闭 apic (如果硬件有问题,网卡,scsi等等)
 - hdx=stroke   (只适合 smp/smp-nofb 核心)允许你在BIOS不支持大容量硬盘时,
还是可以分割整个硬盘
 ----------------------------------------------------------------------------------------------------
 
 *启动live cd:
  boot: gentoo dopcmcia
 
 如果你要查看CD上的文件时,你可以使用links2命令:
  # links2 /mnt/cdrom/docs/html/index.html
 如果你要启动 SSH 服务:
  # /etc/init.d/sshd start
 
 *微调硬盘性能:
  用下面的命令来测试你的硬盘性能
  # hdparm -tT /dev/hda
  范例:
  启动DMA:
# hdparm -d 1 /dev/hda
   启动DMA + 安全的增加性能:
   # hdparm -d 1 -A 1 -m 16 -u 1 -a 64 /dev/had
 
 *设定代理服务器:
  (如果是HTTP 代理服务器)
  # export http_proxy=http://proxy.gentoo.org:8080
  (如果是 FTP 代理服务器)
  # export ftp_proxy="ftp://proxy.gentoo.org:8080"
  (如果是 RSYNC 代理服务器)
  # export RSYNC_PROXY="proxy.gentoo.org:8080"
 如果需要帐号和密码,按照下面的格式将""中的替换:
  http://username:password@server
 
 *设定网络环境:
  # net-setup eth0
 如果使用PPPoE链接到网络
  # adsl-setup
  # adsl-start
 如果有错请仔细检查 /etc/ppp/pap-secrets 或是 /etc/ppp/chap-secrets 查看你的帐号和密码。
  **手动设定网络:
   查找可以用的核心模块:
   # ls /lib/modules/`uname -r` /kernel/drivers/net
   # modprobe pcnet32
 使用DHCP获取ip:
  # dhcpd eth0  或  # dhcpd -HD eth0

************************************ 安装准备结束 **************************************


1.先给硬盘分区
# fdisk /dev/hda

2.格式化每个分区
# mke2fs -j /dev/hda1  //格式化成 ext3
# mkswap /dev/hda2
# mkfs.xfs /dev/hda3  //格式化成xfs

****************************************************************
# mke2fs /dev/hda1   //格式化成 ext2
# mkreiserfs /dev/hda3  //格式化成reiserfs
# mkfs.reiser4 /dev/hda3  //格式化成reiserfs4
# mkfs.jfs /dev/hda3  //格式化成jfs
****************************************************************

3.启用 swap 分区
# swapon /dev/hda2

4.挂载
# mount /dev/hda3 /mnt/gentoo
# mkdir /mnt/gentoo/boot
# mount /dev/hda1 /mnt/gentoo/boot


5.设定时间
# date
# date 090911452004 (格式:data MMDDhhmmYYYY  M为月,D为日,h为时,m为分,Y为年)


6.安装stage档
# cd /mnt/gentoo
# tar -xvjpf /mnt/cdrom/stages/stage3-i686.tar.bz2
# tar -xvjf /mnt/cdrom/snapshots/portage-20040710.tar.bz2 -C /mnt/gentoo/usr
建立目录distfiles并从光盘上拷贝所有文件
# mkdir /mnt/gentoo/usr/portage/distfiles
# cp /mnt/cdrom/distfiles/* /mnt/gentoo/usr/portage/distfiles/


7.准备和配置编译
# nano -w /mnt/gentoo/etc/make.conf
//如果下载的stage和你的机器比较匹配,那几乎不需要改动什么的。其他参数可以参考 /mnt/gentoo/etc/make.conf.example

为chroot作准备
# mount -t proc none /mnt/gentoo/proc


8.拷贝 DNS配置
# cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf

9.Chroot 进入新的编译环境

# chroot /mnt/gentoo /bin/bash
# env-update
Regenerating /etc/ld.so.cache...
# source /etc/profile


选择镜像
# mirrorselect -a -s4 -o | grep 'GENTOO_MIRRORS=' >> /mnt/gentoo/etc/make.conf

10.更新 Portage
# emerge sync   {如果不能完成,就用下面的命令 # emerge-webrsync }

11.USE设置
查看可用的USE参数
# less /usr/portage/profiles/use.desc
# nano -w /etc/make.conf
 加入: USE=" nls cjk -gtk -gnome qt kde alsa"
LINGUAS="zh_CN"

12.Stage 安装的三个过程

Stage1 到 Stage2 的过程:

*********************************** 介绍bootstrapping:************************************
我们会 bootstrap 你的系统,这会花很长的时间,但是你会得到一个针对你的机器完全最佳化的系统。
Bootstrapping 代表编译 GNU C函数库、GNU C编译器以及其他重要的软件。
在开始之前,我们会列出两个你需要或是不需要的参数,
自由选择:先下载原始码
如果你之前没有复制所有的原始码,bootstrap script 会下载所有必要的文件,这当然在有链接到网络时才能正常工作。如果你想要下载原始码然后再执行 bootstrap,使用bootstrap 的 -f 选项,这样会下载所有的原始码。

*********************************** 介绍bootstrapping:************************************
# cd /usr/portage
# scripts/bootstrap.sh -f

Bootstrapping 你的系统
# cd /usr/portage
# scripts/bootstrap.sh


Stage2 到 Stage3 的过程

*************************************** Content:****************************************
现在是编译所有系统组件的时候了。
所有系统组件?不,不完全是。在这一步骤中,你将会编译没有其他选择的系统组件。一些组件有多种选择(例如 system loggers),因为 Gentoo 代表选择,我们不会强迫你一定要使用哪儿一种。

自由选择:看会做哪儿些事

如果你想要知道哪儿些组件会被安装,执行 emerge -pretend system。这将会列出所有要编译的程序。因为这相当的多,你应该使用 less 或 more 来上下浏览。
*************************************** Content:****************************************
# emerge --pretend system | less

*************************************** Content:****************************************
自由选择:下载原始码

如果你想要 emerge 在开始之前先下载原始码(例如你不想在编译时链接在网络上),你可以使用的emerge 的 -fetchonly 参数来帮你下载所有的原始码。
*************************************** Content:****************************************
# emerge --fetchonly system


*************************************** Content:****************************************
编译系统
执行 emerge system 来开始编译系统。这需要花很长一段时间。
*************************************** Content:****************************************
# emerge system

*************************************** Content:****************************************
你现在可以安全的略过任何警告来更新你的设定档。
*************************************** Content:****************************************
# etc-update

13.编译内核
设置时区

# rm /etc/localtime
# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# nano -w /etc/rc.conf
修改使 CLOCK="PRC"

下载内核的源码包
@使用 2.4.X 内核
# emerge gentoo-sources

@使用 2.6.X 内核
# emerge gentoo-dev-sources

# ls -l /usr/src/linux

修改内核源码目录链接
*************************************** Content:****************************************
# rm /usr/src/linux
# cd /usr/src
# ln -s linux-2.4.26-gentoo-r6 linux
*************************************** Content:****************************************


配置内核编译选项
# cd /usr/src/linux
# make menuconfig


必须设定的选项:

*************************************** Content:****************************************
首先,设定 development and experimental code/drivers。你需要这个,不然你将无法看见一些其他重要的设定选项。
*************************************** Content:****************************************
Code maturity level options --->
  [*] Prompt for development and/or incomplete code/drivers

*************************************** Content:****************************************
记得在编译核心时选择正确的处理器类别:
*************************************** Content:****************************************
Processor type and features --->
 (依照你的CPU所更换)
 (Athlon/Duron/K7) Processor family

*************************************** Content:****************************************
现在到 File Systems 然后选择要支持的文件系统。记得不要将他们编成模块,还有 Virtual memory, /proc file system, /dev file system + Automatically mount at boot:
*************************************** Content:****************************************

(使用 2.4.x 核心)
File systems --->
  [*] Virtual memory file system support (former shm fs)
  [*] /proc file system support
  [*] /dev file system support (EXPERIMENTAL)
  [*]   Automatically mount at boot
  [ ] /dev/pts file system for Unix98 PTYs

(使用 2.6.x 核心)
File systems --->
  Pseudo Filesystems --->
    [*] /proc file system support
    [*] /dev file system support (OBSOLETE)
    [*]   Automatically mount at boot
    [*] Virtual memory file system support (former shm fs)

(按照你系统所需要的档案系统开启一下选项)
  <*> Reiserfs support
  <*> Ext3 journalling file system support
  <*> JFS filesystem support
  <*> Second extended fs support
  <*> XFS filesystem support

*************************************** Content:****************************************
如果你的BIOS 不能处理大容量的硬盘,而且你调整跳脚让硬盘回报受限制的容量,你需要开启下面设定让你的系统可以存取所有容量。
*************************************** Content:****************************************
 (只适用 2.4.x 核心)
ATA/IDE/MFM/RLL support --->
  IDE, ATA and ATAPI Block devices --->
    <*>   Include IDE/ATA-2 DISK support
    [ ]     Use multi-mode by default
    [*]     Auto-Geometry Resizing support


*************************************** Content:****************************************
如果你需要通过 PPPoE 链接到网络上,你需要以下的核心选项:
*************************************** Content:****************************************
 (使用 2.4.x 核心)
Network device support --->
  <*> PPP (point-to-point protocol) support
  <*>   PPP support for async serial ports
  <*>   PPP support for sync tty ports

(使用 2.6.x 核心)
Device Drivers --->
  Networking support --->
    <*> PPP (point-to-point protocol) support
    <*>   PPP support for async serial ports
    <*>   PPP support for sync tty ports

*************************************** Content:****************************************
虽然 PPP over Ethernet 选项只是有在 rp-pppoe 设定为核心 PPPoE 时需要,但是这两个压缩的选项不会造成错误。

如果你需要,不要忘了在核心里加入对网卡的支持。

如果你有一个支持 HyperThreading(tm) 的 Intel CPU,或是有多个 CPU ,你应该启用 "Symmetric multi-processing support":
*************************************** Content:****************************************
Processor type and features  --->
  [*] Symmetric multi-processing support


*************************************** Content:****************************************
如果你使用 USB 输入装置,不要忘记开启它。
*************************************** Content:****************************************
USB Support --->
  <*>   USB Human Interface Device (full HID) support


*************************************** Content:****************************************
编译安装核心:
*************************************** Content:****************************************
(核心 2.4)
# make dep && make bzImage modules modules_install

(核心 2.6)
# make && make modules_install

当核心完成编译后,将核心映像复制到 /boot

# cp arch/i386/boot/bzImage /boot/kernel-2.4.26-gentoo-r6
# cp System.map /boot/System.map-2.4.26-gentoo-r6


你也可以将你的核心设定文件备份到 /boot,以防万一。
# cp .config /boot/config-2.4.26-gentoo-r6

*************************************** Content:****************************************
我们也可以用Gentoo 提供的 genkernel 来编译内核。
*************************************** Content:****************************************
# emerge genkernel
# genkernel all

*************************************** Content:****************************************
当 genkernel 完成的时候,一个核心文件,一套模块和一个 initial root disk  (initrd) 将会被建立。
我们将在稍后设定开机程序时使用核心映像档和 initrd 。initrd 将会在开启到"真正"的系统之前马上侦测硬件支持(就和 LiveCD 一样)。
*************************************** Content:****************************************
# ls /boot/kernel* /boot/initrd*


*************************************** Content:****************************************
现在,为了让我们的系统更像 LiveCD , 我们需要安装 hotplug。 当 initrd 自动侦测硬件时,hotplug将会自动侦测其他的硬件。
*************************************** Content:****************************************
# emerge hotplug
# rc-update add hotplug default

*************************************** Content:****************************************
如果你不喜欢它要安装的套件,使用 emerge -pretend -verbose 查看各套件需要使用到什么USE 参数:
*************************************** Content:****************************************
# emerge --pretend --verbose emu10k1
...
[ebuild  N    ] media-sound/aumix-2.8  +gpm +nls +gtk +gnome +alsa -gtk2


*************************************** Content:****************************************
以上的范例将可以看到 emu10k1 的相依性 必须依赖着 gtk和 gnome 的USE 参数,而 gtk (依赖着 xorg-x11 ) 将会被一起编译。
如果你不要编译全部,拿掉所有的USE 参数 如:
*************************************** Content:****************************************
# USE="-gpm -nls -gtk -gnome -alsa" emerge --pretend emu10k1

当你满意时,移除掉 -pretend 开始安装。

14.建立 /etc/fstab
# nano -w /etc/fstab


15.设定主机名称、域名和网络
# echo zbz > /etc/hostname
# echo homenetwork > /etc/dnsdomainname
# rc-update add domainname default

# nano -w /etc/conf.d/net
*************************************** Content:****************************************
 (适用 DHCP)
iface_eth0="dhcp"
dhcpcd_eth0="-HD" 一些网络管理员会要求你使用DHCP 服务器指定的主机名称和域名称。在这种
情况下,加入底下的东西让 dhcpd 使用他们。这会取代你原本设定的主机名称
和域名称。
dhcpcd_eth0="-N"  如果你使用 NTP 来同步你的电脑时间,使用-N参数避免 dhcpd 覆盖你的
/etc/ntp.conf

(适用静态 IP)
iface_eth0="192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0"
gateway="eth0/192.168.0.1"

(适用 rp-pppoe)
iface_eth0="up"
*************************************** Content:****************************************

# rc-update add net.eth0 default


# nano -w /etc/hosts


16.安装必要的系统工具
*************************************** Content:****************************************
如果你使用 stage3 文件的话,先移除 sysklogd 记录器
*************************************** Content:****************************************
# emerge unmerge sysklogd

*************************************** Content:****************************************
你也要删除 sysklogd init 指令文件
*************************************** Content:****************************************
# rm /etc/init.d/sysklogd

*************************************** Content:****************************************
现在安装你选择的系统记录器
*************************************** Content:****************************************
# emerge metalog
# rc-update add metalog default

如果你的一个分区是xfs的话
# emerge xfsprogs
如果你的一个分区是 reiserfs的话
# emerge reiserfsprogs
如果你的一个分区是 jfs的话
# emerge jfsutils

17.安装GRUB


# emerge grub
# nano -w /boot/grub/grub.conf


未使用genkernel的grub
*************************************** Content:****************************************
default 0        开机预设。0为第一,1为第二,以此类推
timeout 30       使用预设前等待的开机秒数
splashimage=(hd0,0)/grub/splash.xpm.gz 启用 splash-image

title=Gentoo Linux 2.4.26-r6
root (hd0,0)       储存核心文件的分割区
kernel /kernel-2.4.26-gentoo-r6 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/hda3

title=Windows XP      启动windows
rootnoverify (hd0,5)
makeactive
chainloader +1

//Note: 如果你使用不同的分割设定或是核心文件,请按照自己的设定更改,但是确认所有 grub 相关的设备(如(hd0,0))和挂载点有相连的,而非 root。换句话说,(hd0,0)/grub/splash.xpm.gz 实际上是放在 /boot/grub/splash.xpm.gz 因为 (hd0,0) 是 /boot。

//如果你需要自行输入任何参数给核心,只要将他们放在 kenerl的指令后面。我们已经传送了一个(root=/dev/hda3 或是 real_root=/dev/hda3),但是你也可以传送其他的指令。
如:kernel /kernel-2.4.26-gentoo-r6 root=/dev/hda3 vga=788
*************************************** Content:****************************************

使用genkernel的grub
*************************************** Content:****************************************
default 0
timeout 30
splashimage=(hd0,0)/grub/splash.xpm.gz

title=Gentoo Linux 2.4.26-r6
root (hd0,0)
kernel /kernel-2.4.26-gentoo-r6 root=/dev/ram0 init=/linuxrc real_root=/dev/hda3
initrd /initrd-2.4.26-gentoo-r6
*************************************** Content:****************************************
# cp /proc/mounts /etc/mtab
# grub-install --root-directory=/boot /dev/hda


修改root密码:
# passwd
添加用户elang
# useradd elang -m -G users,wheel,audio,tty -s /bin/bash
# passwd elang

退出新环境。
# exit

18.卸载分区并重新启动:
# umount /mnt/gentoo/boot /mnt/gentoo/proc /mnt/gentoo
# reboot


重新启动后
如果核心是2.6.8的话,如果不是请 # emerge gentoo-dev-sources
安装GENSPLASH
*************************************** Content:****************************************
在你的/etc/make.conf里加入
# nano -w /etc/make.conf

加入 "ACCEPT_KEYWORDS=~x86"

或者:
在 /etc/portage/package.keywords 里加入

      sys-kernel/gentoo-dev-sources ~x86
media-gfx/splashutils ~x86

*************************************** Content:****************************************
# ACCEPT_KEYWORDS=~x86 >> /etc/make.conf

重新设定并编译核心:
# cd /usr/src/linux
# make menuconfig
# make
# make install modules_install

*************************************** Content:****************************************
Device Drivers  ---> Graphics support  --->
    <*> Support for frame buffer devices
    <*>   VESA VGA graphics support   (NEW)
        + Console display driver support  ---> [*]  Video mode selection support
                                        [*] Framebuffer Console support
          Logo configuration  --->
                                  [ ] Bootup logo
                                  [*] Standard 224-color Linux logo (NEW)
<*> Support for the framebuffer splash
*************************************** Content:****************************************

安装splashutils
# emerge splashutils
建立一个initramfs 图片
# splash_geninitramfs -v -g /boot/fbsplash-emergence-1024x768 -r 1024x768 emergence


重新配置grub
# cd /boot/grub

*************************************** Content:****************************************
title Gentoo Linux (g-d-s 2.6.8.1)
root (hd0,4)
kernel /boot/gentoo-2.6.8.1 ro root=/dev/hda1 video=vesafb:ywrap,pmipal,1024x768-32@75 splash=silent,theme:emergence
initrd /boot/fbsplash-emergence-1024x768
*************************************** Content:****************************************


曾经出现过错误,按照下面方法解决,然后重新开始:
*************************************** Content:****************************************
在/etc/splash/emergence/1024x768.cfg里配置好你的图片的路径,silent和verbose都要配置上
# rm /usr/src/linux/usr/initramfs_data.cpio.gz
# splash_geninitramfs -v -g /usr/src/linux/usr/initramfs_data.cpio.gz -r 1024x768 emergence
*************************************** Content:****************************************


我的make.conf
# These settings were set by the catalyst build script that automatically built this stage
# Please consult /etc/make.conf.example for a more detailed example

CFLAGS="-O2 -march=pentium4 -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"

USE="nls cjk oss apache2 postgres ssl gd flash berkdb gdbm X gpm gnome2 gtk2 mmx sse sse2 dvd alsa png truetype -arts -qt -kde -pdflib"


#Use Prozilla
FETCHCOMMAND='/usr/bin/proz --no-getch -s ${URI} -P ${DISTDIR}'


我的.xinitrc
export LANG=zh_CN
export LC_ALL=zh_CN
export LC_CTYPE=zh_CN

export XIM=fcitx
export XIM_PROGRAM=fcitx
export XMODIFIERS=@im=fcitx

fcitx &
#exec fvwm2
exec gnome-session


普通用户也可以重启或关机:
# emerge app-admin/sudo
# vi /etc/sudoers
yourusername ALL=(root)NOPASSWD:/sbin/halt
yourusername ALL=(root)NOPASSWD:/sbin/reboot
yourusername ALL=(root)NOPASSWD:/sbin/shutdown
# vi /usr/local/bin/halt
 #!/bin/bash
sudo /sbin/halt
# chmod 755 /usr/local/bin/halt


鼠标滚轮使用
在/etc/X11/xorg.conf 里的鼠标section里加入
Option "ZAxisMapping" "4 5"


安装postgresql + php5 + apache2

# USE="postgresql apache2 -qt -qtmt -pdflib" emerge mod_php
*************************************** Content:****************************************
编辑/etc/conf.d/apache2,加入对php的支持:
APACHE2_OPTS="-D SSL -D PHP5"

编辑/etc/apache2/conf/apache2.conf,定义你的Server Name(即你自己的网站域名):
确认你的/etc/hostname和/etc/hosts里指向的名称相同,比如我/etc/hostname为WaterBlue- MoonLight,/etc/hosts里127.0.0.1指向的一是这个名称。两者不相同会导致你的apace启动失败。

ServerName www.linuxsir.org
编辑 commonapache2.conf,让Apache使用GB2312为默认字符集
AddDefaultCharset GB2312
ServerSignature Off

*************************************** Content:****************************************
然后启动Apache2
# /etc/init.d/apache2 start
# rc-update add apache2 default

测试Apache2服务器和php
在/var/www/localhost/htdocs目录下新建index.php
内容:
<?phpinfo()?>

保存,浏览http://127.0.0.1/index.php测试。

配置postgresql
给postgresql 指定存放数据的目录:
# mkdir /var/www/pgsql/data
# chown postgres /var/www/pgsql/data

以 postgres用户登陆
# su - postgres

初始化数据库
# /usr/bin/initdb -D /usr/local/pgsql/data
# /usr/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &

*************************************** Content:****************************************
建立测试数据库
# /usr/bin/createdb test
# /usr/bin/psql test
*************************************** Content:****************************************


打开tcp/ip链接:
修改 /usr/local/pgsql/data/postgresql.conf
port=5432
修改 /usr/local/pgsql/data/pg_hba.conf
加入
host all all 你的ip地址 你的子网掩码 trust

# nano -w /etc/conf.d/postgresql
# /etc/init.d/postgresql start

************************************ 安装桌面:*************************************
# emerge xorg-x11
# emerge kde (# emerge kde-i18n)或 # emerge xfce4 或 # emerge gnome 或 # emerge fvwm
# xorgconfig
# nano -w /etc/X11/xorg.conf
 Option "ZaxisMapping" "4 5"


////////////////////使emerge 使用其他下载工具
编辑/etc/make.conf,加入
FETCHCOMMAND='/usr/bin/proz --no-getch -s ${URI} -P ${DISTDIR}'
当然先要emerge prozilla

安装软件在gentoo中有两种方法:
1.安装预编译的二进制包,好处不用自己编译,编译大的套件很花时间。预编译软件在/usr/portage/packages/All中。
2.下载源文件自动编译安装,慢但是根据自己的机器优化,这种时候就会受USE参数的影响,下载的源码在/usr/portage/distfiles中。

----------------------------------------------------------------------------------
以下都以mozilla为例,括号内为参数的缩写
1.想要编译安装软件:emerge mozilla
2.查看软件依赖哪些别的软件,实际并不编译安装:emerge --pretend mozilla (-p)
3.先下载软件,并不编译:emerge --fetchonly mozilla
4.查看要从哪里下载源码:emerge --pretend -fetchonly mozilla (-pf)如果你本地没有上网条件可以用它记下要下载的东西,去别处下载后带回来,把源码cp到正确的路径下再emerge
5.想安装一个特定版本的软件:emerge "<mozilla-1.4"将会安装比1.4老的版本
emerge ">mozilla-1.4" 将会安装比1.4新的版本
emerge "=mozilla-1.4"将会安装1.4版
6.安装预编译版本:emerge --usepkg mozilla (-k)
7.安装预编译软件,不在乎版本:emerge --usepkgonly mozilla (-K)
8.本地系统上没有预编译软件,可以从网上下载:在/etc/make.conf中用PORTAGE_BINHOST指定提供预编译好的二进制包的地址,然后emerge --getbinpkg mozilla (-g),这将会下载此软件和它依赖的二进制包并安装。要查看哪些依赖的软件将会被安装:
emerge --getbinpkg --pretend mozilla
9.本地系统有此软件的预编译包,但是就是想下载网上的预编译包来安装:
emerge --getbinpkgonly mozilla (-G)
10.指定预编译包版本:emerge --usepkg "<mozilla-1.4"
">mozila-1.4"
"=mozilla-1.4"
11.显示所有mozilla依赖的包:emerge --emptytree --pretend mozilla
12.不管依赖条件,尝试强行编译安装包:emerge --nodeps mozilla(可能会失败)
13.删除以安装的包:emerge unmerge mozilla 也可以用emerge -C mozilla
14.假装删除软件看看会删除什么依赖的包:emerge --pretend unmerge mozilla
15.安装被mask掉的软件:#ACCEPT_KETWORDS="~86" emerge mozilla
每个条目下列的两条指令是等效的,我通常用短的。
options都可以组合使用。

(第一条回楼上同学的问题)
避免升级覆盖掉版本更高的软件

emerge -uU world
emerge --update --upgradeonly world

查找名称包含mozilla的包

emerge -s mozilla
emerge search mozilla

查找描述包含mozilla

emerge -S mozilla
emerge --searchdesc mozilla

使用本地编好的包,没有就下源码(尽量避免编译)

emerge -k mozilla
emerge --usepkg mozilla

只使用本地编好的,否则不安装(绝对不编译,所有依赖的包都有binary才装)

emerge -K mozilla
emerge --usepkgonly mozilla

卸载
emerge -C mozilla
emerge unmerge mozilla

升级portage树

emerge sync

下载snapshot包来完成sync
emerge-webrsync

查看已安装包的changelog

emerge -pl mozilla
emerge --pretend --changelog mozilla

查看依赖关系(这个包还没装)
(--pretend保证这一次操作实际上不做任何事情,可以跟任何options组合)
emerge -p mozilla
emerge --pretend mozilla

只下载某个软件的源码(以及它所依赖的)
emerge -f mozilla
emerge --fetchonly mozilla

查看从哪下的源码
emerge -fp mozilla

安装指定版本号的
emerge "<mozilla-1.6"
emerge "=..........."
.......">..........."
emerge -k "<mozilla-1.6".....


从网上下binary包来装
emerge -g mozilla
emerge --getbinpkg mozilla
(注意,实际上没有任何binary包存在于官方的mirror中
所以这个基本上是无用,在manpage也没有出现。除非自
己用livecd来setup一个这样的站点。不知道以后会不会
出现这样的mirror。gentoo.org论坛上似乎也有讨论这个。)

查看binary包依赖
emerge -gp mozilla
emrege --getbinpkg --pretend mozilla


查看依赖关系(这个包已经装了)
emerge -ep opera
emerge --emptytree --pretend opera
(不用pretend会重新编译这所有依赖的包,glibc因为安全关系没有列出)

不使用依赖关系安装软件
emerge -O opera
emerge --nodeps opera

只安装其依赖的软件
emerge -o opera
emerge --onlydeps opera

升级软件
emerge -u opera
emerge --update opera

升级系统软件
emerge -u system

升级整个系统
emerge -u world

避免升级覆盖掉版本更高的软件
emerge -uU world
emerge --update --upgradeonly world

查看包装了什么文件:
qpkg -l freetype|less

安装 qpkg :emerge app-portage/gentookit

///////////////////让虚拟终端支持中文
# emerge unicon
# emerge zhcon

# echo "exec gnome-session" > ~/.xinitrc

相关阅读 更多 +
排行榜 更多 +
Unity Connect

Unity Connect

学习教育 下载
青橙记录本

青橙记录本

商务办公 下载
脑洞惊魂夜

脑洞惊魂夜

休闲益智 下载