oel 7 本地yum源配置

os环境:
# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.6 (Maipo)

1. 建立ISO文件存放目录(/repo/iso)和ISO文件的挂载目录(/repo/rhel7)
# mkdir -p /repo/iso
# mkdir -p /repo/rhel7

2.如果有现成的ISO文件可以直接上传至/repo/iso目录下.
#ll /repo/iso/OracleLinux-R7-U6-Server-x86_64-dvd.iso
-rw-r-----. 1 root root 4571791360 Dec 16 18:23 /repo/iso/OracleLinux-R7-U6-Server-x86_64-dvd.iso

3. 挂载ISO文件
# mount -o loop /repo/iso/OracleLinux-R7-U6-Server-x86_64-dvd.iso /repo/rhel7

4. 查看挂在是否成功
[root@DEV-OPS-DBPG03 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 168K 3.9G 1% /dev/shm
tmpfs 3.9G 9.0M 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/mapper/ol-root 92G 15G 77G 16% /
/dev/sda1 1014M 212M 803M 21% /boot
/dev/loop0 4.3G 4.3G 0 100% /repo/rhel7
tmpfs 797M 0 797M 0% /run/user/2000

5. 编辑repo文件
[root@DEV-OPS-DBPG03 ~]# cd /etc/yum.repos.d/
[root@DEV-OPS-DBPG03 yum.repos.d]# ll
total 8
drwxr-x--- 2 root root 33 Jan 6 08:50 bak
-rw-r----- 1 root root 193 May 7 18:30 OEL7.repo
-rw-r--r--. 1 root root 78 Jan 6 08:52 OEL7.repo.bak
[root@DEV-OPS-DBPG03 yum.repos.d]# cat OEL7.repo
[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///repo/rhel7/
# file:///media/cdrom/
# file:///media/cdrecorder/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle

6.清空yum缓存
[root@mysql yum.repos.d]# yum clean all

7.生成列表
[root@mysql yum.repos.d]# yum list

 

posted on 2020-05-08 11:26  张冲andy  阅读(477)  评论(0编辑  收藏  举报

导航