1. Create a directory for storing iso images or Cd content
[Root @ hanxi-workstation hanxi] # mkdir/home/hanxi/yum
Copy all files in the CD media or iso image file to the Created directory (/home/hanxi/yum ).
For a CD, run the following command:
[Root @ hanxi-workstation hanxi] # cp-r/media/cdrom/home/hanxi/yum
Ps:/media/cdrom is the directory of the mount optical drive.
I am using an iso image file, and I copied the file to/home/hanxi/yum with the mouse.
Ps: All files in the iso file, not the iso file.
This is the case after the replication is complete, as shown in figure
2. Install createrepo
Createrepo is the configuration tool for configuring the YUM source. Check whether the createrepo package has been installed:
[Root @ hanxi-workstation hanxi] # rpm-qa | grep createrepo
If it is not installed, run the following command to complete the installation:
[Root @ hanxi-workstation hanxi] # rpm-ivh/home/hanxi/yum/Packages/createrepo-0.9.8-4.el6.noarch.rpm
Ps: The version varies depending on the operating system version. Find the current system's createrepo version rpm package for installation. You can find it in the/home/hanxi/yum/Packages/folder, for example:
3. Create xml-rpm-metadata for yum repository
Run the following command:
[Root @ hanxi-workstation hanxi] # createrepo-g/home/hanxi/yum/Server/repodata/repomd. xml/home/hanxi/yum/Server/
[Root @ hanxi-workstation hanxi] # createrepo-g/home/hanxi/yum/HighAvailability/repodata/repomd. xml/home/hanxi/yum/HighAvailability/
[Root @ hanxi-workstation hanxi] # createrepo-g/home/hanxi/yum/LoadBalancer/repodata/repomd. xml/home/hanxi/yum/LoadBalancer/
[Root @ hanxi-workstation hanxi] # createrepo-g/home/hanxi/yum/ResilientStorage/repodata/repomd. xml/home/hanxi/yum/ResilientStorage/
Ps: Each of the preceding commands may take some processing time. Be sure to wait, for example:
After the createrepo command is executed, the system automatically scans the related directories and adds the rpm package to the database of the YUM source.
4. Create a repo file for the local yum Client
Configure the local yum repository:
[Root @ hanxi-workstation hanxi] # cd/etc/yum. repos. d/
[Root @ hanxi-workstation yum. repos. d] # gedit local. repo
Ps: The name can start at will, but it must be suffixed with. repo.
Next, add the following content to the file and save it:
[HighAvailability] name = HighAvailabilitybaseurl = file:/home/hanxi/yum/HighAvailabilityenabled = 1 gpgcheck = 0 gpgkey = file: /home/hanxi/yum/RPM-GPG-KEY-oracle [LoadBalancer] name = LoadBalancebaseurl = file:/home/hanxi/yum/LoadBalancerenabled = 1 gpgcheck = 0 gpgkey = file: /home/hanxi/yum/RPM-GPG-KEY-oracle [ResilientStorage] name = ResilientStoragebaseurl = file:/home/hanxi/yum/ResilientStorageenabled = 1 gpgcheck = 0 gpgkey = file: /home/hanxi/yum/RPM-GPG-KEY-oracle [Server] name = Server baseurl = file: /home/hanxi/yum/Server gpgcheck = 0 enabled = 1 gpgkey = file:/home/hanxi/yum/RPM-GPG-KEY-oracle
For example:
5. test the use of yum to install the software package
You can choose system> Manage> Add/delete software from the menu below.