首先我们需要下载相对应的安装包:
libfastcommon
git clone https://github.com/happyfish100/libfastcommon.git
FastDFS
git clone https://github.com/happyfish100/fastdfs.git
下载完成后我们先直接进入到源码根目录
1.安装libfastcommon
我们进入到libfastcommon-master目录中执行./make.sh和sudo ./make.sh install,具体代码如下:
cd libfastcommon
./make.sh
sudo ./make.sh install
2.安装FastDFS,下载 地址
同安装libfastcommon一样,我们先进入到fastdfs-master目录中,执行./make.sh和sudo ./make.sh install,具体代码如下:
cd fastdfs
./make.sh
sudo ./make.sh install
3.配置
安装完成后我们要进行一些配置
配置跟踪服务器tracker
拷贝tracker配置文件
sudo cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
2.在/home/python/目录中创建目录 fastdfs/tracker
mkdir -p /home/python/fastdfs/tracker/
3.编辑/etc/fdfs/tracker.conf配置文件
sudo vim /etc/fdfs/tracker.conf
修改其中的base_path
base_path=/home/xxx/fastdfs/tracker
配置存储服务器storage
拷贝storage配置文件
sudo cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf
2.在/home/python/目录中创建目录 fastdfs/storage
mkdir -p /home/xxx/fastdfs/storage/
3.编辑/etc/fdfs/storage.conf 配置文件
sudo vim /etc/fdfs/storage.conf
修改其中的base_path, store_path0, tracker_server
base_path=/home/xxx/fastdfs/storage
store_path0=/home/xxx/fastdfs/storage
tracker_server=Mac的IP地址:22122
启动tracker和storage
sudo /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
sudo /usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
查看是否启动成功
ps aux|grep fdfs
username 7884 0.0 0.0 4268056 808 s004 S+ 8:28下午 0:00.00 grep fdfs
root 7868 0.0 0.4 4383916 66792 ?? S 8:27下午 0:02.14 fdfs_storaged /etc/fdfs/storage.conf restart
root 7855 0.0 0.0 4323576 988 ?? S 8:27下午 0:00.01 fdfs_trackerd /etc/fdfs/tracker.conf restart
如上述显示,则表示启动成功。
测试是否安装成功
拷贝client配置文件
sudo cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf
2.修改client配置文件
sudo vim /etc/fdfs/client.conf
修改内容:
base_path=/home/xxx/fastdfs/tracker
tracker_server=Mac的IP地址:22122
上传文件测试
fdfs_upload_file /etc/fdfs/client.conf 要上传的图片 //如:dfs_upload_file /etc/fdfs/client.conf
fdfs_upload_file /etc/fdfs/client.conf /Users/xxx/Desktop/20190812215720.jpg
如果返回类似group1/M00/00/00/wKgCZl0OIFWAZOVMAABwSY4nz_Q55.jpeg的文件id则说明文件上传成功。
group1/M00/00/00/wKgBoV1WSS6AJAnIAALt2JX72nY651.jpg
结尾
以上就是FastDFS在Mac上的安装,ok!这只是一个简单的安装,有情况 下可能还需要安装 nginx配合使用。欢迎留言交流