CentOS-7.6-ARM 離線安裝部署FastDFS


基礎環境

  • CentOS7.6 ARM
  • 關閉防火牆、selinux
  • 安裝需要的包:

-https://sourceforge.net/projects/fastdfs/files/FastDFS Nginx Module Source Code/fastdfs-nginx-module_v1.15.tar.gz/download
-https://github.com/happyfish100/libfastcommon/archive/V1.0.38.tar.gz
-https://github.com/happyfish100/fastdfs/archive/V5.11.tar.gz
-http://nginx.org/download/nginx-1.15.2.tar.gz

百度雲盤
鏈接: https://pan.baidu.com/s/1ABHsf1Fp4AMIDNfX193_SQ 密碼: pld5

編譯和安裝

利用本地源安裝FastDFS依賴環境

yum -y install gcc-c++ zlib-devel
yum -y install pcre pcre-devel openssl ssl-devel perl-devel 

安裝FastDFS依賴包libfastcommon

cd /usr/local/src
##wget https://github.com/happyfish100/libfastcommon/archive/V1.0.38.tar.gz
tar -zxvf libfastcommon-1.0.38.tar.gz
cd libfastcommon-1.0.38/
./make.sh
./make.sh install

安裝FastDFS

cd /usr/local/src
##wget https://github.com/happyfish100/fastdfs/archive/V5.11.tar.gz
tar -zxvf fastdfs-5.11.tar.gz
cd fastdfs-5.11/
./make.sh
./make.sh install

將配置文件復制到系統為fdfs預設的目錄

cd /usr/local/src/fastdfs-5.11/conf
cp mime.types http.conf /etc/fdfs/

查看安裝FastDFS過程中產生的可執行文件

ll /usr/bin/fdfs*
顯示類似如下內容表示安裝成功

-rwxr-xr-x 1 root root  381896 Jul  9 14:45 /usr/bin/fdfs_appender_test
-rwxr-xr-x 1 root root  381680 Jul  9 14:45 /usr/bin/fdfs_appender_test1
-rwxr-xr-x 1 root root  372592 Jul  9 14:45 /usr/bin/fdfs_append_file
-rwxr-xr-x 1 root root  372392 Jul  9 14:45 /usr/bin/fdfs_crc32
-rwxr-xr-x 1 root root  372624 Jul  9 14:45 /usr/bin/fdfs_delete_file
-rwxr-xr-x 1 root root  373360 Jul  9 14:45 /usr/bin/fdfs_download_file
-rwxr-xr-x 1 root root  372976 Jul  9 14:45 /usr/bin/fdfs_file_info
-rwxr-xr-x 1 root root  382640 Jul  9 14:45 /usr/bin/fdfs_monitor
-rwxr-xr-x 1 root root 1138424 Jul  9 14:45 /usr/bin/fdfs_storaged
-rwxr-xr-x 1 root root  387728 Jul  9 14:45 /usr/bin/fdfs_test
-rwxr-xr-x 1 root root  386984 Jul  9 14:45 /usr/bin/fdfs_test1
-rwxr-xr-x 1 root root  520352 Jul  9 14:45 /usr/bin/fdfs_trackerd
-rwxr-xr-x 1 root root  373584 Jul  9 14:45 /usr/bin/fdfs_upload_appender
-rwxr-xr-x 1 root root  374616 Jul  9 14:45 /usr/bin/fdfs_upload_file

配置FastDFS

分別對tracker,storage,client進行配置

創建目錄

mkdir /home/fastdfs/tracker -p
mkdir /home/fastdfs/storage -p
cd /etc/fdfs/

配置tracker

cp tracker.conf.sample tracker.conf
vi tracker.conf

將內容修改為“base_path=/home/fastdfs/tracker”和“thread_stack_size = 128KB”,如下:

# the base path to store data and log files
22 base_path=/home/fastdfs/tracker
......
# thread stack size, should >= 64KB
# default value is 64KB
122 thread_stack_size = 128KB

啟動tracker

/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start

tracker 啟動報錯移步
https://blog.csdn.net/Mabanana/article/details/88076465

配置storage

cd /etc/fdfs/

cp storage.conf.sample storage.conf

vi storage.conf

將內容修改為“base_path=/home/fastdfs/storage”、“store_path0=/home/fastdfs/storage”和“tracker_server=XX.XX.XX.XX:22122”。
修改后的內容,如下面加粗部分所示,其中“192.168.1.206”為示例,應根據實際虛擬IP地址填寫。

# the base path to store data and log files
37 base_path=/home/fastdfs/storage
...
# store_path#, based 0, if store_path0 not exists, it's value is base_path
# the paths must be exist
100 store_path0=/home/fastdfs/storage
#store_path1=/home/yuqing/fastdfs2
.....
# tracker_server can ocur more than once, and tracker_server format is
#  "host:port", host can be hostname or ip address
109 tracker_server=192.168.1.206:22122

啟動storage

/usr/bin/fdfs_storaged /etc/fdfs/storage.conf start

查看storage啟動日志

vi /home/fastdfs/storage/logs/storaged.log

查看最后幾行,顯示類似如下所示,表示啟動成功

[2019-07-09 17:03:51] INFO - file: tracker_client_thread.c, line: 310, successfully connect to tracker server 192.168.1.206:2
2122, as a tracker client, my ip is 192.168.1.206
[2019-07-09 17:04:21] INFO - file: tracker_client_thread.c, line: 1263, tracker server 192.168.1.206:22122, set tracker leade
r: 192.168.1.206:22122

配置client

cd /etc/fdfs/
cp client.conf.sample client.conf
vi client.conf

將內容修改為“base_path=/home/fastdfs/tracker”和“tracker_server=XX.XX.XX.XX:22122”。
修改后的內容,如下面加粗部分所示,其中“192.168.1.206”為示例,應根據實際虛擬IP地址填寫。

# the base path to store log files
10 base_path=/home/fastdfs/tracker
......
# tracker_server can ocur more than once, and tracker_server format is
#  "host:port", host can be hostname or ip address
14 tracker_server=192.168.1.206:22122

安裝和配置fastdfs-nginx-module

安裝fastdfs-nginx-module

cd /usr/local/src
wget http://
tar -zxvf fastdfs-nginx-module-v1.15.tar.gz

配置fastdfs-nginx-module的“config”文件

vim /usr/local/src/fastdfs-nginx-module/src/config
--去掉所有路徑中的local

##CORE_INCS="$CORE_INCS /usr/local/include/fastdfs /usr/local/include/fastcommon/"
##CORE_LIBS="$CORE_LIBS -L/usr/local/lib -lfastcommon -lfdfsclient"
4 CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
5 CORE_LIBS="$CORE_LIBS -L/usr/lib -lfastcommon -lfdfsclient"

配置fastdfs-nginx-module的“mod_fastdfs.conf”文件

cp /usr/local/src/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/
---
vi /etc/fdfs/mod_fastdfs.conf
10 base_path=/home/fastdfs
40 tracker_server=127.0.0.1:22122
53 url_have_group_name = true
62 store_path0=/home/fastdfs/storage
94 http.need_find_content_type=true

安裝和配置Nginx

安裝Nginx

cd /usr/local/src/

wget http://nginx.org/download/nginx-1.15.2.tar.gz

tar -zxvf nginx-1.15.2.tar.gz

cd nginx-1.15.2

./configure --prefix=/usr/local/nginx --add-module=/usr/local/src/fastdfs-nginx-module/src/

make -j 32 
make install

說明
"-j"參數可利用多核CPU加快編譯速度,在本示例中,使用的是32核CPU,所以此處為“-j 32”
可通過下述命令查詢CPU核數:

cat /proc/cpuinfo| grep "processor"| wc -l

配置Nginx

cd /usr/local/nginx/conf/

vi nginx.conf

---
server {
listen80;
server_name  localhost;

#charset koi8-r;

#access_log  logs/host.access.log  main;

location ~/M00{
root   /home/fastdfs/storage/data;
ngx_fastdfs_module;
}

location / {
root   html;
index  index.html index.htm;
}
}

運行

啟動nginx

/usr/local/nginx/sbin/nginx

結束!!!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM