安装libfastcommon
下载地址:https://github.com/happyfish100/libfastcommon
解压后进入目录执行
1、./make.sh
2、./make.sh install
检查一下/usr/lib下是否存在libfastcommon.so,如果不存在则需要从lib64复制过去
cp /usr/lib64/libfastcommon.so /usr/lib/
3、安装fastDFS(Tracker服务)
fastDFS下载地址:https://github.com/happyfish100/fastdfs
解压后进入目录执行
1、./make.sh
2、./make.sh install
3、cp conf /etc/fdfs/ 复制配置文件
4、vim /etc/fdfs/tracker.conf 修改配置文件
主要修改base_path的路径(用于存储store数据和日志文件)
5、/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf 启动服务
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart 重启服务
重新操作一次后成功
[root@localhost bin]#./ trackerd restart
-bash: ./: 是一个目录
[root@localhost bin]#./trackerd restart
-bash: ./trackerd: 没有那个文件或目录
[root@localhost bin]#./fdfs_trackerd
Usage: ./fdfs_trackerd <config_file> [start | stop | restart]
[root@localhost bin]#./fdfs_trackerd start
[2022-12-09 07:33:08] ERROR - file: shared_func.c, line: 960, open file /usr/bin/start fail, errno: 2, error info: No such file or directory
[2022-12-09 07:33:08] ERROR - file: process_ctrl.c, line: 167, load conf file "start" fail, ret code: 2
[root@localhost bin]#./fdfs_trackerd -start
[2022-12-09 07:34:38] ERROR - file: shared_func.c, line: 960, open file /usr/bin/-start fail, errno: 2, error info: No such file or directory
[2022-12-09 07:34:38] ERROR - file: process_ctrl.c, line: 167, load conf file "-start" fail, ret code: 2
[root@localhost bin]#cd ..
[root@localhost usr]#cd ..
[root@localhost /]#cd /usr/local
[root@localhost local]#ll
总用量 1612
drwxr-xr-x. 2 root root 6 4月 11 2018 bin
drwxr-xr-x. 2 root root 58 5月 23 2022 dockerjdk8
drwxr-xr-x. 2 root root 6 4月 11 2018 etc
drwxr-xr-x 10 8980 users 258 12月 9 07:05 FastDFS
-rw-r--r-- 1 root root 345400 11月 21 2018 FastDFS_v5.05.tar.gz
drwxr-xr-x. 2 root root 6 4月 11 2018 games
drwxr-xr-x. 2 root root 6 4月 11 2018 include
drwxr-xr-x. 2 root root 39 5月 1 2022 jdk
drwxr-xr-x. 2 root root 6 4月 11 2018 lib
drwxr-xr-x. 2 root root 6 4月 11 2018 lib64
drwxr-xr-x. 2 root root 6 4月 11 2018 libexec
drwxrwxr-x 3 root root 102 12月 9 07:03 libfastcommon-1.0.7
-rw-r--r-- 1 root root 73148 11月 21 2018 libfastcommonV1.0.7.tar.gz
drwxr-xr-x. 2 root root 31 5月 22 2022 myhtml
drwxr-xr-x. 3 root root 4096 5月 1 2022 mysql
-rw-r--r--. 1 root root 1221796 5月 1 2022 redis-2.8.9.zip
drwxr-xr-x. 2 root root 6 4月 11 2018 sbin
drwxr-xr-x. 5 root root 49 8月 27 2018 share
drwxr-xr-x. 2 root root 6 4月 11 2018 src
drwxr-xr-x. 3 root root 32 10月 8 2019 webapps
[root@localhost local]#cd lib
lib/ lib64/ libexec/ libfastcommon-1.0.7/ libfastcommonV1.0.7.tar.gz
[root@localhost local]#cd libfastcommon-1.0.7/
[root@localhost libfastcommon-1.0.7]#./make.sh
make: 对“all”无需做任何事。
[root@localhost libfastcommon-1.0.7]#./make.sh install
mkdir -p /usr/lib64
install -m 755 libfastcommon.so /usr/lib64
mkdir -p /usr/include/fastcommon
install -m 644 common_define.h hash.h chain.h logger.h base64.h shared_func.h pthread_func.h ini_file_reader.h _os_bits.h sockopt.h sched_thread.h http_func.h md5.h local_ip_func.h avl_tree.h ioevent.h ioevent_loop.h fast_task_queue.h fast_timer.h process_ctrl.h fast_mblock.h connection_pool.h /usr/include/fastcommon
[root@localhost libfastcommon-1.0.7]#cd ..
[root@localhost local]#cd FastDFS
[root@localhost FastDFS]#./make.sh
make: 对“all”无需做任何事。
make: 对“all”无需做任何事。
make: 对“all”无需做任何事。
[root@localhost FastDFS]#./make.sh install
mkdir -p /usr/bin
mkdir -p /etc/fdfs
cp -f fdfs_trackerd /usr/bin
if [ ! -f /etc/fdfs/tracker.conf.sample ]; then cp -f ../conf/tracker.conf /etc/fdfs/tracker.conf.sample; fi
mkdir -p /usr/bin
mkdir -p /etc/fdfs
cp -f fdfs_storaged /usr/bin
if [ ! -f /etc/fdfs/storage.conf.sample ]; then cp -f ../conf/storage.conf /etc/fdfs/storage.conf.sample; fi
mkdir -p /usr/bin
mkdir -p /etc/fdfs
mkdir -p /usr/lib64
cp -f fdfs_monitor fdfs_test fdfs_test1 fdfs_crc32 fdfs_upload_file fdfs_download_file fdfs_delete_file fdfs_file_info fdfs_appender_test fdfs_appender_test1 fdfs_append_file fdfs_upload_appender /usr/bin
if [ 0 -eq 1 ]; then cp -f libfdfsclient.a /usr/lib64; fi
if [ 1 -eq 1 ]; then cp -f libfdfsclient.so /usr/lib64; fi
mkdir -p /usr/include/fastdfs
cp -f ../common/fdfs_define.h ../common/fdfs_global.h ../common/mime_file_parser.h ../common/fdfs_http_shared.h ../tracker/tracker_types.h ../tracker/tracker_proto.h ../tracker/fdfs_shared_func.h ../storage/trunk_mgr/trunk_shared.h tracker_client.h storage_client.h storage_client1.h client_func.h client_global.h fdfs_client.h /usr/include/fastdfs
if [ ! -f /etc/fdfs/client.conf.sample ]; then cp -f ../conf/client.conf /etc/fdfs/client.conf.sample; fi
[root@localhost FastDFS]#cp /usr/lib64/libfastcommon.so /usr/lib/
[root@localhost FastDFS]#cp /conf/* /etc/fdfs/
cp: 无法获取"/conf/*" 的文件状态(stat): 没有那个文件或目录
[root@localhost FastDFS]#cp /conf/ /etc/fdfs/
cp: 无法获取"/conf/" 的文件状态(stat): 没有那个文件或目录
[root@localhost FastDFS]#ll
总用量 116
drwxr-xr-x 3 8980 users 4096 12月 9 07:36 client
drwxr-xr-x 2 8980 users 4096 12月 9 07:05 common
drwxr-xr-x 2 8980 users 146 12月 2 2014 conf
-rw-r--r-- 1 8980 users 35067 12月 2 2014 COPYING-3_0.txt
-rw-r--r-- 1 8980 users 2802 12月 2 2014 fastdfs.spec
-rw-r--r-- 1 8980 users 31386 12月 2 2014 HISTORY
drwxr-xr-x 2 8980 users 48 12月 2 2014 init.d
-rw-r--r-- 1 8980 users 7755 12月 2 2014 INSTALL
-rwxr-xr-x 1 8980 users 5813 12月 2 2014 make.sh
drwxr-xr-x 2 8980 users 320 12月 2 2014 php_client
-rw-r--r-- 1 8980 users 2380 12月 2 2014 README.md
-rwxr-xr-x 1 8980 users 1768 12月 2 2014 restart.sh
-rwxr-xr-x 1 8980 users 1680 12月 2 2014 stop.sh
drwxr-xr-x 4 8980 users 4096 12月 9 07:36 storage
drwxr-xr-x 2 8980 users 317 12月 2 2014 test
drwxr-xr-x 2 8980 users 4096 12月 9 07:36 tracker
[root@localhost FastDFS]#cd conf
[root@localhost conf]#ll
总用量 84
-rw-r--r-- 1 8980 users 23981 12月 2 2014 anti-steal.jpg
-rw-r--r-- 1 8980 users 1461 12月 2 2014 client.conf
-rw-r--r-- 1 8980 users 858 12月 2 2014 http.conf
-rw-r--r-- 1 8980 users 31172 12月 2 2014 mime.types
-rw-r--r-- 1 8980 users 7829 12月 2 2014 storage.conf
-rw-r--r-- 1 8980 users 105 12月 2 2014 storage_ids.conf
-rw-r--r-- 1 8980 users 7102 12月 2 2014 tracker.conf
[root@localhost conf]#cp /conf /etc/fdfs/
cp: 无法获取"/conf" 的文件状态(stat): 没有那个文件或目录
[root@localhost conf]#cd ..
[root@localhost FastDFS]#cp /conf/* /etc/fdfs/
cp: 无法获取"/conf/*" 的文件状态(stat): 没有那个文件或目录
[root@localhost FastDFS]#cp /conf /etc/fdfs/
cp: 无法获取"/conf" 的文件状态(stat): 没有那个文件或目录
[root@localhost FastDFS]#cp conf /etc/fdfs/
cp: 略过目录"conf"
[root@localhost FastDFS]#/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
[root@localhost FastDFS]#/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
waiting for pid [5038] exit ...
starting ...
[root@localhost FastDFS]#