Linux远程软件仓库的搭建

1.实验主机配置

主机1:IP:172.25.254.250 主机名:server.tab.org

[root@server250 ~]# hostnamectl hostname server.tab.org
[root@server250 ~]# hostname
server.tab.org
[root@server250 ~]# ifconfig 
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.25.254.250  netmask 255.255.255.0  broadcast 172.25.254.255
        inet6 fe80::e768:955e:3485:4e1e  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:d3:41:78  txqueuelen 1000  (Ethernet)
        RX packets 139  bytes 15212 (14.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 118  bytes 14638 (14.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

主机2:IP:172.25.254.100 主机名:node1.tab.org
 

[root@server100 ~]# hostnamectl hostname node1.tab.org
[root@server100 ~]# hostname
node1.tab.org
[root@server100 ~]# ifconfig 
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.25.254.100  netmask 255.255.255.0  broadcast 172.25.254.255
        inet6 fe80::e1bf:6c40:f9c2:8d98  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:6d:3a:30  txqueuelen 1000  (Ethernet)
        RX packets 116  bytes 12010 (11.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 122  bytes 14969 (14.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

2.在 server.tab.org 主机的虚拟光驱中接入镜像确保此主机可以访问镜像中的内容

[root@server250 ~]# mount /dev/cdrom  /rhel9/
[root@server250 soft]# df
文件系统                 1K-块     已用     可用 已用% 挂载点
devtmpfs                  4096        0     4096    0% /dev
tmpfs                   994448        0   994448    0% /dev/shm
tmpfs                   397780     9528   388252    3% /run
/dev/mapper/rhel-root 53795160 14128804 39666356   27% /
/dev/nvme0n1p2         1038336   258388   779948   25% /boot
/dev/mapper/rhel-home 26263012   216276 26046736    1% /home
/dev/nvme0n1p1          613184     7140   606044    2% /boot/efi
tmpfs                   198888       96   198792    1% /run/user/0
/dev/sr0               9370716  9370716        0  100% /rhel9

3.设定 server.tab.org 为软件仓库服务器,请共享软件仓库在网络中,确保在服务器重启后仍然生效。

本地仓库配置:

[root@server250 ~]# cat /etc/yum.repos.d/rhel9.repo 
[AppStream]
name=AppStream
baseurl=file:///rhel9/AppStream
gpgcheck=0

[BaseOS]
name=BaseOS
baseurl=file:///rhel9/BaseOS
gpgcheck=0

配置vsftpd服务端:

[root@server250 ~]# systemctl disable --now firewalld.service 
Removed "/etc/systemd/system/multi-user.target.wants/firewalld.service".
Removed "/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service".

[root@server250 ~]# yum  install vsftpd.x86_64 lftp  -y
[root@server250 repodata]# systemctl enable --now vsftpd

[root@server250 ~]# cd /var/ftp/
[root@server250 ftp]# mkdir rhel9
[root@server250 ftp]# cp -rf /rhel9/  /var/ftp/rhel9/
AppStream  EFI   extra_files.json  images    media.repo               RPM-GPG-KEY-redhat-release
BaseOS     EULA  GPL               isolinux  RPM-GPG-KEY-redhat-beta

配置客户端:

[root@server250 ~]# systemctl disable --now firewalld.service 
Removed "/etc/systemd/system/multi-user.target.wants/firewalld.service".
Removed "/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service".

[root@server250 ~]# yum  install ftp lftp  -y
[root@node1 yum.repos.d]# cat rhel9.repo

[AppStream]
name=AppStream
baseurl=ftp://172.25.254.250/rhel9/rhel9/AppStream
gpgcheck=0

[BaseOS]
name=BaseOS
baseurl=ftp://172.25.254.250/rhel9/rhel9/BaseOS
gpgcheck=0


[root@node1 yum.repos.d]# yum clean all 
正在更新 Subscription Management 软件仓库。
无法读取客户身份

本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。

13 个文件已删除
[root@node1 yum.repos.d]# yum makecache 
正在更新 Subscription Management 软件仓库。
无法读取客户身份

本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。

AppStream                                                                        137 MB/s | 6.3 MB     00:00    
BaseOS                                                                            77 MB/s | 1.7 MB     00:00    
元数据缓存已建立。

3.测试远程软件仓库:

[root@node1 yum.repos.d]#  yum install  nginx -y
正在更新 Subscription Management 软件仓库。
无法读取客户身份

本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。

上次元数据过期检查:0:01:11 前,执行于 2024年06月07日 星期五 13时37分46秒。
依赖关系解决。
=================================================================================================================
 软件包                          架构                版本                           仓库                    大小
=================================================================================================================
安装:
 nginx                           x86_64              1:1.20.1-14.el9                AppStream               43 k
安装依赖关系:
 nginx-core                      x86_64              1:1.20.1-14.el9                AppStream              576 k
 nginx-filesystem                noarch              1:1.20.1-14.el9                AppStream               13 k
 redhat-logos-httpd              noarch              90.4-1.el9                     AppStream               18 k

事务概要
=================================================================================================================
安装  4 软件包

总下载:650 k
安装大小:1.8 M
下载软件包:
(1/4): nginx-1.20.1-14.el9.x86_64.rpm                                            3.7 MB/s |  43 kB     00:00    
(2/4): nginx-core-1.20.1-14.el9.x86_64.rpm                                        41 MB/s | 576 kB     00:00    
(3/4): nginx-filesystem-1.20.1-14.el9.noarch.rpm                                 902 kB/s |  13 kB     00:00    
(4/4): redhat-logos-httpd-90.4-1.el9.noarch.rpm                                  4.4 MB/s |  18 kB     00:00    
-----------------------------------------------------------------------------------------------------------------
总计                                                                              36 MB/s | 650 kB     00:00     
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                                                  1/1 
  运行脚本: nginx-filesystem-1:1.20.1-14.el9.noarch                                                          1/4 
  安装    : nginx-filesystem-1:1.20.1-14.el9.noarch                                                          1/4 
  安装    : nginx-core-1:1.20.1-14.el9.x86_64                                                                2/4 
  安装    : redhat-logos-httpd-90.4-1.el9.noarch                                                             3/4 
  安装    : nginx-1:1.20.1-14.el9.x86_64                                                                     4/4 
  运行脚本: nginx-1:1.20.1-14.el9.x86_64                                                                     4/4 
  验证    : nginx-1:1.20.1-14.el9.x86_64                                                                     1/4 
  验证    : nginx-core-1:1.20.1-14.el9.x86_64                                                                2/4 
  验证    : nginx-filesystem-1:1.20.1-14.el9.noarch                                                          3/4 
  验证    : redhat-logos-httpd-90.4-1.el9.noarch                                                             4/4 
已更新安装的产品。

已安装:
  nginx-1:1.20.1-14.el9.x86_64         nginx-core-1:1.20.1-14.el9.x86_64 nginx-filesystem-1:1.20.1-14.el9.noarch
  redhat-logos-httpd-90.4-1.el9.noarch

完毕!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值