Fastdfs安装
1、因為FastDfs是用C語言開發的,安裝需要用到gcc編譯工具,所以首先安裝gcc編譯工具
yum install -y gcc gcc-c++2、FastDFS依賴libevent庫,需要安裝libevent。
yum -y install libevent3、安裝libfastcommon工具,在github上下載master分支,上傳后進行解壓、編譯和安裝
unzip libfastcommon-master.zip cd libfastcommon-master ./make.sh ./make.sh install4、libfastcommon安裝好后會在/usr/lib64 目錄下生成 ?libfastcommon.so 庫文件,將?libfastcommon.so 拷貝到/usr/lib
cp libfastcommon.so /usr/lib5、將FastDfs的安裝包上傳后,進行解壓、編譯和安裝
tar -zxvf fastdfs-5.11.tar.gz cd fastdfs-5.11 ./make.sh ./make.sh install6、安裝成功后將conf下的文件拷貝到/etc/fdfs/下
cp /usr/local/FastDFS/conf/* /etc/fdfs/配置和啟動tracker
7、進入/etc/fdfs目錄下,拷貝tracker.conf.sample為tracker.conf
cd /etc/fdfs/ cp tracker.conf.sample tracker.conf8、修改tracker.conf中內容base_path和http.server_port
base_path:用于存儲日志、分組信息和服務器列表的位置
http.server_port:為配置http端口
base_path=/home/fastdfs http.server_port=80 #配置http端口9、啟動tracker,運行命令如下:
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart?配置和啟動storage
切換到目錄?/etc/fdfs/,修改storage.conf,如果沒有此文件的的話,則拷貝一份storage.conf.sample 為storage.conf
cp storage.conf.sample storage.conf vim storage.conf修改內容如下:
group_name=group1? 修改組名
base_path=/home/yuqing/fastdfs? 修改為自己定義的路徑,在這里修改為 base_path=/home/fastdfs
store_path0=/home/yuqing/fastdfs? 修改文件存儲路徑,在這里修改為 store_path0=/home/fdfs_storage
tracker_server=192.168.209.121:22122 配置tracker服務器IP
http.server_port : 配置http端口
10、啟動storage,運行命令如下:
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart?11、測試是否安裝成功
我們隨便上傳個文件或圖片,在這里上傳了張php.jpg的圖片到/home路徑下,通過如下命令進行測試是否安裝配置成功
/usr/bin/fdfs_test /etc/fdfs/client.conf upload /home/php.jpg看到如下結果表示安裝成功,第一個被標識的為文件的存儲路徑,第二個為文件URL地址
?注意在阿里云上運行上述命令測試時會報如下錯誤
先后提示22122和23000端口無法連接,需要在阿里云的管理控制臺添加安全組規則,配置如下:
?
轉載于:https://www.cnblogs.com/chentop/p/10318582.html
總結
- 上一篇: mac电脑sublime text3安装
- 下一篇: 模型多语言