当前位置:   article > 正文

Redhat7.6 HTTP搭建网络yum源_redhat set network http repo

redhat set network http repo

1.创建挂载点,挂载镜像

[root@localhost ~]# mkdir /mnt/cdrom/

[root@localhost ~]# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/sda3        38G  3.7G   35G  10% /

devtmpfs        895M     0  895M   0% /dev

tmpfs           910M     0  910M   0% /dev/shm

tmpfs           910M   11M  900M   2% /run

tmpfs           910M     0  910M   0% /sys/fs/cgroup

/dev/sda1       297M  156M  142M  53% /boot

tmpfs           182M  4.0K  182M   1% /run/user/42

tmpfs           182M     0  182M   0% /run/user/0

tmpfs           182M   20K  182M   1% /run/user/1000

/dev/sr1        4.2G  4.2G     0 100% /run/media/dizhao/RHEL-7.6 Server.x86_64

[root@localhost ~]# mount /dev/sr1 /mnt/cdrom/

mount: /dev/sr1 is write-protected, mounting read-only

[root@localhost ~]# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/sda3        38G  3.7G   35G  10% /

devtmpfs        895M     0  895M   0% /dev

tmpfs           910M     0  910M   0% /dev/shm

tmpfs           910M   11M  900M   2% /run

tmpfs           910M     0  910M   0% /sys/fs/cgroup

/dev/sda1       297M  156M  142M  53% /boot

tmpfs           182M  4.0K  182M   1% /run/user/42

tmpfs           182M     0  182M   0% /run/user/0

tmpfs           182M   20K  182M   1% /run/user/1000

/dev/sr1        4.2G  4.2G     0 100% /mnt/cdrom

2.将挂载写入开机启动项

[root@localhost ~]# echo "/dev/sr1 /mnt/cdrom iso9660 defaults 0 0" >> /etc/fstab

[root@localhost ~]# cat /etc/fstab

#

# /etc/fstab

# Created by anaconda on Sun Jul 10 23:31:24 2022

#

# Accessible filesystems, by reference, are maintained under '/dev/disk'

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

#

UUID=0f79f1b8-ea96-4c28-9e4d-7e4ac24381f0 /                       xfs     defaults        0 0

UUID=0aa7835c-f335-4797-a846-3de609941036 /boot                   xfs     defaults        0 0

UUID=b3751b6e-31ac-4f91-84b7-4b72f5dcdd20 swap                    swap    defaults        0 0

/dev/sr1 /mnt/cdrom iso9660 defaults 0 0

[root@localhost ~]# reboot

[root@localhost redhat7.6]# yum -y install httpd

[root@localhost redhat7.6]# setenforce 0

[root@localhost redhat7.6]# vim /etc/selinux/config

[root@localhost dizhao]# systemctl stop firewalld.service

[root@localhost dizhao]# systemctl disable firewalld.service

3.将镜像中/mnt/cdrom/Packages 拷贝至/var/www/html/yum/redhat7.6

[root@localhost redhat7.6]# mkdir -p /var/www/html/yum/redhat7.6

[root@localhost redhat7.6]# cp -R /mnt/cdrom/Packages/* /var/www/html/yum/redhat7.6

4.安装createrepo本地仓库包,并建立索引

[root@localhost redhat7.6]# createrepo /var/www/html/yum/redhat7.6

[root@localhost redhat7.6]# ls | grep repodata

repodata

[root@localhost redhat7.6]#

5.客户端配置/var/www/html/red.repo

[root@localhost ~]# vim  /etc/yum.repos.d/red.repo

浏览器输入http://192.168.42.137/yum/redhat7.6/ 如报错就是http服务没开 打开服务即可

[dizhao@localhost ~]$ yum clean all && yum makecache

Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-

              : manager

Cleaning repos: redhat.iso

Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-

              : manager

redhat.iso                                               | 2.9 kB     00:00    

(1/3): redhat.iso/filelists_db                             | 3.4 MB   00:00    

(2/3): redhat.iso/other_db                                 | 1.6 MB   00:00    

(3/3): redhat.iso/primary_db                               | 4.2 MB   00:00    

Metadata Cache Created

6.测试验证

[root@localhost ~]#  yum list | grep httpd

httpd.x86_64                            2.4.6-88.el7               @anaconda/7.6

httpd-tools.x86_64                      2.4.6-88.el7               @anaconda/7.6

httpd-devel.x86_64                      2.4.6-88.el7               redhat.iso  

httpd-manual.noarch                     2.4.6-88.el7               redhat.iso  

keycloak-httpd-client-install.noarch    0.6-3.el7                  redhat.iso  

libmicrohttpd.i686                      0.9.33-2.el7               redhat.iso  

libmicrohttpd.x86_64                    0.9.33-2.el7               redhat.iso  

python2-keycloak-httpd-client-install.noarch

[root@localhost ~]#

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/168757
推荐阅读
相关标签
  

闽ICP备14008679号