实现系统 ftp网络yum服务器

简介:

1准备工作

centos7中禁用关闭防火墙

[root@centos7 yum.repos.d]#systemctl disable firewalld.service  禁用防火墙 下次开机不启用

[root@centos7 yum.repos.d]#systemctl stop firewalld.service    关闭防火墙

Centos6centos7 以上操作命令不同

[root@centos7 yum.repos.d]#iptables -vnL             查看防火墙定义规则的详细信息

Chain INPUT (policy ACCEPT 115K packets, 12M bytes)

 pkts bytes target     prot opt in     out     source               destination        

 

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)

 pkts bytes target     prot opt in     out     source               destination        

 

Chain OUTPUT (policy ACCEPT 2030 packets, 247K bytes)

 pkts bytes target     prot opt in     out     source               destination

 Untitled picture.png

[root@centos7 7]#vim /etc/selinux/config

Untitled picture.png

[root@centos7 7]#setenforce 0                 setenforceLinuxselinux防火墙配置命令 执行setenforce 0 表示关闭selinux防火墙。

centos6中 禁用关闭防火墙

[root@centos6 ~]#chkconfig iptables off

[root@centos6 ~]#service iptables stop

iptables: Setting chains to policy ACCEPT: filter          [  OK  ]

iptables: Flushing firewall rules:                                     [  OK  ]

iptables: Unloading modules:                                         [  OK  ]

 

2安装ftp服务包

假如没有仓库,首先看是否有vsftpd  ,vsftpd 是搭建ftp服务器应用,高效稳定。

[root@centos7 yum.repos.d]#rpm -q vsftpd

package vsftpd is not installed

[root@centos7 yum.repos.d]#rpm -ivh /run/media/root/CentOS\ 7\ x86_   64/Packages/vsftpd-3.0.2-10.el7.x86_64.rpm

Preparing...                          ################################# [100%] yum仓库未搭建 选rpm安装

Updating / installing...

   1:vsftpd-3.0.2-10.el7              ################################# [100%]

[root@centos7 yum.repos.d]#rpm -ql vsftpd

…….

…….

/usr/lib/systemd/system/vsftpd.service    启动此服务  ftp网络共享服务才能运行

/usr/lib/systemd/system/vsftpd.target

/usr/lib/systemd/system/vsftpd@.service

/usr/sbin/vsftpd

…….

/var/ftp                     访问服务器路径 也即是网络共享路径

/var/ftp/pub  

[root@centos7 yum.repos.d]#ss -tnl   ftp网络共享服务会占用网络端口   查看当前监听的tcp端口

State      Recv-Q Send-Q          Local Address:Port                         Peer Address:Port             

LISTEN     0      5               192.168.122.1:53                                      *:*                 

LISTEN     0      128                         *:22                                      *:*           ftp21端口 服务未启动 没有21端口      

LISTEN     0      128                 127.0.0.1:631                                     *:*                 

LISTEN     0      128                        :::22                                     :::*                 

LISTEN     0      128                       ::1:631 

[root@centos7 yum.repos.d]#systemctl start vsftpd.service   启动ftp共享服务

[root@centos7 yum.repos.d]#ss -tnl 

State      Recv-Q Send-Q          Local Address:Port                         Peer Address:Port             

LISTEN     0      5               192.168.122.1:53                                      *:*                 

LISTEN     0      128                         *:22                                      *:*                 

LISTEN     0      128                 127.0.0.1:631                                     *:*                 

LISTEN     0      32                         :::21                                     :::*              21端口打开   

LISTEN     0      128                        :::22                                     :::*   

[root@centos7 yum.repos.d]#systemctl enable vsftpd.service    设置为开机启动

[root@centos7 ~]#cd /var/ftp

[root@centos7 ftp]#ls

pub

测试如下:

Untitled picture.png

准备服务端yum 仓库安装包

[root@centos7 ftp]#cd pub

[root@centos7 pub]#mkdir -p centos/{6,7}       可以参考阿里云路径格式

Untitled picture.png

[root@centos7 pub]#cp -r /run/media/root/CentOS 7 x86_64/* /var/ftp/pub/centos/7

[root@centos7 pub]#cp -r /media/root/CentOS 6 x86_64/* /var/ftp/pub/centos/6

[root@centos7 7]#ls       切换到pub/centos/6 同样查看

CentOS_BuildTag  EULA  images    LiveOS    repodata              RPM-GPG-KEY-CentOS-Testing-7

EFI              GPL   isolinux  Packages  RPM-GPG-KEY-CentOS-7  TRANS.TBL

 

Untitled picture.png

4客户端配置

[root@centos7 ~]#cat>/etc/yum.repos.d/pud.repo<<eof

[centos-ftp]

name=repulic

baseurl=ftp://172.18.254.154/pub/centos/$releasever              仓库路径为repodata的所在目录          

gpgcheck=1

gpgkey=ftp://172.18.254.154/pub/centos/$releasever/RPM-GPG-KEY-CentOS-$releasever

 $releasever: 当前OS的发行版的主版本号

[root@centos7 yum.repos.d]#yum repolist

repo id                                               repo name                                         status

centos-ftp/7                                          repulic                                           9,007

repolist: 9,007

 



本文转自 工运搬运维 51CTO博客,原文链接:http://blog.51cto.com/13157015/2044477,如需转载请自行联系原作者

相关文章
|
9月前
|
Ubuntu 安全 网络安全
在Ubuntu系统下使用vsftpd配置FTP服务器的步骤
以上就是在Ubuntu系统下使用vsftpd配置FTP服务器的步骤。这些步骤都是基础的,但足够让你建立一个简单的FTP服务器。如果你需要更高级的功能,例如SSL加密、虚拟用户等,你可能需要进一步研究vsftpd的配置选项。
546 13
|
安全 编译器 Linux
深入解析与防范:基于缓冲区溢出的FTP服务器攻击及调用计算器示例
本文深入解析了利用缓冲区溢出漏洞对FTP服务器进行远程攻击的技术,通过分析FreeFlow FTP 1.75版本的漏洞,展示了如何通过构造过长的用户名触发缓冲区溢出并调用计算器(`calc.exe`)。文章详细介绍了攻击原理、关键代码组件及其实现步骤,并提出了有效的防范措施,如输入验证、编译器保护和安全编程语言的选择,以保障系统的安全性。环境搭建基于Windows XP SP3和Kali Linux,使用Metasploit Framework进行攻击演示。请注意,此内容仅用于教育和研究目的。
444 4
|
网络协议 文件存储 Windows
Windows Server 2019 FTP服务器搭建
Windows Server 2019 FTP服务器搭建
497 0
|
安全 网络协议 网络安全
Windows Server 2003 FTP服务器搭建
Windows Server 2003 FTP服务器搭建
279 0
|
安全 Ubuntu Linux
在Linux中,如何进行FTP服务器配置?
在Linux中,如何进行FTP服务器配置?
|
弹性计算 关系型数据库 网络安全
阿里云国际版无法连接和访问Windows服务器中的FTP服务
阿里云国际版无法连接和访问Windows服务器中的FTP服务
|
缓存 安全 Linux
本地YUM源大揭秘:搭建您自己的Linux软件宝库,从此告别网络依赖!一文掌握服务器自给自足的终极技能!
【8月更文挑战第13天】在Linux中,YUM是一款强大的软件包管理工具,可自动处理依赖关系。为适应离线或特定安全需求,本指南教你搭建本地YUM源。首先创建存放软件包的`localrepo`目录,复制`.rpm`文件至其中。接着,安装并运用`createrepo`生成仓库元数据。随后配置新的`.repo`文件指向该目录,并禁用GPG检查。最后,清理并重建YUM缓存,即可启用本地YUM源进行软件搜索与安装,适用于网络受限环境。
1199 3
|
SQL Python
你需要在你的系统上安装`sqlmap`。这通常可以通过下载其源代码并编译,或者使用包管理器(如`apt`、`yum`或`pip`,但请注意,`pip`通常不直接提供`sqlmap`)来完成。
你需要在你的系统上安装`sqlmap`。这通常可以通过下载其源代码并编译,或者使用包管理器(如`apt`、`yum`或`pip`,但请注意,`pip`通常不直接提供`sqlmap`)来完成。
|
网络协议 Unix 网络安全
FTP服务器怎么搭建?Windows server搭建FPT服务器
FTP服务器是按照FTP协议提供文件传输服务的计算机。它用于在两台计算机间安全地传输文件,支持用户权限管理和跨平台操作。FTP使用控制连接处理命令,数据连接传输文件,有PORT和PASV模式。要搭建FTP服务器,首先在Windows Server 2008 R2上安装IIS,确保选中FTP服务。接着,创建FTP文件夹作为站点根目录,通过IIS管理器添加FTP站点,配置站点信息、身份验证和权限。测试客户端通过telnet和浏览器访问FTP服务器,确认能成功登录及浏览文件。FTP常用于文件共享和管理,可通过专用工具如FlashFXP上传下载文件。
681 0
FTP服务器怎么搭建?Windows server搭建FPT服务器
|
存储 数据库连接 数据库
如何使用Python上传文件到FTP服务器
如何使用Python上传文件到FTP服务器
492 1

热门文章

最新文章