SSH安装之DedeCMS

2011年3月8日 | 分类: Linux | 标签: , , , , , , , , ,

环境:CentOS 5.5+LNMP

wget http://www.yishanhome.com/wp-content/uploads/2011/03/dedecms.sh;sh dedecms.sh

dedecms.sh代码:

?Download dedecms.sh
#!/bin/bash
array=(http://updatenew.dedecms.com/base-v57/package/DedeCmsV5.7-UTF8-Final.tar.gz http://updatenew.dedecms.com/base-v57/package/DedeCmsV5.7-GBK-Final.tar.gz)
length=${#array[@]}
usage()
{
clear
printf "
#This is a Shell-Based tool
# Author: yishan
# Website: http://www.yishanhome.com
"
for ((i=0; i<$length; i++))
do
let "m = $i + 1"
echo "$m. ${array[$i]}"
done
echo ""
option=0
read -p "Please input your option:" option
let "option = $option + 0"
  if [ "$option" -eq "0" ] || [ "$option" -gt "$length" ] ; then
    usage
  fi
}
 
check_source()
{
  echo "checking $1"
  httpvalue=`wget -nv --spider $1 2>&1|sed q|awk '{print $1}'`
  if [ -z $httpvalue ]; then
    echo "OK!"
  else
    echo "NOT accessible, please check"
    exit
  fi
}
 
input_domain()
{
  read -p "Please input domain:" domain
  if [ "$domain" = "" ]; then
  input_domain
  fi
}
 
www_dir=/home
usage
let "option = $option - 1"
down_url=${array[$option]}
down_file=$(echo $down_url | awk -F\/ '{print $NF}')
sitecode=$(echo $down_file | awk -F\. '{print $1}')
check_source $down_url
mkdir $HOME/$sitecode
mkdir $www_dir/$sitecode
mkdir /usr/local/nginx/conf/vhost
input_domain
wget $down_url
 
if echo $down_file|grep -q .zip;then
unzip $down_file -d $HOME/$sitecode
fi
 
if echo $down_file|grep -q .tar.gz;then
tar -zxvf $down_file -C $HOME/$sitecode
fi
 
mv $HOME/$sitecode/uploads/* $www_dir/$sitecode/
cd $www_dir/$sitecode/
chmod 777 $www_dir/$sitecode
chmod 777 data -R
chmod 777 dede -R
chmod 777 templets -R
chmod 777 uploads -R
chmod 777 a -R
cat > /usr/local/nginx/conf/vhost/$domain.conf <<EOF
server
        {
                listen       80;
                server_name $domain;
                index index.html index.htm index.php default.html default.htm default.php;
                root  $www_dir/$sitecode;
                location ~ .*\.(php|php5)?$
                        {
                                fastcgi_pass  unix:/tmp/php-cgi.sock;
                                fastcgi_index index.php;
                                include fcgi.conf;
                        }
 
                location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
                        {
                                expires      30d;
                        }
 
                location ~ .*\.(js|css)?$
                        {
                                expires      12h;
                        }
 
                access_log off;
        }
EOF
 
/usr/local/nginx/sbin/nginx -s reload

注意安装完成后仍旧要删除安装文件夹

rm -f -R /home/DedeCmsV5/install

演示 http://dedecms.yishanhome.com

  1. 2011年4月7日17:05

    问一下,这个脚本会自动输入建立mysql那一步骤吗?

    ChromePlus 1.6.0.0 Windows 7
  2. 2011年4月7日17:10

    不会,仍然需要install.php进行安装

    Firefox 4.0 Windows Server 2003

返回顶部