First, Introduction
There are three ways to install the software on the Linux system, one, the source code form, the vast majority of open source software is directly in the form of source code, is generally packaged into a tar.gz archive compressed file, this source code form of the program needs to be compiled into a binary form before it can run use, this form although compatibility, Controllability is better, but it is cumbersome to use, there are a lot of dependencies need to be solved; second, RPM installation package, RPM simplifies the installation of open source software by compiling the source code into executable files based on a specific platform system and saving dependencies, but still requires manual resolution of dependencies; third, Yum Software management, The main purpose of the Yum design is to automatically resolve RPM dependencies, to group RPMs, to introduce warehouse (repo) concepts, and to support multiple warehouses, which are relatively simple to configure.
Yum uses the warehouse save management RPM package, the repository's configuration file is saved in the/etc/yum.repos.d/directory, and the CentOS comes with the following configuration file:
[Email protected] ~]# cd/etc/yum.repos.d/[[email protected] yum.repos.d]# lltotal 24-rw-r--r--. 1 root root 1664 Mar 15:27 centos-base.repo-rw-r--r--. 1 root root 1309 Mar 15:27 centos-cr.repo-rw-r--r--. 1 root root 649 Mar 15:27 centos-debuginfo.repo-rw-r--r--. 1 root root 290 Mar 15:27 centos-fasttrack.repo-rw-r--r--. 1 root root 1331 Mar 15:27 centos-sources.repo-rw-r--r--. 1 root root 1002 Mar 15:27 Centos-vault.repo
Delete these files, Rm-rf centos* or remove the folder MV centos*/yum.
Second, manually configure the Yum warehouse
1. Copy all RPM packages to a folder , where we use the CentOS 7 RPM package, which can be used when the VMware physical machine is not networked. Mount the CentOS7 installation image under CentOS, the file default path under/run/media/centostest/, CentOS6 saved under/media/, here centostest for their own user name, The RPM package is guaranteed to exist under the image File packages folder.
Create a folder and copy it, the copy time will be longer, the virtual disc will be faster.
[[Email protected] ~]# CD/[[email protected]/]# mkdir yum-packages[[email protected]/]# cp-rv/run/media/centostest/ce Ntos\ 7\ x86_64/packages/*/yum-packages/
2. Installing the Createrepo software via the rpm command , the Createrepo package is included in the RPM file that was previously copied.
Install Createrepo software, the software name can be automatically complete by tab key.
[[Email protected]/]# CD Yum-packages/[[email protected] yum-packages]# RPM-IVH createrepo-0.9.9-23.el7.noarch.rpm Warning:createrepo-0.9.9-23.el7.noarch.rpm:header V3 rsa/sha256 Signature, key ID f4a80eb5:nokeypreparing ... ################################# [100%] Package Createrepo-0.9.9-23.el7.noarch is already installed
3. Run the Createrepo command to build the index
createrepo/yum-packages/
After completion, a Repodata folder is created under the Yum-packages folder, which holds the index information.
4. Adding configuration Files
Add a configuration file under the/etc/yum.repos.d/folder.
[Email protected] yum-packages]# cd/etc/yum.repos.d/[[email protected] yum.repos.d]# vim Ownyum.repo[[email protected ] yum.repos.d]# cat Ownyum.repo [centos]name = CentOS Yumbaseurl = file:///yum-packages/[[email protected] yum.repos.d]#
Here is the simplest configuration, [CentOS], name any name on the line, enabled, Gpgcheck can be configured or not configured.
5. Empty Yum Cache
Use the Yum Clean all command to clear and view the Yum Library with the Yum List command
[email protected] yum.repos.d]# Yum clean allloaded plugins:fastestmirror, langpackscleaning repos:centoscleaning up Ev Erythingcleaning up list of fastest mirrors[[email protected] yum.repos.d]# Yum list
You can see the Yum warehouse information you've set up
xorg-x11-xbitmaps.noarch 1.1.1-6.el7 centos xpp3.noarch 1.1.3.8-11.el7 centos xrestop.x86_64 0.4-14.el7 centos xsane-common.x86_64 0.999-9.el7 centos xsane-gimp.x86_64 0.999-9.el7 centos xsettings-kde.x86_64 0.12.3-7.el7 centos xsom.noarch &nbSp; 0-10.20110809svn.el7 centos xterm.x86_64 295-3.el7 centos xulrunner.x86_64 31.4.0-1.el7.centos centos xz-devel.x86_64 5.1.2-9alpha.el7 centos yp-tools.x86_64 2.14-3.el7 centos ypbind.x86_64 3:1.37.1-7.el7 centos ypserv.x86_64 2.31-8.el7 centos yum-plugin-aliases.noarch 1.1.31-29.el7 centos yum-plugin-changelog.noarch 1.1.31-29.el7 centos yum-plugin-tmprepo.noarch 1.1.31-29.el7 centos yum-plugin-verify.noarch 1.1.31-29.el7 centos yum-plugin-versionlock.noarch 1.1.31-29.el7 centos zlib-devel.x86_64 1.2.7-13.el7 centos zsh.x86_64 5.0.2-7.el7 centos zziplib.x86_64 0.13.62-5.el7 centos
Here CentOS is the name of [CentOS].
CentOS 7 Manually create your own yum repositories