nginx 와 fsfs 분산 파일 을 원 키 로 설치 하여 셸 스 크 립 트 를 저장 합 니 다.

#!/bin/bash
# lty 20180116
# fastdfs install script

if [ `id -u` -ne 0 ];then
    echo " root  ,    "
    exit 0
fi
if [ ! -f "/root/soft/fastdfs_install.sh" ];then
    echo "        /root/soft         。"
fi

install_fdfs()
{
cd /root/soft
wget https://codeload.github.com/happyfish100/libfastcommon/zip/master -O libfastcommon-master.zip
if [ ! -f "libfastcommon-master.zip" ];then
    echo "  libfastcommon-master.zip  " && exit 1 
fi
unzip libfastcommon-master.zip
cd libfastcommon-master/
sh ./make.sh
sh ./make.sh install
cd ..
wget http://jaist.dl.sourceforge.net/project/fastdfs/FastDFS%20Server%20Source%20Code/FastDFS%20Server%20with%20PHP%20Extension%20Source%20Code%20V5.08/FastDFS_v5.08.tar.gz
if [ ! -f "FastDFS_v5.08.tar.gz" ];then
    echo "  FastDFS_v5.08.tar.gz  " && exit 1
fi
tar xf FastDFS_v5.08.tar.gz
cd FastDFS
sh ./make.sh
sh ./make.sh install
cd /etc/fdfs/
cp storage.conf.sample storage.conf
cp tracker.conf.sample tracker.conf
cp client.conf.sample client.conf

mkdir -p /data/fastdfs
sed -i "s@/home/yuqing/@/data/@g" ./*f
}

install_nginx()
{
cd /root/soft
wget http://nchc.dl.sourceforge.net/project/fastdfs/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz
if [ ! -f "fastdfs-nginx-module_v1.16.tar.gz" ];then
    echo "  fastdfs-nginx-module_v1.16.tar.gz  "
fi 
tar xf fastdfs-nginx-module_v1.16.tar.gz 
cd fastdfs-nginx-module/src/
sed -i "s@/usr/local/@/usr/@g" config
#      vim config,/usr/local  /usr,  :%s+/usr/local/+/usr/+g             
\cp mod_fastdfs.conf /etc/fdfs/

#     fastdfs
IPLINE=`ip addr | grep -E 'inet 172|inet 192|inet 10' | awk -F'[/]' '{print$1}' | awk '{print$2}' |wc -l`
if [ $IPLINE -gt 1 ];then
echo "       IP,     /etc/fdfs/mod_fastdfs.conf tracker_server "
elif [ $IPLINE -eq 1 ];then
IP=`ip addr | grep -E 'inet 172|inet 192|inet 10' | awk -F'[/]' '{print$1}' | awk '{print$2}'`
sed -i "s@tracker:22122@$IP:22122@" /etc/fdfs/mod_fastdfs.conf
sed -i "[email protected]@$IP@g" /etc/fdfs/*conf
sed -i "[email protected]@$IP@g" /etc/fdfs/*conf
else
echo "        IP,     /etc/fdfs/mod_fastdfs.conf tracker_server "
fi
sed -i "s@url_have_group_name = false@url_have_group_name = true@" /etc/fdfs/mod_fastdfs.conf
sed -i "s@home/yuqing@data@g" /etc/fdfs/*conf

#            nginx
NGINX_PROC=`ps -ef | grep nginx | grep -v grep`
if [ $NGINX_PROC ];then
echo "  nginx  ,   nginx  。     nginx.conf"
return
fi

cd /root/soft
yum install -y pcre-devel zlib-devel
wget http://nginx.org/download/nginx-1.12.2.tar.gz
if [ ! -f "nginx-1.12.2.tar.gz" ];then
    echo "  nginx-1.12.2.tar.gz  " && exit 1
fi
tar xf nginx-1.12.2.tar.gz
cd nginx-1.12.2
./configure --prefix=/apps/nginx/ --add-module=../fastdfs-nginx-module/src/
make
make install
cd /apps/nginx/conf
cat > /apps/nginx/conf/nginx.conf < 
  


좋은 웹페이지 즐겨찾기