TIP Converting from or to Debian
出自Gentoo Linux Wiki
| 终端/Shell • 网络 • X 窗口系统 • Portage • 系统 • 文件系统 • 内核 • 其它 |
目录 |
[编辑] 介绍
这个页面是用来向刚从Debian转投过来或欲转投之的人们展示两个发行版之间的一些差异。这只是一个实用性的比较,并不评判孰优孰劣。
本文并不全面,欢迎添加。
[编辑] 软件包管理
Gentoo有portage和emerge,Debian有包括apt在内的众多工具。这一节将告诉你怎样去处理升级,安装软件包等事项。
[编辑] 更新你系统里的软件包数据库
Gentoo:
emerge --sync
Debian:
apt-get update
[编辑] 升级你系统里的软件
升级所有的软件包,但是只是模拟这个操作
[编辑] Gentoo
emerge --deep --update --pretend world
[编辑] Debian
apt-get upgrade --simulate
升级某一个具体的软件包:
apt-get update apt-get install package1 package2
[编辑] 安装软件
[编辑] Gentoo
emerge package1 package2
[编辑] Debian
apt-get install package1 package2
Debian从源代码编译安装软件:
apt-build install package1 package2
[编辑] 重新安装某个软件
[编辑] Gentoo
emerge --oneshot package1 package2
[编辑] Debian
apt-get install --reinstall package1 package2
注意:在Debian里,你很少需要重新安装一个软件
[编辑] 搜索软件包数据库
[编辑] Gentoo
搜索包的名字和描述:
emerge --searchdesc searchword
注意: 在gentoo里,最好使用esearch或者eix来进行搜索,像这样:
eix searchword esearch searchword
[编辑] Debian
apt-cache search searchword
emerge(esearch 或 eix)和apt-cache搜索都支持正则表达式。
在Debian里要得到包的长信息(只用包名进行查询):
apt-cache search --full --names-only searchword
Debian中你可以利用apt-file工具搜索包含某个文件的包:
apt-get install apt-file apt-file update apt-file search searchword
[编辑] 删除软件包
emerge --unmerge package1 package2
apt-get remove package1 package2
或者连同配置文件一起删除
apt-get remove --purge package1 package2
[编辑] 只下载软件包
如果您使用拨号上网的话,这个很有用。您可以下载下来之后,再进行安装。
emerge --fetchonly package1 package2
apt-get install --download-only package1 package2
[编辑] 清除已经下载的软件包
已经下载的供安装的压缩包动辄占到上G的硬盘空间。
Gentoo:
rm -rf /usr/portage/distfiles/*
Debian:
apt-get clean
Gentoo: 为了只删除过期的包您需要安装gentoolkit并使用eclean:
eclean distfiles
Debian: 只删除过期的软件包
apt-get autoclean
Gentoo: 清除emerge过程中产生的临时文件
rm -rf /var/tmp/portage/*
[编辑] 包管理器的图形界面前端
Gentoo: kuroo, porthole (两个都被mask了),portato(开发中,基于porthole?)
Debian: aptitude, dselect (这两个基于ncurses), synaptic (gtk)
[编辑] 反向依赖关系
反向依赖关系是Gentoo目前的portage的实现的主要缺陷:它不是任何时候都会考虑反向依赖关系。这意味着你可以在没有任何警告的情况下卸载一个被其他包所需要的包。比如,你可以卸载掉X server,而portage不会警告你KDE(已经安装)依赖于它。所以,你实际上可以毁掉你的整个系统(比如,删除glibc)。
revdep-rebuild 可以修复被 emerge --depclean 所破坏的依赖关系。
在 Debian里,dpkg会处理反向依赖关系。
[编辑] 运行级别和初始化脚本
Debian里的运行级别是很传统的。Gentoo里的运行级别与传统有别。
[编辑] 目录和文件
Debian运行级别遵循传统命名方式(0-6和S)。他们由/etc/中名为 rc*.d 的目录表示(当安装了缺省的 sysv-rc 启动加载器包的时候;也可以安装 file-rc 以代替它,这样的话相关的文件就是 runlevel.conf)。
- /etc/rc0.d
- /etc/rc1.d
- /etc/rcS.d
- /etc/rc2.d
- /etc/rc3.d
- /etc/rc4.d
- /etc/rc5.d
- /etc/rc6.d
Gentoo 里的运行级别有同样的名字,但是它们被映射到名字本身更有意义的运行级别上(在/etc/inittab里): “boot”, “default”,“nonetwork”,还可以自己添加。表示它们的目录位于 /etc/runlevels/:
- /etc/runlevels/boot
- /etc/runlevels/default
- /etc/runlevels/nonetwork
在 Gentoo 里,如果某个运行级别里的某个服务未明确启动,那么当切换到该运行级别时这个服务会被停止!Debian里显式的停止服务的方式(/etc/rc?.d/K??server)在 Gentoo 并不存在。
在 Debian 和 Gentoo 里,在哪个运行级别里哪个服务被启动(或停止)是指向运行级别目录/etc/init.d/里的脚本的符号连接控制的,比如:
| 代码: gentoo $ ls -l /etc/runlevels/boot/hostname |
lrwxrwxrwx 1 root root 20 Mar 25 2004 /etc/runlevels/boot/hostname -> /etc/init.d/hostname |
| 代码: debian $ ls -l rcS.d/S40hostname.sh |
lrwxrwxrwx 1 root root 21 2004-11-07 00:19 rcS.d/S40hostname.sh -> ../init.d/hostname.sh |
[编辑] 运行级别管理:rc-update, update-rc.d
使用下面的命令来管理哪个运行级别启动哪个服务:
[编辑] Gentoo
rc-update
添加cupsd服务到default运行级别:
rc-update add cupsd default
从boot运行级别删除alsasound服务:
rc-update del alsasound boot
参见这个 wiki 页: 使用 rc-update 管理 gentoo 运行级别
[编辑] Debian
update-rc.d
让cupsd在运行级别2,3,4,5启动,0,1,6关闭,序列号为20:
update-rc.d cupsd start 20 2 3 4 5 . stop 20 0 1 6 .
或者简单的:
update-rc.d cupsd defaults
将cupsd从所有的运行级别移除:
update-rc.d -f cupsd remove
[编辑] 配置文件
[编辑] /etc/make.conf 和 use 标记
Gentoo中有大量的用来控制包管理系统的配置文件,相比之下Debian中就少得多,因为Debian里的软件是预编译好的,可优化的余地比较小。在Gentoo中,很多配置选项都在文件/etc/make.conf里设置;其中就包括了USE标记,它影响着要编译的软件包的组件和库的支持,常用的USE标记(USE或者-USE来表示不支持)包括Gnome用户的'gtk gnome'(同时要'-qt -kde -arts') 和KDE用户的'qt kde arts'。一个Gentoo用户的完整的USE标志看起来可能是这样:
USE="-kde -arts -qt xv truetype bluetooth crypt slang readline gpm berkdb mmx gdbm tcpd pam libwww ssl nls ethereal perl python esd gif imlib sdl oggvorbis mpeg gnome gtk X motif opengl avi png tiff nptl pcmcia nptl ldap eds"
[编辑] 体系结构和软件仓库
[编辑] Gentoo
在/etc/make.conf里还有一个ACCEPT_KEYWORDS变量,有两种设定,以x86为例,x86表示使用稳定的包,~x86表示使用最新的包。但是我们不建议更改/etc/make.conf文件 . 而是在/etc/portage/package.keywords中对每个软件包进行单独的配置. 在文件一行中加入软件包的名字(例如 'app-foo/bar')和相应的关键字(例如 '~x86')就可以了. 实际的文件可能像下面所示:
app-crypt/gpg-agent ~x86 app-text/docbook-xsl-stylesheets ~x86 =app-text/docbook-xml-dtd-4.3-r1 ~x86
最后一行的意思是说,只有版本4.3-r1才会被unmasked.比这新或比这旧的版本都会被忽略。
对于非x86的用户 x86和~x86可以替换成其他的关键字,比如sparc和~sparc
[编辑] Debian
Setting this in Debian is slightly more complicated, and is accomplished by setting different 'repositories' in /etc/apt/sources.list - along with which 'tree' to use for packages; in debian, these are stable, testing, and unstable. An /etc/apt/sources.list file for a debian testing user may look something like this:
deb http://mirrors.kernel.org/debian testing main non-free contrib deb ftp://ftp.nerim.net/debian-marillat testing main deb http://security.debian.org testing/updates main contrib non-free
Alternatively, /etc/apt/sources.list can contain any number of repositories for any trees, and a default tree (this can be overridden using the -t switch on the command line) in /etc/apt/apt.conf:
APT::Default-Release "testing";
Per-package settings go in /etc/apt/preferences, somewhat like Gentoo's /etc/portage/package.keywords.
[编辑] network
To configure your ethernet interfaces, take a look at:
[编辑] Gentoo
| 文件: /etc/conf.d/net |
config_eth0=( "192.168.1.100 netmask 255.255.255.0" ) routes_eth0=( "default via 192.168.1.1" ) |
Note that this has changed recently. For more information please refer to http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=4
[编辑] Debian
| 文件: /etc/network/interfaces |
auto eth0 iface eth0 inet static address 192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255 # etc. |
[编辑] X
As of now, Debian still uses XFree86 4.3 in the sarge release. You can use the .deb-configuration script to get a basic /etc/X11/XF86Config-4:
dpkg-reconfigure xserver-xfree86
For Testing (Codenamed Etch) and Unstable (Codename, Sid) to edit /etc/X11/xorg.conf:
dpkg-reconfigure xserver-xorg
[编辑] TODO
other configuration files;
