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

结束!!!

原文地址:https://www.cnblogs.com/homjun/p/14841843.html