添加项目
This commit is contained in:
commit
f7720fff01
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
package
|
||||||
120
bin/apache.sh
Normal file
120
bin/apache.sh
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# 路径配置
|
||||||
|
PWD=`pwd`
|
||||||
|
BIN_PATH=$PWD/bin
|
||||||
|
|
||||||
|
# 引入
|
||||||
|
source $BIN_PATH'/func.sh'
|
||||||
|
source $BIN_PATH'/extend.sh'
|
||||||
|
|
||||||
|
install_apache
|
||||||
|
|
||||||
|
# 获取配置
|
||||||
|
thread=`get_config core thread`
|
||||||
|
package=`get_config server apache_package`
|
||||||
|
apr_package=`get_config lib apr_package`
|
||||||
|
apr_util_package=`get_config lib apr_util_package`
|
||||||
|
pcre_package=`get_config lib pcre_package`
|
||||||
|
|
||||||
|
# 安装文件夹
|
||||||
|
file_name=`get_path_name $package`
|
||||||
|
path_dir='/usr/local/'`get_file_dir $file_name`
|
||||||
|
|
||||||
|
if [ -d $path_dir ];then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# 安装apr
|
||||||
|
if [ ! -d '/usr/local/apr' ];then
|
||||||
|
# 下载地址
|
||||||
|
apr_package=`exists_download $apr_package`
|
||||||
|
# 解压文件
|
||||||
|
decompression $apr_package
|
||||||
|
apr_dir=`get_file_dir $apr_package`
|
||||||
|
cd $apr_dir
|
||||||
|
./configure --prefix=/usr/local/apr
|
||||||
|
make -j$thread && make install
|
||||||
|
if [ $? != 0 ];then
|
||||||
|
echo 'apr安装失败'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 安装apr-util
|
||||||
|
if [ ! -d '/usr/local/apr-util' ];then
|
||||||
|
# 下载地址
|
||||||
|
apr_util_package=`exists_download $apr_util_package`
|
||||||
|
# 解压文件
|
||||||
|
decompression $apr_util_package
|
||||||
|
apr_util_dir=`get_file_dir $apr_util_package`
|
||||||
|
cd $apr_util_dir
|
||||||
|
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
|
||||||
|
make -j$thread && make install
|
||||||
|
if [ $? != 0 ];then
|
||||||
|
echo 'apr-util安装失败'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 安装pcre
|
||||||
|
if [ ! -d '/usr/local/pcre' ];then
|
||||||
|
# 下载地址
|
||||||
|
pcre_package=`exists_download $pcre_package`
|
||||||
|
# 解压文件
|
||||||
|
decompression $pcre_package
|
||||||
|
pcre_dir=`get_file_dir $pcre_package`
|
||||||
|
cd $pcre_dir
|
||||||
|
./configure --prefix=/usr/local/pcre
|
||||||
|
make -j$thread && make install
|
||||||
|
if [ $? != 0 ];then
|
||||||
|
echo 'pcre安装失败'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 安装apache
|
||||||
|
# 下载地址
|
||||||
|
package=`exists_download $package`
|
||||||
|
# 解压文件
|
||||||
|
decompression $package
|
||||||
|
file_dir=`get_file_dir $package`
|
||||||
|
cd $file_dir
|
||||||
|
|
||||||
|
./configure --prefix=$path_dir --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre --enable-rewrite --enable-modes-shared=all
|
||||||
|
|
||||||
|
make -j$thread && make install
|
||||||
|
|
||||||
|
error=$?
|
||||||
|
if [ $error == 0 ];then
|
||||||
|
# 修改配置文件
|
||||||
|
update_file $file_dir'/build/rpm/httpd.init' 'httpd=${HTTPD-/usr/sbin/httpd}' 'httpd=${HTTPD-'$path_dir'/bin/httpd}'
|
||||||
|
update_file $file_dir'/build/rpm/httpd.init' 'pidfile=${PIDFILE-/var/run/${prog}.pid}' 'pidfile=${PIDFILE-'$path_dir'/logs/${prog}.pid}'
|
||||||
|
update_file $file_dir'/build/rpm/httpd.init' 'CONFFILE=/etc/httpd/conf/httpd.conf' '\tCONFFILE='$path_dir'/conf/httpd.conf'
|
||||||
|
\cp $file_dir'/build/rpm/httpd.init' '/etc/rc.d/init.d/httpd'
|
||||||
|
chmod 755 '/etc/rc.d/init.d/httpd'
|
||||||
|
update_file $path_dir'/conf/httpd.conf' '#ServerName www.example.com:80' 'ServerName localhost:80'
|
||||||
|
update_file $path_dir'/conf/httpd.conf' '#Include conf/extra/httpd-vhosts.conf' 'Include conf/extra/httpd-vhosts.conf'
|
||||||
|
update_file $path_dir'/conf/httpd.conf' '#Include conf/extra/httpd-userdir.conf' 'Include conf/extra/httpd-userdir.conf'
|
||||||
|
|
||||||
|
# 修改vhost配置
|
||||||
|
if [ ! -f $path_dir'/conf/extra/httpd-vhosts.conf.bak' ];then
|
||||||
|
mv $path_dir'/conf/extra/httpd-vhosts.conf' $path_dir'/conf/extra/httpd-vhosts.conf.bak'
|
||||||
|
fi
|
||||||
|
echo -e '<VirtualHost *:80>\n DocumentRoot "/var/www/html"\n</VirtualHost>' > $path_dir'/conf/extra/httpd-vhosts.conf'
|
||||||
|
if [ ! -d '/var/www/html' ];then
|
||||||
|
mkdir -p '/var/www/html'
|
||||||
|
fi
|
||||||
|
echo -e 'Is Work!' > '/var/www/html/index.html'
|
||||||
|
# 增加文件夹访问权限
|
||||||
|
if [ ! -f $path_dir'/conf/extra/httpd-userdir.conf.bak' ];then
|
||||||
|
mv $path_dir'/conf/extra/httpd-userdir.conf' $path_dir'/conf/extra/httpd-userdir.conf.bak'
|
||||||
|
fi
|
||||||
|
echo -e '<Directory "/var/www/html">\n AllowOverride FileInfo AuthConfig Limit Indexes\n Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec\n Require method GET POST OPTIONS\n</Directory>' > $path_dir'/conf/extra/httpd-userdir.conf'
|
||||||
|
|
||||||
|
append_file '/etc/profile' 'export PATH='$path_dir'/bin:$PATH'
|
||||||
|
source '/etc/profile'
|
||||||
|
else
|
||||||
|
exit $error
|
||||||
|
fi
|
||||||
94
bin/extend.sh
Normal file
94
bin/extend.sh
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
function install_gcc() {
|
||||||
|
if [ `rpm -qa|grep gcc|wc -l` == 0 ];then
|
||||||
|
yum -y install gcc
|
||||||
|
fi
|
||||||
|
if [ `rpm -qa|grep gcc-c++|wc -l` == 0 ];then
|
||||||
|
yum -y install gcc-c++
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function install_apache() {
|
||||||
|
if [ `rpm -qa|grep expat-devel|wc -l` == 0 ];then
|
||||||
|
yum -y install expat-devel
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function install_nginx() {
|
||||||
|
if [ `rpm -qa|grep zlib-devel|wc -l` == 0 ];then
|
||||||
|
yum -y install zlib-devel
|
||||||
|
fi
|
||||||
|
if [ `rpm -qa|grep pcre-devel|wc -l` == 0 ];then
|
||||||
|
yum -y install pcre-devel
|
||||||
|
fi
|
||||||
|
if [ `rpm -qa|grep openssl-devel|wc -l` == 0 ];then
|
||||||
|
yum -y install openssl-devel
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function install_mysql() {
|
||||||
|
if [ `rpm -qa|grep cmake|wc -l` == 0 ];then
|
||||||
|
yum -y install cmake
|
||||||
|
fi
|
||||||
|
if [ `rpm -qa|grep ncurses-devel|wc -l` == 0 ];then
|
||||||
|
yum -y install ncurses-devel
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function install_php() {
|
||||||
|
if [ `rpm -qa|grep libxml2-devel|wc -l` == 0 ];then
|
||||||
|
yum -y install libxml2-devel
|
||||||
|
fi
|
||||||
|
if [ `rpm -qa|grep libjpeg-turbo-devel|wc -l` == 0 ];then
|
||||||
|
yum -y install libjpeg-turbo-devel
|
||||||
|
fi
|
||||||
|
if [ `rpm -qa|grep libpng-devel|wc -l` == 0 ];then
|
||||||
|
yum -y install libpng-devel
|
||||||
|
fi
|
||||||
|
if [ `rpm -qa|grep freetype-devel|wc -l` == 0 ];then
|
||||||
|
yum -y install freetype-devel
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 扩展需要的函数
|
||||||
|
function install_extension() {
|
||||||
|
if [ `rpm -qa|grep autoconf|wc -l` == 0 ];then
|
||||||
|
yum -y install autoconf
|
||||||
|
fi
|
||||||
|
if [ 'a'$1 == 'a' ];then
|
||||||
|
echo $1'扩展不能传空'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
case $1 in
|
||||||
|
pdo_pgsql|pgsql)
|
||||||
|
if [ `rpm -qa|grep postgresql-devel|wc -l` == 0 ];then
|
||||||
|
yum -y install postgresql-devel
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
mysqli)
|
||||||
|
if [ `rpm -qa|grep mysql-devel|wc -l` == 0 ];then
|
||||||
|
yum -y install mysql-devel
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
snmp)
|
||||||
|
if [ `rpm -qa|grep net-snmp-devel|wc -l` == 0 ];then
|
||||||
|
yum -y install net-snmp-devel
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
amqp)
|
||||||
|
if [ `rpm -qa|grep librabbitmq-devel|wc -l` == 0 ];then
|
||||||
|
yum -y install librabbitmq-devel
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
grep_file=$1'-devel'
|
||||||
|
if [ `echo $1|grep pdo_|wc -l` != 0 ];then
|
||||||
|
grep_file=`echo $1|awk -F 'pdo_' '{print $2}'`'-devel'
|
||||||
|
fi
|
||||||
|
if [ `rpm -qa|grep "$grep_file"|wc -l` == 0 ];then
|
||||||
|
yum -y install $grep_file
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
175
bin/func.sh
Normal file
175
bin/func.sh
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# 路径配置
|
||||||
|
PWD=`pwd`
|
||||||
|
CONFIG_PATH=$PWD'/config.ini'
|
||||||
|
|
||||||
|
# 获取配置文件
|
||||||
|
# example: get_config server path
|
||||||
|
function get_config() {
|
||||||
|
# 判断是否传入空
|
||||||
|
if [ 'a'$1 == 'a' ] || [ 'a'$2 == 'a' ];then
|
||||||
|
echo '没有传入配置项'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# 获取类型
|
||||||
|
cfg_type=`cat $CONFIG_PATH|grep '\['$1'\]'`
|
||||||
|
cfg_start=`grep '\['$1'\]' $CONFIG_PATH -n|awk -F ':' '{print $1}'`
|
||||||
|
if [ 'a'$cfg_type == 'a' ];then
|
||||||
|
echo '配置['$1']不存在'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cfg_data=''
|
||||||
|
while read line;do
|
||||||
|
# 替换特殊字符
|
||||||
|
line=${line//\[/\\\[}
|
||||||
|
line=${line//\]/\\\]}
|
||||||
|
i=`grep $line $CONFIG_PATH -n|awk -F ':' '{print $1}'`
|
||||||
|
if [ $i -gt $cfg_start ];then
|
||||||
|
if [ 'a'`echo $line|grep '\['|grep '\]'` != 'a' ];then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
cfg_val=`echo $line|grep $2'='|awk -F '=' '{print $2}'`
|
||||||
|
if [ 'a'$cfg_val != 'a' ];then
|
||||||
|
cfg_data=$cfg_val
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done<$CONFIG_PATH
|
||||||
|
|
||||||
|
if [ 'a'$cfg_data == 'a' ];then
|
||||||
|
echo '配置['$1']里面项'$2'不存在'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo $cfg_data
|
||||||
|
}
|
||||||
|
|
||||||
|
# 获取路径文件名
|
||||||
|
# example: get_path_name /root/package/pcre-8.43.tar.bz2
|
||||||
|
# result: pcre-8.43.tar.bz2
|
||||||
|
function get_path_name() {
|
||||||
|
fun_file_path=$1
|
||||||
|
echo ${fun_file_path##*/}
|
||||||
|
}
|
||||||
|
|
||||||
|
# 获取路径文件夹
|
||||||
|
# example: get_path_dir /root/package/pcre-8.43.tar.bz2
|
||||||
|
# result: /root/package
|
||||||
|
function get_path_dir() {
|
||||||
|
fun_file_path=$1
|
||||||
|
echo ${fun_file_path%/*}
|
||||||
|
}
|
||||||
|
|
||||||
|
# 获取路径文件后缀
|
||||||
|
# example: get_file_suffix /root/package/pcre-8.43.tar.bz2
|
||||||
|
# result: tar.bz2
|
||||||
|
function get_file_suffix() {
|
||||||
|
# 获取后缀
|
||||||
|
fun_suffix=`echo $1|awk -F '.' '{print $NF}'`
|
||||||
|
if [[ $1 =~ '.tar.' ]];then
|
||||||
|
fun_suffix=`echo $1|awk -F '.' '{print $(NF-1)}'`'.'`echo $1|awk -F '.' '{print $NF}'`
|
||||||
|
fi
|
||||||
|
echo $fun_suffix
|
||||||
|
}
|
||||||
|
|
||||||
|
# 获取路径文件的文件夹
|
||||||
|
# example: get_file_dir /root/package/pcre-8.43.tar.bz2
|
||||||
|
# result: /root/package/pcre-8.43
|
||||||
|
function get_file_dir() {
|
||||||
|
# 获取后缀
|
||||||
|
fun_suffix=`get_file_suffix $1`
|
||||||
|
fun_file_dir=`echo $1|awk -F $fun_suffix '{print $1}'`
|
||||||
|
echo ${fun_file_dir%*.}
|
||||||
|
}
|
||||||
|
|
||||||
|
# 解压文件
|
||||||
|
# example: get_file_dir /root/package/pcre-8.43.tar.bz2
|
||||||
|
function decompression() {
|
||||||
|
# 判断是否传入空
|
||||||
|
if [ 'a'$1 == 'a' ];then
|
||||||
|
echo '没有传入压缩包地址'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# 判断文件是否存在
|
||||||
|
if [ ! -f $1 ];then
|
||||||
|
echo $1'文件不存在'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# 删除原解压
|
||||||
|
zip_file_dir=`get_file_dir $1`
|
||||||
|
rm -rf zip_file_dir
|
||||||
|
|
||||||
|
zip_suffix=`get_file_suffix $1`
|
||||||
|
zip_path_name=`get_path_name $1`
|
||||||
|
zip_path_dir=`get_path_dir $1`
|
||||||
|
cd $zip_path_dir
|
||||||
|
if [ $zip_suffix == 'tar.bz2' ] || [ $zip_suffix == 'tar.gz' ] || [ $zip_suffix == 'tgz' ];then
|
||||||
|
tar xvf $zip_path_name
|
||||||
|
elif [ $zip_suffix == 'zip' ];then
|
||||||
|
unzip $zip_path_name
|
||||||
|
else
|
||||||
|
echo $zip_suffix'格式的压缩文件无法解压'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 存在http且下载
|
||||||
|
# example: exists_download http://www.baidu.com/a.tar.bz2
|
||||||
|
# result: /root/abc/package/a.tar.bz2
|
||||||
|
function exists_download() {
|
||||||
|
down_path_name=`get_path_name $1`
|
||||||
|
if [ ! -f $PWD'/package/'$down_path_name ];then
|
||||||
|
if [ ! -d $PWD'/package' ];then
|
||||||
|
mkdir -p $PWD'/package'
|
||||||
|
fi
|
||||||
|
wget -P $PWD'/package' $1
|
||||||
|
if [ $? != 0 ];then
|
||||||
|
echo $1'下载失败'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo $PWD'/package/'$down_path_name
|
||||||
|
}
|
||||||
|
|
||||||
|
# 修改文件
|
||||||
|
# example: update_file /root/a.txt user_name user_upload
|
||||||
|
function update_file() {
|
||||||
|
update_file_url=$1
|
||||||
|
update_find_name=$2
|
||||||
|
update_name=$3
|
||||||
|
if [ ! -f $update_file_url ];then
|
||||||
|
echo $update_file_url'文件不存在'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# 文件备份
|
||||||
|
if [ ! -f $update_file_url'.bak' ];then
|
||||||
|
cp $update_file_url $update_file_url'.bak'
|
||||||
|
fi
|
||||||
|
# 临时文件
|
||||||
|
mv $update_file_url $update_file_url'.tmp'
|
||||||
|
SAVEIFS=$IFS
|
||||||
|
IFS=$(echo -en "\n")
|
||||||
|
while read -r line
|
||||||
|
do
|
||||||
|
if [ `echo $line|grep "$update_find_name"|wc -l` == 0 ];then
|
||||||
|
echo "$line" >> $update_file_url
|
||||||
|
else
|
||||||
|
echo -e "$update_name" >> $update_file_url
|
||||||
|
fi
|
||||||
|
done < $update_file_url'.tmp'
|
||||||
|
IFS=$SAVEIFS
|
||||||
|
rm -rf $update_file_url'.tmp'
|
||||||
|
}
|
||||||
|
|
||||||
|
# 追加文件
|
||||||
|
# example: append_file /root/a.txt user_name
|
||||||
|
function append_file() {
|
||||||
|
append_file_url=$1
|
||||||
|
append_name=$2
|
||||||
|
if [ ! -f $append_file_url ];then
|
||||||
|
echo $append_file_url'文件不存在'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ `cat $append_file_url|grep "$append_name"|wc -l` == 0 ];then
|
||||||
|
echo "$append_name" >> $append_file_url
|
||||||
|
fi
|
||||||
|
}
|
||||||
104
bin/install_extension.sh
Normal file
104
bin/install_extension.sh
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# 路径配置
|
||||||
|
PWD=`pwd`
|
||||||
|
BIN_PATH=$PWD/bin
|
||||||
|
|
||||||
|
# 引入
|
||||||
|
source $BIN_PATH'/func.sh'
|
||||||
|
source $BIN_PATH'/extend.sh'
|
||||||
|
|
||||||
|
# 获取配置
|
||||||
|
thread=`get_config core thread`
|
||||||
|
php_package=`get_config php package`
|
||||||
|
php_extension=`get_config php php_extension`
|
||||||
|
|
||||||
|
# 安装扩展
|
||||||
|
php_file_name=`get_path_name $php_package`
|
||||||
|
php_file_dir=`get_file_dir $php_file_name`
|
||||||
|
php='/usr/local/'$php_file_dir'/bin/php'
|
||||||
|
phpize='/usr/local/'$php_file_dir'/bin/phpize'
|
||||||
|
php_config='/usr/local/'$php_file_dir'/bin/php-config'
|
||||||
|
php_ini='/usr/local/'$php_file_dir'/etc/php.ini'
|
||||||
|
pecl='/usr/local/'$php_file_dir'/bin/pecl'
|
||||||
|
|
||||||
|
if [ 'a'$1 == 'a' ];then
|
||||||
|
echo '传入扩展为空'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
extension=$1
|
||||||
|
case $extension in
|
||||||
|
mcrypt)
|
||||||
|
libmcrypt_package=`get_config lib libmcrypt_package`
|
||||||
|
libmcrypt_package=`exists_download $libmcrypt_package`
|
||||||
|
# 安装libmcrypt
|
||||||
|
if [ ! -d '/usr/local/libmcrypt' ];then
|
||||||
|
decompression $libmcrypt_package
|
||||||
|
libmcrypt_dir=`get_file_dir $libmcrypt_package`
|
||||||
|
cd $libmcrypt_dir
|
||||||
|
./configure --prefix=/usr/local/libmcrypt
|
||||||
|
make -j$thread && make install
|
||||||
|
if [ $? != 0 ];then
|
||||||
|
echo 'libmcrypt安装失败'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
if [ `$php -m|grep $extension|wc -l` == 0 ];then
|
||||||
|
ext_dir=$PWD'/package/'$php_file_dir'/ext'
|
||||||
|
extension_dir=$ext_dir'/'$extension
|
||||||
|
if [ ! -d $extension_dir ];then
|
||||||
|
$pecl install $extension
|
||||||
|
pecl_error=$?
|
||||||
|
if [ $pecl_error != 0 ] && [ $pecl_error != 1 ];then
|
||||||
|
echo $extension'扩展不存在'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# so文件存在则删除重新编译
|
||||||
|
dir_extension=`find '/usr/local/'$php_file_dir'/lib/php' -name $extension'.so'`
|
||||||
|
if [ 'a'$dir_extension != 'a' ];then
|
||||||
|
rm -rf $dir_extension
|
||||||
|
fi
|
||||||
|
install_extension $extension
|
||||||
|
cd $extension_dir
|
||||||
|
if [ -f $extension_dir'/config0.m4' ] && [ ! -f $extension_dir'/config.m4' ];then
|
||||||
|
cp $extension_dir'/config0.m4' $extension_dir'/config.m4'
|
||||||
|
fi
|
||||||
|
$phpize
|
||||||
|
case $extension in
|
||||||
|
pdo_mysql)
|
||||||
|
./configure --with-php-config=$php_config --with-pdo-mysql=/usr
|
||||||
|
;;
|
||||||
|
mysqli)
|
||||||
|
if [ ! -d $extension_dir'/ext/mysqlnd' ];then
|
||||||
|
mkdir -p $extension_dir'/ext/mysqlnd'
|
||||||
|
fi
|
||||||
|
if [ ! -f $extension_dir'/ext/mysqlnd/mysql_float_to_double.h' ];then
|
||||||
|
cp -R $ext_dir'/mysqlnd/mysql_float_to_double.h' $extension_dir'/ext/mysqlnd/mysql_float_to_double.h'
|
||||||
|
fi
|
||||||
|
./configure --with-php-config=$php_config --with-mysqli=/usr/bin/mysql_config
|
||||||
|
;;
|
||||||
|
mcrypt)
|
||||||
|
./configure --with-php-config=$php_config --with-mcrypt=/usr/local/libmcrypt
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
./configure --with-php-config=$php_config
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
make -j$thread && make install
|
||||||
|
if [ $? != 0 ];then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# 配置文件是否配置
|
||||||
|
file_extension_num=`cat $php_ini|grep $extension'.so'|wc -l`
|
||||||
|
dir_extension_num=`find '/usr/local/'$php_file_dir'/lib/php' -name $extension'.so'|wc -l`
|
||||||
|
if [ $file_extension_num == 0 ] && [ $dir_extension_num != 0 ];then
|
||||||
|
echo 'extension='$extension'.so' >> $php_ini
|
||||||
|
fi
|
||||||
|
fi
|
||||||
66
bin/mysql.sh
Normal file
66
bin/mysql.sh
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# 路径配置
|
||||||
|
PWD=`pwd`
|
||||||
|
BIN_PATH=$PWD/bin
|
||||||
|
|
||||||
|
# 引入
|
||||||
|
source $BIN_PATH'/func.sh'
|
||||||
|
source $BIN_PATH'/extend.sh'
|
||||||
|
|
||||||
|
install_mysql
|
||||||
|
|
||||||
|
# 获取配置
|
||||||
|
thread=`get_config core thread`
|
||||||
|
package=`get_config db package`
|
||||||
|
|
||||||
|
# 安装文件夹
|
||||||
|
file_name=`get_path_name $package`
|
||||||
|
path_dir='/usr/local/'`get_file_dir $file_name`
|
||||||
|
|
||||||
|
if [ -d $path_dir ];then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# 安装mysql
|
||||||
|
# 下载地址
|
||||||
|
package=`exists_download $package`
|
||||||
|
# 解压文件
|
||||||
|
decompression $package
|
||||||
|
file_dir=`get_file_dir $package`
|
||||||
|
cd $file_dir
|
||||||
|
|
||||||
|
cmake -DCMAKE_INSTALL_PREFIX=$path_dir -DMYSQL_DATADIR=$path_dir'/data' -DSYSCONFIGDIR=$path_dir'/etc' -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_USER=mysql
|
||||||
|
|
||||||
|
make -j$thread && make install
|
||||||
|
error=$?
|
||||||
|
if [ $error == 0 ];then
|
||||||
|
cp $path_dir/support-files/my-huge.cnf /etc/my.cnf
|
||||||
|
# 去掉innodb注释
|
||||||
|
update_file '/etc/my.cnf' '#innodb_data_home_dir' 'innodb_data_home_dir = '$path_dir'/data'
|
||||||
|
update_file '/etc/my.cnf' '#innodb_data_file_path' 'innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend'
|
||||||
|
update_file '/etc/my.cnf' '#innodb_log_group_home_dir' 'innodb_log_group_home_dir = '$path_dir'/data'
|
||||||
|
update_file '/etc/my.cnf' '#innodb_buffer_pool_size' 'innodb_buffer_pool_size = 384M'
|
||||||
|
update_file '/etc/my.cnf' '#innodb_additional_mem_pool_size' 'innodb_additional_mem_pool_size = 20M'
|
||||||
|
update_file '/etc/my.cnf' '#innodb_log_file_size' 'innodb_log_file_size = 100M'
|
||||||
|
update_file '/etc/my.cnf' '#innodb_log_buffer_size' 'innodb_log_buffer_size = 8M'
|
||||||
|
update_file '/etc/my.cnf' '#innodb_flush_log_at_trx_commit' 'innodb_flush_log_at_trx_commit = 1'
|
||||||
|
update_file '/etc/my.cnf' '#innodb_lock_wait_timeout' 'innodb_lock_wait_timeout = 50'
|
||||||
|
if [ ! -f '/etc/init.d/mysqld' ];then
|
||||||
|
cp $path_dir'/support-files/mysql.server' '/etc/init.d/mysqld'
|
||||||
|
fi
|
||||||
|
if [ `cat /etc/group|grep 'mysql:'|wc -l` == 0 ];then
|
||||||
|
groupadd mysql
|
||||||
|
fi
|
||||||
|
if [ `cat /etc/passwd|grep 'mysql:'|wc -l` == 0 ];then
|
||||||
|
useradd -s /sbin/nologin -g mysql -M mysql
|
||||||
|
fi
|
||||||
|
chown -R mysql:mysql $path_dir
|
||||||
|
$path_dir/scripts/mysql_install_db --user=mysql --basedir=$path_dir --datadir=$path_dir'/data' >> $path_dir'/install.log' 2>&1 &
|
||||||
|
|
||||||
|
append_file '/etc/profile' 'export PATH='$path_dir'/bin:$PATH'
|
||||||
|
source '/etc/profile'
|
||||||
|
else
|
||||||
|
exit $error
|
||||||
|
fi
|
||||||
68
bin/nginx.sh
Normal file
68
bin/nginx.sh
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# 路径配置
|
||||||
|
PWD=`pwd`
|
||||||
|
BIN_PATH=$PWD/bin
|
||||||
|
FILES_PATH=$PWD/files
|
||||||
|
|
||||||
|
# 引入
|
||||||
|
source $BIN_PATH'/func.sh'
|
||||||
|
source $BIN_PATH'/extend.sh'
|
||||||
|
|
||||||
|
install_nginx
|
||||||
|
|
||||||
|
# 获取配置
|
||||||
|
thread=`get_config core thread`
|
||||||
|
package=`get_config server nginx_package`
|
||||||
|
|
||||||
|
# 安装文件夹
|
||||||
|
file_name=`get_path_name $package`
|
||||||
|
path_dir='/usr/local/'`get_file_dir $file_name`
|
||||||
|
|
||||||
|
if [ -d $path_dir ];then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# 安装nginx
|
||||||
|
# 下载地址
|
||||||
|
package=`exists_download $package`
|
||||||
|
# 解压文件
|
||||||
|
decompression $package
|
||||||
|
file_dir=`get_file_dir $package`
|
||||||
|
cd $file_dir
|
||||||
|
|
||||||
|
./configure --prefix=$path_dir --with-openssl=/usr/include/openssl --with-pcre --with-http_stub_status_module
|
||||||
|
|
||||||
|
make -j$thread && make install
|
||||||
|
|
||||||
|
error=$?
|
||||||
|
if [ $error == 0 ];then
|
||||||
|
# 配置文件
|
||||||
|
if [ ! -f $path_dir'/conf/nginx.conf.bak' ];then
|
||||||
|
cp $path_dir'/conf/nginx.conf' $path_dir'/conf/nginx.conf.bak'
|
||||||
|
fi
|
||||||
|
if [ ! -d $path_dir'/conf/vhost' ];then
|
||||||
|
mkdir -p $path_dir'/conf/vhost'
|
||||||
|
fi
|
||||||
|
\cp $FILES_PATH'/nginx.conf' $path_dir'/conf/nginx.conf'
|
||||||
|
\cp $FILES_PATH'/enable-php.conf' $path_dir'/conf/enable-php.conf'
|
||||||
|
\cp $FILES_PATH'/rewrite.conf' $path_dir'/conf/rewrite.conf'
|
||||||
|
\cp $FILES_PATH'/default.conf' $path_dir'/conf/vhost/default.conf'
|
||||||
|
update_file $path_dir'/conf/nginx.conf' 'pid /usr/local/nginx/logs/nginx.pid;' 'pid '$path_dir'/logs/nginx.pid;'
|
||||||
|
if [ ! -d '/var/www/html' ];then
|
||||||
|
mkdir -p '/var/www/html'
|
||||||
|
fi
|
||||||
|
if [ ! -d '/var/www/logs' ];then
|
||||||
|
mkdir -p '/var/www/logs'
|
||||||
|
fi
|
||||||
|
echo -e 'Is Work!' > '/var/www/html/index.html'
|
||||||
|
if [ `cat /etc/group|grep 'www:'|wc -l` == 0 ];then
|
||||||
|
groupadd www
|
||||||
|
fi
|
||||||
|
if [ `cat /etc/passwd|grep 'www:'|wc -l` == 0 ];then
|
||||||
|
useradd -s /sbin/nologin -g www -M www
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
exit $error
|
||||||
|
fi
|
||||||
105
bin/php.sh
Normal file
105
bin/php.sh
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# 路径配置
|
||||||
|
PWD=`pwd`
|
||||||
|
BIN_PATH=$PWD/bin
|
||||||
|
|
||||||
|
# 引入
|
||||||
|
source $BIN_PATH'/func.sh'
|
||||||
|
source $BIN_PATH'/extend.sh'
|
||||||
|
|
||||||
|
install_php
|
||||||
|
|
||||||
|
# 获取配置
|
||||||
|
thread=`get_config core thread`
|
||||||
|
package=`get_config php package`
|
||||||
|
libmcrypt_package=`get_config lib libmcrypt_package`
|
||||||
|
server_type=`get_config server type`
|
||||||
|
apache_package=`get_config server apache_package`
|
||||||
|
nginx_package=`get_config server nginx_package`
|
||||||
|
|
||||||
|
|
||||||
|
# 安装文件夹
|
||||||
|
file_name=`get_path_name $package`
|
||||||
|
path_dir='/usr/local/'`get_file_dir $file_name`
|
||||||
|
|
||||||
|
if [ -d $path_dir ];then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 下载地址
|
||||||
|
package=`exists_download $package`
|
||||||
|
libmcrypt_package=`exists_download $libmcrypt_package`
|
||||||
|
|
||||||
|
# 安装libmcrypt
|
||||||
|
if [ ! -d '/usr/local/libmcrypt' ];then
|
||||||
|
decompression $libmcrypt_package
|
||||||
|
libmcrypt_dir=`get_file_dir $libmcrypt_package`
|
||||||
|
cd $libmcrypt_dir
|
||||||
|
./configure --prefix=/usr/local/libmcrypt
|
||||||
|
make -j$thread && make install
|
||||||
|
if [ $? != 0 ];then
|
||||||
|
echo 'libmcrypt安装失败'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# 安装php
|
||||||
|
decompression $package
|
||||||
|
file_dir=`get_file_dir $package`
|
||||||
|
cd $file_dir
|
||||||
|
|
||||||
|
case $server_type in
|
||||||
|
apache)
|
||||||
|
apache_file_name=`get_path_name $apache_package`
|
||||||
|
apache_file_dir=`get_file_dir $apache_file_name`
|
||||||
|
apxs_path='/usr/local/'$apache_file_dir'/bin/apxs'
|
||||||
|
./configure --prefix=$path_dir --with-apxs2=$apxs_path --with-config-file-path=$path_dir/etc --enable-soap --with-jpeg-dir --with-freetype-dir --with-png-dir
|
||||||
|
make -j$thread && make install
|
||||||
|
error=$?
|
||||||
|
if [ $error == 0 ];then
|
||||||
|
cp $file_dir'/php.ini-development' $path_dir'/etc/php.ini'
|
||||||
|
# 为apache添加php支持
|
||||||
|
update_file '/usr/local/'$apache_file_dir'/conf/httpd.conf' 'AddType application/x-gzip .gz .tgz' ' AddType application/x-gzip .gz .tgz\n AddType application/x-httpd-php .php .phtml\n AddType application/x-httpd-php-source .phps'
|
||||||
|
update_file '/usr/local/'$apache_file_dir'/conf/httpd.conf' 'DirectoryIndex index.html' ' DirectoryIndex index.html index.php'
|
||||||
|
update_file '/usr/local/'$apache_file_dir'/conf/httpd.conf' 'AllowOverride None' ' AllowOverride All'
|
||||||
|
update_file '/usr/local/'$apache_file_dir'/conf/httpd.conf' 'AllowOverride none' ' AllowOverride All'
|
||||||
|
if [ ! -d '/var/www/html' ];then
|
||||||
|
mkdir -p '/var/www/html'
|
||||||
|
fi
|
||||||
|
rm -rf '/var/www/html/index.html'
|
||||||
|
echo -e '<?php\n phpinfo();' > '/var/www/html/index.php'
|
||||||
|
else
|
||||||
|
exit $error
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
nginx)
|
||||||
|
nginx_file_name=`get_path_name $nginx_package`
|
||||||
|
nginx_file_dir=`get_file_dir $nginx_file_name`
|
||||||
|
./configure --prefix=$path_dir --with-config-file-path=$path_dir/etc --enable-fastcgi --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-soap --enable-opcache=no --with-jpeg-dir --with-freetype-dir --with-png-dir
|
||||||
|
make -j$thread && make install
|
||||||
|
error=$?
|
||||||
|
if [ $error == 0 ];then
|
||||||
|
cp $path_dir'/etc/php-fpm.conf.default' $path_dir'/etc/php-fpm.conf'
|
||||||
|
cp $path_dir'/etc/php-fpm.d/www.conf.default' $path_dir'/etc/php-fpm.d/www.conf'
|
||||||
|
cp $file_dir'/php.ini-development' $path_dir'/etc/php.ini'
|
||||||
|
cp $file_dir'/sapi/fpm/init.d.php-fpm' '/etc/init.d/php-fpm'
|
||||||
|
chmod +x /etc/init.d/php-fpm
|
||||||
|
if [ `cat /etc/group|grep 'www:'|wc -l` == 0 ];then
|
||||||
|
groupadd www
|
||||||
|
fi
|
||||||
|
if [ `cat /etc/passwd|grep 'www:'|wc -l` == 0 ];then
|
||||||
|
useradd -s /sbin/nologin -g www -M www
|
||||||
|
fi
|
||||||
|
# 为nginx添加php支持
|
||||||
|
update_file '/usr/local/'$nginx_file_dir'/conf/vhost/default.conf' 'index index.html index.htm;' ' index index.html index.htm index.php;'
|
||||||
|
update_file '/usr/local/'$nginx_file_dir'/conf/vhost/default.conf' '# include enable-php.conf;' ' include enable-php.conf;'
|
||||||
|
update_file '/usr/local/'$nginx_file_dir'/conf/vhost/default.conf' '# include rewrite.conf;' ' include rewrite.conf;'
|
||||||
|
rm -rf '/var/www/html/index.html'
|
||||||
|
echo -e '<?php\n phpinfo();' > '/var/www/html/index.php'
|
||||||
|
else
|
||||||
|
exit $error
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
22
bin/php_extension.sh
Normal file
22
bin/php_extension.sh
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# 路径配置
|
||||||
|
PWD=`pwd`
|
||||||
|
BIN_PATH=$PWD/bin
|
||||||
|
|
||||||
|
# 引入
|
||||||
|
source $BIN_PATH'/func.sh'
|
||||||
|
source $BIN_PATH'/extend.sh'
|
||||||
|
|
||||||
|
# 获取配置
|
||||||
|
php_extension=`get_config php php_extension`
|
||||||
|
|
||||||
|
# 安装扩展
|
||||||
|
extension_arr=(${php_extension//,/ })
|
||||||
|
for extension in ${extension_arr[@]};do
|
||||||
|
sh $BIN_PATH'/install_extension.sh' $extension
|
||||||
|
if [ $? != 0 ];then
|
||||||
|
echo $extension'的php扩展安装失败'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
17
config.ini
Normal file
17
config.ini
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
[server]
|
||||||
|
type=nginx
|
||||||
|
nginx_package=http://nginx.org/download/nginx-1.15.12.tar.gz
|
||||||
|
apache_package=http://www.apache.org/dist/httpd/httpd-2.4.39.tar.bz2
|
||||||
|
[db]
|
||||||
|
type=mysql
|
||||||
|
package=http://mirrors.163.com/mysql/Downloads/MySQL-5.5/mysql-5.5.61.tar.gz
|
||||||
|
[php]
|
||||||
|
package=https://www.php.net/distributions/php-7.1.29.tar.bz2
|
||||||
|
php_extension=curl,gd,pdo_mysql,pgsql,pdo_pgsql,session,sockets,openssl,mysqli,mbstring,zip,zlib,xsl,xmlwriter,mcrypt,soap,snmp,shmop
|
||||||
|
[lib]
|
||||||
|
apr_package=http://www.apache.org/dist/apr/apr-1.7.0.tar.bz2
|
||||||
|
apr_util_package=http://www.apache.org/dist/apr/apr-util-1.6.1.tar.bz2
|
||||||
|
pcre_package=http://ftp.pcre.org/pub/pcre/pcre-8.43.tar.bz2
|
||||||
|
libmcrypt_package=https://sourceforge.mirrorservice.org/m/mc/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
|
||||||
|
[core]
|
||||||
|
thread=4
|
||||||
41
files/default.conf
Normal file
41
files/default.conf
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
server
|
||||||
|
{
|
||||||
|
listen 80;
|
||||||
|
#listen 443 ssl;
|
||||||
|
#listen [::]:80;
|
||||||
|
server_name 0.0.0.0;
|
||||||
|
index index.html index.htm;
|
||||||
|
root /var/www/html;
|
||||||
|
# ssl on;
|
||||||
|
# ssl_certificate /usr/local/nginx/default/server.pem;
|
||||||
|
# ssl_certificate_key /usr/local/nginx/default/server.key;
|
||||||
|
|
||||||
|
#error_page 404 /404.html;
|
||||||
|
|
||||||
|
# Deny access to PHP files in specific directory
|
||||||
|
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
|
||||||
|
|
||||||
|
# include enable-php.conf;
|
||||||
|
# include rewrite.conf;
|
||||||
|
|
||||||
|
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
|
||||||
|
{
|
||||||
|
expires 30d;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ .*\.(js|css)?$
|
||||||
|
{
|
||||||
|
expires 12h;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /.well-known {
|
||||||
|
allow all;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /\.
|
||||||
|
{
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
access_log /var/www/logs/default.log;
|
||||||
|
}
|
||||||
8
files/enable-php.conf
Normal file
8
files/enable-php.conf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
location ~ [^/]\.php(/|$)
|
||||||
|
{
|
||||||
|
try_files $uri =404;
|
||||||
|
#fastcgi_pass unix:/tmp/php-cgi.sock;
|
||||||
|
fastcgi_pass 127.0.0.1:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
include fastcgi.conf;
|
||||||
|
}
|
||||||
51
files/nginx.conf
Normal file
51
files/nginx.conf
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
user www www;
|
||||||
|
|
||||||
|
worker_processes auto;
|
||||||
|
|
||||||
|
error_log /var/www/logs/nginx_error.log crit;
|
||||||
|
|
||||||
|
pid /usr/local/nginx/logs/nginx.pid;
|
||||||
|
#google_perftools_profiles /tmp/tcmalloc;
|
||||||
|
|
||||||
|
#Specifies the value for maximum file descriptors that can be opened by this process.
|
||||||
|
worker_rlimit_nofile 51200;
|
||||||
|
|
||||||
|
events
|
||||||
|
{
|
||||||
|
use epoll;
|
||||||
|
worker_connections 51200;
|
||||||
|
multi_accept on;
|
||||||
|
}
|
||||||
|
|
||||||
|
http
|
||||||
|
{
|
||||||
|
include mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
|
||||||
|
keepalive_timeout 60;
|
||||||
|
|
||||||
|
fastcgi_connect_timeout 300;
|
||||||
|
fastcgi_send_timeout 300;
|
||||||
|
fastcgi_read_timeout 300;
|
||||||
|
fastcgi_buffer_size 64k;
|
||||||
|
fastcgi_buffers 4 64k;
|
||||||
|
fastcgi_busy_buffers_size 128k;
|
||||||
|
fastcgi_temp_file_write_size 256k;
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
gzip_min_length 1k;
|
||||||
|
gzip_buffers 4 16k;
|
||||||
|
gzip_http_version 1.1;
|
||||||
|
gzip_comp_level 2;
|
||||||
|
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
|
||||||
|
gzip_vary on;
|
||||||
|
gzip_proxied expired no-cache no-store private auth;
|
||||||
|
gzip_disable "MSIE [1-6]\.";
|
||||||
|
|
||||||
|
server_tokens off;
|
||||||
|
access_log off;
|
||||||
|
include vhost/*.conf;
|
||||||
|
}
|
||||||
|
|
||||||
5
files/rewrite.conf
Normal file
5
files/rewrite.conf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
location / {
|
||||||
|
if (!-e $request_filename){
|
||||||
|
rewrite ^/(.*)$ /index.php?s=/$1 last;
|
||||||
|
}
|
||||||
|
}
|
||||||
61
install.sh
Normal file
61
install.sh
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# 路径配置
|
||||||
|
PWD=`pwd`
|
||||||
|
BIN_PATH=$PWD/bin
|
||||||
|
|
||||||
|
# 引入
|
||||||
|
source $BIN_PATH'/func.sh'
|
||||||
|
source $BIN_PATH'/extend.sh'
|
||||||
|
|
||||||
|
install_gcc
|
||||||
|
|
||||||
|
# 获取配置
|
||||||
|
server_type=`get_config server type`
|
||||||
|
db_type=`get_config db type`
|
||||||
|
|
||||||
|
# 安装server服务器
|
||||||
|
if [ ! -f $BIN_PATH'/'$server_type'.sh' ];then
|
||||||
|
echo $BIN_PATH'/'$server_type'.sh不存在'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sh $BIN_PATH'/'$server_type'.sh'
|
||||||
|
|
||||||
|
if [ $? != 0 ];then
|
||||||
|
echo $server_type'安装失败'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 安装php
|
||||||
|
sh $BIN_PATH'/php.sh'
|
||||||
|
|
||||||
|
if [ $? != 0 ];then
|
||||||
|
echo 'php安装失败'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 安装php扩展
|
||||||
|
sh $BIN_PATH'/php_extension.sh'
|
||||||
|
|
||||||
|
if [ $? != 0 ];then
|
||||||
|
echo 'php_extension安装失败'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 安装db服务器
|
||||||
|
if [ ! -f $BIN_PATH'/'$db_type'.sh' ];then
|
||||||
|
echo $BIN_PATH'/'$db_type'.sh不存在'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sh $BIN_PATH'/'$db_type'.sh'
|
||||||
|
|
||||||
|
if [ $? != 0 ];then
|
||||||
|
echo $db_type'安装失败'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user