CentOS yum服务器安装与使用命令
想知道到CentOS yum系统的真相么,想知道CentOS yum系统中藏有的内在奥义么,只有我来给大家全面讲解介绍CentOS yum系统全面分析,不知道从什么时候服务器上的CentOS yum坏了, 提示:
Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Traceback (most recent call last): File "/usr/bin/yum", line 29, in ? yummain.user_main(sys.argv[1:], exit_code=True) File "/usr/share/yum-cli/yummain.py", line 309, in user_main errcode = main(args) File "/usr/share/yum-cli/yummain.py", line 178, in main result, resultmsgs = base.doCommands() File "/usr/share/yum-cli/cli.py", line 345, in doCommands self._getTs(needTsRemove) File "/usr/lib/python2.4/site-packages/yum/depsolve.py", line 101, in _getTs self._getTsInfo(remove_only) File "/usr/lib/python2.4/site-packages/yum/depsolve.py", line 112, in _getTsInfo pkgSack = self.pkgSack File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 661, in <lambda> pkgSack = property(fget=lambda self: self._getSacks(), File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 501, in _getSacks self.repos.populateSack(which=repos) File "/usr/lib/python2.4/site-packages/yum/repos.py", line 232, in populateSack self.doSetup() File "/usr/lib/python2.4/site-packages/yum/repos.py", line 79, in doSetup self.ayum.plugins.run('postreposetup') File "/usr/lib/python2.4/site-packages/yum/plugins.py", line 179, in run func(conduitcls(self, self.base, conf, **kwargs)) File "/usr/lib/yum-plugins/fastestmirror.py", line 181, in postreposetup_hook all_urls = FastestMirror(all_urls).get_mirrorlist() File "/usr/lib/yum-plugins/fastestmirror.py", line 333, in get_mirrorlist self._poll_mirrors() File "/usr/lib/yum-plugins/fastestmirror.py", line 376, in _poll_mirrors pollThread.start() File "/usr/lib/python2.4/threading.py", line 416, in start _start_new_thread(self.__bootstrap, ()) thread.error: can't start new thread
CentOS yum删除了,重新安装结果还是不行。 估计是配置文件错误,再查查资料看看。 从网上下了yum.tgz压缩包安装好像有问题,自己找源安装吧。 tar zxvf yum.tgz解压文件不能不说通过rpm命令安装时很痛苦的事情,其中的包依赖关系搞的让你吐血。 比如 安装 a.rpm提示缺少 b.rpm , 下载了b.rpm 又提示 缺少 c.rpm,下载了c.rpm 让人吐血的事情发生了,说是缺少a.rpm,陷入死循环了。
制作的rpm包不能把a,b,c都达到一个包里吗?
解决办法: 所有包一起安装 使用命令 rpm -ihv*.rpm,不管怎么循环系统自己去找吧。重新安装CentOS yum需要4个包 yum-3.2.22-20.el5.centos.noarch.rpm ,yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm python-iniparse-0.2.3-4.el5.noarch.rpm yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm
PS:下载前删除一下下载的东西,下面是 rm指令
rm -rf ls ./*删除本级文件 rm -rf / 删除系统 ,运行了这个命令就要重新安装系统了。 find . -name "*" -exec rm {} \; -print - f 忽略不存在的文件,从不给出提示。 - r 指示rm将参数中列出的全部目录和子目录均递归地删除。 - i 进行交互式删除。
开始下载:
wget http://mirror.centos.org/centos/5.4/os/i386/CentOS/yum-3.2.22-20.el5.centos.noarch.rpm
wget http://mirror.centos.org/centos/5.4/os/i386/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
wget http://mirror.centos.org/centos/5.4/os/i386/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm
wget http://mirror.centos.org/centos/5.4/os/i386/CentOS/yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm
rpm -ihv*.rpm
rpm -ivh yum-3.2.22-20.el5.centos.noarch.rpmyum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm
到Preparing...########################################### [100%]
安装成功。 可惜重新安装还是不行。
下面几个包在安装过,不清楚CentOS yum安装需要不需要下面几个包。
centos-yumconf_4-4.3_noarch.rpm python-urlgrabber_2.9.6-2_noarch.rpm python-elementtree_1.2.6-4_i386.rpm sqlite_3.2.2-1_i386.rpm python-sqlite_1.1.6-1_i386.rpm
把 fastestmirror.conf的 maxthreads 值修改小也不行,没有办法禁用吧。禁用 yum-fastmirror 就可以了。
# vi /etc/yum/pluginconf.d/fastestmirror.conf [main] enabled=1 verbose=0 socket_timeout=3 hostfilepath=/var/cache/yum/timedhosts.txt maxhostfileage=10 maxthreads=15 #exclude=.gov, facebook enabled=1改为0就ok
运行一下CentOS yum没有问题。
这里有几个mirrors地址不错,常用的系统都有:
http://mirrors.163.com/感觉不全,缺少文件。
http://mirrors.sohu.com/ 没有用过。
http://mirror.centos.org/我使用的源,速度挺快。
http://mirror.centos.org/centos/5.4/os/i386/CentOS/ 服务器系统版本是 centos5.4
获取当前系统的版本号:#more /etc/redhat-releaseCentOS release 5.4 (Final)
RHEL 使用 CentOS 的CentOS yum源
CentOS-3.1 = AS3-update1 CentOS-3.2 = AS3-update2 CentOS-3.3 = AS3-update3 CentOS-3.4 = AS3-update4 CentOS-3.5 = AS3-update5 CentOS-4.0 = AS4 CentOS-4.1 = AS4-update1
参考资料:http://hi.baidu.com/qu6zhi/blog/item/7533b0f4cc7944d3f2d3858b.html