##使用root账户登录
su root
##编译环境
apt-get -y install git gcc g++ make automake autoconf libtool pcre2-utils libpcre2-dev zlib1g zlib1g-dev openssl libssh-dev wget vim
##/home路径下,创建文件夹
cd /home
mkdir fdfs_storage
mkdir fastdfs
##进入/usr/local/src路径下 上传文件fastdfs.tar.gz、libfastcommon.tar.gz、nginx-1.21.3.tar.gz与fastdfs-nginx-module.tar.gz
cd /usr/local/src
##分别解压
tar -xvf fastdfs.tar.gz
tar -xvf libfastcommon.tar.gz
tar -xvf fastdfs-nginx-module.tar.gz
tar -xvf nginx-1.21.3.tar.gz
##编译安装libfastcommon
cd /usr/local/src/libfastcommon/
chmod +x make.sh
./make.sh && ./make.sh install
##编译安装fastdfs
cd /usr/local/src/fastdfs/
chmod +x make.sh
./make.sh && ./make.sh install
##复制文件到/etc/fdfs
cp /usr/local/src/fastdfs/conf/http.conf /etc/fdfs/
cp /usr/local/src/fastdfs/conf/mime.types /etc/fdfs/
##编译安装fastdfs-nginx-module
cd /usr/local/src/fastdfs-nginx-module/
cp /usr/local/src/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs
##进入nginx安装目录
cd /usr/local/src/nginx-1.21.3
apt-get -y install gcc libpcre3 libpcre3-dev zlib1g-dev openssl libssl-dev
./configure --add-module=/usr/local/src/fastdfs-nginx-module/src/
make && make install
cd /usr/local/nginx/sbin
##启动
./nginx
##上传tracker.conf到/etc/fdfs/路径下,修改tracker.conf配置(配置已预先填好)
cd /etc/fdfs
vi /etc/fdfs/tracker.conf
##修改以下配置
port=22122
base_path=/home/fastdfs
##上传storage.conf到/etc/fdfs/路径下,修改storage.conf配置(配置已预先填好)
vi /etc/fdfs/storage.conf
##修改以下配置
port=23000
base_path=/home/fastdfs
store_path0=/home/fdfs_storage
tracker_server=server1:22122
# http访问文件的端口(默认8888,看情况修改,和nginx中保持一致)
http.server_port=8083
##上传client.conf到/etc/fdfs/路径下,修改client.conf配置(配置已预先填好)
vi /etc/fdfs/client.conf
##修改以下配置
base_path=/home/fastdfs
tracker_server=server1:22122
##设置执行权限
chmod +x /usr/bin/fdfs_*
##启动服务
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf start
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start
##查看进程
ps -ef|grep storage
ps -ef|grep tracker
##nginx配置
##修改mod_fastdfs.conf
vi /etc/fdfs/mod_fastdfs.conf
##修改一下内容
tracker_server=server1:22122 # 服务器1
url_have_group_name=true
base_path=/home/fastdfs
store_path0=/home/fdfs_storage
##修改nginx.conf
vi /usr/local/nginx/conf/nginx.conf
listen 8083
server_name IP16
location /group1/M00 {
root /home/fdfs_storage/data;
ngx_fastdfs_module;
}
##等所有集群安装完成之后测试
fdfs_upload_file /etc/fdfs/client.conf /usr/local/src/libfastcommon.tar.gz
http://server:8083/group1/M00/00/00/wKgAQ1pysxmAaqhAAA76tz-dVgg.tar.gz
ubuntu FastDFS环境下 安装部署
最新推荐文章于 2024-08-26 16:16:44 发布