Linux: Where to store the Yum Source:/etc/yum.repos.d/, the directory is full of some Yum sources
First, the network of Yum Source:
All of the following are Yum sources, and the suffix is ". Repo" is a legal yum source, the default is to start the Centos-base.repo this yum source (network Yum Source)
[email protected] yum.repos.d]# ls-28-rw-r--r--. 1 root root 1664 Dec 9 centos-base.repo---network yum source -rw-r--r--. 1 root root 1309 Dec 9 Ce ntos-Cr.repo-rw-r--r--. 1 root root 649 Dec 9 centos-debuginfo.repo ---Debug repair tool yum Source -rw-r--r--. 1 root root< c12/>290 Dec 9 centos-fasttrack.repo-rw-r--r-- 1 root root 661 June 29 09:41 centos-Media.repo ---Local disc yum source -rw-r--r--. 1 root root 1331 Dec 9 centos- Sources.repo-rw-r--r--. 1 root root 1952 Dec 9 centos-vault.repo ---virtual yum source
To use Centos-base.repo this yum source, Linux must be able to connect to the extranet, otherwise it will not use the network Yum source
Next look at the contents of this Centos-base.repo network yum source file:
# Geographically close to the client. should use This forCentOS updates# Unless you is manually picking other mirrors.## If the mirrorlist= Does not work forYou, as a fall back canTryThe # remarked out BaseURL=Line Instead.##[base]name=centos-$releasever-basemirrorlist=http://mirrorlist.centos.org/?release= $releasever &arch= $basearch &repo=os&infra= $infra#baseurl =http://mirror.centos.org/centos/$releasever/os/$basearch/Gpgcheck=1Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-7#released Updates [Updates]name=centos-$releasever-updatesmirrorlist=http://mirrorlist.centos.org/?release= $releasever &arch= $basearch &repo=updates&infra= $infra#baseurl =http://mirror.centos.org/centos/$releasever/updates/$basearch/Gpgcheck=1Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-7#additional Packages that could be useful[extras]name=centos-$releasever-extrasmirrorlist=http://mirrorlist.centos.org/?release= $releasever &arch= $basearch &repo=extras&infra= $infra#baseurl =http://mirror.centos.org/centos/$releasever/extras/$basearch/Gpgcheck=1Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-7#additional packages that extend functionality of existing Packages[centosplus]name=centos-$releasever-plusmirrorlist=http://mirrorlist.centos.org/?release= $releasever &arch= $basearch &repo=centosplus&infra= $infra#baseurl =http://mirror.centos.org/centos/$releasever/centosplus/$basearch/Gpgcheck=1enabled=0Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-7
Explain:
[Base]: container name, must be placed in []
Name: Description, container description
Mirrorlist: Mirror site, this can be commented out (the site is abroad, a bit slow)
BaseURL: Our Yum source server address, which is the official CentOS Yum source server by default, can be used
Enabled: Whether this container is in effect, not written or written enabled=1 are effective, written Enabled=0 said not to take effect
Gpgcheck: If 1 refers to the RPM digital certificate is in effect, if it is 0 it does not take effect
Gpgkey: The public key file where the digital certificate is saved. No modification
In fact, we can use Yum list to see the list that Yum can install:
Yum-plugin-tsflags.noarch 1.1.31-34. El7 base Yum-plugin-upgrade-helper.noarch 1.1.31-34. El7 base Yum-plugin-verify.noarch 1.1.31-34. El7 base Yum-plugin-versionlock.noarch 1.1.31-34. El7 base Yum-rhn-plugin.noarch 2.0.1-5. El7 base Yum-updateonboot.noarch 1.1.31-34. El7 base zenity.x86_64 3.8.0-5. El7 base zlib.i686 /c4>1.2.7-15. El7 base Zlib-devel.i686 1.2.7-15. El7 base Zlib-Static. i686 1.2.7-15. El7 base Zlib-Static. x86_64 1.2.7-15. El7 base zsh.x86_64
5.0.2-14.el7_2.2Updates zsh-html.x86_64 5.0.2-14.el7_2.2Updates zziplib.i6860.13.62-5. El7 base zziplib.x86_64 0.13.62-5. El7 base Zziplib-devel.i686 0.13.62-5. El7 base Zziplib-devel.x86_64 0.13.62-5. El7 base Zziplib-utils.x86_64 0.13.62-5. EL7 base [[email protected] yum.repos.d]#
The above list is divided into three parts (from left to right): Package name (parking full name, attention to distinction), version number (number of discoveries, applicable system, etc.), right this familiar bar! is the container within the Yum source (base, updates ...)
Using Yum to install the software, we do not need to resolve the dependencies of the installation package, it will be directly in the Yum source server to download and install the relevant dependencies of the software, very convenient
But when we can not connect the network, we can not use the Internet Yum Source, then what to do? That is the local disc yum source, i.e.: Centos-media.repo
Second, the production of local CD Yum source
The first step: Mount the disc (/dev/cdrom This can be used/dev/sr0 can be the same,/mnt/cdrom this CDROM directory does not exist directly created)
Before you mount the disc, you need to put the disc in the virtual machine (Linux), which is the image you have when you install Linux.
mount/dev/cdrom/mnt/cdrom/
[Email protected] yum.repos.d]# mount/dev/sr0/mnt/cdrom//dev/sr0 is write-protected, mounting read-/dev/sr0 is already mounted or/mnt/ cdrom busy/dev/sr0 is already mounted on/mnt/cdrom
Because I hung up before, so it suggests/dev/sr0 or/mnt/cdrom is very busy, that is already mounted meaning
The second step: Modify the name of the Yum source under the/etc/yum.repos.d/directory, the following code, using the MV command to modify the name, because we make local disc yum source, so centos-media.repo do not modify
[email protected] yum.repos.d]# ls-28-rw-r--r--. 1 root root 1664 Dec 9 centos-Base.repo.bak-rw-r--r--. 1 root root 1309 Dec 9 centos-< C6>cr.repo.bak-rw-r--r--. 1 root root 649 Dec 9 centos-Debuginfo.repo.bak-rw-r--r--. 1 root root 290 Dec 9 centos-fasttrack.repo.bak-rw-r--r-- 1 root root 661 June 09:41 centos- Media.repo-rw-r--r--. 1 root root 1331 Dec 9 centos-Sources.repo.bak-rw-r--r--. 1 root root 1952 Dec 9 Centos-vault.repo.bak
Then is to modify the Centos-media.repo file, first look at the contents of the file:
# centos-media.repo## This repo can is used with mounted DVD Media, verify the Mount point for# CentOS-7. You can use Thisrepo and yum to install items directly off the# DVD ISO, we release.## to use Thisrepo, put in your DVDs and use it with the other repos too:# Yum--enablerepo=c7-Media [command]# # or forOnly the media repo, Do This: # # Yum--disablerepo=\*--enablerepo=c7-Media [Command][c7-Media]name=centos-$releasever-Mediabaseurl=file:///media/centos/File///media/cdrom/File///media/cdrecorder/Gpgcheck=1enabled=0Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-7
In fact, as the above Centos-base.repo file configuration items, but the configuration of the content is a little different, the biggest difference is BaseURL:
The BaseURL of the network Yum Source is followed by the URL address, and the Centos-base.repo local disc yum source is followed by the CD-ROM address that is attached to the BaseURL
At this point we want to make the local CD Yum source effective, need to change BaseURL and enabled configuration, container name casually write, name description also casually write, as long as you remember to know the line:
baseurl=file:///mnt/cdrom/(You just disc mount location), the other several locations directly comment points on the line, do not comment also line, but each time the execution of the error prompt will not find
Enabled=1 (This is very important, in the above mentioned in the network Yum source, this is a switch, set to 1 (or directly this configuration item does not write) indicates that the Yum source is in effect, written as 0 does not take effect)
The contents of the modified file are as follows:
[c7-media]name=centos-$releasever- mediabaseurl= file:///mnt/cdrom/# File:///media/centos/# file:///media/cdrom/# file:// /media/cdrecorder/gpgcheck=1enabled=1gpgkey=file:///etc/pki/ Rpm-gpg/rpm-gpg-key-centos-7
This time the local disc yum source is ready, then you can use the Yum list to get a listing of Yum source installation to see if we made the local disc yum source is in effect:
Yum-plugin-show-leaves.noarch 1.1.31-34.el7 c7-Media Yum-plugin-tmprepo.noarch 1.1.31-34.el7 c7-Media Yum-plugin-tsflags.noarch 1.1.31-34.el7 c7-Media Yum-plugin-upgrade-helper.noarch 1.1.31-34.el7 c7-Media Yum-plugin-verify.noarch 1.1.31-34.el7 c7-Media Yum-plugin-versionlock.noarch 1.1.31-34.el7 c7-Media Yum-rhn-plugin.noarch 2.0.1-5.el7 c7-Media Yum-updateonboot.noarch 1.1.31-34.el7 c7-Media zenity.x86_643.8.0-5.el7 c7-Media zlib.i6861.2.7-15.el7 c7-Media zlib-devel.i686 1.2.7-15.el7 c7-Media zlib-Static. i686 1.2.7-15.el7 c7-Media zlib-Static. x86_64 1.2.7-15.el7 c7-Media zsh.x86_645.0.2-14.el7 c7-Media zsh-html.x86_64 5.0.2-14.el7 c7-Media zziplib.i6860.13.62-5.el7 c7-Media zziplib.x86_640.13.62-5.el7 c7-Media zziplib-devel.i686 0.13.62-5.el7 c7-Media zziplib-devel.x86_64 0.13.62-5.el7 c7-Media zziplib-utils.x86_64 0.13.62-5.el7 c7-media [[email protected] yum.repos.d]#
This list I said above, we will see the right side of the line "C7-media", we found no, from the original base, updates into the c7-media, the container name of everyone's property bar! is the container name of the local disc yum source that we just made, which shows that the list of software installed by these Yum sources is obtained from our local CD Yum Source, and said the production was successful!
However, there are 2 problems with the local disc yum Source:
1. It is not possible to get the latest software, compared to the software obtained from our CD-ROM, but it's OK, we can connect the extranet, using the Yum tool to upgrade
2. That is, every time you turn on, you want to use the disc must be added to the virtual machine, and then manually mounted, or before the CD-ROM before the boot, and then you can write the Mount command to/etc/rc.d/rc.local, turn on automatic mount
Iii.commands commonly used by Yum
Option-y is auto-answer Yes
1. Upgrade : Update
Format: Yum-y update package name (Note that the package name is not the full name of the package)
Note: Must not write only yum-y update, did not write the package name on the execution, that is to upgrade the entire Linux system so the software, including the kernel will be upgraded, once all upgrade, then your server can not be connected remotely, a lot of problems are out
2. Uninstall : Remove
Format: Yum-y Remove Package name (Note that the package name is not the full name of the package)
Note: Do not casually uninstall a software, because it does not just uninstall the software itself so simple, we all know that the Linux software is dependent, perhaps several software are dependent on the same installation package, once you uninstall one of the software, then the corresponding dependency package will be uninstalled along with it, will cause some software to not work properly
3. Installation: Install
Format: Yum-y install package name (Note that the package name is not the full name of the package)
4. Query:list, search
Format: Yum list
Format: Yum search keyword
5.yum Software Group Management commands
Get software Group command: Yum grouplist
Installation: Yum Groupinstall software group name
Uninstall: Yum groupremove software group name
Linux: Network yum source and make local disc yum source