完善单机部署文档
parent
646e906dff
commit
a351693184
59
Home.md
59
Home.md
|
|
@ -1,39 +1,42 @@
|
|||
[TOC]
|
||||
# 环境准备
|
||||
## 目录准备
|
||||
## 编译环境
|
||||
```shell
|
||||
yum install git gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl-devel -y
|
||||
```
|
||||
## 目录
|
||||
|说明|位置|
|
||||
|-|-|
|
||||
|安装包|/usr/local/src|
|
||||
|所有安装包|/usr/local/src|
|
||||
|tracker跟踪服务器数据|/fastdfs/tracker|
|
||||
|storage存储服务器数据|/fastdfs/storage|
|
||||
```shell
|
||||
mkdir -p /fastdfs/tracker #创建跟踪服务器数据目录
|
||||
mkdir -p /fastdfs/storage #创建存储服务器数据目录
|
||||
cd /usr/local/src #切换到安装目录准备安装包
|
||||
# 准备编译环境
|
||||
yum install git gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl-devel -y
|
||||
#切换到安装目录准备下载安装包
|
||||
cd /usr/local/src
|
||||
```
|
||||
## 安装libfatscommon
|
||||
```shell
|
||||
git clone https://github.com/happyfish100/libfastcommon.git --depth 1
|
||||
cd libfastcommon/
|
||||
./make.sh
|
||||
./make.sh install
|
||||
./make.sh && ./make.sh install
|
||||
```
|
||||
## 安装FastDFS
|
||||
```shell
|
||||
git clone https://github.com/happyfish100/fastdfs.git --depth 1
|
||||
cd fastdfs/
|
||||
./make.sh
|
||||
./make.sh install
|
||||
./make.sh && ./make.sh install
|
||||
#配置文件准备
|
||||
cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
|
||||
cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf
|
||||
cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf #客户端文件,测试用
|
||||
cp /usr/local/src/fastdfs/conf/http.conf /etc/fdfs/ #供nginx访问使用
|
||||
cp /usr/local/src/fastdfs/conf/mime.types /etc/fdfs/ #供nginx访问使用
|
||||
```
|
||||
## 安装fastdfs-nginx-module
|
||||
```shell
|
||||
git clone https://github.com/happyfish100/fastdfs-nginx-module.git --depth 1
|
||||
cp /usr/local/src/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs
|
||||
```
|
||||
## 安装nginx
|
||||
```shell
|
||||
|
|
@ -41,9 +44,8 @@ wget http://nginx.org/download/nginx-1.12.2.tar.gz
|
|||
tar -zxvf nginx-1.12.2.tar.gz
|
||||
cd nginx-1.12.2/
|
||||
#添加fastdfs-nginx-module模块
|
||||
./configure --prefix=/opt/nginx/ --add-module=/usr/local/src/fastdfs-nginx-module/src/
|
||||
make
|
||||
make install
|
||||
./configure --add-module=/usr/local/src/fastdfs-nginx-module/src/
|
||||
make && make install
|
||||
```
|
||||
# 单机部署
|
||||
## tracker配置
|
||||
|
|
@ -64,7 +66,7 @@ port=23000 # storage服务端口(默认23000,一般不修改)
|
|||
base_path=/fastdfs/storage # 数据和日志文件存储根目录
|
||||
store_path0=/fastdfs/storage # 第一个存储目录
|
||||
tracker_server=192.168.0.xxx:22122 # tracker服务器IP和端口
|
||||
http.server_port=8888 # http访问文件的端口(默认888,一般不修改)
|
||||
http.server_port=8888 # http访问文件的端口(默认8888,看情况修改,和nginx中保持一致)
|
||||
#保存后启动
|
||||
/etc/init.d/fdfs_storaged start #启动storage服务
|
||||
chkconfig fdfs_storaged on #自启动storage服务
|
||||
|
|
@ -75,6 +77,31 @@ vim /etc/fdfs/client.conf
|
|||
#需要修改的内容如下
|
||||
base_path=/fastdfs/tracker
|
||||
tracker_server=192.168.1.xxx:22122 #tracker IP地址
|
||||
#保存后测试
|
||||
fdfs_upload_file /etc/fdfs/client.conf /usr/local/src/nginx-1.12.2.tar.gz #返回ID表示成功
|
||||
#保存后测试,返回ID表示成功 eg:group1/M00/00/00/wKgAQ1pysxmAaqhAAA76tz-dVgg.tar.gz
|
||||
fdfs_upload_file /etc/fdfs/client.conf /usr/local/src/nginx-1.12.2.tar.gz
|
||||
```
|
||||
## 配置nginx访问
|
||||
```shell
|
||||
vim /etc/fdfs/mod_fastdfs.conf
|
||||
#需要修改的内容如下
|
||||
tracker_server=192.168.0.xxx:22122
|
||||
url_have_group_name=true
|
||||
store_path0=/fastdfs/storage
|
||||
#配置nginx.config
|
||||
vi /usr/local/nginx/conf/nginx.conf
|
||||
#添加如下配置
|
||||
server {
|
||||
listen 8888; ## 该端口为storage.conf中的http.server_port相同
|
||||
server_name localhost;
|
||||
location ~/group[0-9]/ {
|
||||
ngx_fastdfs_module;
|
||||
}
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root html;
|
||||
}
|
||||
}
|
||||
#测试下载,用外部浏览器访问刚才已传过的nginx安装包,引用返回的ID
|
||||
http://192.168.0.xxx:8888/group1/M00/00/00/wKgAQ1pysxmAaqhAAA76tz-dVgg.tar.gz
|
||||
#弹出下载单机部署全部跑通,否则首先检查防火墙,再检查其他配置。
|
||||
```
|
||||
Loading…
Reference in New Issue