FTP的搭建过程,以及遇到的坑
在之前的博客中,我有说到,我最喜欢用Yum在线安装的方式安装软件,简单省事儿。现在看来,也不尽然,关键是,无法快速找到我要的文件,整个whereis 也很累。所以,现在觉得,还是乖乖的整个压缩包,自行安装比较和我心意。
首先,要用到的压缩包列表:
安装步骤概况:
1,安装运行环境包libevent工具包
2,安装libfastcommon工具包
3,安装Tracker服务
4,安装storage服务
5,安装Nginx提供HTTP服务
5.1,需要重新编译Nginx,所以需要处理fastdfs-nginx-module插件(简单)
详细安装步骤:
友情提示:最好是把需要的压缩包聚集到一个目录下,然后解压的时候,在一个自己知道的地方,没什么别的意思或者深意,只是为了自己方便找一些文件,然后操作文件的时候快一点。(你要是写半天的cp或者rm,结果发现写不出目录,就呵 呵影响心情了)
1,安装运行环境包libevent工具包
这一步是极其简单粗暴的,一行命令:yum -y install libevent
2,安装libfastcommon工具包
1, 解压缩: tar -zxvf 压缩包所在位置
2, ./make.sh
3, ./make.sh install
4, 把/usr/lib64/libfastcommon.so文件向/usr/lib/下复制一份
备注:编译安装的时候,注意一下当前所在文件的位置。 不跟我这个猴子派来的DB学习,当前,我可是在根目录下执行./make.sh,还傻傻闹不懂,为毛不成功
3,安装Tracker服务
2、./make.sh
3、./make.sh install
安装后在/usr/bin/目录下有以fdfs开头的文件都是编译出来的。
配置文件都放到/etc/fdfs文件夹
4、把/root/FastDFS/conf目录下的所有的配置文件都复制到/etc/fdfs下。
5、配置tracker服务。修改/root/FastDFS/conf/tracker.conf文件。
重启使用命令:/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
4,安装storage服务
/usr/bin/fdfs_storaged/etc/fdfs/storage.confrestart
5,安装Nginx提供HTTP服务
./configure \
--prefix=/var /nginx \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/nginx/client\
--http-proxy-temp-path=/var/nginx/proxy\
--http-fastcgi-temp-path=/var/nginx/fastcgi\
--http-uwsgi-temp-path=/var/nginx/uwsgi\
--http-scgi-temp-path=/var/nginx/scgi\
--add-module=/usr/local/fastdfs-nginx-module/src
附录:最开始的config配置
./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scgi
注意:上边将临时文件目录指定为/var/temp/nginx,需要在/var下创建temp及nginx目录
4、make
5、makeinstall
6、把/root/fastdfs-nginx-module/src/mod_fastdfs.conf文件复制到/etc/fdfs目录下。编辑四个地方:1,base_path=/tmp(日志存放路径) 2,tracker_server=IP:22122(tracker服务器地址) 3,url_have_group_name=true 4,store_path0=/home/fastdfs/storage (图片保存路径,注意和storage服务配置相对应)
7、配置nginx
在nginx的配置文件中添加一个Server:
server {listen 80;server_name 192.168.101.3;location /group1/M00/{#root /home/FastDFS/fdfs_storage/data;ngx_fastdfs_module;}
}
8、将libfdfsclient.so拷贝至/usr/lib下
cp/usr/lib64/libfdfsclient.so /usr/lib/
9、启动nginx
附:使用的基本代码
1,FastDFSClient
package taotao.utils;import org.csource.common.NameValuePair;
import org.csource.fastdfs.*;
/*** Created by Angelina on 2017/6/7.*/
public class FastDFSClient {private TrackerClient trackerClient = null;private TrackerServer trackerServer = null;private StorageServer storageServer = null;private StorageClient1 storageClient = null;public FastDFSClient(String conf) throws Exception {if (conf.contains("classpath:")) {String url = this.getClass().getResource("/").getPath();url = url.substring(1);conf = conf.replace("classpath:", url);}ClientGlobal.init(conf);trackerClient = new TrackerClient();trackerServer = trackerClient.getConnection();storageServer = null;storageClient = new StorageClient1(trackerServer, storageServer);}public String uploadFile(String fileName, String extName, NameValuePair[] metas) throws Exception {return storageClient.upload_file1(fileName, extName, metas);}public String uploadFile(String fileName, String extName) throws Exception {return storageClient.upload_file1(fileName, extName, null);}public String uploadFile(String fileName) throws Exception {return storageClient.upload_file1(fileName, null, null);}public String uploadFile(byte[] fileContent, String extName, NameValuePair[] metas) throws Exception {return storageClient.upload_file1(fileContent, extName, metas);}public String uploadFile(byte[] fileContent, String extName) throws Exception {return storageClient.upload_file1(fileContent, extName, null);}public String uploadFile(byte[] fileContent) throws Exception {return storageClient.upload_file1(fileContent, null, null);}}
2,应用实例
@Value("${IMAGE_SERVER_BASE_URL}")private String IMAGE_SERVER_BASE_URL;@Overridepublic PictureResult uploadPic(MultipartFile picFile){PictureResult result=new PictureResult();//check the pictureif (picFile.isEmpty()){result.setError(1);result.setMessage("the file not found");return result;}//upload the picture to the servertry{//get the file's extensionString originalFilename=picFile.getOriginalFilename();String extName=originalFilename.substring(originalFilename.lastIndexOf(".")+1);FastDFSClient client=new FastDFSClient("classpath:properties/client.conf");String url=client.uploadFile(picFile.getBytes(),extName);//stitching the URLurl=IMAGE_SERVER_BASE_URL+url;result.setError(0);result.setUrl(url);}catch(Exception e){e.printStackTrace();}return result;}
FTP的搭建过程,以及遇到的坑相关推荐
- win10下mediasoup搭建过程中的一些坑记录
我们原来基于Janus的webrtc系统基本上可用了,系统目前最高到5万人同时在线,不过确实发现Janus的一些不足,对于我这种喜欢c++的人来说,看Janus的代码实在是比较痛苦,于是处于研究目的, ...
- 关于虚拟机搭建Hadoop的几个坑
首先很高兴你能打开我的这篇博客,相信我在Hadoop搭建过程中遇到的坑总结的一些经验会对你有所帮助. CSDN上有很多关于Hadoop集群搭建的博客,因此我就不再叙述Hadoop的搭建过程,重点说一下 ...
- suse ftp文件服务器搭建,SUSE下FTP服务器搭建
FTP(File Transfer Protocol),是TCP/IP网络上两台计算机传送文件的协议,是在TCP/IP网络和Internet上最早使用的协议之一,属于网络协议组的应 用层.FTP客户机 ...
- iis7 文件服务器搭建,iis7 ftp服务器搭建
iis7 ftp服务器搭建 内容精选 换一换 安装MySQL本文档以"CentOS 6.5 64bit(40GB)"操作系统为例,对应MySQL版本为5.1.73.CentOS 7 ...
- 阿里云服务器 搭建单体redis 以及踩坑
在搭建阿里云服务器的过程中,踩坑很多,特写此文: 简介 Redis是一个开源(BSD许可),内存数据结构存储,用作数据库,缓存和消息代理.它支持数据结构,如字符串,散列,列表,集合,带有范围查询的排序 ...
- 世界你好! 个人网站搭建过程
2019独角兽企业重金招聘Python工程师标准>>> 这几天花了点时间,在西部数码购买了个服务器,使用WordPress4.0中文版构建了这个博客,安装文件你可以在这里下载 htt ...
- linux ftp mysql_linux搭建ftp服务——未连接mysql数据库的做法
ftp服务很重要,这里介绍ftp在linux上不连接mysql数据库的搭建方法,ftp也可以连接mysql,有时间再生成文档. 先说明ftp的基本原理:FTP –File Transfer Proto ...
- FTP服务器搭建及操作(一)
FTP服务器搭建及操作(一) FTP搭建 PHP FTP操作 搭建方法参照(windows):http://www.cnblogs.com/lidan/archive/2012/06/04/25351 ...
- 先电iaas云平台搭建(openstack)————搭建过程
写在前面: 1,在上一篇博客中具体记录了创建controller和compute这两个节点的过程 2,此片博客继续上一篇博客内容 3,使用的远程连接工具为CRT 4,搭建过程两个节点有重复步骤,均以c ...
最新文章
- SQL脚本--有关压缩数据库日志
- LeetCode(Java) 两数相加
- QT的QDirIterator类的使用
- c语言键盘连续双击程序,编了个C语言的键盘程序有点问题,请指点下!
- jQuery 实现Ajax
- oracle10g数据库复制,oracle -10g 中Duplicate 复制数据库
- Python数据分析:pandas玩转Excel(三)
- 计算机二级C选择题精华
- 蓝牙技术|伦茨科技智能语音遥控器方案简介
- 个体工商户属于小微企业吗_个体户属于小微企业吗?
- 苹果x屏幕多少钱_北京苹果手机维修为大家分享iPadAir2换屏幕多少钱
- 第五(模块、包说明)
- java在win8闪退_win8.1应用闪退
- JSR303校验使用
- bootm bootz
- 数据库CAST()函数,格式(CAST AS decimal)
- 图像正交变换的研究意义
- 使用HTML+CSS技术制作篮球明星介绍网站
- 【spine】制作游戏中人物动作(战斗、倒地、移动等操作等)动画的一个完整流程
- 2014年360校园招聘笔试题,干货分享
热门文章
- 微波炉甜点(附做法)
- 教你用Python画笔填充颜色
- 【python】tensorflow框架中的tf.gather_nd()函数对应的 pytorch框架的gather_nd()函数
- [推荐] 韩国精品LOGO设计欣赏
- 【总裁云】王文京:强攻推进!用友云吹响云服务阵地战冲锋号
- 超详细Kafka架构原理图(观止)
- UE5遇到255错误代码:ShaderCompileWorker Win64 Development -Quiet“ -WaitMutex -FromMsBuild已 退出,代码为 255。
- 主动变被动9个例句_怒赞!这30个雅思口语地道表达和例句,让你秒变native speaker!...
- 【Python】50行代码带你背单词,四六级冲冲冲
- 艾司博讯:拼多多多多场景推广怎么调节