Redhat6.4-yum本地源安装配置

[sxdp@JZGZdaping2 ~]$ su - root
Password:xxxx
[root@JZGZdaping2 bzcj]# pwd
/opt/sxdp/bzcj
[root@JZGZdaping2 opt]# mkdir -p /opt/media/cdrom
[root@JZGZdaping2 opt]# mkdir -p /opt/media/repo
You have new mail in /var/spool/mail/root
[root@JZGZdaping2 opt]# pwd
/opt
[root@test14 /]# cd /etc/yum.repos.d/
[root@JZGZdaping2 yum.repos.d]# ll
total 8
-rw-r----- 1 root root 137 Oct 23 2017 rhel-local.repo
-rw-r--r--. 1 root root 529 Jan 29 2013 rhel-source.repo
[root@JZGZdaping2 yum.repos.d]#

[root@JZGZdaping2 bzcj]# mount -o loop /opt/sxdp/bzcj/rhel-server-6.4-x86_64-dvd.iso /opt/media/cdrom
You have new mail in /var/spool/mail/root
[root@JZGZdaping2 bzcj]# cd /opt/media/cdrom/Packages/
[root@JZGZdaping2 Packages]# cp -r * /opt/media/repo
RPM-GPG-KEY-redhat-beta RPM-GPG-KEY-redhat-release
[root@JZGZdaping2 cdrom]# cp /opt/media/cdrom/RPM-GPG-KEY-redhat-release /opt/media/repo/
[root@JZGZdaping2 cdrom]# cd /etc/yum.repos.d/
[root@JZGZdaping2 yum.repos.d]# mkdir backup_tmp
You have mail in /var/spool/mail/root
[root@JZGZdaping2 yum.repos.d]# ll
total 12
drwxr-x--- 2 root root 4096 Jan 18 14:34 backup_tmp
-rw-r----- 1 root root 137 Oct 23 2017 rhel-local.repo
-rw-r--r--. 1 root root 529 Jan 29 2013 rhel-source.repo
[root@JZGZdaping2 yum.repos.d]# mv *.repo backup_tmp/
[root@JZGZdaping2 yum.repos.d]# vim rhel-source.repo

[rhel-source-local]
name=Red Hat Enterprise Linux
baseurl=file:///opt/media/repo
enable=1
gpgcheck=1
gpgkey=file:///opt/media/repo/RPM-GPG-KEY-redhat-release

[root@VM000003423 yum.repos.d]# /opt/media/repo/
[root@JZGZdaping2 repo]# rpm -ivh createrepo-0.9.9-17.el6.noarch.rpm python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:deltarpm ########################################### [ 33%]
2:python-deltarpm ########################################### [ 67%]
3:createrepo ########################################### [100%]
[root@JZGZdaping2 repo]# pwd
/opt/media/repo
[root@JZGZdaping2 repo]# createrepo -v ./
Workers Finished
Gathering worker results

Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Starting other db creation: Wed Aug 28 02:41:08 2019
Ending other db creation: Wed Aug 28 02:41:10 2019
Starting filelists db creation: Wed Aug 28 02:41:10 2019
Ending filelists db creation: Wed Aug 28 02:41:16 2019
Starting primary db creation: Wed Aug 28 02:41:16 2019
Ending primary db creation: Wed Aug 28 02:41:19 2019
Sqlite DBs complete
[root@JZGZdaping2 repo]# 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: rhel-source-local
Cleaning up Everything
You have mail in /var/spool/mail/root
[root@JZGZdaping2 repo]# yum install -y gcc

原文地址:https://www.cnblogs.com/zhangkaimin/p/14383887.html