I. Introduction
In the form of source code, the program must be compiled into a binary form before it can run and use. This form is compatible and controllable, but it is more troublesome to use, there are a lot of Dependencies to be solved; 2. RPM installation package, by compiling the source code based on a specific platform system into an executable file, and saving the dependency, the installation of open source software is simplified, however, manual dependency still needs to be solved. 3. Yum software management, yum is designed to automatically resolve the RPM dependency, group the RPM, and introduce the repository (repo) concept and supports multiple repositories, which is easy to configure.
Yum uses the repository to save and manage the RPM software package. The repository configuration file is saved in the/etc/yum. Repos. d/directory. the built-in configuration file of centos is as follows:
[[email protected] ~]# cd /etc/yum.repos.d/[[email protected] yum.repos.d]# lltotal 24-rw-r--r--. 1 root root 1664 Mar 31 15:27 CentOS-Base.repo-rw-r--r--. 1 root root 1309 Mar 31 15:27 CentOS-CR.repo-rw-r--r--. 1 root root 649 Mar 31 15:27 CentOS-Debuginfo.repo-rw-r--r--. 1 root root 290 Mar 31 15:27 CentOS-fasttrack.repo-rw-r--r--. 1 root root 1331 Mar 31 15:27 CentOS-Sources.repo-rw-r--r--. 1 root root 1002 Mar 31 15:27 CentOS-Vault.repo
Delete these files. rm-RF centos * or the MV centos */Yum folder is removed.
2. manually configure the yum Repository
1. Copy all RPM software packages to a folder.Here, we use the RPM package that comes with centos 7, which can be used when the VMware physical machine cannot be connected to the Internet. Mount the centos7 installation image to centos. The default file path is/run/Media/centostest/, and centos6 is saved to/Media/. Here, centostest is your username, the RPM package is saved in the packages folder of the image file.
Create a folder and copy it. The copy time will be relatively long, and the virtual disc will be faster.
[[email protected] ~]# cd /[[email protected] /]# mkdir yum-packages[root[email protected] /]# cp -rv /run/media/centostest/CentOS\ 7\ x86_64/Packages/* /yum-packages/
2. Run the RPM command to install the createrepo software.The createrepo package is included in the RPM file copied earlier.
Install the createrepo software. The software name can be automatically supplemented by the 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 create an index.
createrepo /yum-packages/
A repodata folder is created under the Yum-packages folder to save the index information.
4. Add a configuration file
Add a configuration file in 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]#
The simplest configuration is made here. [centos] And name can be obtained by any name. enabled and gpgcheck can be configured or not.
5. Clear Yum Cache
Run the yum clean all command to clear and run the yum LIST command to view the yum library.
[[email protected] yum.repos.d]# yum clean allLoaded plugins: fastestmirror, langpacksCleaning repos: centosCleaning up everythingCleaning up list of fastest mirrors[[email protected] yum.repos.d]# yum list
You can see your own Yum repository information.
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 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 in [centos.
Manually create your own Yum repository in centos 7