It returns that I "No package vim available".
I run:
1. cd /ect/yum.repos.d
2. ls
The redhat.repo is empty.
Only after got a valid license, it will have the right value. For people don't have purchased a license, I have to find a way to config another source. Fortunately I figured out how to do it.
Then general solution is to:
- Unistall the original yum in Red Hat
- Download yum rpm packages
- Install Yum
- Config Repository Source
- Run Yum and Test Install
The following are the details.
1. Uninstall The Original Yum in Red Hat
rpm -aq|grep yum|xargs rpm -e --nodeps
2. Download yum rpm packages
You can manually go to the URL http://mirrors.163.com/centos/6/os/x86_64/Packages/ to find what's the right package version:
I have done this and find out them, so run these commands in terminal:
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
3. Install Yum
rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
Please notice that the in the last command it installs two packages together, because the two packages have dependencies on each other.
4. Update the repo configuration
a. cd /etc/yum.repos.h
b. backup original redhat.repo
mv redhat.repo redhat.repo.repo.bak
c. download a copy of CentOS repo, for example our version is verson 6
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
d. modify CentOS6-base-163.repo
vi CentOS6-Base-163.repo
the repo file contains 5 sections: [base], [updates], [exras], [centoplus], [contrib]
For each section, you need to replace with the the values in your environment
$releaserver means the version, in our case it's 6
$basearch means which branch, in our case it's x86_64, (another branch is i386
Modify each of the 5 sections.
The result looks like below:
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base - 163.com
baseurl=http://mirrors.163.com/centos/6/os/x86_64
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6/updates/x86_64
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
baseurl=http://mirrors.163.com/centos/6/extras/x86_64/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/6/centosplus/x86_64/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/6/contrib/x86_64/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
f. the last step is to replace the original redhat.repo
mv CentOS6-Base-163.repo redhat.repo
[Note] In my case, I am using the mirror located in China which is hosted by Netease (163), people can also use the website http://mirrors.fedoraproject.org/publiclist/ to find one that good for yourself.
For example http://mirror.overthewire.com.au/pub/centos/6/
It has the same structure.
run yum:
yum clean all
test install
yum install vim
hallelujah!
If you think this article is useful, please click the ads on this page to help. Thank you very much.









