Install yum in CentOS

Source: Internet
Author: User
Tags custom name

1. Local YUM Configuration


1. Mount the Local cd to the system [root @ centos mnt] # mkdir cd
[Root @ centos mnt] # mkdir cd1
[Root @ centos mnt] # mount/dev/cdrom/mnt/cd
[Root @ centos mnt] # mount/dev/cdrom1/mnt/cd1




2. Configure the local yum source cd/etc/yum. repos. d/# To Go To The yum configuration directory.
Vi CentOS-Media.repo # edit the configuration file to add the following:


[GuangPan]
Name = CentOS-$ releasever-Media # custom name
Baseurl = file: // mnt/cdrom/# local disk Mount path
Gpgcheck = 0 # Check the GPG-KEY, 0 is not checked, 1 is checked
Enabled = 1 # enable yum source. If 0 is disabled, 1 is enabled.
========================================================== ==============================================
[Root @ centos ~] # Cd/etc/yum. repos. d/
[Root @ centos yum. repos. d] # ls
CentOS-Base.repo123 CentOS-Media.repo CentOS-Vault.repo
CentOS-Debuginfo.repo123 CentOS-Media.repo.bak
[Root @ centos yum. repos. d] # vi CentOS-Media.repo
# CentOS-Media.repo
#
# This repo can be used with mounted DVD media, verify the mount point
# CentOS-6. You can use this repo and yum to install items directly off
# Dvd iso that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
# Yum -- enablerepo = c6-media [command]
#
# Or for ONLY the media repo, do this:
#
# Yum -- disablerepo = \ * -- enablerepo = c6-media [command]


C6-media
Name = CentOS-$ releasever-Media
Baseurl = file: // mnt/cd
File: // mnt/cd1
Gpgcheck = 0
Enabled = 1
~
~
~
~
CentOS-Media.repo "19L, 533C
========================================================== ============================================
3. Clear yum cache and use yum install to automatically install software
Yum clean all # Clear yum Cache



4. The configuration file CentOS for yum shielding network requires/etc/yum. rpos. d/directory under the CentOS-Base.repo, CentOS-Debuginfo.repo file rename, so that you can bypass the network for local installation.
The command is as follows:


Cd/etc/yum. repos. d/
Mv CentOS-Base.repo CentOS-Base.repo123
Mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo123


5. test whether the local ground source is specified successfully.



Yum makecache get yum list
The following prompt is displayed, indicating that the yum change is complete:
Metadata Cache Created





Yum install php # install php
Yum remove php # uninstall php


# Yum list ---- list the software that can be installed
# Yum grouplist ---- list installable Components

# Yum makecache ---- synchronous Cache
# Yum clean all ---- clear all caches

# Yum remove package ---- delete a software package

# Yum groupremove group ---- delete all software packages of a component
========================================================== ==============
# Yum groupinstall 'x Window system'-y ---- install the "X windows" component

# Yum groupinstall desktop

# Yum groupremove 'K Desktop Environment '---- uninstall the KDE Desktop Environment


Done!


2. Network YUM configuration [reprinted] RedHat Enterprise Linux 6.4 using Centos 6 yum Source

Idea: uninstall the yum of redhat, download the yum of centos, and modify the configuration file after installation.

1. First download the software package from http://mirrors.163.com/centos

X86 address: http://mirrors.163.com/centos/6/ OS /i386/Packages/

X86_64: http://mirrors.163.com/centos/6/ OS /x86_64/Packages/

The necessary software packages are available (taking a 64-bit system as an example ):

APython-iniparse-0.3.1-2.1.el6.noarch.rpm

BYum-3.2.29-40.el6.centos.noarch.rpm

CYum-metadata-parser-1.1.2-16.el6.x86_64.rpm

DYum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm


Download command:

Wget http://mirrors.163.com/centos/6/ OS /x86_64/Packages/python-iniparse-0.3.1-2.1.el6.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-3.2.29-40.el6.centos.noarch.rpm

Wget http://mirrors.163.com/centos/6/ OS /x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

[Note]: The latest version is not required.


2. Uninstall the yum that comes with RedHat.

Rpm-qa | grep yum | xargs rpm-e -- nodeps

Note: a and xargs are common commands for Unix and Unix-like operating systems. It is used to convert the parameter list into small segments and pass it to other commands to avoid the problem that the parameter list is too long.

B. -- nodepsForce uninstall, regardless of dependency


3. Install the downloaded centos yum package:


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

[Note]: The last two must be installed together. Otherwise, a dependency error occurs.



4. Download The http://mirrors.163.com file to the centos help document for the CentOS6-Base-163.repo and store it in/etc/yum. repo. d.


Wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

5. Edit the CentOS6-Base-163.repo file and change $ releasever to the centos version

The changes are as follows:

# CentOS-Base.repo

#

# The mirror system uses the connecting IP address of the client and

# Update status of each mirror to pick mirrors that are updated to and

# Geographically close to the client.You shoshould use this for CentOS updates

# Unless you are manually picking other mirrors.

#

# If the specified list = does not work for you, as a fall back you can try

# Remarked out baseurl = line instead.

#

#

[Base]

Name = CentOS-6-Base-163.com

Baseurl = http://mirrors.163.com/centos/6/ OS /?basearch/

# Items list = http://mirrorlist.centos.org /? Release = 6 & arch = $ basearch & repo = OS

Gpgcheck = 1

Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

# Released updates

[Updates]

Name = CentOS-6-Updates-163.com

Baseurl = http://mirrors.163.com/centos/6/updates/?basearch/

# Items list = http://mirrorlist.centos.org /? Release = 6 & arch = $ basearch & repo = updates

Gpgcheck = 1

Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

# Additional packages that may be useful

[Extras]

CentOS-6-Extras-163.com

Baseurl = http://mirrors.163.com/centos/6/extras/?basearch/

# Items list = http://mirrorlist.centos.org /? Release = 6 & arch = $ basearch & repo = extras

Gpgcheck = 1

Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

# Additional packages that extend functionality of existing packages

[Centosplus]

CentOS-6-Plus-163.com

Baseurl = http://mirrors.163.com/centos/6/centosplus/?basearch/

# Items list = http://mirrorlist.centos.org /? Release = 6 & arch = $ basearch & repo = centosplus

Gpgcheck = 1

Enabled = 0

Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

# Contrib-packages by Centos Users

[Contrib]

CentOS-6-Contrib-163.com

Baseurl = http://mirrors.163.com/centos/6/contrib/?basearch/

# Items list = http://mirrorlist.centos.org /? Release = 6 & arch = $ basearch & repo = contrib

Gpgcheck = 1

Enabled = 0

Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6


6. yum clean all clear original cache 7. yum makecache Get yum list

The following prompt is displayed, indicating that the yum change is complete:

Metadata Cache Created


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.