安裝依賴包
yum install git gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl-devel -y
安裝libfastcommon
cd /opt/fastdfs
//下載
git clone https://github.com/happyfish100/libfastcommon.git --depth 1
cd libfastcommon
//安裝
./make.sh && ./make.sh install
安裝fastdfs
cd /opt/fastdfs
//下載
git clone https://github.com/happyfish100/fastdfs.git --depth 1
cd fastdfs
//安裝
./make.sh && ./make.sh install
配置tracker
/etc/fdfs
cp tracker.conf.sample tracker.conf
vim tracker.conf
修改base_path = /fastdfs/tracker
# 創建上面配置的tracker目錄
mkdir -p /fastdfs/tracker
# 啟動tracker
/etc/init.d/fdfs_trackerd start
#查看啟動情況
[root@192 fdfs]# netstat -tunlp | grep fdfs
tcp 0 0 0.0.0.0:22122 0.0.0.0:* LISTEN 11333/fdfs_trackerd
#設置tracker開機啟動
vim /etc/rc.d/rc.local
加入這句:
/etc/init.d/fdfs_trackerd start
配置storage
cd /etc/fdfs
cp storage.conf.sample storage.conf
vim storage.conf
做如下修改:
base_path = /fastdfs/storage
store_path0 = /fastdfs/file
tracker_server = 192.168.25.131:22122 #此處IP根據實際填寫
#創建需要的storage目錄
mkdir -p /fastdfs/storage
mkdir -p /fastdfs/file
#啟動storage
/etc/init.d/fdfs_storaged start
#設置storage開機啟動:
vim /etc/rc.d/rc.local
加入這行:
/etc/init.d/fdfs_storaged start
上傳測試
修改客戶端配置文件
cd /etc/fdfs
cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf
vim client.conf
做如下修改
base_path = /fastdfs/client
tracker_server = 192.168.25.131:22122 #IP根據實際填寫
創建一個txt文件,並上傳
[root@localhost fdfs]# echo "hello">a.txt
[root@localhost fdfs]# /usr/bin/fdfs_upload_file /etc/fdfs/client.conf a.txt
group1/M00/00/00/wKgZg187jumAUztfAAAABjY6MCA472.txt
#這串返回值后面測試要用,記下來
安裝nginx
安裝
cd /opt
wget http://nginx.org/download/nginx-1.14.0.tar.gz #下載
tar -zxf nginx-1.14.0.tar.gz #解壓
cd nginx-1.14.1/
#安裝到/usr/local/nginx
./configure --prefix=/usr/local/nginx
make
make install
配置
cd /usr/local/nginx/conf
vim nginx.conf
加上紅框部分:
啟動或重啟nginx
cd ../sbin/
./nginx
或者
./nginx -s reload
測試下載
打開瀏覽器,輸入地址:
http://192.168.25.131/group1/M00/00/00/wKgZg187jumAUztfAAAABjY6MCA472.txt
可以正常訪問,則說明安裝成功