安装依赖
yum install gcc gcc-c++ make automake autoconf libtool pcre* zlib openssl openssl-devel
普通用户:npt_cluster
├── opt
│ └── fastdfs
└── soft
├── fastdfs-5.11.tar.gz
├── fastdfs-nginx-module-1.20.tar.gz
├── libfastcommon-1.0.43.tar.gz
└── nginx-1.18.0.tar.gz
vi /etc/profile
export DESTDIR=/home/npt_cluster/opt/fastdfs
source /etc/profile
解压安装文件
cd /home/fastdfs/soft
tar -zxvf libfastcommon-1.0.43.tar.gz
编译安装
cd libfastcommon-1.0.39/
./make.sh
./make.sh install
安装fastdfs
cd /home/npt_cluster/soft
tar -zxvf fastdfs-5.11.tar.gz
cd /home/fastdfs/soft/fastdfs-5.11
修改make.sh
说明:编译完的程序运行时读取额外lib文件的路径。
> LIBS=''
---
< LIBS="-Wl,-rpath=/home/fastdfs/opt/fastdfs/usr/lib64"
说明:编译时生成默认配置文件的路径
> if [ ! -d /etc/fdfs ]; then
> mkdir -p /etc/fdfs
---
< if [ ! -d $TARGET_CONF_PATH ]; then
< mkdir -p $TARGET_CONF_PATH
修改Makefile.in文件
vi /home/fastdfs/soft/fastdfs-5.11/tracker/Makefile.in
> INC_PATH = -I../common -I/usr/include/fastcommon
> LIB_PATH = $(LIBS) -lfastcommon
---
< INC_PATH = -I../common -I${DESTDIR}/usr/include/fastcommon
< LIB_PATH = $(LIBS) -L${DESTDIR}/usr/lib64 -lfastcommon
vi /home/fastdfs/soft/fastdfs-5.11/storage/Makefile.in
> INC_PATH = -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I/usr/include/fastcommon
> LIB_PATH = $(LIBS) -lfastcommon
---
< INC_PATH = -I. -Itrunk_mgr -I../common -I../tracker -I../client -Ifdht_client -I${DESTDIR}/usr/include/fastcommon
< LIB_PATH = $(LIBS) -L${DESTDIR}/usr/lib64 -lfastcommon
vi /home/fastdfs/soft/fastdfs-5.11/client/Makefile.in
> INC_PATH = -I../common -I../tracker -I/usr/include/fastcommon
> LIB_PATH = $(LIBS) -lfastcommon
---
< INC_PATH = -I../common -I../tracker -I${DESTDIR}/usr/include/fastcommon
< LIB_PATH = $(LIBS) -L${DESTDIR}/usr/lib64 -lfastcommon
编译安装
cd /home/fastdfs/soft/fastdfs-5.11/
./make.sh
./make.sh install
复制fastdfs源码中给的参考配置文件到fastdfs安装目录
cd /home/npt_cluster/soft/fastdfs-5.11/conf
cp ./*.conf /home/npt_cluster/opt/fastdfs/etc/fdfs/
准备启动脚本
你可以去/home/fastdfs/opt/fastdfs/etc/init.d/目录下启动程序
当然也可以把两个启动程序复制出来
9.1创建启动脚本目录
mkdir /home/npt_cluster/bin
cp /home/npt_cluster/opt/fastdfs/etc/init.d/* /home/npt_cluster/bin
/home/fastdfs/bin/
├── fdfs_storaged
└── fdfs_trackerd
修改两个启动脚本中程序目录和配置文件目录
vi /home/npt_cluster/bin/fdfs_trackerd
> PRG=/usr/bin/fdfs_trackerd
> CONF=/etc/fdfs/tracker.conf
---
< PRG=/home/npt_cluster/opt/fastdfs/usr/bin/fdfs_trackerd
< CONF=/home/npt_cluster/opt/fastdfs/etc/fdfs/tracker.conf
vi /home/npt_cluster/bin/fdfs_storaged
> PRG=/usr/bin/fdfs_storaged
> CONF=/etc/fdf