tar -xvf libevent-2.0.22-stable.tar.gz
cd libevent-2.0.22-stable
./configure --prefix=/data/libevent
tar -xvf libfastcommon.tar.gz
./make.sh
./make.sh install
tar -xvf FastDFS_v5.05.tar.gz
./make.sh
./make.sh install
注:编译如果报错解决办法,升级libfastcommon-master。或者使用低版本FastDFS。
cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
mkdir -p /home/python/fastdfs/tracker
vim /etc/fdfs/tracker.conf
base_path = /home/python/fastdfs/tracker
cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf
mkdir -p /home/python/fastdfs/storage
vim /etc/fdfs/storage.conf
base_path = /home/python/fastdfs/storage
store_path0=/home/python/fastdfs/storage
tracker_server=当前服务器IP:22122
cd /etc/fdfs
service fdfs_trackerd start
注:
启动报错 查看日志中出现:
failed to start LSB :fastdfs tracker server
查找:find / -name fdfs_trackerd
得到结果:
/etc/rc.d/init.d/fdfs_trackerd
/usr/bin/fdfs_trackerd
/root/FastDFS/init.d/fdfs_trackerd
/root/FastDFS/tracker/fdfs_trackerd
检查trackerd.conf,并没指定此路径,直接复制,下一步启动fdfs_storaged做一样的处理。
cp /usr/bin/fdfs_trackerd /usr/local/bin/fdfs_trackerd
cp /usr/bin/stop.sh /usr/local/bin/stop.sh
cp /usr/bin/restart.sh /usr/local/bin/restart.sh
service fdfs_storaged start
注:遇到报错同上处理。
cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf
vim /etc/fdfs/client.conf
base_path = /home/python/fastdfs/tracker
tracker_server=服务器IP:22122
service fdfs_storaged restart
注:此方法针对已安装完成nginx的服务器,未安装请先安装nginx。
./configure --prefix=/usr/local/nginx --add-module=/usr/local/src/fastdfs-nginx-module-1.20/src/
#注意不需要make install ,不然就覆盖掉原来安装的模块了
make
备份原来的nginx执行程序
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
将新编译的nginx执行程序复制到/usr/local/nginx/sbin/目录下
#前一个路径为nginx的源码路径 后一个路径为安装路径
cp /opt/nginx-1.16.1/objs/nginx /usr/local/nginx/sbin/nginx
server {
listen 9999;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
location /group1/M00 {
root /home/python/fastdfs/storage/data;
ngx_fastdfs_module;
}
}
cp /home/tomecat/fast/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/
vi /etc/fdfs/mod_fastdfs.conf
tracker_server=IP:22122 #tracker服务器的IP地址以及端口号
storage_server_port=23000 #storage服务器的端口号
url_have_group_name = true #文件 url 中是否有 group 名
store_path0=/home/python/fastdfs/storage
ln -s /home/python/fastdfs/storage/data/ /home/python/fastdfs/storage/data/M00
./nginx -s reload