CentOS7安装FastDFS文件系统
一.安装libfastcommon
1.切换root用户
su
2.安装C语言环境
yum install -y gcc gcc-c++
3.安装libevent
FastDFS依赖libevent库;
yum -y install libevent
4.安装libfastcommon
移动文件
mv filename path
拷贝文件
cp filename path
libfastcommon是FastDFS官方提供的,libfastcommon包含了FastDFS运行所需要的一些基础库。
(1)上传 libfastcommonV1.0.7.tar.gz到Centos机器上;
(2)将 libfastcommonV1.0.7.tar.gz解压至/usr/local/下:
解压文件
tar -zxvf {filename}
编译
./make.sh #编译
安装
./make.sh install #安装
libfastcommon安装好后会在/usr/lib64 目录下生成 libfastcommon.so 库文件;
注意:由于FastDFS程序引用usr/lib目录所以需要将/usr/lib64下的库文件拷贝至/usr/lib下。
cp libfastcommon.so /usr/lib
二.安装tracker
同上,拷贝、解压、编译、安装
安装完之后
安装成功将安装目录下的conf下的文件拷贝到/etc/fdfs/下;
/usr/local/fastdfs-5.05/
目录下的conf文件拷贝到 /etc/fdfs 下
三、配置和启动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
base_path=/home/fastdfs
http.server_port=80 #配置http端口
4、创建 /home/fastdfs 目录
mkdir /home/fastdfs
5、启动racker
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
注意:在/home/fastdfs/ 目录下生成两个目录, 一个是数据,一个是日志;
四、配置启动storage
(1)切换目录到: /etc/fdfs/ 目录下;
cd /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
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
启动完成后进入 /home/fdfs_storage/data 目录下,显示目录如下: