安装libevent(运行时需求):yum -y install libevent
2、安装libevent(运行时需求)
若安装了桌面图形界面,就不需要安装;FastDFS依赖libevent库;
yum -y install libevent
3、 安装libfastcommon
wget https://github.com/happyfish100/libfastcommon/archive/V1.0.7.tar.gz
1)上传 libfastcommonV1.0.7.tar.gz到Centos机器上;
2)将 libfastcommonV1.0.7.tar.gz解压至/usr/local/下:
tar -zxvf V1.0.7.tar.gz -C /usr/local/
cd /usr/local/libfastcommon-1.0.7/
3)切换目录到:/usr/local/libfastcommon-1.0.7/ 下,接着进行编译和安装;
./make.sh #编译
./make.sh install #安装
(4)libfastcommon安装好后会在/usr/lib64 目录下生成 libfastcommon.so 库文件;
注意:由于FastDFS程序引用usr/lib目录所以需要将/usr/lib64下的库文件拷贝至/usr/lib下。
cd usr/lib64 cp libfastcommon.so /usr/lib
4、下载安装FastDFS
wget https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz
切换目录到: /usr/local/FastDFS/ 下,编译和安装
cd /usr/local/FastDFS/
./make.sh && ./make.sh install #编译之后接着进行安装
cd conf
安装成功将安装目录下的conf下的文件拷贝到/etc/fdfs/下;
cp /usr/local/fastdfs-5.05/conf/* /etc/fdfs/
5、配置和启动tracker
(1)切换目录到: /etc/fdfs/ 目录下
(2)拷贝一份新的tracker配置文件
cp tracker.conf.sample tracker.conf
(3)修改tracker.conf ;
vim tracker.conf
base_path=/home/yuqing/fastdfs 改为: base_path=/home/fastdfs
http.server_port 改为: 80
创建 /home/fastdfs 目录
mkdir /home/fastdfs
(5)启动tracker,运行如下命令
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
注意:在/home/fastdfs/ 目录下生成两个目录, 一个是数据,一个是日志
6、配置和启动storage
由于上面已经安装过FastDFS,这里只需要配置storage就好了;
(1)切换目录到: /etc/fdfs/ 目录下;
(2)拷贝一份新的storage配置文件
cp storage.conf.sample storage.conf
(3)修改storage.conf ; vim storage.conf
group_name=group1 #配置组名
base_path=/home/yuqing/fastdfs 改为: base_path=/home/fastdfs
#store存放文件的位置(store_path)
store_path0=/home/yuqing/fastdfs 改为: store_path0=/home/fdfs_storage
#如果有多个挂载磁盘则定义多个store_path,如下
#store_path1=.....
#store_path2=......
#配置tracker服务器:IP
tracker_server=192.168.172.20:22122
#如果有多个则配置多个tracker
#tracker_server=192.168.101.4:22122
#配置http端口
http.server_port=88
(4)创建 /home/fdfs_storage 目录
mkdir /home/fdfs_storage
(5)启动storage, 运行命令
本文暂时没有评论,来添加一个吧(●'◡'●)