需求:在Linux环境上安装FTP服务端Serv-U

解决方案:

1.下载Serv-U的linux 64bit的安装文件(如果要安装ftp的机器外网不通,则需要本地下载后上传到该机器)

wget  http://www.rhinosoft.com.cn/download/14.0.1.0/SU-MFTS-Linux-64bit.zip

2.解压安装文件

unzip SU-MFTS-Linux-64bit.zip

3.对安装文件赋予最高权限(r=4,w=2,x=1) ,键入y继续执行

chmod 777 Serv-U-Linux-x86_64-Install

4.继续默认安装并启动服务,默认安装在/usr/local/Serv-U目录下,安装完成,默认管理界面服务的端口是8080

5.现在可以在浏览器中输入:http://ip:8080/ ,如果访问不了,原因可能是:

1)8080端口已被占用,可在Serv-U-StartupLog.txt中查看日志确认

2)防火墙没有关闭,需要手动关闭:service iptables stop

6.使用管理员默认帐号/密码:admin/admin登录,即可新增域、添加账户、配置数据目录等

7.这时候就可以测试了,使用客户端FlashFXP上传文件。浏览器可浏览ftp://ip查看下载(IE浏览器如果打开不了,需要在工具->Internet选项->高级中去除勾选下图中的选项)

8.java代码测试FTP服务的上传下载功能

  1. package com.besttone.zookeepergroup;
  2. import java.io.File;
  3. import java.io.FileInputStream;
  4. import java.io.FileOutputStream;
  5. import java.io.InputStream;
  6. import java.io.OutputStream;
  7. import org.apache.commons.net.ftp.FTPClient;
  8. import org.apache.commons.net.ftp.FTPFile;
  9. import org.apache.commons.net.ftp.FTPReply;
  10. /**
  11. * @author zhenzhen
  12. * @title ItemFtp
  13. * @Description : FTP 上传下载工具类
  14. */
  15. public class ItemFtp {
  16. private FTPClient ftp;
  17. /**
  18. *
  19. * @param path
  20. * 上传到ftp服务器哪个路径下
  21. * @param addr
  22. * 地址
  23. * @param port
  24. * 端口号
  25. * @param username
  26. * 用户名
  27. * @param password
  28. * 密码
  29. * @return
  30. * @throws Exception
  31. */
  32. private boolean connect(String path, String addr, int port,
  33. String username, String password) throws Exception {
  34. boolean result = false;
  35. ftp = new FTPClient();
  36. int reply;
  37. ftp.connect(addr, port);
  38. ftp.login(username, password);
  39. ftp.setFileType(FTPClient.BINARY_FILE_TYPE);
  40. reply = ftp.getReplyCode();
  41. if (!FTPReply.isPositiveCompletion(reply)) {
  42. ftp.disconnect();
  43. return result;
  44. }
  45. ftp.changeWorkingDirectory(path);
  46. result = true;
  47. return result;
  48. }
  49. /**
  50. * @author
  51. * @class ItemFtp
  52. * @title upload
  53. * @Description :
  54. * @time 2013 2013-11-27
  55. * @return void
  56. * @exception :(Error note)
  57. * @param file
  58. * 上传的文件或文件夹
  59. * @param path
  60. * 上传的文件的路径
  61. * @throws Exception
  62. */
  63. private void upload(File file, String path) throws Exception {
  64. System.out.println(" file.isDirectory() : " + file.isDirectory());
  65. if (file.isDirectory()) {
  66. ftp.makeDirectory(file.getName());
  67. ftp.changeWorkingDirectory(file.getName());
  68. String[] files = file.list();
  69. for (int i = 0; i < files.length; i++) {
  70. File file1 = new File(file.getPath() + "\\" + files[i]);
  71. if (file1.isDirectory()) {
  72. upload(file1, path);
  73. ftp.changeToParentDirectory();
  74. } else {
  75. File file2 = new File(file.getPath() + "\\" + files[i]);
  76. FileInputStream input = new FileInputStream(file2);
  77. ftp.storeFile(file2.getName(), input);
  78. input.close();
  79. }
  80. }
  81. } else {
  82. File file2 = new File(file.getPath());
  83. System.out.println(" file.getPath() : " + file.getPath()
  84. + " | file2.getName() : " + file2.getName());
  85. InputStream input = new FileInputStream(file2);
  86. ftp.changeWorkingDirectory(path);
  87. ftp.storeFile(file2.getName(), input);
  88. input.close(); // 关闭输入流
  89. ftp.logout(); // 退出连接
  90. }
  91. }
  92. /**
  93. * @author
  94. * @class ItemFtp
  95. * @title download
  96. * @Description : FPT 下载文件方法
  97. * @time 2013 2013-11-27
  98. * @return void
  99. * @exception :(Error note)
  100. * @param reomvepath
  101. * 下载的文件的路径
  102. * @param fileName
  103. * 下载的文件名
  104. * @param localPath
  105. * 下载的文件本地路径
  106. * @throws Exception
  107. */
  108. @SuppressWarnings("unused")
  109. private void download(String reomvepath, String fileName, String localPath)
  110. throws Exception {
  111. ftp.changeWorkingDirectory(reomvepath);
  112. // 列出该目录下所有文件
  113. FTPFile[] fs = ftp.listFiles();
  114. // 遍历所有文件,找到指定的文件
  115. for (FTPFile ff : fs) {
  116. if (ff.getName().equals(fileName)) {
  117. // 根据绝对路径初始化文件
  118. File localFile = new File(localPath + "/" + ff.getName());
  119. // 输出流
  120. OutputStream is = new FileOutputStream(localFile);
  121. // 下载文件
  122. ftp.retrieveFile(ff.getName(), is);
  123. System.out.println("下载成功!");
  124. is.close();
  125. }
  126. }
  127. ftp.logout(); // 退出连接
  128. }
  129. public static void main(String[] args) throws Exception {
  130. ItemFtp t = new ItemFtp();
  131. boolean lianjie = t.connect("/zhengzhenzhen", "180.153.*.*", 21,
  132. "*", "*");
  133. System.out.println("连接 :" + lianjie);
  134. // 上传
  135. File file = new File("d:\\test\\test.txt");
  136. t.upload(file, "/zhengzhenzhen/");
  137. // 下载
  138. // t.download("/zhengzhenzhen", "22.png", "D:\\test");
  139. System.out.println("test");
  140. }
  141. }

6.打开FlashFXP客户端连接FTP服务查看结果

完毕!

Linux环境安装FTP服务Serv-U相关推荐

  1. linux 环境安装 webdav 服务

    linux 环境安装 webdav 服务 执行安装语句 yum install httpd* -y 安装路径为:/ect/httpd/ 相关配置 httpd.conf 在文件 /etc/httpd/c ...

  2. Linux系统下安装FTP服务

    Linux系统下安装FTP服务 1. 简介 2. 工作原理 3. FTP的安装与配置 1. 下载vsftp安装包 2. 检查是否已经安装了vsftp,后面会介绍怎样卸载 3. 安装vsftpd 4. ...

  3. Linux离线安装NTP服务,内网环境下配置本地时间同步

    参考文章:Linux离线安装NTP服务,无外网环境下配置本地时间同步 | 航行学园 1.常用命令 rpm -qa | grep ntp #查询已安装的ntp版本信息等 rpm -e --nodeps ...

  4. linux环境下和网络服务相关的配置文件含义及如何配置

    要建立一个安全Linux服务器就首先要了解Linux环境下和网络服务相关的配置文件的含义及如何进行安全的配置.那天查看服务器的eth0地址,后来想了一些问题,到家里就翻了翻以前的文档,无意中看到了这个 ...

  5. Linux 环境安装 Node、nginx、docker、vsftpd、gitlab

    Linux 环境安装 centos7 # 更新yum yum update -y 0. 防火墙 firewalld 新入的JD云服务器,发现防火墙默认是关闭的. # 查看防火墙状态 systemctl ...

  6. Ubuntu安装FTP 服务, 实现和Windows的文件互传

    如下内容来自<[正点原子]I.MX6U嵌入式Linux驱动开发指南V1.5.2.pdf> 在开发的过程中会频繁的在 Windows 和 Ubuntu 下进行文件传输,比如在 Windwos ...

  7. linux环境安装mysql8.0以及使用Navicat连接Linux中的mysql

    目录 一.linux环境安装mysql 二.使用Navicat连接Linux中的mysql 一.linux环境安装mysql 1.官网下载mysql对应的包,我这下载的是8.0.28版本.官网链接:M ...

  8. Linux下检测FTP服务并开启FTP服务

    Linux下检测FTP服务并开启FTP服务 1. 检测FTP服务是否开启 通过查询提供FTP服务的进程是否存在 Shell代码   ps -ef | grep ftp   并未找到任何包含ftp关键字 ...

  9. 在Linux环境安装memcached

    2019独角兽企业重金招聘Python工程师标准>>> 1.memcached的安装依赖libevent-dev组件,先安装这个组件 在Linux环境安装memcached 2.下载 ...

最新文章

  1. mass Framework event模块 v4
  2. webGIS(离线版)研究路线归总
  3. jQuery javaScript js 判断浏览器的类型、版本的方法
  4. Unity 编辑器启动时运行自定义编辑器脚本
  5. vb6.0动态加载odbc驱动(mysql数据源)_vb教程之在VB中动态加载ODBC数据源
  6. sql创建和添加时间字段
  7. Chrome谷歌浏览器Flash Player被屏蔽如何解决
  8. vnc支持用计算机民远程吗,VNC远程控制软件是什么?有没有更好的远程桌面控制解决方案?...
  9. python正则表达式提取字符串中的书名_使用python正则表达式从字符串中提取名称...
  10. 提升 Docker Desktop For macOS 磁盘使用率
  11. NLP学习笔记——情感分析一 (简介)
  12. 【2023最新版】超详细NMAP安装保姆级教程,Nmap的介绍、功能并进行网络扫描,收藏这一篇就够了
  13. top 与 margin-top的区别
  14. 不用做实验也可以轻松找到癌症组织特异性基因
  15. 详解Lodash中的fp实现
  16. 管理者树立威信,牢记这“6字诀”!
  17. 【论文翻译】 BMN: Boundary-Matching Network for Temporal Action Proposal Generation
  18. ZOJ 3964 Yet Another Game of Stones (博弈)
  19. 【网络】IEEE 802现有标准
  20. mac html乱码,Mac 中文字符显示为乱码

热门文章

  1. 基于Hadoop的疫情信息分析与可视化研究——包含大屏可视化及预测算法
  2. rabbitlearning下载_RabbitMQ-learning
  3. 用于自动驾驶汽车赛车中实时最优轨迹规划的顺序凸规划方法(Matlab代码实现)
  4. 瑞禧|富勒烯C60|Fullerene-C60|CAS:99685-96-8
  5. mongoDB聚合操作_aggregate()归纳
  6. 创造虚拟环境报错An unexpected error has occurred. Conda has prepared the above report.解决方案
  7. Window10 双击bat文件,提示“windows找不到文件xxx.bat”
  8. RSS Reader for MAC Code
  9. Windows安装go-python环境--使用golang执行python3
  10. 单纯形法Python实现