如何安装fastdfs
时间: 2023-10-13 11:19:01 浏览: 42
安装 FastDFS 需要以下步骤:
1. 安装 libfastcommon
```
$ git clone https://github.com/happyfish100/libfastcommon.git
$ cd libfastcommon/
$ ./make.sh
$ ./make.sh install
```
2. 安装 FastDFS
```
$ git clone https://github.com/happyfish100/fastdfs.git
$ cd fastdfs/
$ ./make.sh
$ ./make.sh install
```
3. 配置 FastDFS
- 创建存储目录
```
$ mkdir -p /fastdfs/storage/data
$ mkdir -p /fastdfs/tracker
```
- 修改配置文件
进入 FastDFS 安装目录下的 `conf` 目录,复制 `http.conf.sample` 和 `mime.types.sample` 文件为 `http.conf` 和 `mime.types`,修改 `http.conf` 文件中的 `base_path` 和 `url_have_group_name` 配置项:
```
base_path=/fastdfs/storage
url_have_group_name = true
```
- 修改 tracker 配置文件
进入 FastDFS 安装目录下的 `conf` 目录,复制 `tracker.conf.sample` 文件为 `tracker.conf`,修改 `tracker.conf` 文件中的 `base_path` 配置项:
```
base_path=/fastdfs/tracker
```
4. 启动 FastDFS
- 启动 tracker
```
$ /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start
```
- 启动 storage
```
$ /usr/bin/fdfs_storaged /etc/fdfs/storage.conf start
```
5. 测试 FastDFS
上传文件:
```
$ /usr/bin/fdfs_upload_file /etc/fdfs/client.conf test.jpg
```
下载文件:
```
$ /usr/bin/fdfs_download_file /etc/fdfs/client.conf group1 M00/00/00/wKjThF8CjJyAZ0dYAAEJUBC3hLM216.jpg test_download.jpg
```
以上就是安装 FastDFS 的基本步骤。注意,这只是最基本的安装步骤,具体实现还需要根据实际情况进行配置和调整。