在Linux中安装软件,对菜鸟而言,一是个多么困难的事情(我刚到Linux世界的时候深有体会)。用rpm包的安装时,依赖关系弄得头晕,源码包的安装方式,命令参数让人害怕,出显编译方面的错后根本不知道怎么办。其实,别把安装软件就看成是那么难,用yum(或apt-get)来安装软件却是自动化的,比Windows安装软件还要方便。一个命令下去后yum(或apt-get)自己去完成的软件的安装(包括在网上的源中找软件包,解决依赖关系,下载软件包,验证软件包,安装软件包)等,最后软件就出显在程序菜单中了。但这种全自动安装软件的条件就是要把软件源配置好,下面说配置源(高手就别笑我了): screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http:///fileicon/zip.gif');}" onmousewheel="return imgzoom(this);" alt="" /> 文件:CentOS-Dag.repo.tar.gz 大小:0KB 下载: 下载 下载上面的CentOS-Dag.repo.tar.gz文件,解压并把CentOS-Dag.repo文件放到/etc/yum.repos.d/目录中,再导入两个RPM-GPG-KEY吧: # rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt # rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 这样,软件包源就完成了,哈哈,够简单了吧! 说明:上面的CentOS-Dag.repo是我从rpmforge-release-0.3.6-1.el5.rf.i386.rpm包中提出来的文件(改了名而已)。导入RPM-GPG-KEY是为了校验软件包(知道MD5码吧,每个文件都有自己的MD5码,如果文件有修改,那么被修改后的MD5码与之前的MD5就不一样),校验软件包也就是这样的概念了,如果没有RPM-GPG-KEY会出显下类信息: warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 6b8d79e6 只要完成上面的就行了,应该很简单了,下面的想看就看吧。 在网上找个3个国内的更新源: http://mirror.be10.com/centos/ http://centos.candishosting.com.cn/ http://ftp.hostrino.com/pub/centos/ 来看看/etc/yum.repos.d/CentOS-Base.repo配置文件吧: screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080907011811.png');}" onmousewheel="return imgzoom(this);" alt="" /> $releasever:这是版本号,我用的是CentOS5这个版本,所以CentOS-$releasever就是CentOS-5了。 $basearch:这是体系号,就是指i386、i586、i686这类这东西了。 mirrorlist:这是指向一个镜像列表,如果把mirrorlist指向的这个http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates地址,把$releasever用5代替,把$basearch用i386代替,就是下面这个地址http://mirrorlist.centos.org/?release=5&arch=i386&repo=updates然后用浏览器访问这个地址看看,下图: screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080907020850.png');}" onmousewheel="return imgzoom(this);" alt="" /> 是个镜像列表,这是网上的镜像列表,算是只读的吧(因为无法去改动它),也可以把镜像列表设在本地。把网上的镜像列表复制到文本文件中保存,比如说就命名为Mirrorlist-Base吧,并且放在/etc/yum.repos.d/目录中,那么mirrorlist就可以设置为mirrorlist=file:///etc/yum.repos.d/Mirrorlist-Base就指向本地镜像列表了。 在更新软件或者安装什么软件时,感觉非常的慢,最后出显下类信息: http://ftp-stud.fht-esslingen.de/dag/redhat/el5/en/i386/dag/repodata/primary.xml.gz: [Errno 4] Socket Error: timed out Trying other mirror. 看到这类信息,说明超时了,尝试其它的镜像地址。这里很容易就看出来是超时的镜像地址,就可以去把镜像列表中的这个地址用“#”批注掉(因为它太慢了,难道还要用)!去批注掉那个慢的镜像地址,只有在本地才能办到,想要改网上的(除非是那网站的管理员)。 baseurl:是指向一个或多个url地址,就这样说吧,把mirrorlist和baseurl看作是同一个意思,都是放镜像列表的。只是mirrorlist是把镜像列表放在文件或网上的,而baseurl是直接放在其后面的,如下图: screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080907094446.png');}" onmousewheel="return imgzoom(this);" alt="" /> 所以mirrorlist与baseurl要怎么用,自己去体会吧,网上有些讲的是把mirrorlist用“#”批注掉,而用baseurl的;也有讲把baseurl用“#”批注掉,而用mirrorlist的,不管怎么,只要明白这是怎么回事了,想怎么用就怎么用。 下面说地址这东东,就拿上图中http://mirror.centos.org/centos/$releasever/os/$basearch/这个地址来说吧,把$releasever用5代替,把$basearch用i386代替,就是http://mirror.centos.org/centos/5/os/i386/这个地址了。再去用浏览器访问http://mirror.centos.org/centos/5/这个地址,如下图: screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://blog.chinaunix.net/photo/76337_080907095843.png');}" onmousewheel="return imgzoom(this);" alt="" /> 看到了吧,有addons、centosplus、extras、os、updates这些目录吧,再看看CentOS-Base.repo文件中的信息,看baseurl后面的地址(例如/$releasever/os/$basearch/、/$releasever/updates/$basearch/、... ... 这些),这都是相对应的,怎么添加源就自己去琢磨吧,不会太难的,呵呵。 gpgcheck:是否进行GPG校验,0表示“否”,1表示“是”。 enabled:是否启用更新库,0表示“否”,1表示“是”。 protect:是否从网上更新,0表示“否”,1表示“是”。 gpgkey:是指向RPM-GPG-KEY的位置。 我在网上找到 centos中用yum安装MPlayer(同样可以yum安装xmms) 这个文章,文章中基本上说的不是怎样安装MPlayer播放器,而是大部讲的怎么配置个软件的源,我就不多说了。 最后,如果就遇到下面信息: Existing lock /var/run/yum.pid: another copy is running. Aborting. 这说明yum正在运行,一般是指自动更新正在运行(同一时刻只能一个yum运行),可以暂时先关闭yum-updatesd服务(系统->管理->服务)。 我想到什么就说什么,可能有些说得也不是很准确,呵呵!有问题,多去问问Google或Baidu吧! |
|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )
GMT+8, 2024-9-29 23:25 , Processed in 0.093669 second(s), 12 queries , Gzip On, MemCache On.
Powered by Discuz! X3.5
© 2001-2023 Discuz! Team.