写了一个自动安装和配置FastDFS的脚本,还没有写好关于nginx的配置。先贴上,如下:
自动安装FastDFS,(这部分是之前同事写好的)
#!/bin/bash#instll gccecho "================== install gcc =================="cd ./gccRpm./gccInstall.shcd ..echo "================== gcc installed =================="#install depended Packagesecho "================== install depends =================="rpm -ivh libevent-1.4.13-4.el6.x86_64.rpmecho "================== depends installed =================="#install fastdfsecho "================== install fastdfs =================="tar -zxvf fdfsinstall.tar.gzcd FastDFS./make.sh./make.sh installcd ../echo "================= fastdfs installed =================="echo "================= install nginx =================="tar -zxvf nginx-1.6.2.tar.gztar -zxvf fastdfs-nginx-module_v1.15.tar.gzcd nginx-1.6.2./configure --prefix=/usr/local/nginx --add-module=../fastdfs-nginx-module/src --without-http_gzip_modulemakemake installcp ../fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/cd ..echo "================= fastdfs config ==================="./config.sh $1 $2 $3
config.sh脚本主要用来自动配置tracker和storage
#!/bin/bashrole=$1path=/home/fastdfs/$rolesed -i 's/\(disabled=\)\S\S*/\1false/' /etc/fdfs/$role.confsed -i "s:\(base_path=\)\S\S*:\1${path}:" /etc/fdfs/$role.confsed -i 's/\(port=\)\S\S*/\122122/' /etc/fdfs/$role.confsed -i 's/\(http.server_port=\)\S\S*/\18080/' /etc/fdfs/$role.confif [[ $role == "storage" ]]; then sed -i "s:\(group_name=\)\S\S*:\1group${2}:" /etc/fdfs/$role.conf sed -i "s#\(tracker_server=\)\S\S*#\1${3}:22122#" /etc/fdfs/$role.conf sed -i "s:\(store_path0=\)\S\S*:\1${path}:" /etc/fdfs/$role.conf sed -i "s:\(store_path_count\)\S\S*:\11:" /etc/fdfs/$role.conffi