关于RPM仓库:RPM仓库有4种协议模式,分别为FTP、http、https以及本地file模式,此处以FTP为例。 实验环境:一台挂有2张DVD软件包的FTP Server,一台Clinet客户机 步骤:
[root@Centos7 ~]# yum -y install vsftpd
[root@Centos7 ~]# systemctl enable vsftpd #设置开机自启动
[root@Centos7 ~]# systemctl start vsftpd #启动服务
[root@Centos7 ~]# ss -tnl | grep 21 # 过滤到21端口说明安装及启动服务成功
LISTEN 0 32 :::21 :::*
[root@Centos7 ~]# vim /etc/selinux/config #修改SELinux配置文件
SELINUX=permissive
[root@Centos7 ~]# systemctl disable firewalld # 开机禁止启用防火墙
[root@Centos7 ~]# systemctl stop firewalld # 关闭防火墙
[root@Centos7 ~]# mkdir -p /var/ftp/pub/{6,7}
[root@Centos7 ~]# mount /dev/sr1 /var/ftp/pub/7
[root@Centos7 7]# echo "/dev/sr0 /var/ftp/pub/6 iso9660 defaults 0 0" >> /etc/fstab
[root@Centos7 7]# echo "/dev/sr1 /var/ftp/pub/7 iso9660 defaults 0 0" >> /etc/fstab
ftp://172.18.250.223/pub/
](https://zhima.io/static/upload/20170829/H9sSRTxvNClow_ZC5LbSj-w4.png)
[root@devel yum.repos.d]# yum repolist # 该命令显示 当前客户机无可用repo源
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
repolist: 0
[root@devel yum.repos.d]# vim ftp.repo # 手动创建repo文件
[root@devel yum.repos.d]# cat ftp.repo
[ftprepo]
name=ftprepo
baseurl=ftp://172.18.250.223/pub/$releasever #指明rpm仓库的ftp地址,变量$releasever的作用在于识别系统版本号
enabled=1
gpgcheck=0
[root@devel yum.repos.d]# yum repolist # 从以下返回可发现已经识别RPM仓库成功了
Loaded plugins: fastestmirror, langpacks
ftprepo | 3.6 kB 00:00:00
(1/2): ftprepo/7/group_gz | 155 kB 00:00:00
(2/2): ftprepo/7/primary_db | 5.6 MB 00:00:00
Determining fastest mirrors
repo id repo name status
ftprepo/7 ftprepo 9,363
repolist: 9,363
[root@devel yum.repos.d]# yum -y install httpd # 安装httpd成功 说明仓库搭建也没问题了
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-45.el7.centos will be installed
--> Processing Dependency: httpd-tools = 2.4.6-45.el7.centos for package: httpd-2.4.6-45.el7.centos.x86_64
......此处忽略很多行......