Centos yum install
http://wiki.centos.org/TipsAndTricks/BrokenVserver
centos mirror: http://mirror.centos.org/centos/6/os/x86_64/ 注意匹配正确的版本, /ect/yum.conf
How to install yum on a Virtual Server
Contents
1. But I DO have yum already, and I AM on CentOS
Many Linux distributions use a variant of yum. All CentOS releases are shipped with yum and a certain set of matching configuration files. In part this permits your system to work with the CentOS world-wide mirror and updates system. Some downstream forks break these yum configurations, and make their system incompatible.
For the reasons we will see later in this article, CentOS support regulars will decline to make a bad situation (a broken yum), worse.
2. I don't have yum on my CentOS installation
If yum is not installed and working, it is not CentOS. If you have a installation 'based on' or 'derived from' CentOS, but yum is missing, you don't have a real CentOS installation. It is not really possible for non-developers to install CentOS without installing yum.
Several VPS (Virtual Server) providers and some downstream forks of CentOS and its management tools (think: OpenVZ, cPanel, Plesk, webmin, Direct Admin, BlueQuartz, Asterisk, Trixbox, Elastix) seem to install only parts of CentOS on their virtual servers. Some then also remove yum from the installation, or alter the settings of the yum configurations. The usual alterations are to 'exclude' certain locally modified packages from yum package management. The command:
grep -ir exclud /etc/yum.*
usually discloses the excluded matter. Some 'manage' the box outside of the package management system. See also the Other Voices page for a list of more fork tines, derived in whole or in part from CentOS.
Why they do it is unclear. Maybe they try to make it harder for you to overwrite their kernel. Perhaps they do it from ignorance or sloth. The CentOS view of this is that such an approach is ill-considered. yum has mechanisms to protect specific packages from change. Perhaps, they cannot figure out how to read: man yum for the 'exclude' option; or perhaps they want to avoid support calls and are willing to sell a system which cannot be updated with facility. The second way, when the machine gets compromised though some newly emerged exploit which they prevented patching away, they can charge you for a full reinstall or restore from backups.
Before you try anything: Please STOP, and ask your VPS provider why they removed yum and how you are supposed to keep your system up to date withoutyum. This article makes some assumptions, such that simply blindly following advice below might break your system if there is more than just the kernel package which has to be protected!
3. You are saying I was lied to and mislead?
Yes. A true CentOS installation has a CentOS kernel, the CentOS centos-release package, the CentOS yum package and no modification or additions to the contents of the /etc/yum.repos.d/ directory [other than possibly a local mirror, or staged and not-enabled adjunct repositories]. All dependencies will be satisfied and, except for configuration files (see: man rpm), a
$ sudo rpm -Va
command will run silently except for expected configuration file changes. (See: man rpm for help in reading such a listing, where there is a decoder for the left hand column details.)
A true CentOS system also may be freely updated at any time. We note this requirement because security fixes also issue asynchronously. One indication that there may be a problem is that the rack hosting vendor offers CentOS 4.X (where X is a digit), rather than CentOS 4, and so forth; the CentOS team (and indeed the upstream distribution stabilizer) do not permit 'holding back' at a non-current, prior 'point' version, and still representing the product as the 'genuine' article.
A quick test to see if yum is providing expected answers is this:
$ sudo yum grouplist \*
which will return a full list of available package groups on CentOS 4 and CentOS 5.
Members of the #centos IRC channel on irc.freenode.net will often ask you to perform that test, or a couple of other related tests with:
$ lsb_release -a ; uname -a ; rpm -V yum centos-release ; ls /etc/yum.repos.d/ ; yum repolist all
which produces multi-line output. That complete set of output (it should only be a few lines -- under ten, unless things are seriously wrong) should be placed in the CentOS pastebin and the channel advised of the specific URL at which the content appears. Alternatively, a quick determination may sometimes be attempted with the one line result producing:
$ uname -a
which can properly be pasted in full in the #centos IRC channel. In either case, this information is sought in order to help quickly diagnose this state of affairs.
When it is clear that there is a non-CentOS installation in play, the regular and 'in the know' members of the IRC channel will not continue to offer further advice. They do not wish either to suggest a course which may potentially break your system further, or to 'spoonfeed' people who will not learn better system administration; the regulars cannot and do not know all the ways rack hosting providers may have altered the functions which a true CentOS environment provides at any point in time.
If you were lied to, we ask that you seek to have them mend their ways. You could ask your provider to:
Stop misrepresenting what they offer as CentOS.
Deliver to you what they promised or return your money.
4. Installing yum
Okay, okay -- I get it -- it is not CentOS. But, I still want yum, or to try to remove and repair a crippled set of yum configurations.
First, take full backups and make sure they may be read. This may not work.
Then, you need the following package to get a working yum - all of which can be downloaded from any CentOS mirror:
- centos-release
You should already have this package installed. You can check that with
rpm -q centos-release
centos-release-4-4.3.i386
If it is already on your system, please check that the yum configuration hasn't been pulled and is available on your system:
ls -l /etc/yum.repos.d/
This directory should contain only the files: CentOS-Base.repo and CentOS-Media.repo. If those aren't there, you should make a directory: 'attic' there, and 'mv' a backup of the current content into that attic, to prepare for the reinstall of the centos-release package:
rpm -Uvh --replacepkgs centos-release.*.rpm
If centos-release isn't installed on your machine, you can drop the --replacepkgs from the command above. Make a backup directory ./attic/ and move any other files present into it, so that you can back out of this proccess later, if you decide you are in 'over your head'.
Then you need the following packages:
CentOS 4
(available from where you also got the centos-release package):
- yum
- sqlite
- python-sqlite
- python-elementtree
- python-urlgrabber
- yum-metadata-parser
CentOS 5
(available from where you also got the centos-release package):
- m2crypto
- python-elementtree
- python-sqlite
- python-urlgrabber
- rpm-python
- yum
- yum-metadata-parser
CentOS 6
(available from where you also got the centos-release package):
- gpgme
- pygpgme
- python-iniparse
- python-pycurl
- python-urlgrabber
- rpm
- rpm-libs
- rpm-python
- yum
- yum-metadata-parser
- yum-plugin-fastestmirror
This is a preliminary list for CentOS 6 (as of 19 Jul 2012) based on info received via some affected persons. Some other packages might be missing, as well as some of the packages listed above might already exist on your system.
Download those into a separate directory and install them with
rpm -Uvh *.rpm
from that directory. As before, take a backup of /etc/yum.conf so that you might back out any changes.
5. Making sure your kernel doesn't get overwritten
Now consider the desire to ensure your (running) kernel does not get overwritten by a kernel update from CentOS, such as in the case of a specially built kernel on a VPS.
Open /etc/yum.conf with your favorite editor and add the following line to the end of the [main] section:
exclude=kernel*
This will prevent yum from installing packages beginning with kernel and so your VPS kernel is safe from being overwritten by yum.
6. Recovering to pristine CentOS yum repositories only
Some system administrators find that they have self-inflicted changes of yum configuration files, such as by adding, enabling, or editing the yum configurations to permit use of non-CentOS repositories. This section describes a recovery approach.
The 'pristine' versions of the files needed are contained in the centos-release package. One solution is to use a manually retrieved copy of that package, and to restore only those files in the /etc/yum.repos.d/ directory. Obviously the /etc/yum.conf and other files may have need altered as well, and a similar recovery approach applies.
We assume in this example a CentOS 4 release and retrieve that proper centos-release rpm into /tmp/unpack with wget:
$ # ... as an end user
$ cd /tmp
$ mkdir unpack
$ wget http://mirror.centos.org/centos-4/4.6/os/i386/CentOS/RPMS/centos-release-4-4.4.i386.rpm
$ mkdir -p /tmp/unpack/var/lock/rpm/
$ # this is a very unusual case (an 'out of tree' RPM --root), where it is
$ # NOT improper to use --nodeps
$ sudo rpm -Uvh --root /tmp/unpack/ --nodeps centos-release*rpm
$ # ... become root
$ su -
# cd /etc/yum.repos.d/
# mkdir attic
# mv *.repo attic/
# cp /tmp/unpack/etc/yum.repos.d/* .
and you will have a pristine CentOS yum repository setup once again. As we are done with the 'out of tree' unpacking of the relacement configurations, we can do: rm -rf /tmp/unpack to clean up after the process.
7. Other helpful links
Sometimes people come to the IRC channel seeking help for a box that was represented by a hosting firm as being a CentOS install, but is not running yumproperly, or not picking up updates that have been released to the mirror network after the usual propagation delays. This page offers a quickstart to seeing the detail that the regulars in the channel recognize as common CentOS forgeries.
Centos yum install的更多相关文章
- centos yum install redis
linux下yum安装redis以及使用 1.yum install redis --查看是否有redis yum 源 [root@localhost ~]# yum install r ...
- centos yum install 找不到软件包
yum install epel-release 然后再试试yum install 其他安装包
- centos yum install oracle java
How to install Java on CentOS 7 | Linuxizehttps://linuxize.com/post/install-java-on-centos-7/ CentOS ...
- centos yum install nginx
nginx newshttp://nginx.org/ nginx news: 2017http://nginx.org/2017.html nginx: Linux packageshttps:// ...
- CentOS yum时出现"Could not retrieve mirrorlist"
问题描述: CentOS 6.x minimal(最小化) 安装, CentOS yum install net-tools 时出现"Could not retrieve mirrorlis ...
- centos 7 升级后yum install出现Exiting on user cancel
centos 7 升级后yum install出现Exiting on user cancel centos 7.x升级后用yum install进行安装时经常出现Exiting on user ca ...
- centos在yum install报错:Another app is currently holding the yum lock解决方法
centos在yum install报错:Another app is currently holding the yum lock,这个问题可能是很多的新手经常遇到问题,之前也有人问我,包括本人在刚 ...
- CentOS 7 yum install cobbler2.8.3
安装前注意事项: 1.cobbler主机要为静态ip,否则和dhcpd服务冲突. 2.如果用虚拟机安装,client的内存请设置为2g以上,否则会报错. 3.kickstart文件中不要出现中文,大坑 ...
- yum install mysql on centos 6.5 zz
http://www.cnblogs.com/xiaoluo501395377/archive/2013/04/07/3003278.html 1.使用yum命令进行mysql的安装 yum list ...
随机推荐
- 京东集团副总裁李大学:像CEO一样思考 - Dancen的专栏 - 博客频道 - CSDN.NET
京东集团副总裁李大学:像CEO一样思考 - Dancen的专栏 - 博客频道 - CSDN.NET 京东集团副总裁李大学:像CEO一样思考
- Google生活
本博文的主要内容有 .Google生活的介绍 1.Google生活的介绍 Google生活搜索的官网: http://shenghuo.google.cn/shenghuo/ http://sheng ...
- JQuery ajax调用asp.net的webMethod
本文章转载:http://www.cnblogs.com/zengxiangzhan/archive/2011/01/16/1936938.html 在vs2010中,用JQuery ajax调用as ...
- BFS-hdu-4101-Ali and Baba
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4101 题目大意: 给一个矩阵,0表示空的可走,-1宝藏的位置(只有一个),其余的正整数表示该位置石头 ...
- MapReduce实战:查找相同字母组成的单词
1.项目需求 一本英文书籍包含成千上万个单词,现在我们需要在大量的单词中,找出相同字母组成的所有单词 2.数据集 下面是一本英文书籍截取的一部分单词内容(书籍内容是随意写的,主要目的是实现这种需求) ...
- 你需要知道的 Android 拍照适配方案
近段时间,家里陪自己度过大学四年的电脑坏了,挑选好的新电脑配件终于在本周全部到货,自己动手完成组装.从AMD到i7的CPU,6G内存到14G内存,打开 AndroidStudio 的速度终于杠杆的上去 ...
- URAL 2032 - Conspiracy Theory and Rebranding【本源勾股数组】
[题意] 给出三角形的三个边长,均是10^7以内的整数,问三角形的三个角的坐标是否能均是整数,输出其中任意一个解. [题解] 一开始想的是枚举一条边的横坐标,然后通过勾股定理以及算角度求出其他点的坐标 ...
- 客户端session与服务端session
会话(Session)跟踪是Web程序中常用的技术,用来跟踪用户的整个会话.常用的会话跟踪技术是Cookie与Session.Cookie通过在客户端记录信息确定用户身份,Session通过在服务器端 ...
- maven占位符
maven占位符默认是${} 也可以自己指定. pom.xml配置如下: <plugin> <groupId>org.apache.maven.plugins</grou ...
- sqlserver 误删数据恢复
----创建存储过程 CREATE PROCEDURE Recover_Deleted_Data_Proc @Database_Name NVARCHAR(MAX) , @SchemaName_n_T ...