lj2007331 8 лет назад
Родитель
Сommit
43040a8c2e
5 измененных файлов с 60 добавлено и 15 удалено
  1. 40 7
      addons.sh
  2. 2 2
      include/check_sw.sh
  3. 2 0
      options.conf
  4. 4 1
      versions.txt
  5. 12 5
      vhost.sh

+ 40 - 7
addons.sh

@@ -132,15 +132,48 @@ EOF
       apt-get -y install $Package
     done
   fi
-  if [ ! -e "~/.pip/pip.conf" ] ;then
+  # Install Python27
+  if [ ! -e "${python_install_dir}/bin/python" ] ;then
+    src_url=http://mirrors.linuxeye.com/oneinstack/src/Python-${python_version}.tgz && Download_src
+    tar xzf Python-${python_version}.tgz
+    pushd Python-${python_version}
+    ./configure --prefix=${python_install_dir}
+    make && make install
+    popd
+    rm -rf Python-${python_version}
+  fi
+
+  if [ ! -e "${python_install_dir}/bin/easy_install" ] ;then
+    src_url=http://mirrors.linuxeye.com/oneinstack/src/setuptools-${setuptools_version}.tar.gz && Download_src
+    tar xzf setuptools-${setuptools_version}.tar.gz
+    pushd setuptools-${setuptools_version}
+    ${python_install_dir}/bin/python setup.py install
+    popd
+    rm -rf setuptools-${setuptools_version}
+  fi
+
+  if [ ! -e "${python_install_dir}/bin/pip" ] ;then
+    src_url=http://mirrors.linuxeye.com/oneinstack/src/pip-${pip_version}.tar.gz && Download_src
+    tar xzf pip-${pip_version}.tar.gz
+    pushd pip-${pip_version}
+    ${python_install_dir}/bin/python setup.py install
+    popd
+    rm -rf pip-${pip_version}
+  fi
+
+  if [ ! -e "/root/.pip/pip.conf" ] ;then
     # get the IP information
     PUBLIC_IPADDR=$(../include/get_public_ipaddr.py)
     IPADDR_COUNTRY=$(../include/get_ipaddr_state.py $PUBLIC_IPADDR | awk '{print $1}')
-    [ "$IPADDR_COUNTRY"x != "CN"x ] && { mkdir ~/.pip; echo -e "[global]\nindex-url = https://pypi.tuna.tsinghua.edu.cn/simple" > ~/.pip/pip.conf; }
+    if [ "$IPADDR_COUNTRY"x != "CN"x ]; then
+      [ ! -d "/root/.pip" ] && mkdir /root/.pip
+      echo -e "[global]\nindex-url = https://pypi.tuna.tsinghua.edu.cn/simple" > /root/.pip/pip.conf
+    fi
   fi
-  pip install certbot
+
+  ${python_install_dir}/bin/pip install certbot
   popd
-  if [ -e "/usr/bin/certbot" ]; then
+  if [ -e "${python_install_dir}/bin/certbot" ]; then
     echo; echo "${CSUCCESS}Let's Encrypt client installed successfully! ${CEND}"
   else
     echo; echo "${CFAILURE}Let's Encrypt client install failed, Please try again! ${CEND}"
@@ -148,10 +181,10 @@ EOF
 }
 
 Uninstall_letsencrypt() {
-  pip uninstall certbot
-  rm -rf /etc/letsencrypt /var/log/letsencrypt /var/lib/letsencrypt
+  ${python_install_dir}/bin/pip uninstall -y certbot
+  rm -rf /etc/letsencrypt /var/log/letsencrypt /var/lib/letsencrypt ${python_install_dir}
   [ "${OS}" == "CentOS" ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root
-  sed -i '/certbot/d' ${Cron_file}
+  [ -e "$Cron_file" ] && sed -i '/certbot/d' ${Cron_file}
   echo; echo "${CMSG}Let's Encrypt client uninstall completed${CEND}";
 }
 

+ 2 - 2
include/check_sw.sh

@@ -9,7 +9,7 @@
 
 installDepsDebian() {
   echo "${CMSG}Removing the conflicting packages...${CEND}"
-  pkgList="apache2 apache2-data apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-*"
+  pkgList="apache2 apache2-data apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-*"
   for Package in ${pkgList};do
       apt-get -y remove --purge ${Package}
   done
@@ -80,7 +80,7 @@ installDepsCentOS() {
 installDepsUbuntu() {
   # Uninstall the conflicting software
   echo "${CMSG}Removing the conflicting packages...${CEND}"
-  pkgList="apache2 apache2-data apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-*"
+  pkgList="apache2 apache2-data apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-*"
   for Package in ${pkgList}; do
     apt-get -y remove --purge ${Package}
   done

+ 2 - 0
options.conf

@@ -24,6 +24,8 @@ memcached_install_dir=/usr/local/memcached
 
 redis_install_dir=/usr/local/redis
 
+python_install_dir=/usr/local/python
+
 #########################################################################
 # database data storage directory, you can freely specify
 mysql_data_dir=/data/mysql

+ 4 - 1
versions.txt

@@ -46,7 +46,7 @@ zendopcache_version=7.0.5
 xcache_version=3.2.0
 apcu_version=4.0.11
 apcu_for_php7_version=5.1.7
-ImageMagick_version=6.9.6-4
+ImageMagick_version=6.9.6-5
 imagick_version=3.4.1
 imagick_for_php53_version=3.3.0
 GraphicsMagick_version=1.3.25
@@ -87,3 +87,6 @@ libevent_version=2.0.22-stable
 tmux_version=2.2
 htop_version=2.0.2
 bison_version=2.7.1
+python_version=2.7.12
+setuptools_version=28.8.0 
+pip_version=9.0.1

+ 12 - 5
vhost.sh

@@ -174,7 +174,7 @@ If you enter '.', the field will be left blank.
 }
 
 Create_SSL() {
-  if [ -e "/usr/bin/certbot" ]; then
+  if [ -e "${python_install_dir}/bin/certbot" ]; then
     while :; do echo
       read -p "Do you want to use a Let's Encrypt certificate? [y/n]: " letsencrypt_yn
       if [[ ! ${letsencrypt_yn} =~ ^[y,n]$ ]]; then
@@ -218,14 +218,21 @@ Create_SSL() {
   DocumentRoot "${vhostdir}"
   ServerName ${domain}
   ${Apache_Domain_alias}
-  ErrorLog "/dev/null" common
-  CustomLog "/dev/null" common
+<Directory "${vhostdir}">
+  SetOutputFilter DEFLATE
+  Options FollowSymLinks ExecCGI
+  Require all granted
+  AllowOverride All
+  Order allow,deny
+  Allow from all
+  DirectoryIndex index.html index.php
+</Directory>
 </VirtualHost>
 EOF
         /etc/init.d/httpd restart > /dev/null
       fi
 
-      certbot certonly --webroot --agree-tos --quiet --email ${Admin_Email} -w ${vhostdir} -d ${domain} ${moredomainame_D}
+      ${python_install_dir}/bin/certbot certonly --webroot --agree-tos --quiet --email ${Admin_Email} -w ${vhostdir} -d ${domain} ${moredomainame_D}
       if [ -s "/etc/letsencrypt/live/${domain}/cert.pem" ]; then
         [ -e "${PATH_SSL}/${domain}.crt" ] && rm -rf ${PATH_SSL}/${domain}.{crt,key}
         ln -s /etc/letsencrypt/live/${domain}/fullchain.pem ${PATH_SSL}/${domain}.crt
@@ -238,7 +245,7 @@ EOF
           Cron_Command="/etc/init.d/httpd graceful"
         fi
         [ "${OS}" == "CentOS" ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root
-        [ -z "$(grep 'certbot renew' ${Cron_file})" ] && echo "0 0 1 * * /usr/bin/certbot renew --renew-hook \"${Cron_Command}\"" >> $Cron_file
+        [ -z "$(grep 'certbot renew' ${Cron_file})" ] && echo "0 0 1 * * ${python_install_dir}/bin/certbot renew --renew-hook \"${Cron_Command}\"" >> $Cron_file
       else
         echo "${CFAILURE}Error: Let's Encrypt SSL certificate installation failed! ${CEND}"
         exit 1