在home下新建一个文件夹packages,将rpms、rpm_new、python2、python_tassl.tgz、gm_soft.conf、gm_prox上传到/root/packages目录下安装即可
#!/bin/bash
# 变量
OFFLINE_PATH=/home/packages
INSTALLED_PATH=/home/qw
function close_Firewall(){
echo "-----------------------START-关闭防火墙--------------------------------"
echo "防火墙关闭中..."
systemctl stop firewalld.service
systemctl disable firewalld.service
echo "防火墙已关闭!"
echo "-----------------------END-关闭防火墙----------------------------------"
}
function install_gm(){
if [ ! -d "$INSTALLED_PATH" ]; then mkdir -p $INSTALLED_PATH;fi
echo "-----------------------START-安装配置国密-----------------------------"
echo "安装国密依赖中..."
rpm -Uvh --force --nodeps $OFFLINE_PATH/rpms/*.rpm
rpm -Uvh --force --nodeps $OFFLINE_PATH/rpm_new/*.rpm
echo "安装完毕!"
echo "如下输出包含openssl:/usr/lib64/openssl /usr/include/openssl则表明openssl安装成功)"
whereis openssl
echo "安装国密中..."
tar -xvf $OFFLINE_PATH/python_tassl.tgz -C /
cd /root/nginx_phpMultiVersionIMG
source install_nginx+php-1.16.1.sh
source /alidata/server/nginx/sbin/setting
mv /alidata/server/nginx/conf/vhosts/gm_card.conf /alidata/server/nginx/conf/vhosts/gm_card
echo "安装完毕!"
echo "配置国密服务端中..."
source /alidata/server/nginx/sbin/setting
mv /alidata/server/nginx/conf/vhosts/gm_soft.conf /alidata/server/nginx/conf/vhosts/gm_soft.conf.bak
cp $OFFLINE_PATH/gm_soft.conf /alidata/server/nginx/conf/vhosts/gm_soft.conf
echo "配置完毕!"
echo "启动国密服务端中..."
nohup /alidata/server/nginx/sbin/nginx &>/dev/null
echo "国密服务端已启动!"
echo "可使用命令(ps -aux | grep nginx)查看国密服务端状态"
echo "安装国密客户端依赖中..."
source /alidata/server/nginx/sbin/setting
cd $OFFLINE_PATH/python2
cp requirements.txt packages/
cd packages
/usr/local/Python-2.7.17/bin/pip install --no-index --find-links=file:./ -r requirements.txt
echo "安装完毕!"
echo "启动国密客户端中..."
cp -r $OFFLINE_PATH/gm_prox $INSTALLED_PATH/gm_prox
cd $INSTALLED_PATH/gm_prox
nohup /usr/local/Python-2.7.17/bin/gunicorn -w 4 -b 0.0.0.0:2879 manage:app &
echo "启动国密客户端已启动!"
echo "-----------------------END-安装配置国密-------------------------------"
}
# 调用函数执行安装
#close_Firewall
install_gm