How to configure the local disc Yum repository and the network Yum repository
1. Configure the Local warehouse
Enable Disc
Mount CD to MNT
[[email protected] ~]# mount /dev/cdrom /mnt[[email protected] ~]# ls /mntaddons GPL media.repo RPM-GPG-KEY-redhat-releaseEFI images Packages TRANS.TBLEULA isolinux repodataextra_files.json LiveOS RPM-GPG-KEY-redhat-beta
Configuring the local disc Yum repository
Configuring the Repo file
[[email protected] ~]# mkdir /opt/myrepo // 创建一个单独的目录,存放自己打包好的rpm包[[email protected] ~]# cp -r /mnt/* /opt/myrepo/ //复制mnt下的所有到/opt/myrepo/ ,这里需要等待 命令前+\可免除提示[[email protected] ~]# ls /opt/myrepo/ //查看addons GPL media.repo RPM-GPG-KEY-redhat-releaseEFI images Packages TRANS.TBLEULA isolinux repodataextra_files.json LiveOS RPM-GPG-KEY-redhat-beta[[email protected] ~]# vim /etc/yum.repos.d/myrepo.repo //使用vim编辑yum.repos.d下的myrepo[[email protected] ~]# cat /etc/yum.repos.d/myrepo.repo[guohui] //仓库名name:qwe //描述信息baseurl=http://192.168.56.11 //指定仓库位置为(网络/本地 ) gpgcheck=0 //0为不检查来源,1为检查软件包合法来源enabled=1 //1为启用此仓库,0为不检查来源[[email protected] ~] yum clean all //清空yum本地缓存[[email protected] ~] yum list all //检验yum本地仓库
2. Create httpd network Yum repository
[[email protected] ~]# yum install httpd //安装[[email protected] ~]# rpm -ql httpd 查看安装的文件cd /var/www/html 进入httpd的文件[[email protected] html]# vim index.html[[email protected] html]# cat index.html力拔兮山盖气世,时不利兮骓不逝。骓不逝兮可奈何!虞兮虞兮奈若何![[email protected] html]# httpd 开启[[email protected] html]# ifconfig //查看本地ipens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.56.11 netmask 255.255.255.0 broadcast 192.168.56.255 inet6 fe80::eea3:7c7:9d4d:7b01 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:ce:d7:c2 txqueuelen 1000 (Ethernet) RX packets 49293 bytes 46745645 (44.5 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 25415 bytes 3503030 (3.3 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Enter the local IP in the browser
If the first configuration of the httpd service is inaccessible, it may be a firewall problem
You can disable the firewall first
Systemctl Stop Firewalld
Systemctl Disable FIREWALLD
Create a folder on a network warehouse
[[email protected] html]# mkdir -pv httpd/1/2mkdir: 已创建目录 "httpd"mkdir: 已创建目录 "httpd/1"mkdir: 已创建目录 "httpd/1/2"
Mount the disc to a new network file into a yum repository
[[email protected] html]# mount /dev/cdrom /var/www/html/httpd/1mount: /dev/sr0 写保护,将以只读方式挂载
View
[[email protected] html]# lshttpd index.html
Enter address configuration Yum Warehouse success
Yum Repolist to see if the connection
[[email protected] html]# yum repolist
How does Linux build local repositories and httpd network yum repositories?