CentOS Yum source Configuration and usage and configuration Yum repository

Source: Internet
Author: User
Tags yum repolist



About Yum



Yum (full name Yellow dog Updater, Modified) is a in Fedora and Redhat and CentOS Shell Front-end package manager. Based on RPM package management, the ability to automatically download RPM packages from specified servers and install them automatically handles dependency relationships and installs all dependent packages at once, without the hassle of downloading and installing them over and over again.



Yum Installation:



The system is installed with Yum by default, so no installation is required.



650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/58/C9/wKioL1S8u4CAbeQkAAE6kMZzC74131.jpg "title=" 1.png " alt= "Wkiol1s8u4cabeqkaae6kmzzc74131.jpg"/>



If your friends do not have Yum installed on their system, mount the CD



Yum's basic installation package is as follows, other installation packages are installed according to their needs, the installation process is no longer demonstrated;



650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/58/CC/wKiom1S8vEyCMR3RAANOtgZpY-s391.jpg "title=" 2.png " alt= "Wkiom1s8veycmr3raanotgzpy-s391.jpg"/>



Yum configuration:



The Yum configuration file is divided into two parts: Main and Repositoy



    ·  Mans section defines the global configuration options, the entire Yum configuration file should have only one main, located in the /etc/yum.conf ;



     Repository /etc/yum.repo.d directory


[main]
cachedir = / var / cache / yum / $ basearch / $ releasever
    // yum cache directory, yum stores downloaded rpm packages and databases here, the default setting is / var / cache / yum
keepcache = 0
    // Whether to keep the software package after installation, 0 is not reserved (default is 0), 1 is reserved
debuglevel = 2
    // Debug information output boarding, the range is 0-10, the default is 2
logfile = / var / log / yum.log
    // yum log file location. The user can go to the /var/log/yum.log file to query the updates made in the past
exactarch = 1
    // There are two options, 1 and 0. If set to 1, yum will only install packages that match the system architecture. For example, yum will not install the i686 package on a system suitable for i386. The default is 1.
obsoletes = 1
    // This is an update parameter. For details, please read yum (8). In short, it is equivalent to upgrade, which allows to update stale PRM packages.
gpgcheck = 1
    // gpgcheck is an option to verify whether gpg is turned on, 1 is turned on, 0 is not turned on, generally you can turn it off.
plugins = 0
    // Whether to enable the plug-in, the default 1 is allowed, 0 means not allowed. We generally use the yum-fastestmirror plugin.
installonly_limit = 5
    // How many cores are allowed to be reserved, the default is 5
bugtracker_url = http: //bugs.centos.org/set_project.php? project_id = 16 & ref = http: //bugs.centos.org/bug_report_page.php? category = yum
distroverpkg = centos-release
    // Specify a software package, yum will determine your hairstyle version based on this package, the default is centos-release, or any rpm package installed for your own release.

# This is the default, if you make this bigger yum wo n‘t see if the metadata
# is newer on the remote and so you ’ll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
# It is esp. Important, to have correct metadata, for distributions like
# Fedora which do n‘t keep old packages around. If you do n’t like this checking
# interupting your command line usage, it ’s much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire = 90m

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d


In addition to the above, there are some options that you can add, such as:


exclude = selinux *
// Exclude some software from the upgrade list, you can use wildcards, each item in the list should be separated by spaces, this is especially useful for friends who have installed such as beautification packages, Chinese patches.
gpgcheck = 1
// There are two choices, 1 and 0, which respectively represent whether to perform gpg (GNU Private Guard) verification to determine whether the source of the rpm package is valid and safe. This option, if set in the [main] section, is valid for each repository. The default value is 0.


To configure the local Yum Source:



1, mount the CD-ROM (please refer to: http://ssc4469.blog.51cto.com/6315913/1602717) here do not explain;



2. Local Yum source located in /etc/yum.repos.d/


[[email protected] 10.19.166.23 /etc/yum.repos.d ] 
# ls -l /etc/yum.repos.d/
total 20
-rw-r--r--. 1 root root 1926 Jan 19 05:36 CentOS-Base.repo
-rw-r--r--. 1 root root  638 Jan 19 05:36 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  630 Jan 19 05:36 CentOS-Media.repo
-rw-r--r--. 1 root root 3664 Jan 19 05:36 CentOS-Vault.repo


Centos-base.repo is a configuration file for the Yum network source



Centos-media.repo is a configuration file for Yum Local source






Modify Centos-media.repo



# Vim Centos-media.repo


# CentOS-Media.repo
#
#  This repo can be used with mounted DVD media, verify the mount point for
#  CentOS-6.  You can use this repo and yum to install items directly off the
#  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:///media/CentOS/
        file:///media/cdrom/
        file:///media/cdrecorder/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6


Modify the 2nd path in BaseURL, Note (this path is the mount point path of the disc, here is my mount path, friends make changes according to their own path)



650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/58/CD/wKiom1S8zlvABydQAAMuy2XLx8o484.jpg "title=" 3.png " alt= "Wkiom1s8zlvabydqaamuy2xlx8o484.jpg"/>



Change Enabled=0 to 1






3. Disable the default Yum network source mode:



(1) Renaming the default Yum source;



(2) Place the default Yum source backup in a different directory;



Note: If the default Centos-base.repo system is automatically limited, use the network source to find the appropriate package



4. Execution, yum install PostgreSQL



Self-built network yum Source configuration: (Due to time relationship, abbreviated, although abbreviated, follow the step Illinois to perform the absolute configuration success)



1, yum install httpd (installed Apache software package, the same can also use Nginx)



2, enter the default Apache path, create a new Yum source directory classification name; I created the rpmpackage here, in fact, to illustrate the diagram of the trouble, the CDROM package copy came.


# Cd/var/www/html/rpmpackage


3. Install the Createrepo package


# yum Install Createrepo


Executive Createrepo


# Creataerepo/var/www/html/rpmpackage


In the/var/www/html/rpmpackage directory will be automatically generated Repodata directory, Repodata directory is a database, where the file is mainly in XML format, describes a RPM package details, such as dependencies, including files, checksum code information.



4. Modify Apache Default configuration


vim /etc/httpd/conf/httpd.conf

Add at the end:

NameVirtualHost *: 80
<VirtualHost *: 80>
DocumentRoot / home / yum
ServerName XXX.XXX.XXX #Fill the bound domain name
<Directory "/ home / yum">
Options Indexes FollowSymlinks
</ Directory>
</ VirtualHost>


5. Restart Apache


Two ways (1) #/ETC/INIT.D/HTTPD Restart (2) # service httpd restart


Shown below:



650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/58/CB/wKioL1S824CTvkeiAASD-kykSGQ804.jpg "title=" 4.png " alt= "Wkiol1s824ctvkeiaasd-kyksgq804.jpg"/>



6 . Configure the client's Yum source configuration file



(1) Clear the source files in the client default/etc/yum.repos.d/directory



(2) New


# Vim Local-media.repo


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/58/CE/wKiom1S82xHAyRwAAACdD1M5nUw482.jpg "title=" 6.png " alt= "Wkiom1s82xhayrwaaacdd1m5nuw482.jpg"/>


Explanation:
[test]: is the repo id.
name: The description of the warehouse.
baseurl: the location of the warehouse.
enabled: Whether to enable this warehouse, 1 is enabled, 0 is disabled.
gpgcheck: whether to check the gpg signature, 1 is checked, 0 is not checked.
(XXX.XXX.XXX is the bound domain name)
Note: If it is used internally, gpgcheck can be set to 0 (and gpgkey does not need to be set). If the update source is placed on the public network, you still need to check the gpg signature to ensure the client's reliability of the source.


(3) Clean up the cache


Yum Clean All 


(4) View Yum Package


Yum Listall


######################### #finish ~ ~


Use of yum client command:
List all available repo
yum repolist {enabled | disabled | all}
Ranch
2.List rpm packages
yum list {all | installed | available}

yum list KEYWORD *

3.Description information of the package
yum info package_name

4. List all package group information
yum grouplist

5. Display package group information: for example, the list of packages contained in the group
yum groupinfo "GROUP NAME"

CentOS6 development related packages:
Development Tools
Server Platform Development
Desktop Platform Development

6.Clear the cache
yum clean {all | packages | metadata | expire-cache | rpmdb | plugins}

7, install the package
yum install package_name

    re-install:
yum reinstall package_name

8.Upgrade
yum check-update: check available upgrade packages

yum update package_name

yum update x-1.3.2

yum downgrade package_name

9, uninstall
yum remove | erase package_name

10. Query which package was installed to generate a file
yum whatprovides | provides / path / to / somefile

11, installation package group
yum groupinstall "GROUP NAME"

12, uninstall package group
yum groupremove "GROUP NAME"




This article is from the "Chun Blog" blog, please be sure to keep this source http://ssc4469.blog.51cto.com/6315913/1605864



CentOS Yum source Configuration and usage and configuration Yum repository


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.