FastDFS安装教程(Centos7)
下载相关依赖https://github.com/happyfish100
yum -y install cmake make gcc-c++
yum -y install unzip
mkdir -p /usr/local/fastdfs
unzip libfastcommon-1.0.43.zip -d /usr/local/fastdfs/
./make.sh install
ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
ln -s /usr/local/lib64/libfdfsclient.so /usr/local/lib/libfdfsclient.so
ln -s /usr/local/lib64/libfdfsclient.so /usr/lib/libfdfsclient.so
tar zxvf fastdfs-6.06.tar.gz -C /usr/local/fastdfs/
vim make.sh
./make.sh
./make.sh install
内置命令
vim fdfs_trackerd
设置开机自启动
vim /etc/rc.d/rc.local
配置storage
[root@localhost fdfs]# mkdir -p /fastdfs/storage/base
[root@localhost fdfs]# mkdir -p /fastdfs/storage/store
[root@localhost fdfs]# vim /etc/init.d/fdfs_storaged
配置fastdfs client
mkdir -p /fastdfs/client
[root@localhost bin]# ./fdfs_upload_file /etc/fdfs/client.conf /home/yihui/jdk-8u321-linux-aarch64.tar.gz
group1/M00/00/00/wKgrgGJas3aAS5QJBHBb5MiU4Fk.tar.gz
[root@localhost bin]# ./fdfs_delete_file /etc/fdfs/client.conf group1/M00/00/00/wKgrgGJas3aAS5QJBHBb5MiU4Fk.tar.gz
Nginx组件安装
yum install -y gcc gcc-c++ make automake autoconf libtool pcre pcre-develzlib zlib-devel openssl openssl-devel
./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 \
--add-module=/usr/local/fastdfs/fastdfs-nginx-module-1.22/src
make
make install
[root@localhost fdfs]# cp /usr/local/fastdfs/fastdfs-6.06/conf/http.conf /etc/fdfs
[root@localhost fdfs]# cp /usr/local/fastdfs/fastdfs-6.06/conf/mime.types /etc/fdfs
## 创建软连接
[root@localhost fdfs]# ln -s /usr/local/lib64/libfdfsclient.so /usr/lib64/libfdfsclient.so
## 创建网络访问存储服务的软连接
[root@localhost conf]# /etc/init.d/fdfs_storaged restart
Restarting fdfs_storaged (via systemctl): [ OK ]
[root@localhost conf]# cd ../
[root@localhost nginx]# ll
total 4
drwxr-xr-x. 2 root root 4096 Apr 16 06:14 conf
drwxr-xr-x. 2 root root 40 Apr 16 05:55 html
drwxr-xr-x. 2 root root 19 Apr 16 05:55 sbin
[root@localhost nginx]# cd sbin
[root@localhost sbin]# ll
total 3872
-rwxr-xr-x. 1 root root 3962632 Apr 16 05:55 nginx
[root@localhost sbin]# ./nginx
ngx_http_fastdfs_set pid=28660
[root@localhost sbin]# cd /home/yihui
[root@localhost yihui]# /usr/local/bin/fdfs_upload_file /etc/fdfs/client.conf 1.jpg
group1/M00/00/00/wKgrgGJaxaSAUdvZAAAlKBJ2ayM093.jpg