ftp搭建yum仓库

本文详细介绍了如何在两台CentOS7操作系统中搭建VSFTP服务,包括安装VSFTP软件包、指定FTP路径、配置防火墙与SELinux、设置客户端以及验证YUM源的有效性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

前提准备两台lcentos7 的操作系统并且两个能互相ping通

第一步安装vsftpd包

[root@compute ~]# yum install -y vsftpd
Loaded plugins: fastestmirror, langpacks
Packages                                                                         | 2.9 kB  00:00:00     
iaas                                                                             | 2.9 kB  00:00:00     
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:3.0.2-11.el7_2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================
 Package               Arch                  Version                          Repository           Size
========================================================================================================
Installing:
 vsftpd                x86_64                3.0.2-11.el7_2                   iaas                167 k

Transaction Summary
========================================================================================================
Install  1 Package

Total download size: 167 k
Installed size: 347 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : vsftpd-3.0.2-11.el7_2.x86_64                                                         1/1 
  Verifying  : vsftpd-3.0.2-11.el7_2.x86_64                                                         1/1 

Installed:
  vsftpd.x86_64 0:3.0.2-11.el7_2                                                                        

Complete!
You have mail in /var/spool/mail/root
[root@compute ~]# 
[root@compute ~]# systemctl restart vsftpd
[root@compute ~]# systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
[root@compute ~]# 

第二步指定ftp的路径

anon_root=/opt/
# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.

第三步关闭防火墙我选择最粗暴的方式关闭防火墙和selinux

[root@compute ~]# systemctl stop firewalld
[root@compute ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)

Mar 14 23:42:14 compute systemd[1]: Stopped firewalld - dynamic firewall daemon.
Mar 14 23:42:42 compute systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@compute ~]# setenforce 0
[root@compute ~]# getenforce 
Permissive
[root@compute ~]# 

第四步配置客服端

[root@server yum.repos.d]# yum install -y vsftpd
[root@server yum.repos.d]# systemctl restart vsftpd.service 
[root@server yum.repos.d]# systemctl enable vsftpd
[root@server yum.repos.d]# 

**第五步配置客服端的yum 注意:不要写绝对路径不然会找不到位置报错因为刚才创建的ftp的路径指定的是opt所以直接写opt目录下的文件就行

[root@server yum.repos.d]# vim ftp.repo 

[iaas]
name=iaas
baseurl=ftp://192.168.1.10/iaas-repo
gpgcheck=0
enabled=1

[Packages]
name= Packages
baseurl=ftp://192.168.1.10/Packages
gpgcheck=0
enabled=1

第六步照样关闭可客服端的防火墙设置selinux为permissive

[root@compute ~]# systemctl stop firewalld
[root@compute ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)

Mar 14 23:42:14 compute systemd[1]: Stopped firewalld - dynamic firewall daemon.
Mar 14 23:42:42 compute systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@compute ~]# setenforce 0
[root@compute ~]# getenforce 
Permissive
[root@compute ~]# systemctl restart vsftpd

第七步验证yum,可以发现我们使用的yum为Packages和iaas得到正确的yum仓库

[root@server yum.repos.d]# yum repolist all
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
repo id                                      repo name                                     status
Packages                                     Packages                                      enabled: 3,723
iaas                                         iaas                                          enabled: 1,482
repolist: 5,205
[root@server yum.repos.d]# 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值