Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure YumSource in rhel6.3

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to configure the Yum source in rhel6.3, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let's take a look at it.

Environment: RHEL6.3

The steps to create a local yum source are as follows:

1. First check whether there is a YUM command, and if not, install it.

# rpm-ivh yum-3.2.29-30.el6.noarch.rpm

Check again if there is a createrepo. If not, please install the createrepo package. Install the following two packages before installing this package.

[root@localhost Packages] # rpm- ivh deltarpm-3.5-0.5.20090913git.el6.i686.rpm

Warning: deltarpm-3.5-0.5.20090913git.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... # [100%]

1:deltarpm # # [100%]

[root@localhost Packages] # rpm- ivh python-deltarpm-3.5-0.5.20090913git.el6.i686.rpm

Warning: python-deltarpm-3.5-0.5.20090913git.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Preparing... # [100%]

1:python-deltarpm # # [100%]

[root@localhost Packages] # rpm-ivh createrepo-0.9.8-5.el6.noarch.rpm

2. Create a new local source directory

# mkdir / Packages # storing files required by the local YUM

Put all the installation packages under the Packages on the CD into this directory, and copy the RPM-GPG-KEY-redhat-release on the CD to this directory.

3. In the / Packages directory, execute createrepo / Packages

2842 prime 2842-xorg-x11-fonts-misc-7.2-9.1.el6.noarch.rpm

Saving Primary metadata

Saving file lists metadata

Saving other metadata

The repodata directory will be generated, and there are four key files. Now take a look.

[root@localhost Packages] # ls-d * /

HighAvailability/ images/ isolinux/ LoadBalancer/ repodata/

[root@localhost Packages] # cd repodata

[root@localhost repodata] # ls

Filelists.xml.gz other.xml.gz primary.xml.gz repomd.xml

Note: as a repository of software, repodata has four necessary files in its directory: filelists.xml.gz other.xml.gz primary.xml.gz repomd.xml (md means metadata), the most important of which is the repomd.xml file. There are usually three reasons why repodata directories or files cannot be found: first, path problems; second, no generation of repodata directories; third, * .repo configuration file conflicts (this requires special attention. You need to set the enabled=0 of other repo files under / etc/yum.repos.d or delete other repo files). The above four files will not appear until the yum library is established. In the following example, the path is / Packages / repodata/

4. Create a new yum.repo under / etc/yum.repos.d. The contents are as follows:

[RHEL]

Name=rhel6.3

Baseurl= file:///Packages

Gpgcheck=1

Gpgkey= file:///Packages/RPM-GPG-KEY-redhat-release

Enabled=1

Explanation:

[....] The name that represents this library must be unique and cannot be repeated.

Name= is the description of the library, it doesn't make much practical sense, it's just a field description.

Baseurl= describes how to transmit, where the specific path is, and the ways that can be used, such as file://,ftp://,http://, etc.

Enabled=1 indicates that the update library is enabled, and 0 means it is not enabled.

Gpgcheck=0 means not to use the gpg file to check the signature of the package 1 means to use the signature

Gpgkey= represents the location where the gpg file is stored, and there can also be a http location here.

At this point, you can test whether the creation of the yum library is successful.

5. Test it.

[root@localhost /] # yum-y install telnet*

Loaded plugins: product-id, refresh-packagekit, security, subscription-manager

Updating certificate-based repositories.

Unable to read consumer identity

Setting up Install Process

Resolving Dependencies

-> Running transaction check

-> Package telnet.i686 1RU 0.17-47.el6 will be installed

-> Package telnet-server.i686 1RU 0.17-47.el6 will be installed

-- > Processing Dependency: xinetd for package: 1:telnet-server-0.17-47.el6.i686

-> Running transaction check

-> Package xinetd.i686 2 2.3.14-34.el6 will be installed

-> Finished Dependency Resolution

Dependencies Resolved

=

Package Arch Version Repository Size

=

Installing:

Telnet i686 1 0.17-47.el6 RHEL 57k

Telnet-server i686 1 0.17-47.el6 RHEL 36k

Installing for dependencies:

Xinetd i686 2 2.3.14-34.el6 RHEL 121k

Transaction Summary

=

Install 3 Package (s)

Total download size: 214 k

Installed size: 409 k

Downloading Packages:

Error Downloading Packages:

1:telnet-0.17-47.el6.i686: failure: Packages/telnet-0.17-47.el6.i686.rpm from RHEL: [Errno 256] No more mirrors to try.

2:xinetd-2.3.14-34.el6.i686: failure: Packages/xinetd-2.3.14-34.el6.i686.rpm from RHEL: [Errno 256] No more mirrors to try.

1:telnet-server-0.17-47.el6.i686: failure: Packages/telnet-server-0.17-47.el6.i686.rpm from RHEL: [Errno 256] No more mirrors to try.

Found that the installation failed and did not discover the dependencies between the packages themselves. Update it.

[root@localhost yum.repos.d] # yum clean all

Loaded plugins: product-id, refresh-packagekit, security, subscription-manager

Updating certificate-based repositories.

Unable to read consumer identity

Cleaning repos: RHEL

Cleaning up Everything

And then install it, and that's it.

[root@localhost yum.repos.d] # yum-y install telnet*

Loaded plugins: product-id, refresh-packagekit, security, subscription-manager

Updating certificate-based repositories.

Unable to read consumer identity

RHEL | 1.3 kB 00:00.

RHEL/primary | 1.3 MB 00:00.

RHEL 2842/2842

Setting up Install Process

Resolving Dependencies

-> Running transaction check

-> Package telnet.i686 1RU 0.17-47.el6 will be installed

-> Package telnet-server.i686 1RU 0.17-47.el6 will be installed

-- > Processing Dependency: xinetd for package: 1:telnet-server-0.17-47.el6.i686

-> Running transaction check

-> Package xinetd.i686 2 2.3.14-34.el6 will be installed

-> Finished Dependency Resolution

Dependencies Resolved

=

Package Arch Version Repository Size

=

Installing:

Telnet i686 1 0.17-47.el6 RHEL 57k

Telnet-server i686 1 0.17-47.el6 RHEL 36k

Installing for dependencies:

Xinetd i686 2 2.3.14-34.el6 RHEL 121k

Transaction Summary

=

Install 3 Package (s)

Total download size: 214 k

Installed size: 409 k

Downloading Packages:

-

Total 4.1 MB/s | 214 kB 00:00

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing: 2:xinetd-2.3.14-34.el6.i686 1 Compact 3

Installing: 1:telnet-server-0.17-47.el6.i686 2 Compact 3

Installing: 1:telnet-0.17-47.el6.i686 3 Compact 3

Installed products updated.

Verifying: 1:telnet-server-0.17-47.el6.i686 1 Compact 3

Verifying: 2:xinetd-2.3.14-34.el6.i686 2 Compact 3

Verifying: 1:telnet-0.17-47.el6.i686 3 Compact 3

Installed:

Telnet.i686 1RO 0.17-47.el6 telnet-server.i686 1RU 0.17-47.el6

Dependency Installed:

Xinetd.i686 2vl 2.3.14-34.el6

Complete!

Do the cache of YUM to facilitate acceleration

[root@localhost yum.repos.d] # yum makecache

Loaded plugins: product-id, refresh-packagekit, security, subscription-manager

Updating certificate-based repositories.

Unable to read consumer identity

RHEL | 1.3 kB 00:00.

RHEL/filelists | 2.9 MB 00:00...

RHEL/other | 1.3 MB 00:00.

RHEL 2842/2842

RHEL 2842/2842

Metadata Cache Created

Note: yum install [software name] it is best not to use the full name here, although some packages can be installed. But I tested and encountered the trouble of installation failure.

Some useful YUM commands:

Yum remove | erase software name 1 [software name 2] [...]

Yum list [...]

Yum info [...]

Yum provides | whatprovides feature1 [feature2] [...]

Yum clean [packages | headers | metadata | dbcache | all]

Yum makecache

Automatic analysis of dependency relationships is the best feature of YUM, and it is also the most convenient installation method at present.

A useful command.

Createrepo-update / Packages/ # updates the local source, if a new RPM package is added

Createrepo / Packages/ # regenerate metadata

Createrepo-update:

Sometimes your software repository contains a lot of software packages, although only a small number of them have been changed, but you don't have to regenerate metadata for each package, which is obviously a waste of time. Createrepo updates only those items that have been changed, added, or deleted since the last generation of metadata.

Use ftp as yum source

The above setting only allows the local machine to use the yum source, so configure ftp server on the source machine in order to make it available to other machines

1. Yum install vsftpd

two。 Access the test through the ftp command on other machines, and if 500 OOPS: cannot change directry appears, execute setsebool-P ftp_home_dir on on the source machine, and then service vsftpd restart

3. Mount under / var/ftp/pub instead of symbolic links, because if it is a symbolic link, 550Failed to change directory will appear when accessed from the browser. Of course, you can also copy everything under / Packages to pub.

# mkdir / rh75

# umount / dev/sr0

# mount / dev/sr0 / rh75

Cd / var/ftp/pub, mkdir yum, mount-- bind / rh75 yum

4. Set the yum ftp connection method (including the source machine can also be set this way, both sides of the repo can be the same)

Modify yum.repo under / etc/yum.repos.d

[RHEL1]

Name=rhel6.3

Baseurl= ftp://192.168.1.130/pub/yum/

Gpgcheck=0

Enabled=1

Use HTTP as YUM source

1 install httpd installation package # yum-y install httpd

2 create a local update source as above

# cd / var/www/html/

# mkdir yum

# mount-- bind / rh75 / yum

Or, for example, yum files are all under / rh75.

[root@localhost html] # vi / etc/yum.repos.d/yum.repo

[root@localhost html] # cat / etc/yum.repos.d/yum.repo

[RHEL]

Name=rhel6.3

Baseurl= http://192.168.1.130/yum/

Gpgcheck=0

Enabled=1

3 service httpd start # start the httpd daemon, otherwise you will be prompted that the relevant source cannot be found on other machines

4 test it

[root@localhost yum.repos.d] # rpm-qa | grep telnet

[root@localhost yum.repos.d] # yum-y install telnet*

Installed:

Telnet.i686 1RO 0.17-47.el6 telnet-server.i686 1RU 0.17-47.el6

Dependency Installed:

Xinetd.i686 2vl 2.3.14-34.el6

Complete!

Use ISO CD to directly attach the cost of YUM source

1. First connect the ISO CD to the system, and then mount take a look.

[root@localhost network-scripts] # mount

/ dev/sda3 on / type ext4 (rw)

Proc on / proc type proc (rw)

Sysfs on / sys type sysfs (rw)

Devpts on / dev/pts type devpts (rw,gid=5,mode=620)

Tmpfs on / dev/shm type tmpfs (rw,rootcontext= "system_u:object_r:tmpfs_t:s0")

/ dev/sda1 on / boot type ext4 (rw)

None on / proc/sys/fs/binfmt_misc type binfmt_misc (rw)

Vmware-vmblock on / var/run/vmblock-fuse type fuse.vmware-vmblock (rw,nosuid,nodev,default_permissions,allow_other)

Gvfs-fuse-daemon on / root/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev)

/ dev/sr0 on / media/RHEL_6.3 i386 Disc 1 type iso9660 (ro,nosuid,nodev,uhelper=udisks,uid=0,gid=0,iocharset=utf8,mode=0400,dmode=0500)

2. Then create a directory under the root or in another directory

# cd /

# mkdir rhel6

# umount / dev/sr0

# mount / dev/sr0 / rhel6

3. Edit the REPO file

# cd / etc/yum.repos.d

# vi yum.repo

[RHEL]

Name=rhel6.3

Baseurl= file:///rhel6 (if rhel5, file:///rhel5/Server, because repodata/repomd.xml is not under the root of the CD)

Enabled=1

# service iptables stop

# setenforce 0

# yum-y install telnet

Loaded plugins: product-id, refresh-packagekit, security, subscription-manager

Updating certificate-based repositories.

Unable to read consumer identity

RHEL | 4.0 kB 00:00...

RHEL/primary_db | 2.5 MB 00:00...

Setting up Install Process

Resolving Dependencies

-> Running transaction check

-> Package telnet.i686 1RU 0.17-47.el6 will be installed

-> Finished Dependency Resolution

Dependencies Resolved

=

Package Arch Version Repository Size

=

Installing:

Telnet i686 1 0.17-47.el6 RHEL 57k

Transaction Summary

=

Install 1 Package (s)

Total download size: 57 k

Installed size: 102 k

Downloading Packages:

Warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY

Public key for telnet-0.17-47.el6.i686.rpm is not installed

Note that there is a NOKEY error. If there is no problem in checking the YUM.REPO file, you need to see the yum.conf master file.

# cat / etc/yum.conf

[main]

Cachedir=/var/cache/yum/$basearch/$releasever

Keepcache=0

Debuglevel=2

Logfile=/var/log/yum.log

Exactarch=1

Obsoletes=1

Gpgcheck=1

Plugins=1

Installonly_limit=3

Just change the gpgcheck=1 in / etc/yum.conf to gpgcheck=0 (do not check the package signature).

Note: when making a YUM source, make sure that the REPO file and yum.conf file configuration of the source and the LINUX host that uses the source are the same.

It will be normal if you try again at last.

# yum-y install telnet

Downloading Packages:

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing: 1:telnet-0.17-47.el6.i686 1 Compact 1

Installed products updated.

Verifying: 1:telnet-0.17-47.el6.i686 1 Compact 1

Installed:

Telnet.i686 1Rank 0.17-47.el6

Complete!

Vim / etc/udev/rules.d/70-persistent-net.rules

Vim / etc/sysconfig/network-scripts/ifcfg-eth0

Thank you for reading this article carefully. I hope the article "how to configure Yum sources in rhel6.3" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report