??xml version="1.0" encoding="utf-8" standalone="yes"?> 一般僵进E很隄接kill掉,不过您可以kill僵尸爸爸。父q程dQ僵进E成?#8221;孤儿q程”Q过l给1可EinitQinit始终会负责清理僵进E.它生的所有僵进E也跟着消失?/p> ps -e -o ppid,stat | grep Z | cut -d” ” -f2 | xargs kill -9 ?/p> kill -HUP `ps -A -ostat,ppid | grep -e ’^[Zz]‘ | awk ’{print $2}’` 当然您可以自q写更好的shell脚本Q欢q与大家分n?/p> 另外子进E死后,会发送SIGCHLD信号l父q程Q父q程收到此信号后Q执行waitpid()函数为子q程收尸。就是基于这L原理Q就父q?E没有调用waitQ内怹会向它发送SIGCHLD消息Q而此Ӟ管对它的默认处理是忽略Q如果想响应q个消息Q可以设|一个处理函数?/p>
1、修改用戯E可打开文g数限?/p>
在Linuxq_上,无论~写客户端程序还是服务端E序Q在q行高ƈ发TCPq接处理Ӟ最高的q发数量都要受到pȝ对用户单一q程同时可打开文g数量的限?q是因ؓpȝ为每个TCPq接都要创徏一个socket句柄Q每个socket句柄同时也是一个文件句?。可使用ulimit命o查看pȝ允许当前用户q程打开的文件数限制Q?/p>
[speng@as4 ~]$ ulimit -n
1024
q表C当前用L每个q程最多允许同时打开1024个文Ӟq?024个文件中q得除去每个q程必然打开的标准输入,标准输出Q标准错误,服务?/a>监听 socket,q程间通讯?a id="k530834966" target="_blank" style="text-decoration: none; color: #333333; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #d30010;">unix域socket{文Ӟ那么剩下的可用于客户端socketq接的文件数只有大?024-10=1014个左叟뀂也是说缺省情况下Q基于Linux的通讯E序最多允许同?014个TCPq发q接?/p>
对于x持更高数量的TCPq发q接的通讯处理E序Q就必须修改Linux对当前用Lq程同时打开的文件数量的软限?soft limit)和硬限制(hardlimit)。其中Y限制是指Linux在当前系l能够承受的范围内进一步限制用户同时打开的文件数;限制则是根据系l硬件资源状?主要是系l内?计算出来的系l最多可同时打开的文件数量。通常软限制小于或{于限制?/p>
修改上述限制的最单的办法是使用ulimit命oQ?/p>
[speng@as4 ~]$ ulimit -n
上述命o中,在中指定要设|的单一q程允许打开的最大文件数。如果系l回昄g"Operation notpermitted"之类的话Q说明上q限制修改失败,实际上是因ؓ在中指定的数Dq了Linuxpȝ对该用户打开文g数的软限制或限制。因此,需要修改Linuxpȝ对用L关于打开文g数的软限制和限制?/p>
W一步,修改/etc/security/limits.conf文gQ在文g中添加如下行Q?/p>
speng soft nofile 10240
speng hard nofile 10240
其中speng指定了要修改哪个用户的打开文g数限Ӟ可用'*'可CZҎ有用L限制;
soft或hard指定要修改Y限制q是限?10240则指定了惌修改的新的限制|x大打开文g?h意Y限制D于或等于硬限制)。修改完后保存文件?/p>
W二步,修改/etc/pam.d/login文gQ在文g中添加如下行Q?/p>
session required /lib/security/pam_limits.so q是告诉Linux在用户完成系l登录后Q应该调用pam_limits.so模块来设|系l对该用户可使用的各U资源数量的最大限?包括用户可打开的最大文件数限制)Q而pam_limits.so模块׃?etc/security/limits.conf文g中读取配|来讄q些限制倹{修改完后保存此文g?/p>
W三步,查看LinuxpȝU的最大打开文g数限Ӟ使用如下命oQ?/p>
[speng@as4 ~]$ cat /proc/sys/fs/file-max
12158
q表明这台Linuxpȝ最多允许同时打开(卛_含所有用h开文g数d)12158个文Ӟ是LinuxpȝU硬限制Q所有用L的打开文g数限刉不应过q个数倹{通常q个pȝU硬限制是Linuxpȝ在启动时Ҏpȝg资源状况计算出来的最佳的最大同时打开文g数限Ӟ如果没有Ҏ需要,不应该修Ҏ限制Q除非想为用L打开文g数限制设|超q此限制的倹{?/p>
修改此硬限制的方法是修改/etc/rc.local脚本Q在脚本中添加如下行Q?/p>
echo 22158 > /proc/sys/fs/file-max
q是让Linux在启动完成后系l打开文g数硬限制讄?2158.修改完后保存此文件?/p>
完成上述步骤后重启系l,一般情况下可以将LinuxpȝҎ定用L单一q程允许同时打开的最大文件数限制设ؓ指定的数倹{如果重启后?ulimit-n命o查看用户可打开文g数限制仍然低于上q步骤中讄的最大|q可能是因ؓ在用L录脚?etc/profile中用ulimit -n命o已经用户可同时打开的文件数做了限制。由于通过ulimit-n修改pȝ对用户可同时打开文g的最大数限制ӞC改的值只能小于或{于上次 ulimit-n讄的|因此想用此命令增大这个限制值是不可能的?/p>
所以,如果有上q问题存在,只能去打开/etc/profile脚本文gQ在文g中查找是否用了ulimit-n限制了用户可同时打开的最大文件数量,如果扑ֈQ则删除q行命oQ或者将其设|的值改为合适的|然后保存文gQ用户退出ƈ重新dpȝ卛_?通过上述步骤Q就为支持高q发TCPq接处理的通讯处理E序解除关于打开文g数量斚w的系l限制?/p>
2、修改网l内核对TCPq接的有关限?/p>
在Linux上编写支持高q发TCPq接的客L通讯处理E序Ӟ有时会发现尽已l解除了pȝ对用户同时打开文g数的限制Q但仍会出现q发TCPq接数增加到一定数量时Q再也无法成功徏立新的TCPq接的现象。出现这U现在的原因有多U?/p>
W一U原因可能是因ؓLinux|络内核Ҏ地端口号范围有限制。此Ӟq一步分析ؓ什么无法徏立TCPq接Q会发现问题出在connect()调用q回p|Q查看系l错误提C消息是"Can't assign requestedaddress".同时Q如果在此时用tcpdump工具监视|络Q会发现Ҏ没有TCPq接时客L发SYN包的|络量。这些情况说明问题在于本地Linuxpȝ内核中有限制?/p>
其实Q问题的Ҏ原因在于Linux内核?a id="k530840217" target="_blank" style="text-decoration: none; color: #333333; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #d30010;">TCP/IP协议实现模块对系l中所有的客户端TCPq接对应的本地端口号的范围进行了限制(例如Q内栔R制本地端口号的范围ؓ1024~32768之间)。当pȝ中某一时刻同时存在太多的TCP客户端连接时Q由于每个TCP客户端连接都要占用一个唯一的本地端口号(此端口号在系l的本地端口可围限制中)Q如果现有的TCP客户端连接已所有的本地端口号占满,则此时就无法为新的TCP客户端连接分配一个本地端口号了,因此pȝ会在q种情况下在connect()调用中返回失败,q将错误提示消息设ؓ"Can't assignrequested address".
有关q些控制逻辑可以查看Linux内核源代码,以linux2.6内核ZQ可以查看tcp_ipv4.c文g中如下函敎ͼ
static int tcp_v4_hash_connect(struct sock *sk)
h意上q函C对变量sysctl_local_port_range的访问控制。变量sysctl_local_port_range的初始化则是在tcp.c文g中的如下函数中设|:
void __init tcp_init(void)
内核~译旉认设|的本地端口可围可能太,因此需要修Ҏ本地端口范围限制?/p>
W一步,修改/etc/sysctl.conf文gQ在文g中添加如下行Q?/p>
net.ipv4.ip_local_port_range = 1024 65000
q表明将pȝҎ地端口范围限制设|ؓ1024~65000之间。请注意Q本地端口范围的最值必d于或{于1024;而端口范围的最大值则应小于或{于65535.修改完后保存此文件?/p>
W二步,执行sysctl命oQ?/p>
[speng@as4 ~]$ sysctl -p
如果pȝ没有错误提示Q就表明新的本地端口范围讄成功。如果按上述端口范围q行讄Q则理论上单独一个进E最多可以同时徏?0000多个TCP客户端连接?/p>
W二U无法徏立TCPq接的原因可能是因ؓLinux|络内核的IP_TABLE防火?/a>Ҏ大跟t的TCPq接数有限制。此时程序会表现为在 connect()调用中阻塞,如同LQ如果用tcpdump工具监视|络Q也会发现根本没有TCPq接时客L发SYN包的|络量。由?IP_TABLE防火墙在内核中会Ҏ个TCPq接的状态进行跟t,跟踪信息会攑֜位于内核内存中的conntrackdatabase中,q个数据?/a>的大有限,当系l中存在q多的TCPq接Ӟ数据库容量不IIP_TABLE无法为新的TCPq接建立跟踪信息Q于是表Cؓ在connect()调用中阻塞。此时就必须修改内核Ҏ大跟t的TCPq接数的限制Q方法同修改内核Ҏ地端口号范围的限制是cM的:
W一步,修改/etc/sysctl.conf文gQ在文g中添加如下行Q?/p>
net.ipv4.ip_conntrack_max = 10240
q表明将pȝҎ大跟t的TCPq接数限制设|ؓ10240.h意,此限制D量,以节省对内核内存的占用?/p>
W二步,执行sysctl命oQ?/p>
[speng@as4 ~]$ sysctl -p
如果pȝ没有错误提示Q就表明pȝҎ的最大跟t的TCPq接数限制修Ҏ功。如果按上述参数q行讄Q则理论上单独一个进E最多可以同时徏?0000多个TCP客户端连接?/p>
3、用支持高q发|络I/O的编E技术在Linux上编写高q发TCPq接应用E序Ӟ必须使用合适的|络I/O技术和I/O事g分派机制。可用的I/O技术有同步I/O,非阻塞式同步I/O(也称反应式I/O)Q以及异步I/O.在高TCPq发的情形下Q如果用同步I/O,q会严重dE序的运转,除非为每个TCPq接的I/O创徏一个线E?/p>
但是Q过多的U程又会因系l对U程的调度造成巨大开销。因此,在高TCPq发的情形下使用同步 I/O是不可取的,q时可以考虑使用非阻塞式同步I/O或异步I/O.非阻塞式同步I/O的技术包括用select()Qpoll()Qepoll{机制。异步I/O的技术就是用AIO.
从I/O事g分派机制来看Q用select()是不合适的Q因为它所支持的ƈ发连接数有限(通常?024个以?。如果考虑性能Qpoll()也是不合适的Q尽它可以支持的较高的TCPq发敎ͼ但是׃光?轮询"机制Q当q发数较高时Q其q行效率相当低,q可能存在I/O事g分派不均Q导致部分TCPq接上的I/O出现"饥饿"现象。而如果用epoll或AIO,则没有上q问?早期Linux内核的AIO技术实现是通过在内怸为每?I/Oh创徏一个线E来实现的,q种实现机制在高q发TCPq接的情形下使用其实也有严重的性能问题。但在最新的Linux内核中,AIO的实现已l得到改q??/p>
lg所qͼ在开发支持高q发TCPq接的Linux应用E序Ӟ应尽量用epoll或AIO技术来实现q发的TCPq接上的I/O控制Q这ؓ提升E序寚wq发TCPq接的支持提供有效的I/O保证?/p>
内核参数sysctl.conf的优?/p>
/etc/sysctl.conf 是用来控制linux|络的配|文Ӟ对于依赖|络的程??a id="k530844826" target="_blank" style="text-decoration: none; color: #333333; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #d30010;">web服务?/a>和cache服务?非常重要QRHEL默认提供的最好调整?/p>
推荐配置(把原/etc/sysctl.conf内容清掉Q把下面内容复制q去)Q?/p>
net.ipv4.ip_local_port_range = 1024 65536
net.core.rmem_max=16777216
net.core.wmem_max=16777216
net.ipv4.tcp_rmem=4096 87380 16777216
net.ipv4.tcp_wmem=4096 65536 16777216
net.ipv4.tcp_fin_timeout = 10
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_window_scaling = 0
net.ipv4.tcp_sack = 0
net.core.netdev_max_backlog = 30000
net.ipv4.tcp_no_metrics_save=1
net.core.somaxconn = 262144
net.ipv4.tcp_syncookies = 0
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
q个配置参考于cache服务器varnish的推荐配|和SunOne 服务器系l?/a>优化的推荐配|?/p> varnish调优推荐配置的地址为:http://varnish.projects.linpro.no/wiki/Performance W一步:配置/etc/security/limits.conf W一列,可以是用P也可以是l,要用@groupq样的语法,也可以是通配W如*% W二列,两个|hardQ硬限制QsoftQY仉Ӟ一般来说soft要比hard,hard是底U,军_不能过Q超qsoft报警Q直到hard?/span> W三列,见列表,打开文g数是nofile W四列,数量Q这个也不能讄太大 W二步:/etc/pam.d/su(官方)?etc/pam.d/common-session(|络) 打开/etc/pam.d/suQ发现是包含/etc/pam.d/common-sessionq个文g的,所以修改哪个文仉应该是可以的 我的修改是在/etc/pam.d/common-session文g中进行的?/span> 官方只到W二步,重启系l了Q没有第三步Q好象不行,感觉是不是全是第三步的作用?Q?/span> W三步:配置/etc/profile 最后一行加?/span> 重启Qulimit -n 验证Q显C?0960没问题?/span> 注意以上三步均是要用root权限q行修改?/span> 在debian6中,加入开机启动脚本的Ҏ与debian5不同了,直接做符号链接到runlevel已经不v作用了,提示~少LSB信息Qƈ且用insserv来替代update-rc.dQ?/p> root@14:/etc/rc2.d# update-rc.d -n php_fastcgi.sh defaults # insserv /etc/init.d/php_fastcgi.sh debian6中将脚本加入到开机启动的ҎQ?/p> 在脚本中加入LSB描述信息?br /> root@14:~# more /etc/init.d/php_fastcgi.sh 安装启动脚本到system init script?br /> root@14:~# insserv -v -d /etc/init.d/php_fastcgi.sh 重启机器试试吧?/p> These notes are for MIT Kerberos 1.3 or higher. The /etc/krb5.conf configuration file should include rc4-hmac support under the [libdefaults] section. Windows XP uses rc4-hmac. However, do not include rc4-hmac in the default* encryption types, as older Unix clients may not support rc4-hmac. [libdefaults] The kdc.conf configuration file on the Kerberos servers must support rc4-hmac as an encryption type. [realms] Use the ksetup.exe command to add the site Kerberos servers. $ ksetup.exe /addkdc EXAMPLE.ORG kerberos-1.example.org Create host
principals on each Windows client, then use the same password to create
an equivalent principal in the MIT Kerberos database. If using an
installation system such as Unattended, use a script to generate the random password and setup the host principal. #!/usr/bin/perl Then, use kdamin to add an equivalent principal to the Kerberos database, using the same password as above. Use the -e rc4-hmac:normal encryption option if adding a principal for a Windows XP system. kadmin: ank -e rc4-hmac:normal host/client.example.org User mapping translates local accounts to the Kerberos domain. See module:users for user account management under CFEngine. $ ksetup.exe /mapuser * * Windows clients can authenticate to Samba using Kerberos. Use Samba version 3.0.14a or higher on the server, and enable Kerberos support in the smb.conf configuration file. [global] Multiple host and cifs
principals must be created for each Samba server, as principals are
case sensitive, and Windows systems may randomly start using Server.example.org or SERVER.EXAMPLE.ORG when connecting. Extract these principals to the /etc/krb5.keytab file on each Samba server. kadmin: ank -randkey host/server.example.org 下面是我在blog上写的笔记。同时帖几张图,大家看看Q指Ҏ炏V?/p>
Ubuntu安装W记 1Q首先用Ubuntu 5.1的安装盘全新安装。采用缺省安装,不用server模式?br />2Q安装完成后Q修Ҏ城域中的源。sudo vi /etc/apt/source.list $sudo sh -c " echo 'export XMODIFIERS=@im=SCIM ; export GTK_IM_MODULE="scim" ; scim -d ' > /etc/X11/Xsession.d/95xinput " $sudo chmod +755 /etc/X11/Xsession.d/95xinput 7Q设|LC_ALL和其它属性: LANGUAGE="en_US:en" 保存Q关闭编辑器 好了Q注销一下电脑。输入法 (?Ctrl + I格 键激z输入法) 都应该可以用了?/p>
8Q中文粗体美化:按照手工升freetype&ibXft在Ubuntu 5.10 下实现粗?br />实现ҎQ详见:http://forum.ubuntu.org.cn/viewtopic.php?p=40191#40191 9Q安装必要的字体Q?br />安装msttcorefonts: sudo apt-get install msttcorefonts 10Q安装JAVA环境Q?br />sudo apt-get install sun-j2re1.5 11Q安装QQQ?br />1.下蝲q安?/p>
wget -c http://download.ubuntu.org.cn/software/lumaqq_2005-linux_gtk2_x86_no_jre.tar.gz 2.在新增的文g内加入下面这几行 [Desktop Entry] 3.保存~辑q的文g 安装完成后的快捷方式?应用E序 -> internat -> LumaQQ)?/p>
12Q安装acroreadQsudo apt-get install acroread 13Q安装firefox 1.5.0.1:
15Q安装多媒体Q?br />sudo apt-get install beep-media-player totem-xine w32codecs gstreamer0.8-plugins 16Q安装编E环境:sudo apt-get install build-essential
sudo vim /etc/security/limits.conf 文g追? * hard nofile 40960 * soft nofile 40960
4096可以自己讄Q四列参数的讄见英文,单讲一下:sudo vim /etc/pam.d/su ?pam_limits.so q一行注释去? 重vpȝ
sudo vim /etc/pam.d/common-session 加上以下一?session required pam_limits.so
ulimit -SHn 40960
]]>
net.core.rmem_default = 25696000
hotrod方式Q?br />
]]>
update-rc.d: using dependency based boot sequencing
insserv: warning: script 'K02php_fastcgi' missing LSB tags and overrides
insserv: warning: script 'K01php_fastcgi.sh' missing LSB tags and overrides
insserv: warning: script 'php_fastcgi.sh' missing LSB tags and overrides
insserv: warning: current start runlevel(s) (empty) of script `php_fastcgi.sh' overwrites defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0) of script `php_fastcgi.sh' overwrites defaults (0 1 6).
insserv: dryrun, not creating .depend.boot, .depend.start, and .depend.stop
insserv: warning: script 'K02php_fastcgi' missing LSB tags and overrides
insserv: warning: script 'php_fastcgi.sh' missing LSB tags and overrides
#!/bin/sh
### BEGIN INIT INFO
# Provides: php_fastcgi.sh
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the php_fastcgi daemon
# Description: starts php_fastcgi using start-stop-daemon
### END INIT INFO
default_realm = EXAMPLE.ORG
default_etypes = des3-hmac-sha1 des-cbc-crc
default_tkt_enctypes = des3-hmac-sha1 des-cbc-crc
default_tgs_enctypes = des3-hmac-sha1 des-cbc-crc
permitted_enctypes = des3-hmac-sha1 des-cbc-crc rc4-hmac
dns_lookup_realm = false
dns_lookup_kdc = true
EXAMPLE.ORG = {
database_name = /var/kerberos/krb5kdc/principal
key_stash_file = /var/kerberos/krb5kdc/.k5.EXAMPLE.ORG
supported_enctypes = des3-hmac-sha1:normal des-cbc-crc:normal ?
rc4-hmac:normal
}Windows Client Setup
$ ksetup.exe /addkdc EXAMPLE.ORG kerberos-2.example.org
$ ksetup.exe /addkdc EXAMPLE.ORG kerberos.example.org
$ ksetup.exe /addkpasswd EXAMPLE.ORG kerberos.example.org
$ ksetup.exe /setrealm EXAMPLE.ORG
my $domain = 'example.org';
my $password = '';
my @chars = grep { /[[:print:]]/ and /\S/ } map { chr } 1..128;
$password .= $chars[rand @chars] for 1..(int (rand 7)) + 8;
system qw{ksetup.exe /setcomputerpassword}, $password;
print "Principal: host/", lc( $ENV{COMPUTERNAME} ), ".$domain\n";
print "Password: $password\n";Samba
use kerberos keytab = yes
realm = EXAMPLE.ORG
security = ads
kadmin: ank -randkey host/Server.example.org
kadmin: ank -randkey host/SERVER.EXAMPLE.ORG
kadmin: ank -randkey cifs/server.example.org
kadmin: ank -randkey cifs/Server.example.org
kadmin: ank -randkey cifs/SERVER.EXAMPLE.ORG
kadmin: ktadd -k /etc/krb5.keytab host/server.example.org
kadmin: ktadd -k /etc/krb5.keytab host/Server.example.org
kadmin: ktadd -k /etc/krb5.keytab host/SERVER.EXAMPLE.ORG
kadmin: ktadd -k /etc/krb5.keytab cifs/server.example.org
kadmin: ktadd -k /etc/krb5.keytab cifs/Server.example.org
kadmin: ktadd -k /etc/krb5.keytab cifs/SERVER.EXAMPLE.ORG
]]>
-----------------------------------------------------------------------------------------
以server安装的,再装desktopQ?/p>
再等{Dapper的Release版本。记下安装Breezy的过E?/p>
3Q设|locale: sudo dpkg-reconfigure locales选中zh_CN.UTF-8
4Q安装中文语a支持Qsudo apt-get install language-pack-gnome-zh language-pack-gnome-zh-base language-pack-zh language-pack-zh-base language-support-zh
5Q安装中文字体:sudo apt-get install ttf-arphic-ukai ttf-arphic-uming
6Q安装输入法scim:
$sudo apt-get install scim scim-modules-socket scim-modules-table scim-pinyin scim-tables-zh scim-input-pad
sudo gedit /etc/environment
需要用英文界面,内容修改如?
LC_CTYPE=zh_CN.UTF-8
LANG=en_GB.UTF-8
GST_ID3_TAG_ENCODING=GBK
使用winxp下面的字体:cd /usr/share/fonts/truetype
sudo mkdir windows
cd windows
sudo cp /media/hda1/windows/Fonts/simsun.ttc .
(我的winxp盘挂在在/media/hda1/下面Q?br />q把tahmo*Q等字体copyq来?/p>
sudo ln -sf /usr/lib/j2re1.5-sun/bin/java /usr/bin/java
sudo tar zxvf lumaqq_2005-linux_gtk2_x86_no_jre.tar.gz -C /opt/
wget -c http://download.ubuntu.org.cn/software/lumaqq_2005_patch_2006.01.30.02.00.zip
sudo unzip -o lumaqq_2005_patch_2006.01.30.02.00.zip -d /opt/LumaQQ/lib
sudo chown -R root:root /opt/LumaQQ/
sudo chmod -R 755 /opt/LumaQQ/
sudo gedit /usr/share/applications/LumaQQ.desktop
Name=LumaQQ
Comment=QQ Client
Exec=/opt/LumaQQ/lumaqq
Icon=/opt/LumaQQ/QQ.png
Terminal=false
Type=Application
Categories=Application;Network;
a) 从官|上down下来Q解压到/opt/下面
b)做个链接Qsudo ln -sf /opt/firefox/firefox /usr/bin/
14Q安装flash支持Q?br />sudo apt-get install flashplayer-mozilla
g把插件安装在pȝ带的firefox目录中,把插件copyq来
sudo cp /usr/lib/mo*fox/plugins/*flash* /opt/firefox/plugins/
q里依赖关系有问题,要删除相关的东西
17Q安装gnuplot: sudo apt-get install gnuplot
18Q安装窗口管理器程序:sudo apt-get install nautilus-open-terminal
19Q设|机地址Qsudo vi /etc/hosts d相关机器的地址
20Q设|公寓网l登录脚本:
21Q换个wallpaperQ?br />22Q安装matlab, mathematica, perl, mpi{等自己专业相关的库以及E序
22Q上|,听歌Q看电媄Q看代码Q学习等{?/p>
参考链接:
1Q快速设|指?a >http://wiki.ubuntu.org.cn/%E5%BF%AB%E9%80%9F%E8%AE%BE%E7%BD%AE%E6%8C%87%E5%8D%97
2Q手工升Ufreetype&ibXft在Ubuntu 5.10 下实现粗?br />http://forum.ubuntu.org.cn/viewtopic.php?p=40191#40191
3Qforum.ubuntu.org.cn
4Qsmth.org
5Qkyxk.net
版权声明
Copyright ? 2001, 2002 Gustavo Noronha Silva
This manual is licensed under the terms of the GNU FDL (Free Documentation License). It has been written in the hope that it will be useful to the community but it comes with no warranty; use it at your own risk.
目录
1.D
2.基础讄
2.1 /etc/apt/sources.list文g
2.2 怎样在本C用APT
2.3
选择最佳镜像发布站点加入source.list文gQnetselectQnetselect-apt
2.4 CD-ROM加入source.list文g
3.软g包管?
3.1 更新可用软g包列?
3.2 安装软g?
3.3 U除软g?
3.4 更新软g?
3.5
升到新版本
3.6 U除无用软g包文Ӟapt-get clean and autoclean
3.7 在dselect中操作APT
3.8 如何keep a mixed system
3.9 如何从Debian的专用版本下升软g?
3.10
如何l护已安装Y件包的多个版本(复杂Q?
4.非常有用的助?
4.1 如何安装本地~译的Y件包Qequivs
4.2
U除无用的locale files文gQlocalepurge
4.3 如何知晓哪些软g包可以升U?
5.获取软g包信?
5.1
获得软g包名U?
5.2 使用dpkg查找软g包名U?
5.3 如何“按需”安装Y件包
5.4 如何知道文g属于哪个软g?
5.5
如何掌握软g包的变化情况
6.操作源码?
6.1 下蝲源码?
6.2 ~译源码包所需的Y件包
7.如何处理错误
7.1
一般错?
7.2 在哪儿获得帮助?
8.哪些版本支持APTQ?
9.感谢
10.本用指南的新版?
Debian APT HOWTO W一?D
APT HOWTO
W一?D
最初只?tar.gz的打包文Ӟ用户必须~译每个他想在GNU/Linux上运行的软g。用户们普遍认ؓpȝ很有必要提供一U方法来理q些? 装在机器上的软g包,当Debian诞生Ӟq样一个管理工具也应q而生Q它被命名ؓdpkg。从而著名的“package”概늬一ơ出现在 GNU/Linuxpȝ中,E后RedHat才决定开发自q“rpm”包理pȝ?
很快一个新的问题难倒了GNU/Linux制作者,他们需要一个快速、实用、高效的Ҏ来安装Y件包Q当软g包更新时Q这个工具应该能自动理兌文g和维护已有配|文Ӟ再次QDebian率先解决了这个难题,APTQAdvanced Packaging ToolQ诞生了。APT后来q被Conectiva攚w用来管理rpmQƈ被其它Linux发行版本采用为它们的软g包管理工兗?
本文档不打算讲解apt-rpm相关知识Q因为Conectiva port of APT已很有名了,不过提供有关q部分的补充文档q是Ƣ迎的?
本文档是ZDebian下一个发行版的,长官?
Debian APT HOWTO W二?基础讄
APT HOWTO
W二?基础讄
2.1 /etc/apt/sources.list文g
=============================
作ؓ操作的一部分QAPT使用一个文件列出可获得软g包的镜像站点地址Q这个文件就?etc/apt/sources.list?
文g中的各项信息通常按如下格式列出:
deb http://site.http.org/debian distribution section1 section2 section3
deb-src http://site.http.org/debian distribution section1 section2 section3
当然Q上面所列的地址w是假讄不可用的。每行的W一个单词deb或deb-srcQ描qC文gcdQ目录中包含的是二进制Y件包QdebQ,? 我们通常使用的已~译好的软g包;或包含的是源码包Qdeb-srcQ,源码包包含源E序~码、Debian理文gQ?dscQ和“Debian化”该 E序所做更改的记录文gdiff.gz?
通常可以看出如下Debian默认的sources.listQ?
# See sources.list(5) for more information, especialy
# Remember that you
can only use http, ftp or file URIs
# CDROMs are managed through the
apt-cdrom tool.
deb http://http.us.debian.org/debian stable main contrib
non-free
deb http://non-us.debian.org/debian-non-US stable/non-US main
contrib non-free
deb http://security.debian.org stable/updates main contrib
non-free
# Uncomment if you want the apt-get source function to work
#deb-src
http://http.us.debian.org/debian stable main contrib non-free
#deb-src
http://non-us.debian.org/debian-non-US stable non-US
q些是Debian基本安装所需的Y件包来源地址Q第一个deb行指向官Ҏ式Y件包来源Q第二个deb行指向non-US软g包来源,W三deb行指向Debian安全补丁更新包来源?
最后两行被注释掉了Q在句首?Q,所以apt-get忽略它们。这些是deb-src行指向Debian源码包来源,如果你常下蝲E序源码来测试或重编译,可取消对它们的注释?
/etc/apt/sources.list文g可包含多U类型的地址QAPT知道如何处理q些不同的地址cdQhttpQftpQfileQ本地文Ӟ例如Q一个加载了ISO9600文gpȝ的目录)和ssh?
别忘了在修改?etc/apt/sources.list文g后运行apt-get使更改生效。你必须完成q个步骤Q以便让APT从你指定的地方获得新的Y件包列表?
2.2 如何在本C用APT
=====================
有时你硬盘上有许多Y件包Q你会希望通过APT来安装它们,以便让它d理Y件包间复杂的依赖关系?
惌么做Q就Z个目录,所有你惌安装?deb文g攑օ其中。例如:
mkdir /root/debs
你可以用一个重载文Ӟoverride fileQ直接去修改软g包中理文g中的定义QdefinitionsQ,使之W合你的软g储藏库管理规则,在这个重载文件中Q你可能希望定义一些选项来重载那些Y件包的定义,如下所C:
package priority section
package是Y件包的名Uͼpriority有三个别lowQmedium或highQsection是Y件包所属的sectionQ重载文 件可L命名Q文件名在接下来的步骤中做为参C递给dpkg-scanpackages。如果你不想写重载文Ӟ只需在调用dpkg- scanpackages时?dev/nullp了?
仍是?root目录下执行:
dpkg-scanpackages debs file | gzip > debs/Packages.gz
在上q的命o行中Qfile为重载文Ӟ命o生成一个Packages.gz文gQ它包含了APT所需的各UY件包信息Q要使用q些软g包,在sources.list中加上:
deb file:/root debs/
完成了上面的工作Q就可以通常那样使用APT命o操作q些软g包了。你可以使用同样的方法生成一个源码库Q但误住你需要将. orig.tar.gz文g?dsc文g?diff.gz文g包含在目录中Q要生成Source.gz文g而不是Packages.gz文g。所使用 的命令也不相同,要用dpkg-scansourcesQ命令如下所C:
dpkg-scansources debs | gzip > debs/Sources.gz
注意dpkg-scansource不需要重载文Ӟ在sources.list中的引用法是Q?
deb-src file:/root debs/
2.3 选择最佳镜像发布站点加入source.list文gQnetselectQnetselect-apt
=====================================================================
一个新用户l常问到的问题:“该哪个Debian镜像发布站点加入source.list文gQ”。有很多Ҏ来选择镜像发布站点Q专家们可能会写一个脚本去试不同站点的ping
timeQ不q有一个现成的E序可以帮你Qnetselect?
安装netselect
apt-get install netselect
不带参数q行它时会显C它的帮助信息。运行它时加上以I格分隔的镜像主机列表,它会q回一个分值和列表中的一个主机名。这个分值通过评估ping time和hops numberQ一个网l请求报文到辄标主机所l过的{发主机的个数Q得出,它与镜像站点预计下蝲速度成反比(数D越好)。返回的L名是L列表中得分最低的那个Q查看列表中所以主机的得分情况可?vv选项Q。看Z的例子:
bash$ netselect ftp.debian.org http.us.debian.org ftp.at.debian.org
download.unesp.br ftp.debian.org.br
365 ftp.debian.org.br
bash$
它表C,在netselect后列出的所有主ZQftp.debian.org.br是下载速度最快的LQ其得分?65。(注意Q!q是在我电脑上的试l果Q不同的|络节点|速会大不相同Q所以这个分g一定适用于其它电脑)
现在netselect扑ֈ的连接速度最快的镜像站点加入/etc/apt/sources.list文gQsee The /etc/apt/sources.list file, Section 2.1Qand follow the tips in Managing packages, Chapter 3.
注意Q镜像站点列表通常包含在文件http://www.debian.org/mirror/mirrors_full?
?.3版开始,netselect软g包包含了netselect-apt脚本Q它使上q操作自动完成。只需发布目录树做ؓ参数Q默认ؓ stableQ输入,sources.list文g׃生成速度最快的main和non-US镜像站点列表Qƈ保存在当前目录下。下面的例子生成一个包? stable发布镜像站点列表的sources.list
bash$ ls sources.list
ls: sources.list: File or directory not found
bash$ netselect-apt stable
(...)
bash$ ls -l sources.list
sources.list
bash$
CQsources.list生成在当前目录下Q必d其移?etc/apt目录?
Then, follow the tips in Managing packages, Chapter 3.
2.4 CD-ROM加入source.list文g
===============================
如果你用APT从CD-ROM上安装及升软g包,你可以将它加入到sources.list文g中。完成该操作Q可使用apt-cdromE序Q?
apt-cdrom add
Debian光盘攑օ光驱Q它加载光盘目录,q在光盘上查找Y件包信息。如果你的光驱需要额外设|,可用以下选项Q?
-h - program help
-d directory - CD-ROM mount point
-r - Rename a
recognized CD-ROM
-m - No mounting
-f - Fast mode, don't check package
files
-a - Thorough scan mode
例如Q?
apt-cdrom -d /home/kov/mycdrom add
你还可以扫描一张光盘,但不其加入列表Q?
apt-cdrom ident
注意Q只有当你在pȝ?etc/fstab中正设|了光驱后,该程序才会工作?
Debian APT HOWTO W三?软g包管?
APT HOWTO
W三?软g包管?
3.1 更新可用软g包列?
======================
软g包管理系l用一个私有数据库跟踪列表中Y件包的当前状态:已安装、未安装或可安装。apt-get通过该数据库来确定如何安装用h用的软g包以及正常运行Y件包所必须的其它关联包?
你可以用apt-get update来更新数据库列表。这个命令将扫描/etc/apt/sources.list文g中所指\径中的Y件包列表文g。有兌列表文g的更多信息请查阅 W二? /etc/apt/source.list文g?
定时q行q个E序是个好主意,它将使你和你的系l获得最新的软g包更新和安全更新{信息?
3.2 安装软g?
==============
现在Q终于到了你一直期待的阶段Q准备好了sources.list和最新版的的可用软g包,你所需做的是q行apt-get来安装你渴望已久的Y件了。例如,你可以这P
apt-get install xchat
APT会扫描它的数据库扑ֈ最新的版本的Y件包Qƈ它从sources.list中所指的地方下蝲到本地。如果该软g包需要其它Y件包才能正常q行——如本例一样——APT会做兌性检查ƈ自动安装所兌软g包。如下所C:
[root]@[/] # apt-get install nautilus
Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be
installed:
bonobo libmedusa0 libnautilus0
The following NEW packages
will be installed:
bonobo libmedusa0 libnautilus0 nautilus
0 packages
upgraded, 4 newly installed, 0 to remove and 1 not upgraded.
Need to get
8329kB of archives. After unpacking 17.2MB will be used.
Do you want to
continue? [Y/n]
nautilus软g包需要引用共享函数库Q因此APT会从镜像源处下蝲相关׃n函数库,如果你在apt-get命o行中手动指定了这些共享函数库的名UͼAPT会默认ؓ你要安装所有这些Y件包?
也就是说APT只会在安装那些没有在命o行中指定的Y件包时提CZq行认?
下列apt-get选项也许对你有用
-h This help text.
-d Download only - do NOT install or unpack archives
-f Attempt to continue if the integrity check fails
-s No-act. Perform
ordering simulation
-y Assume Yes to all queries and do not prompt
-u
Show a list of upgraded packages as well
可以用一条命令安装多个Y件包。包文g从网l上下蝲到本?var/cache/apt/archives目录Q稍后再安装?
你可以用同样的命令行删除指定软g包,只需在Y件包名称后紧跟一个?”,如下所C:
[root]@[/] # apt-get install nautilus gnome-panel-
Reading Package
Lists... Done
Building Dependency Tree... Done
The following extra
packages will be installed:
bonobo libmedusa0 libnautilus0
The following
packages will be REMOVED:
gnome-applets gnome-panel gnome-panel-data
gnome-session
The following NEW packages will be installed:
bonobo
libmedusa0 libnautilus0 nautilus
0 packages upgraded, 4 newly installed, 4
to remove and 1 not upgraded.
Need to get 8329kB of archives. After
unpacking 2594kB will be used.
Do you want to continue? [Y/n]
有关删除软g包的更多详细信息Q参?3.3 U除软g包?
假如你不心损坏了已安装的Y件包而想修复它,或者仅仅想安装软g包中某些文g的最新版本,q是可以做到的,你可以用--reinstall选项Q?
[root]@[/] # apt-get --reinstall install gdm
Reading Package Lists...
Done
Building Dependency Tree... Done
0 packages upgraded, 0 newly
installed, 1 reinstalled, 0 to remove and 1 not upgraded.
Need to get
0B/182kB of archives. After unpacking 0B will be used.
Do you want to
continue? [Y/n]
本文档写作时所参考的APT版本?.5.3Q这个版本还属于“unstable”(sidQ阶Dc如是你安装了这个版本,你可以在pȝ配置中用新增的功能Q你可以用apt-get install package/distribution来安装指定发布版中的软g包,或者用apt-get install package=versionQ如下所C:
apt-get install nautilus/unstable
它将Z安装“unstable”发布版中的nautilus软g包,即你当前运行的是“stable”版本。命令中“distribution”选项的可用参数gؓQstableQtestingQunstable?
在处理关联问题时Q你可能更乐意?t开x选择目标发布版,让apt-get帮你考虑使用哪个发布版?
重要信息Q最新版的Debian软g包首先会上传到“unstable”发布版中,q个发布版包含了软g包所有更攚wD,无论是小修小补还是媄响到众多软g包乃x个系l的重大修改。所以,新手和那些强调系l稳定性的用户不会使用q个发布版?
“testing”发布版比v“unstable”发布版Q多注重了些pȝE_性,但正式运行的pȝ应当使用“stable”发布版?
3.3 U除软g?
==============
如果你不再用某些Y件包Q你可以用APT其从系l中删除。要删除软g包只需输入Qapt-get remove package。如下所C:
[root]@[/] # apt-get remove gnome-panel
Reading Package Lists... Done
Building Dependency Tree... Done
The following packages will be REMOVED:
gnome-applets gnome-panel gnome-panel-data gnome-session
0 packages
upgraded, 0 newly installed, 4 to remove and 1 not upgraded.
Need to get 0B
of archives. After unpacking 14.6MB will be freed.
Do you want to continue?
[Y/n]
׃例可知,APT会关注那些与被删除的软g包有依赖关系的Y件包。用APT删除一个Y件包会q带删除那些与该软g包有依赖关系的Y件包?
上例中运行apt-get会删除指定Y件包以及与之有依赖关pȝ软g包,但它们的配置文gQ如果有的话Q会完好无损C留在pȝ里。如果想d删除q些包及光|文Ӟq行Q?
[root]@[/] # apt-get --purge remove gnome-panel
Reading Package Lists...
Done
Building Dependency Tree... Done
The following packages will be
REMOVED:
gnome-applets* gnome-panel* gnome-panel-data* gnome-session*
0
packages upgraded, 0 newly installed, 4 to remove and 1 not upgraded.
Need
to get 0B of archives. After unpacking 14.6MB will be freed.
Do you want to
continue? [Y/n]
注意QY件包名字后面?表示该Y件包所有的配置文g也将被删除?
p安装软g时一P你可以在删除命o中用一个符h指定安装某个软g包。在删除软g包时Q如果你在Y件包名字后面紧跟一个?”,那么该Y件包׃被安装而不是删除?
[root]@[/] # apt-get --purge remove gnome-panel nautilus+
Reading Package
Lists... Done
Building Dependency Tree... Done
The following extra
packages will be installed:
bonobo libmedusa0 libnautilus0 nautilus
The
following packages will be REMOVED:
gnome-applets* gnome-panel*
gnome-panel-data* gnome-session*
The following NEW packages will be
installed:
bonobo libmedusa0 libnautilus0 nautilus
0 packages upgraded,
4 newly installed, 4 to remove and 1 not upgraded.
Need to get 8329kB of
archives. After unpacking 2594kB will be used.
Do you want to continue?
[Y/n]
注意Qapt-get列出了那些将要被安装的关联Y件包Q即保证该Y件包正常q行的其它Y件包Q和要被删除关联Y件包Q然后,再次列出了将要被安装的Y件包?
3.4 更新软g?
==============
软g包更新是APT最成功的特炏V只需一条命令即可完成更斎ͼapt-get
upgrade。你可以使用q条命o从相同版本号的发布版中更新Y件包Q也可以从新版本L发布版中更新软g包,管实现后一U更新的首选命令ؓapt-get
dist-upgradeQ实情参?3.5升到新版本?
在运行该命o时加?u选项很有用。这个选项让APT昄完整的可更新软g包列表。不加这个选项Q你只能盲目地更新。APT会下载每个Y件包的最新更新版本,然后以合理的ơ序安装它们。注意在q行该命令前应先q行apt-get update更新数据库。有兌情参?3.1更新可用软g包列表。看看这个例子:
[root]@[/] # apt-get -u upgrade
Reading Package Lists... Done
Building Dependency Tree... Done
The following packages have been kept
back
cpp gcc lilo
The following packages will be upgraded
adduser ae
apt autoconf debhelper dpkg-dev esound esound-common ftp indent
ipchains
isapnptools libaudiofile-dev libaudiofile0 libesd0 libesd0-dev
libgtk1.2
libgtk1.2-dev liblockfile1 libnewt0 liborbit-dev liborbit0
libstdc++2.10-glibc2.2 libtiff3g libtiff3g-dev modconf orbit procps psmisc
29 packages upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Need to get 5055B/5055kB of archives. After unpacking 1161kB will be used.
Do you want to continue? [Y/n]
整个更新q程非常单。注意在本例中头几行Qapt-get报告有些软g包的更新被阻止(kept backQ,q表明这些Y件包的更新版本因故无法安装,可能的原因有兌不同步(当前没有供下载的新版本关联包Q或兌扩展Q需要安装新的关联包以配合新版Y件包Q?
对于W一U原因没有很好的解决ҎQ对于第二次原因Q运行apt-get intall安装所需的新兌包就可以。另一个更好的解决Ҏ是使用dist-upgrade。详情参?3.5升到新版本?
3.5 升到新版本
================
APT的绝zd是让你一ơ就完成整个pȝ的更斎ͼ不论是通过Internetq是通过光盘文gQ购买的片或下载的ISO镜像文gQ?
它也可以用来更新M改变了关联关pȝ软g包。即如前所q的那些使用apt-get upgrade时被L更新Qkept backQ的软g包?
例如Q假设你目前使用的Debian为stable revision 0Q如woody 3.0 r0Q译者注Q,而你购买了revision 3的新版DebianQ如woody 3.0 r3Q译者注Q,你可以用APT从新光盘上升U你的系l。用apt-cdromQ参? 2.4CD-ROM加入source.list文gQ将光盘加蝲?etc/apt/sources.list中,然后q行apt-get dist-upgrade?
h意,APTL搜烦最新版本的软g包,因此Q如果一个Y件包在你?etc/apt/sources.list中所列的版本比光盘上所列的版本要新Q那么APT会按照sources.list文g所指的地址下蝲q个软g包而不是用光盘上的Y件包?
?3.4更新软g?中我们D了个例子Q我们看到有些包被阻止更斎ͼkept backQ,现在我们qdist-upgradeҎ来解册个问题:
[root]@[/] # apt-get -u dist-upgrade
Reading Package Lists... Done
Building Dependency Tree... Done
Calculating Upgrade... Done
The
following NEW packages will be installed:
cpp-2.95 cron exim gcc-2.95
libident libopenldap-runtime libopenldap1
libpcre2 logrotate mailx
The
following packages have been kept back
lilo
The following packages will
be upgraded
adduser ae apt autoconf cpp debhelper dpkg-dev esound
esound-common ftp gcc
indent ipchains isapnptools libaudiofile-dev
libaudiofile0 libesd0
libesd0-dev libgtk1.2 libgtk1.2-dev liblockfile1
libnewt0 liborbit-dev
liborbit0 libstdc++2.10-glibc2.2 libtiff3g
libtiff3g-dev modconf orbit
procps psmisc
31 packages upgraded, 10 newly
installed, 0 to remove and 1 not upgraded.
Need to get 0B/7098kB of
archives. After unpacking 3118kB will be used.
Do you want to continue?
[Y/n]
注意现在那些软g包将会被更新Q那些新的关联Y件包也会被安装。但是lilo仍被L更新Q可能还存在一些比建立新关联更手的问题,我们通过如下Ҏ定问题所在:
[root]@[/] # apt-get -u install lilo
Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be
installed:
cron debconf exim libident libopenldap-runtime libopenldap1
libpcre2
logrotate mailx
The following packages will be REMOVED:
debconf-tiny
The following NEW packages will be installed:
cron
debconf exim libident libopenldap-runtime libopenldap1 libpcre2
logrotate
mailx
The following packages will be upgraded
lilo
1 packages
upgraded, 9 newly installed, 1 to remove and 31 not upgraded.
Need to get
225kB/1179kB of archives. After unpacking 2659kB will be used.
Do you want
to continue? [Y/n]
查看上述提示信息可知Qlilo与debconf-tiny包生了一个新冲突Q这表明除非删除debconf-tinyQ否则将无法更新lilo?
想知道该保留或删除哪些Y件包Q你可以使用Q?
# apt-get -o Debug::pkgProblemResolver=yes dist-upgrade
Reading Package
Lists... Done
Building Dependency Tree... Done
Calculating Upgrade...
Starting
Starting 2
Investigating python1.5
Package python1.5 has
broken dep on python1.5-base
Considering python1.5-base 0 as a solution to
python1.5 0
Holding Back python1.5 rather than change python1.5-base
Investigating python1.5-dev
Package python1.5-dev has broken dep on
python1.5
Considering python1.5 0 as a solution to python1.5-dev 0
Holding Back python1.5-dev rather than change python1.5
Try to
Re-Instate python1.5-dev
Done
Done
The following packages have been
kept back
gs python1.5-dev
0 packages upgraded, 0 newly installed, 0 to
remove and 2 not upgraded.
现在Q你很容易就知道不能安装python1.5-dev软g包是因ؓ无法满另一个Y件包python1.5的关联要求?
3.6 U除无用软g包文Ӟapt-get clean and autoclean
===================================================
当你需要安装某个Y件包ӞAPT?etc/apt/sources.list中所列的L下蝲所需的文Ӟ它们保存到本机软g库(/var/cache/apt/archives/Q,然后开始安装,参阅
3.2 安装软g包?
本地软g库会不断膨胀占用大量盘I间Q幸q的是,APT提供了工h理本地软g库:apt-get的cleanҎ和autocleanҎ?
apt-get clean删?var/cache/apt/archives目录?var/cache/apt/archives/partial目录下的所有文Ӟ除了被锁定的文g。这样以来,当你需要再ơ安装某个Y件包ӞAPT重C载它?
apt-get autoclean仅删除那些不需要再ơ下载的文g?
下面q个例子昄了apt-get autoclean如何工作Q?
# ls /var/cache/apt/archives/logrotate* /var/cache/apt/archives/gpm*
logrotate_3.5.9-7_i386.deb
logrotate_3.5.9-8_i386.deb
gpm_1.19.6-11_i386.deb
?var/cache/apt/archives目录下有两个不同版本的logrotate软g包文件以及一个gpm软g包文件?
# apt-show-versions -p logrotate
logrotate/stable uptodate 3.5.9-8
#
apt-show-versions -p gpm
gpm/stable upgradeable from 1.19.6-11 to 1.19.6-12
apt-show-versions昄logrotate_3.5.9-8_i386.deb提供了logrotate的升U版本,所? logrotate_3.5.9-7_i386.deb没用了。同样gpm_1.19.6-11_i386.deb也没有用了,因ؓ可以下蝲该Y件包的更 新版本?
# apt-get autoclean
Reading Package Lists... Done
Building Dependency
Tree... Done
Del gpm 1.19.6-11 [145kB]
Del logrotate 3.5.9-7 [26.5kB]
MQapt-get autoclean仅删除那些过时的文g。参?3.9如何从Debian的专用版本下升软g? 获得更多apt-show-versions相关信息?
3.7 在dselect中操作APT
======================
dselect工具帮助用户选取惌安装的Debian软g包。它有点复杂甚至令h望而生厌,但经q实践你p掌握它恐怖的l端界面?
dselect高功能之一是它知道利用Debian软g包的“推荐”和“徏议”能力。(Debian软g包有一U能力:推荐或徏议系l在安装? q同时Q安装别的Y件包以配合自w的工作Q当然这些推荐的软g包不一定是必须的;而dselect工具可以识别和利用这个能力,使用dselect时你 p体会到。译者注Q以rootw䆾q行dselectQ进入程序后选择apt作ؓq接方式QaccessQ。该步骤不是必须的,但如果你没有光驱而且? 通过Internet下蝲安装软g包,q是使用dselect的最好方法?
x入学习dselect的用法,请到Debian|站查阅dselect文档面
http://www.debian.org/doc/ddp
在dselect中选好了Y件包后,q行Q?
apt-get -u dselect-upgrade
如下例所C:
[root]@[/] # apt-get -u dselect-upgrade
Reading Package Lists... Done
Building Dependency Tree... Done
The following packages will be REMOVED:
lbxproxy
The following NEW packages will be installed:
bonobo
console-tools-libs cpp-3.0 enscript expat fingerd gcc-3.0
gcc-3.0-base
icepref klogd libdigest-md5-perl libfnlib0 libft-perl
libgc5-dev libgcc300
libhtml-clean-perl libltdl0-dev libsasl-modules
libstdc++3.0 metamail
nethack proftpd-doc psfontmgr python-newt talk tidy
util-linux-locales
vacation xbill xplanet-images
The following packages will be upgraded
debian-policy
1 packages upgraded, 30 newly installed, 1 to remove and 0
not upgraded.
Need to get 7140kB of archives. After unpacking 16.3MB will be
used.
Do you want to continue? [Y/n]
比较一下我们在相同pȝ上运行apt-get dist-upgrade时的情ŞQ?
[root]@[/] # apt-get -u dist-upgrade
Reading Package Lists... Done
Building Dependency Tree... Done
Calculating Upgrade... Done
The
following packages will be upgraded
debian-policy
1 packages upgraded, 0
newly installed, 0 to remove and 0 not upgraded.
Need to get 421kB of
archives. After unpacking 25.6kB will be freed.
Do you want to continue?
[Y/n]
我们看到在前例中许多软g包被安装是其它Y件包“推荐”或“徏议”的l果。另外一些Y件包被安装或删除Q例如lbxproxy软g包)是我们通过dselect工具作出的决定。由此可见dselect与APTl合h是一个功能强大的工具?
3.8 如何构徏一个合系l?
========================
Z怋用testing发布版,因ؓ它比unstable要稳定同时又比stable旉。然而对于那些想q行某些软g包的最新版本,又不希望
整个系l迁Udunstable发布版的q有一U选择Q运行一个testing/unstable混合pȝ。对另一部分保守的用戯言Q他们可能希望运
行stable/testing混合pȝ?
要实现合系l,请在/etc/apt/apt.conf中加入下面的语句Q?
APT::Default-Release "testing";
以后Q在从unstable发布版安装Y件包Ӟ使用-t开养I
# apt-get -t unstable install packagename
别忘了,使用Debian的某个发布版的Y件包Ӟ要将镜像源加入到/etc/apt/sources.list文g中。在q个例子中,除了加入testing发布版镜像源处,我们q需要加入unstable发布版镜像源?
3.9 如何从Debian的专用版本下升软g?
======================================
apt-show-versions提供了一个安全的途径Q让那些使用混合pȝ的用h心升U他们的pȝQ不必担心升U会原来属于stable的包升成了unstable包。例如,q条命o只升你的unstable软g包:
# apt-get install `apt-show-versions -u -b | grep unstable`
3.10 如何l护已安装Y件包的多个版本(复杂Q?
==========================================
你可能会遇到q种情况Q更改了某个软g包中的一些文Ӟ但你没有旉或根本就不想这些更改引入到新版本中。或者,你将pȝ升?.0Q但仍想l箋使用Debian
2.2下的某个软g包。你可以“钉住”(pinQ这个版本,q样它就不会被更C?
操作h十分单,你只需~辑/etc/apt/preferences文g?
文g格式很简单:
Package: <package>
Pin: <pin definition>
Priority:
<pin's priority>
例如Q我对sylpheed软g包做了某些修改,其版本ؓ0.4.99Q我想保留这些修改不被更斎ͼ可加上:
Package: sylpheed
Pin: version 0.4.99*
注意我用了一? *Q星P。这是一个“通配W”;它表明我希望“钉住”所有以0.4.99打头的版本(以防它们被下载ƈ安装到我机器上。pin控制的是服务器端的更新Y 件包而非本地的已安装软g包。译者注Q。因为Debian使用“Debian版本号”ؓ其Y件包定版本,我不惌行所有这些版本的升Q如果不用通配W, 那么0.4.99-1版或0.4.99-10版只要一出炉pȝ׃安装它们。如果你修改了Y件包Q你一定不希望q么做?
Priority是可选域Q如果没有特别指定,它的默认gؓ989?
让我们来看看pin如何体现优先U(priortyQ区别。一个低?的优先表示Q该软g包被止安装Q优先??00之间表示QY件包没有 安装q且当前也没有可用版本,q些软g包不会出现在供选择版本列表中;优先Uؓ100表示软g包已被安装——对于这个已安装的Y件包Q如果有一个不同的? 本要替换它,那么替换者的优先U必d?00?
优先U在100以上表示软g包应该被安装。典型的例子如,某个软g包的升补丁包,M处于100?000Q包?000Q之间的优先U都表示? q情形。但是,一个Y件包如果被定L优先U,它ƈ不会降已安装的版本。例如,如果我安装了sylpheed 0.5.3qؓsylpheed 0.4.99指定了一个优先?99的pinQ那么由于要满pin的优先Q所?.4.99软g包不会被安装。如果要实现软g包“降U”,则需要将 pin的优先定ؓ大于1000。(100<优先U?lt;=1000Ӟ如果存在升包就Ҏ机相兛_升Q如果本Y件包比更新包q新׃持不 变;优先U?gt;1000Ӟ服务器端软g包不论比本机的Y件包新还是旧Q均Ҏ机相兌Y件包q行更新。译者注Q?
pin可以被用来控制Y件包的修订版本(versionQ、发布版本(releaseQ或版本来源QoriginQ?
在前面我们已l看刎ͼ钉住修订版本时用通配W来代替版本h字,q样可一ơ指定多个版本?
release选项是基于发布版文gQRelease fileQ的Q这个文件在本地APT软g库中或安装光盘上。如果你从本地Y件库安装软g包而Y件库中又没有该文Ӟ那么q个选项失效。来看看 /var/lib/apt/lists/目录中发布版文g的内容,发布版包括这些参敎ͼaQarchiveQ,cQcomponentsQ,v QversionQ,oQoriginQ,lQlableQ?
来看一个例子:
Package: *
Pin: release v=2.2*,a=stable,c=main,o=Debian,l=Debian
Priority: 1001
在本例中Q我们选择了version?.2*的DebianQ它可以?.2r2Q?.2r3——这些版本包含了“point releases”即安全更新和其它非常生要的更新Q,stable软g库,maincY件包Q非contrib或non-freeQ,版本来源和标{֝ 为Debian。版本来源(o=Q说明谁制作了这个发布版文gQ标{(l=Q说明该发布版的名称QDebianx指Debian自己QProgeny? 是指后裔制作者,下面是一个发布版文g的样例:
$ cat
/var/lib/apt/lists/ftp.debian.org.br_debian_dists_potato_main_binary-i386_Release
Archive: stable
Version: 2.2r3
Component: main
Origin: Debian
Label: Debian
Architecture: i386
Debian APT HOWTO W四?几个非常有用的工?
APT HOWTO
W四?几个非常有用的工?
4.1 如何安装本地~译的Y件包Qequivs
====================================
有时Q用h使用某些软g的特D版本,它们只以源代码的形式存在Q没有现成的Debian软g包。Y件包理pȝ在处理这cM务时可能会出问题?
假设你想~译新版本的邮g服务器,~译、安装一切正常,然而,软g包管理系lƈ不知道你在系l中安装了自q译的东西Q在Debian中许多基于MTA
QMail Transport Agent 邮g传输代理Q的软g包也不知道这些?
现在是equivsd的时候了。用它来安装软g包,它所做的工作是创徏一个新的空软g包来实现兌Q让软g包管理系l相信关联实C?
在我们开始以前,我必L醒你Q编译某个Y件最安全的方法是对该软g现有的Debian软g包进行修改后重新~译Q如果你q不知道你正在干什么,劝你不要使用equivs替换兌包。更多信息请参阅 W六?源码包操作?
l箋上面的例子,你安装好了新~译的postfixQ接下来打算安装muttQ突然你发现mutt想与另一个MTA建立兌Q而你惌它用你刚安装的新MTA?
转到某个目录Q例?tmpQ执行:
# equivs-control name
name替换Z创徏的管理文Ӟcontrol fileQ,理文g按如下格式创建:
Section: misc
Priority: optional
Standards-Version: 3.0.1
Package: <enter package name; defaults to equivs-dummy>
Version:
<enter version here; defaults to 1.0>
Maintainer: <your name and
email address; defaults to username>
Pre-Depends: <packages>
Depends: <packages>
Recommends: <packages>
Suggests:
<package>
Provides: <(virtual)package>
Architecture: all
Copyright: <copyright file; defaults to GPL2>
Changelog:
<changelog file; defaults to a generic changelog>
Readme:
<README.Debian file; defaults to a generic one>
Extra-Files:
<additional files for the doc directory, commaseperated>
Description:
<short description; defaults to some wise words>
long description and
info
.
second paragraph
我们只需按自q需要修改相关项目就行了。文件中每个目都描q得很清楚,我们不必在此逐行解释它们。现在开始修改吧Q?
Section: misc
Priority: optional
Standards-Version: 3.0.1
Package: mta-local
Provides: mail-transport-agent
行了Q就是这栗mutt要与mail-transport-agent兌Q这是所有MTAq的一个虚拟包Qvirtual packageQ,我可以简单地这个Y件包命名为mail-transport-agentQ不q我更愿意用系l的虚拟包方案,使用Provides选项?
现在你可以开始创Y件包了:
# equivs-build name
dh_testdir
touch build-stamp
dh_testdir
dh_testroot
dh_clean -k
# Add here commands to install the package
into debian/tmp.
touch install-stamp
dh_testdir
dh_testroot
dh_installdocs
dh_installchangelogs
dh_compress
dh_fixperms
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dpkg-deb:
building package `name' in `../name_1.0_all.deb'.
The package has been created.
Attention, the package has been created in
the current directory,
然后安装q个新创建的.deb?
众所周知Qequivs的用法很多,它甚臛_以帮你ؓ那些常用软g的底层关联包创徏个性化版本。尽情发挥你的想像力吧,不过要小心?
重要提示Q管理文Ӟcontrol filesQ的样例文g?usr/share/doc/equivs/examples目录下?
4.2 U除无用的locale files文gQlocalepurge
===========================================
许多Debian用户仅在固定地区使用Debian。例如,在巴西的Debian用户Q通常使用pt_BR地区配置文gQlocale
fileQ而不会关心es地区配置文g?
对于q类用户而言localepurge是一个非常有用的工具Q你可以仅保留你当前所用的地区配置文gQ删除其它无用的文gQ从而释攑֤量硬盘空间。运行apt-get install localepurgep了?
它配|v来非常容易,debconf的提问将引导用户一步一步完成设|。在回答W一个问题时请务必}慎,如果回答错了Q系l可能删掉所有的地区配置文gQ包括你正在使用的这个。复原它们的唯一Ҏ是重装那些软g包?
4.3 如何知晓哪些软g包可以升U?
==============================
apt-show-versions工具可以告诉你系l中哪些包可以更C及其它一些有用的信息?u选项可以昄可更新Y件包列表Q?
$ apt-show-versions -u
libeel0/unstable upgradeable from 1.0.2-5 to
1.0.2-7
libeel-data/unstable upgradeable from 1.0.2-5 to 1.0.2-7
Debian APT HOWTO W五?获取软g包信?
APT HOWTO
W五?获取软g包信?
有些ZAPTpȝ的前端程序,能十分方便地获得pȝ软g包列表,列表包括可安装或已安装的软g包,q可以显C某软g包属于哪个域QsectionQ,它的优先U(priorityQ是多少Q它的说明文档,{等?
但是...在此我们想的学习如何使用APT本n来完成。你如何扑և你想要安装的软g包的名称Q?
我们完成q个d的方法有很多。我们从apt-cache开始,APTpȝ使用q个E序来维护它的数据库。下面我们通过一些实际操作来对它做个概览?
5.1 获得软g包名U?
==================
假设你十分怀늎Atari
2600的好日子Q你军_用APT安装一个Atari emulatorQ随后再下蝲几个游戏Q你可以q样Q?
[root]@[/] # apt-cache search atari
atari-fdisk-cross - Partition editor
for Atari (running on non-Atari)
circuslinux - The clowns are trying to pop
balloons to score points!
madbomber - A Kaboom! clone
tcs - Character
set translator.
atari800 - Atari emulator for svgalib/X/curses
stella -
Atari 2600 Emulator for X windows
xmess-x - X binaries for Multi-Emulator
Super System
我们扑ֈ了几个相关的软g包,以及有关的简单描q。想q一步获得某个Y件包的详l信息,你可以运行:
[root]@[/] # apt-cache show stella
Package: stella
Priority: extra
Section: non-free/otherosfs
Installed-Size: 830
Maintainer: Tom Lear
<tom@trap.mtview.ca.us>
Architecture: i386
Version: 1.1-2
Depends: libc6 (>= 2.1), libstdc++2.10, xlib6g (>= 3.3.5-1)
Filename: dists/potato/non-free/binary-i386/otherosfs/stella_1.1-2.deb
Size: 483430
MD5sum: 11b3e86a41a60fa1c4b334dd96c1d4b5
Description:
Atari 2600 Emulator for X windows
Stella is a portable emulator of the old
Atari 2600 video-game console
written in C++. You can play most Atari 2600
games with it. The latest
news, code and binaries for Stella can be found
at:
http://www4.ncsu.edu/~bwmott/2600
屏幕上显C出q个软g包的详细信息及其用途的完整描述。如果你的系l中已安装了某个软g包而系l又搜烦到它的新版本Q系l会它们的详细信息一q列出。如下例Q?
[root]@[/] # apt-cache show lilo
Package: lilo
Priority: important
Section: base
Installed-Size: 271
Maintainer: Russell Coker
<russell@coker.com.au>
Architecture: i386
Version: 1:21.7-3
Depends: libc6 (>= 2.2.1-2), debconf (>=0.2.26), logrotate
Suggests: lilo-doc
Conflicts: manpages (<<1.29-3)
Filename:
pool/main/l/lilo/lilo_21.7-3_i386.deb
Size: 143052
MD5sum:
63fe29b5317fe34ed8ec3ae955f8270e
Description: LInux LOader - The Classic OS
loader can load Linux and others
This Package contains lilo (the installer)
and boot-record-images to
install Linux, OS/2, DOS and generic Boot Sectors
of other OSes.
.
You can use Lilo to manage your Master Boot Record
(with a simple text screen)
or call Lilo from other Boot-Loaders to
jump-start the Linux kernel.
Package: lilo
Status: install ok installed
Priority: important
Section: base
Installed-Size: 190
Maintainer: Vincent Renardias
<vincent@debian.org>
Version: 1:21.4.3-2
Depends: libc6 (>=
2.1.2)
Recommends: mbr
Suggests: lilo-doc
Description: LInux LOader
- The Classic OS loader can load Linux and others
This Package contains lilo
(the installer) and boot-record-images to
install Linux, OS/2, DOS and
generic Boot Sectors of other OSes.
.
You can use Lilo to manage your
Master Boot Record (with a simple text screen)
or call Lilo from other
Boot-Loaders to jump-start the Linux kernel.
注意Q首先列出的是可用Y件包Q接着列出的是已安装Y件包。获取某个Y件包的常规信息可q行Q?
[root]@[/] # apt-cache showpkg penguin-command
Package: penguin-command
Versions:
1.4.5-1(/var/lib/apt/lists/download.sourceforge.net_debian_dists_unstable_main_binary-i386_Packages)(/var/lib/dpkg/status)
Reverse Depends:
Dependencies:
1.4.5-1 - libc6 (2 2.2.1-2) libpng2 (0
(null)) libsdl-mixer1.1 (2 1.1.0) libsdl1.1 (0 (null)) zlib1g (2 1:1.1.3)
Provides:
1.4.5-1 -
Reverse Provides:
如果仅想了解某Y件包的与哪些软g包关联,可运行:
[root]@[/] # apt-cache depends penguin-command
penguin-command
Depends: libc6
Depends: libpng2
Depends: libsdl-mixer1.1
Depends: libsdl1.1
Depends: zlib1g
MQ有一pd工具可帮助我们找到我们想要的软g包?
5.2 使用dpkg查找软g包名U?
==========================
另一个定位Y件包的方法是知道软g包中某个关键文g的名U。例如,你编译时需要某个头文gQ查找提供该文g的Y件包Q你可以q行Q?
[root]@[/] # dpkg -S stdio.h
libc6-dev: /usr/include/stdio.h
libc6-dev: /usr/include/bits/stdio.h
perl:
/usr/lib/perl/5.6.0/CORE/nostdio.h
或者:
[root]@[/] # dpkg -S /usr/include/stdio.h
libc6-dev: /usr/include/stdio.h
在清理硬盘空间时Q了解系l中已安装Y件的软g包名U十分有用,你可以运行:
[root]@[/] # dpkg -l | grep mozilla
ii mozilla-browse 0.9.6-7 Mozilla Web
Browser
q个命o的缺Ҏ它会“截断”Y件包的名字。在上例中,软g包的全称是mozilla-browserQ解册个问题可以用COLUMNS环境变量Q?
[kov]@[couve] $ COLUMNS=132 dpkg -l | grep mozilla
ii mozilla-browser
0.9.6-7 Mozilla Web Browser - core and browser
或显C成q样Q?
[root]@[/] # apt-cache search "Mozilla Web Browser"
mozilla-browser -
Mozilla Web Browser
5.3 如何“按需”安装Y件包
==========================
你正在编译某D늨序,H然Q停住了Q一条错误信息报告说你没有它需要的头文件。让auto-apt来救你吧Q它问你是否要安装需要的软g包,然后挂v~译q程Q安装好软g包后再恢复编译进E?
你所要做的仅仅是Q?
auto-apt run command
q里“command”指在运行过E中可能出现“需求文件不存在”问题的命o。例如:
auto-apt run ./configure
一会儿Q它׃告诉你要安装所需的Y件包q自动{到apt-get处理。如果你正在q行XQ就会一个图形界面提C窗口?
Z提高效率auto-apt所用的数据库需要实时更新。可调用auto-apt updateQauto-apt updatedb和auto-apt update-local来完成更新?
5.4 如何知道文g属于哪个软g?
==============================
如果你想安装某个软g包,但用apt-cache查不出它的名Uͼ不过你知道这个程序的文g名,或这个Y件包中某些文件的文g名,那么你可以用apt-file来查找Y件包名称?
$ apt-file search filename
它用h很象dpkg -SQ不q它q会列出包含该文件的已删除Y件包。它也可以用来查扑֓个Y件包包含~译时所~的文gQ当Ӟ解决q类问题auto-apt可能是更好的ҎQ请参阅 5.3如何“按需”安装Y件包?
用这个命令,你可以列Y件包的内容:
$ apt-file list packagename
apt-file用一个数据库来存放所有Y件包的内容信息,和auto-apt一Pq个数据库也需要实时更斎ͼ完成更新可以q行Q?
# apt-file update
默认情况下,apt-file和auto-apt使用同一个数据库Q参?5.3如何“按需”安装Y件包?
5.5 如何掌握软g包的变化情况
============================
在每个Y件包被安装以后,都会在文档目录(/usr/share/doc/packagenameQ生成一?
changelog.Debian.gz的文Ӟq个文g记录了该软g包最后一ơ更新对pȝ做了哪些修改Q你可以用zless阅读q些信息。不q当你对?
个系l进行升U以后,逐个查看软g包的更新信息可不是gҎ事?
有一个工兯帮你完成q项dQ它是apt-listchanges。首先你要装上apt-listchanges软g包。在安装的过E中QDebconf会问你一些问题,按你的要求回{它们就行了?
“Should apt-listchanges be automatically run by apt”(惌apt自动q行apt-listchanges吗?Q这个选项非常有用Q因为在你用apt更新软g包时Q它会告诉你此次软g包更新将会对原有pȝ做出了哪些修改,你分析了q些信息以后再决定是否执行此ơ更新。“Should apt-listchanges prompt for confirmation after displaying changes?”(昄更新信息后,需要apt-listchanges{待你的认信息吗?Q选项也非常有用,因ؓ在你阅读完更C息后Q它会询问你是否l箋安装q程Q如果你不想l箋Qapt-listchanges会返回一条错误信息,告诉apt停止安装q程?
安装了apt-listchanges后,每当apt下蝲软g包时Q不论来源是Internet、光盘或是硬盘)都会昄q些软g包的pȝ更新信息?
Debian APT HOWTO W六?源码包操?
APT HOWTO
W六?源码包操?
6.1 下蝲源码?
==============
在自pY件的世界里,l常需要学习源码或为程序除错,所以你需要下载它们。APT提供了一套简便的Ҏ帮你获得发布版中众多E序的源代码以及创徏一?debs所需的所有文件?
Debian源码的另一个普遍用途是unstable发布版的新版E序q行改写以供别的发布版用,例如Q从stable发布版外引入新的软g包,需要重新生?debs它在原发布版中的关联关p迁Ud新的发布版?
完成q些工作Q?etc/apt/sources.list文g中deb-src所指引用镜像源应该是unstableQ别忘了行首的注释W去掉。详情参? 2.1/etc/apt/sources.list文g?
用下面的命o下蝲源码包:
apt-get source packagename
通常会下载三个文Ӟa .orig.tar.gz, a .dsc and a .diff.gz。对于Debian专用的Y件包Q最后一个文件不会下载,W一个文件的文g名中没有“orig”项?
dpkg-sourced.dsc文g信息Q将源码包解包到packagename-version目录Q下载下来的源码包中有一个debian/目录Q里面是创徏.deb包所需的文件?
惌下蝲的源码包自动~译成Y件包Q只需在命令行中加?bQ如下:
apt-get -b source packagename
如果你不打算立即创徏.deb包,你可以运行如下命令,以后再创建它?
dpkg-buildpackage -rfakeroot -uc -b
请在下蝲包所在的目录中运行上面的命o?
apt-get的source命o与它的其它命令有所不同Q普通用h限就可以q行source命oQ指定文件被下蝲到用戯用apt-source package命o时所处的目录中?
6.2 ~译源码包所需的Y件包
==========================
通常Q编译源码包时要用到某些头文件和׃n库,所有的源码包的理文gQcontrol
fileQ中都有一个域“Build-DependsQ”,域中指出了编译该源码包需要哪些附加包?
APT提供了一个简单的Ҏ下蝲q些附加包,你只需q行apt-get build-dep packageQ其中package是你打编译的源码包名U。见下例Q?
[root]@[/] # apt-get build-dep gmc
Reading Package Lists... Done
Building Dependency Tree... Done
The following NEW packages will be
installed:
comerr-dev e2fslibs-dev gdk-imlib-dev imlib-progs libgnome-dev
libgnorba-dev
libgpmg1-dev
0 packages upgraded, 7 newly installed, 0 to
remove and 1 not upgraded.
Need to get 1069kB of archives. After unpacking
3514kB will be used.
Do you want to continue? [Y/n]
q些用于gmc正确~译指定源码包的附加包将会被安装。注意这个命令不能用来搜索某个Y件的源码包,你得另外q行apt-get source下蝲源码包?
Debian APT HOWTO W七?如何处理错误
APT HOWTO
W七?如何处理错误
7.1 一般错?
============
错误L发生Q大部分是因为用L_心Q下面列举一些常见错误及处理Ҏ?
如果在运行apt-get install package...Ӟ你的pȝ报告如下信息Q?
Reading Package Lists... Done
Building Dependency Tree... Done
W:
Couldn't stat source package list 'http://people.debian.org unstable/ Packages'
(/var/state/apt/lists/people.debian.org_%7ekov_debian_unstable_Packages) - stat
(2 No such file or directory)
W: You may want to run apt-get update to
correct these missing files
E: Couldn't find package penguineyes
上次你修?etc/apt/sources.list后,忘了q行apt-get update更新?
如果出现q样的信息:
E: Could not open lock file /var/lib/dpkg/lock - open (13 Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you
root?
如果你没有root权限Q当q行除source处的其它apt-get命oQ如会出C面的错误信息?
当你同时q行两个apt-getq程Q或者当你试图运行apt-get时已有一个的dpkgq程处于Ȁzȝ态,pȝ也会报告与上面相似的错误信息。唯一能与其它命o同时q行的只有source命o?
如果在安装过E中出现中断Q然后你发现该Y件包既不能重装又不能删除Q试试下面两个命令:
# apt-get -f install
# dpkg --configure -a
再试着安装那个软g包,如果不行再次q行上述命o后再试。这两个命o对于那些使用unstable的玩安常有用?
7.2 在哪儿获得帮助?
===================
如果你发现自己有太多疑问Q没关系Q有大量的Debian软g包管理系l文档供你参考?-help和帮助文档能Z提供巨大的帮助,q些文档位于/usr/share/doc目录中,?usr/share/doc/apt?
如果本文档没法帮你排忧解难,可以去Debian邮g列表找找{案Q相x目内你会获得更多信息。Debian的网址是:http://www.debian.org?
C只有Debian用户才能q些邮g列表和资源,其它操作pȝ的用戯到相关系l发布者徏立的C中获取更多资源?
Debian APT HOWTO W八?哪些发布版支持APTQ?
APT HOWTO
W八?哪些发布版支持APTQ?
下面是部分用APTpȝ的发布团体名Uͼ
Debian GNU/Linux (http://www.debian.org) - APT的开发?
Conectiva (http://www.conectiva.com.br) - W一个将APTUL用于rpm的发布团?
Mandrake (http://www.mandrake.com)
PLD (http://www.pld.org.pl)
Vine (http://www.vinelinux.org)
APT4RPM (http://apt4rpm.sf.net)
Alt Linux (http://www.altlinux.ru/)
Red Hat (http://www.redhat.com/)
Sun Solaris (http://www.sun.com/)
SuSE (http://www.suse.de/)
Yellow Dog Linux (http://www.yellowdoglinux.com/)
Debian APT HOWTO W九?致谢
APT HOWTO
W九?致谢
非常感谢你们Q我Debian-BR目l的好朋友们Q还有你DebianQ始l在我n边帮助我Q给我动力不停工作ؓ全hcdA献,帮助我树立拯救世界的理想。:Q?
我还要感谢CIPSGAQ他们给予我们项目组乃至整个自由软g目巨大的帮助,是我们灵感的源泉?
特别感谢Q?
Yooseong Yang <yooseong@debian.org>
Michael Bramer <grisu@debian.org>
Bryan Stillwell <bryan@bokeoa.com>
Pawel Tecza <pawel.tecza@poczta.fm>
Hugo Mora <h.mora@melix.com.mx>
Luca Monducci <luca.mo@tiscali.it>
Tomohiro KUBOTA <kubota@debian.org>
Pablo Lorenzzoni <spectra@debian.org>
Steve Langasek <vorlon@netexpress.net>
Arnaldo Carvalho de Melo <acme@conectiva.com.br>
Erik Rossen <rossen@freesurf.ch>
Ross Boylan <RossBoylan@stanfordalumni.org>
Matt Kraai <kraai@debian.org>
Aaron M. Ucko <ucko@debian.org>
Jon ?slund <d98-jas@nada.kth.se>
Debian APT HOWTO W十?本用指南的新版?
APT HOWTO
W十?本用指南的新版?
本操作手册由Debian-BR目l撰写,我们希望它能为Debian用户提供有效的帮助?
你可以从Debian文档目面获得本文档的新版本:http://www.debian.org/doc/ddp
Ҏ文档有Q何意见或可直接发emaill我Qkov@debian.org
Debian APT HOWTO 译后?
非常感谢版主能将本文收录到精华区Q谢谢!
学DebianC不少弯\Q得出的l验是Debian入门三板斧:dselect、APT、内核编译,掌握了这三者,q入门了,再深入学习就Ҏ多了。无怪乎有一U说法:Debian是Packages?
惛_初看着dselect头都大了Q找了半天也没找到完整一些的中文文档Q没办法只好着头皮读e文,׃不少旉Q读后果然功力增加不,现在居然觉得dselect是最手的包理软g?
最q有一D闲暇时_于是斗胆d文档,希望我一个h费点旉能ؓ大家省点旉。本时受q不汉化文档之苦,每每大骂译者不负责Q轮到自q译时 才知道其中的艰苦Q本着首先要自己搞懂然后再动笔的原则,只希望日后少被读者骂。不q由于专业技术水q뀁遣词造句能力都很有限Q如果各位Debian高手 d译文后,发现有错误或不通不懂之处,请发邮gl我Q以免误人子弟,我也会升U该文档?
在翻译过E中Q我最大努力保持原文的风格Q不q中文与英文表达方式有不的差别Q所以有一些地方译出来读v来怪怪的Q不好懂Q这些地Ҏ均以Q译 者注Q方式进行了意译。整个文档中《导a》、《哪些发布版支持APTQ》、《致谢》、《本使用指南的新版本》几个章节没有什么技术信息,不过考虑到文档的 完整性,q是都翻译了Q希望版Mq收录进_֍区?
接下来嘛Q打译一下dselect的官文文档,希望它是你们所期待的。:Q?/p>
apt-get install apt-rdepends springgraph
apt-rdepends -d anjuta | springgraph > anjuta.png
The aim of this page is to become a useful resource for scientist and science students using Ubuntu (or any other) Linux. Please add information or comments.
Linux is a great operating system for scientists, for many reasons:
It is stable, secure and runs on all sorts of hardware, from embedded systems to supercomputers.
It is possible to create a highly customised setup to do what you want.
Repetitive tasks can be automated.
There are lots of useful free scientific programs and tools.
Although some people say that linux is not user friendly enough for the desktop yet, scientists are usually a bit more familier with computers, and don't mind learning how to do things.
Some applications that scientists use in Linux. Please add some more.
See also: SAL (Scientific Applications on Linux) is a collection of
information and links to software that will be of interest to
scientists and engineers. The broad coverage of Linux applications will
also benefit the whole Linux/Unix community. There are currently 3,017
entries in SAL. http://sal.iatp.by/
Cernlib - A suite of data analysis tools and libraries created
for use in physics experiments, but also with applications to other
fields such as the chemical and biological sciences. Cernlib
JaxoDraw - A Java program for drawing Feynman diagrams JaxoDraw
ROOT - An Object Oriented Data Analysis Framework ROOT
Geant4 - A toolkit for the simulation of the passage of particles through matter Geant4
CLHEP - A Class Library for High Energy Physics CLHEP
Pluto++ - A Monte Carlo simulation tool for hadronic physics Pluto++
Data files from the Particle Data Group http://pdg.lbl.gov/2005/html/computer_read.html
GChemPaint - A 2D chemical structures editor GChemPaint
ghemical - A molecular modeling and computational chemistry package that provides molecular mechanics, semi-empirical (via MOPAC7), and ab initio (via MPQC) calculations ghemical
gdis - A molecular display program that supports OpenGL and POVRay rendering. gdis
OpenBabel - A chemical file format conversion program. OpenBabel
Chemtool and Xdrawchem - 2D molecule drawing programs similar to ChemDraw. Chemtool and
xdrawchem
mpqc - The Massively Parallel Quantum Chemistry Program. Ab initio quantum chemical computational package. mpqc
Linux4Chemistry - list of linux applications which may be useful for chemists
Bioconductor - bioinformatics tools Bioconductor
SciCraft - Addon to Octave, clones
Simulink. Still in developement, blocks have to be written by the user.
It is supposed to specialize in bioinformatics functions SciCraft
Insight Toolkit (ITK) - an open-source software toolkit for performing registration and segmentation. Created to support the
Visible Human Project .
Octave - GNU Octave is a high-level language, primarily intended for numerical computations. (Similar to MATLAB). Octave
SciCraft - Addon to Octave, clones
Simulink. Still in developement, blocks have to be written by the user.
It is supposed to specialize in bioinformatics functions SciCraft
Scilab - Another MATLAB-like software. Scilab
SciCos - A free Simulink-like addon to Scilab SciCos
Maxima - A computer algebra system (xmaxima is its X interface)
GNU MP - GNU Multiprecision arthmetic library. Useful if you need to use very big numbers in a C program. GMP
GSL - the Gnu Scientific Library GSL
R - for statistical computing and graphics. R
OOStatistics - A statistics macro for openoffice calc. OOStatistics
freefem - A PDE oriented language using Finite Element Method - 2D and 3D versions. freefem
SciPy - An open source library of scientific tools for Python. SciPy
F2PY - Fortran to Python interface generator provides a connection between Python and Fortran languages. F2PY
KStars - A virtual planetarium. KStars
xephem - A very comprehensive ephemeris/planetarium. Old interface. xephem
Nightfall - An astronomy application for fun, education, and science. http://www.lsw.uni-heidelberg.de/users/rwichman/Nightfall.html
Eagle - A printed circuit board design tool. Eagle
oregano - Schematic capture, netlists, and spice for simulations. oregano
gEDA - GPL'd suite of Electronic Design Automation tools. gEDA
Qucs - An integrated circuit simulator Qucs
UbuntuGIS Geographical Information System
ncview - A very fast program for viewing netCDF files (a standard widely used in meteorology, climate and oceanography) ncview
Generic Mapping Tools (GMT) - a mapping program that can also be used to make pretty graphs. GMT
openmosix - Turns a network of ordinary computers into a supercomputer. openmosix
boinc - A software platform for distributed computing using volunteered computer resources boinc
projects include Climateprediction.net,Einstein@home,LHC@home,Predictor@home,SETI@home
Xfig - A diagram and figure creation tool. Can import GIF,
JPEG, and EPS figures and can export to Postscipt, LaTeX, and bitmap
files. Xfig
Dia - A "Visio" like diagram tool. Especially useful for simple circuits and flowcharts. Dia
BIKA - A laboratory information management system (LIMS) built on top of Zope and Plone, and coded in Python BIKA
GNUPlot - A command-line driven 2D/3D plotting tool. Can
perform data fitting and exports to PNG, PS, Xfig, and Latex formats.
Has python bindings (python-gnuplot) for including in other programs or
scripts. gnuplot
grace - A 2D WYSIWYG plotting tool that exports to JPEG, PNG, EPS, PDF, and SVG. Also does curve fitting. grace
PGPLOT - Fortran- or C-callable graphics subrutine package for making scientific graphs. PGPLOT
SciGraphica - A scientific application for data analysis and technical graphics. Attempts to be a "Microcal Origin" clone
SciGraphica
Qtiplot - A 2D/3D, Qt based plotting tool that attempts to be another "Origin" clone Qtiplot
LabPlot - Another Qt based 2D/3D GUI plotting tool that also does curve fitting, supports many data formats, LaTeX labeling, GSL functions, and statistics. LabPlot
Veusz - A scientific plotting package written in Python. veusz.
Gri - A scientific graphics language. Gri
LaTeX - WYGIWYW (What You Get Is What You Want) text mark up system. What real scientist write papers with. LaTeX
Kile - A LaTeX-frontend for KDE, with support for syntax highlighting
and convenient palettes for all standard mathematical symbols and text
formatting. It also provides easy access to forward and inverse search
facilities. Kile
eqe - Allows you write equations in Latex and drag and drop them into other apps eqe
Conglomerate - An XML editor, to create DocBook or similar formats. Conglomerate
Jabref - A graphical bibtex bibliography manager which can be used in conjunction with lyx. It is java based. Jabref
TeXmacs - A wysiwyg scientific text editor TeXmacs
doubles as an interface for computer algebra systems like [Maxima], maple, mupad, axiom, giac, GTybalt, Macaulay 2, pari, yacas
can also be used as a front end for [R], Octave, [GNUplot], [Xfig], [Dr. Geo], [Eukleides],[Qcl]
preview-latex - (almost) turns emacs into a WYSIWYG-LaTeX-frontend preview-latex
latex2html ,
tth and
hevea for converting LaTeX to html.
gaim-latex - A small gaim (see GaimHowto) plugin which allow you to insert LaTeX formulae into im conversations. gaim-latex
hopefully this list will get long enough to deserve its own page.
Proprietary |
Free alternative |
Info |
Link |
Matlab |
Matrix based computing environment |
||
Matlab |
Scilab |
see above |
|
Simulink |
SciCraft |
Based on Octave (Available for Debian, I think) |
|
Simulink |
SciCos |
Based on Scilab (Not found in Ubuntu Repos) |
|
Origin |
SciGraphica & Qtiplot |
Data plotting and analysis |
Labview for linux (non-free) http://sine.ni.com/nips/cds/view/p/lang/en/nid/2541
National Instruments GPIB drivers for linux. http://www.ni.com/linux/gpib.htm
Comedi - Open source drivers, tools and libraries. comedi
RTAI - Real-Time Application Interface is a hard real-time extension to the Linux kernel http://www.rtai.org/
Quantian A Knoppix / Debian variant tailored to numerical and quantitative analysis.
Debian-Med Debian-Med is a "Custom Debian Distribution" for medical practice and research.
debian-med metapackages are in Ubuntu(Universe): to list them type: apt-cache search debian-med
Scientific Linux Linux release put together by Fermilab and CERN based on RH
Madrake4Chemistry is about using Madrake Linux for chemistry
repository of ROOT packages
repository of ITK Packages
Daniel Leidert repository (
read)
UbuntuSciencePackages is a list of packages that are in the official Ubuntu Repositories that scientist use
UbuntuScienceMetaPackages discusses possible science metapackages
sourceforge - scientific software on sourceforge
DebianLinux.Net-Scientific Software - links to science software
freshmeat - scientific software on freshmeat
http://www.linuxlinks.com/Software/Scientific/ - scientific linux software
gnome-files - scientific software - scientific apps for gnome
kde-apps.org- scientific software - scientific apps for kde
Educypedia - collection of links about scientific and educational material.
Openscience project is dedicated to writing and releasing free and Open Source scientific software.
(2005-09-26 06:17:30?span title="158.144.70.26">KevinGoldstein~辑)
The first user created is part of the admin group, which can use sudo. Any users created after that are not by default. It is recommended that all users of Ubuntu use sudo, as it provides clear benefits to security.
The password is stored by default for 15 minutes. After that time, you will need to enter your password again
To run the graphical configuration utilities with sudo, simply launch the application via the menu.
To run a program using sudo that normally is run as the user, such as gedit, go to Applications --> Run Application and enter 'gksudo gedit'. For users of Kubuntu, used 'kdesu' in replacement for gksudo. Breezy users, go to Applications --> System Tools --> Run as different user.
To use sudo on the command line, preface the command with sudo, as below.
sudo chown bob *
To start a root shell (i.e. a command window where you can run root commands) use:
sudo -s
Warning: sudo -s doesn't change the environment variables ($HOME, $PATH etc). It can have some bad side effects. You can use sudo -i to initialize a full root environment.
In Warty, adding a new user involves editing the /etc/sudoers file. To edit that file, you must use 'visudo' as it will error check the file before exiting. To add a user with the same administration rights as the first user, add the following lines to the file: '$newuser ALL=(ALL) ALL'. Replace the $newuser with the username.
To add a new user to sudo, open the "Users and Groups" tool from System --> Adminitration menu. Then click on the user and then on properties. Choose the "User Privileges" tab. In the tab, find "Executing system administration tasks" and check that.
The benefits of leaving root disabled by default include the following.
Initially the Ubuntu team wanted the easiest install possible. By not enabling root, a couple of steps requiring user interaction during install could be avoided. (Colin Watson)
Even more significantly, if root were enabled during install, the user would be required to forever remember the password they chose--even though they would rarely use it. Root passwords are often forgotten by users who are new to the Unix security model. (Matt Zimmerman)
It avoids the "I can do anything" interactive login by default--you will be prompted for a password before major changes can happen, which should make you think about the consequences of what you are doing. If you were logged in as root, you could just delete some of those "useless folders" and not realize you were in the wrong directory until it's too late. It's been good Unix practice for a long time to "su-command-^D" regularly instead of staying in a root shell--unless you're doing serious system maintenance (at which point you can still "sudo su"). (Jim Cheetham and Andrew Sobala)
Sudo adds a log entry of the command(s) run (In /var/log/auth.log). If you mess up, you can always go back and see what commands were run. (Andrew Zbikowski)
Every cracker trying to brute-force their way into your box will know it has an account named "root" and will try that first. What they don't know is what the usernames of your other users are.
Allows easy transfer for admin rights, in a short term or long term period, by added and removing users from groups, while not compromising the root account. (Stuart Bishop)
While there are various advantages and disadvantages to this approach, compared with the traditional superuser model. Neither is clearly superior overall.
By encouraging the execution of single commands with root privileges, rather than opening a shell, sudo:
Reduces the amount of time spent with root privileges, and thus the risk of inadvertently executing a command as root
Provides a more useful audit trail
Having a separate root password (the traditional model) provides an extra layer of protection if an administrative user's password is compromised
In either case, if the administrative user (who uses sudo or su to become root) is compromised, the attacker can generally gain root through an indirect attack
Although for desktops the benefits of using sudo are great, there are possible issues which need to be noted:
Some packages from universe are effectively broken (e.g. webmin) or become dangerous to use. A good workaround is to enable the root account before dealing with the affected packages (sudo su-; passwd <password>) and to lock it again afterwards (su -; passwd -l).
Redirecting the output of commands run with sudo can catch new
users out (consider "sudo ls > /root/somefile"). Workarounds for
this include using "sudo sh -c 'ls > /root/somefile'" (but escaping
for this gets very ugly very quickly), using Adverbio, or simply using sudo -s to get a root shell and going from there
MattZimmerman: A simple approach which works for most cases is to use dd(1): ls | sudo dd of=/root/somefile
In a lot of office environments the ONLY local user on a system is root. All other users are imported using NSS techniques such as nss-ldap. To setup a workstation, or fix it, in the case of a network failure where nss-ldap is broken, root is required. This tends to leave the system unusable unless cracked.
JerryHaltom: Perhaps in these cases it neccessitates the creation of a local account: "admin" with sudo to root privileges.
Isn't sudo less secure than su?
The basic security model is the same, and therefore these two systems share their primary weaknesses. Any user who uses su or sudo must be considered to be a privileged user. If that user's account is compromised by an attacker, the attacker can also gain root privileges the next time the user does so. The user account is the weak link in this chain, and so must be protected with the same care as root.
On a more esoteric level, sudo provides some features which encourage different work habits, which can positively impact the security of the system. sudo is commonly used to execute only a single command, while su is generally used to open a shell and execute multiple commands. The sudo approach reduces the likelihood of a root shell being left open indefinitely, and encourages the user to minimize their use of root privileges.
I won't be able to enter single-user mode!
The sulogin program in Ubuntu is patched to handle the default case of a locked root password.
Note: This is not recommended!
To enable the root account (i.e. set a password) use:
sudo passwd root
Enter your existing password
Enter password for root
Confirm password for root
Note: This is if you have already enabled a root account and wish to disable it again. To disable the root account after you have enabled it use:
sudo passwd -l root
This locks the root account.
It is generally recommended that you do not run applications with root privileges, but if you have to, it is recommended that you do not run "sudo {GUIAPP}", as sudo may not set up the environment correctly, and particularly on KDE this can be detrimental. Instead, always use gksudo {GUIAPP} or kdesu {GUIAPP}.
1. 下RPM安装?
$ wget http://ardownload.adobe.com/pub/adobe/reader/unix/7x/7.0/chs/AdobeReader_chs-7.0.0-2.i386.rpm
2. 转换RPM包ؓDEB包,q安?
$ sudo alien AdobeReader_chs-7.0.0-2.i386.rpm
$ sudo dpkg -i adobereader-chs_7.0.0-3_i386.deb
3. 建立acroread执行脚本链接
$ sudo ln -sf /usr/local/Adobe/Acrobat7.0/bin/acroread /usr/bin/acroread
1. 下蝲tar.gz安装?
$ wget http://ardownload.adobe.com/pub/adobe/reader/unix/7x/7.0/chs/AdbeRdr70_linux_chs.tar.gz
2. 安装软g?
$ tar zxvf AdbeRdr70_linux_chs.tar.gz
$ sudo AdobeReader/INSTALL
$ sudo ln -sf /usr/local/Adobe/Acrobat7.0/bin/acroread /usr/bin/acroread
3. 讄E序菜单?
$ sudo vi /usr/share/applications/AcrobatReader.desktop
//输入如下内容
[Desktop Entry]
Name=Acrobat Reader 7
Comment=Acrobat Reader 7
Exec=/usr/local/Adobe/Acrobat7.0/bin/acroread
Icon=/usr/local/Adobe/Acrobat7.0/Resource/Icons/AdobeReader.png
Terminal=false
Type=Application
Categories=Application;Office;
$ sudo /usr/local/Adobe/Acrobat7.0/Browser/install_browser_plugin
安装浏览器?acroread 增效工具?br>
误? Adobe Reader 7.0.0 的安装\径?[/usr/local/Adobe/Acrobat7.0]
1. 执行全局安装
2. 执行用户指定的安?(Mozilla/Firefox/Netscape)
误入您的选择 [1/2] 1
误入浏览器安装路径 - /usr/lib/mozilla-firefox
安装成功。添加文?/usr/lib/mozilla-firefox/plugins/nppdf.so
您是否要安装另一个浏览器Q?[y/n] n
$ sudo rm -rf /usr/local/Adobe/Acrobat7.0/
$ sudo rm /usr/share/applications/AdobeReader.desktop
$ sudo rm /usr/bin/acroread
1. 下蝲DEB?
$ wget http://download.yahoo.com/dl/unix/ymessenger_1.0.4_1_i386.deb2. 安装
$ sudo apt-get install libgdk-pixbuf2 libglib1.2 libgtk1.2 libssl0.9.6 $ sudo dpkg -i ymessenger_1.0.4_1_i386.deb3. q行
$ /usr/bin/ymessenger &1. 安装
$ sudo apt-get install prozgui
2. 讄
$ sudo vi /usr/share/applications/prozgui.desktop
//输入如下内容
[Desktop Entry]
Name=Prozilla GUI
Comment=Prozilla Downloader GUI
Exec=/usr/bin/prozgui
Icon=/usr/share/pixmaps/prozgui.xpm
Terminal=false
Type=Application
Categories=Application;Network;
1. 下蝲NeroLinux的deb?
$ wget ftp://ftp5.us.nero.com/nerolinux-2.0.0.2-x86.deb2. 安装NeroLinux依赖的包
$ sudo apt-get install libglib1.2 libgtk1.23. 安装NeroLinux?
$ sudo dpkg -i nerolinux-2.0.0.2-x86.deb4. 启动NeroLinuxE序 选择菜单“Applications?>“System Tools?>“NeroLINUX”启动程序?
1、安装pppoe软g?
$ sudo apt-get install pppoeconf
2、配|adsl拨号的帐号信?
$ sudo pppoeconf
3、进行adsl拨号建立|络q接
$ sudo pon dsl-provider
4、断开adsl|络q接
$ sudo poff
$ killall gnome-panel
3. 使用 选择“Applications?>“Internet?>“Prozilla GUI”?
作? kanru
有在注意 freetype 最新發展的人應該已E知?
freetype2 已經內徏_體模擬支援(cvs 版本)Q在 xft2 中相應的程式碼也已E有? 所以只要更新這兩個套件便可以有基本的_體支援 眨眨? 惌嘗鮮的h可以加入以下?sources.list 代码:
其中 freetype2 的部份是今天更新?cvs 版本Q有熱呼呼的的粗體支? xft2 是拿 debian 中的版本直接重新R譯Q讓 configure 偉|到已E開啟模擬粗? 更新 libfreetype6 ?libxft2 後重新啟?X 便能體驗C違的_體 眨眨? NOTE: 此修正是以直接修改底層的方式Q與其他之前?patch 不同 L這些不同 patch 的套件將有不能預期的後果 盔RE址Q? freetype maillist a論? http://lists.gnu.org/archive/html/f...5/msg00019.html (Firefly) freetype已經接受_体補丁Q?br> http://firefly.idv.tw/test/Forum.ph...=view&History=0 |
|