Basic method of configuring local Yum source in RedHat system

Time:2020-12-15

Yu is the abbreviation of yellow dog updater modified. It was originally developed by Terra soft, the developer of yellow dog. It was written in Python. At that time, it was also called yup (yellow dog updater). Later, it was developed by Duke University [email protected] The development team makes improvements, hence the name. The purpose of Yum is to automatically upgrade, install / remove RPM packages, collect information about RPM packages, check dependencies, and automatically prompt users to resolve them. The key point of Yum is to have a reliable repository. As the name suggests, this is the software repository. It can be HTTP or FTP site, or local software pool. However, it must contain the header of RPM. The header includes all kinds of information about RPM package, including description, function, provided documents, dependency, etc Only by analyzing the header can the remaining tasks be completed automatically.

If anyone who has experienced the pain of RPM installation, I believe they will definitely choose Yum instead of RPM. It’s very convenient to use yum. If you want to use rpm, you must configure the repository (software warehouse). Because RHEL’s Yum online update is charged, it cannot be used if it is not registered. If you want to install some packages using yum, you need to configure the local Yum source. The following describes how to configure it. Red Hat Enterprise Linux server release 6.6 is used as the experimental scenario. There may be slight differences between different versions of Linux.

1: Mount the local CD to the system

If the server is a virtual machine, you can enter the control platform through vSphere client and specify the ISO image file of the operating system in “Edit settings” > “hardware” > “CD / DVD drive”. If it is a physical machine, you need to enter the computer room to find the server, and put the installation CD into the CD-ROM drive. This is relatively troublesome, so it is generally best to copy the CD files to the local hard disk.
 
 
 
Method 1: mount the image on the optical disk drive

Copy code

The code is as follows:

[[email protected] ~]# mkdir /mnt/cdrom
[[email protected] ~]# mount -t iso9660 /dev/cdrom /mnt/cdrom
mount: block device /dev/sr0 is write-protected, mounting read-only
[[email protected] ~]#

Method 2: copy CD files
 
File / TMP / rehl6 tar.gz It is packaged and copied from the CD, and then unzip it to the specified directory / MNT / CDROM

Copy code

The code is as follows:

[[email protected] ~]# mkdir /mnt/cdrom/
[[email protected] ~]tar zxvf /tmp/rehl6.tar.gz -C /mnt/cdrom/

2: Configure local Yum source

Copy code

The code is as follows:

[[email protected] ~]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# ls
redhat.repo rhel-source.repo
[[email protected] yum.repos.d]touch rhel-media.repo
[[email protected] yum.repos.d]# vi rhel-media.repo
[media]
name=Red Hat Enterprise Linux 6.6
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release

Clear old cache

Copy code

The code is as follows:

[[email protected] ~]# yum clean all
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: media
Cleaning up Everything

Get Yum list

Copy code

The code is as follows:

manager to register.media | 4.1 kB 00:00 … media/group_gz | 211 kB 00:00 … media/filelists_db | 3.3 MB 00:00 … media/primary_db | 3.1 MB 00:00 … media/other_db | 1.4 MB 00:00 … Metadata Cache Created[[email protected] ~]#

3: Verify that the yum configuration is successful

Copy code

The code is as follows:

[[email protected] ~]# yum grouplist | grep Server
Network Infrastructure Server
Server Platform
Web Server
Backup Server
Directory Server
Identity Management Server
Network Storage Server
Print Server
Server Platform Development