#!/bin/bash
#
#********************************************************************
#Author: zhuzikang
#QQ: 985848343
#Date: 2021-08-18
#FileName: wcp.sh
#URL: www.zhuzikang.cn
#Description: The test script
#Copyright (C): 2021 All rights reserved
#********************************************************************
DIR=`pwd`
PORINT_NAME="mysql-5.7.32-linux-glibc2.12-x86_64"
PACKAGE_NAME="${PORINT_NAME}.tar.gz"
DOCKER_FILE=${DIR}/${PACKAGE_NAME}
DIR2="/usr/local"
PORINT_NAME2="apache-tomcat-7.0.109"
PACKAGE_NAME2="apache-tomcat-7.0.109.tar.gz"
DOCKER_FILE2=${DIR2}/${PORINT_NAME2}
centos_install_docker(){
grep "Kernel" /etc/issue &> /dev/null
if [ $? -eq 0 ];then
/bin/echo "当前系统是`cat /etc/redhat-release`,即将开始系统初始化、配置与安装mysql" && sleep 1
systemctl stop firewalld && systemctl disable firewalld && echo "防火墙已关闭" && sleep 1
systemctl stop NetworkManager && systemctl disable NetworkManager && echo "NetworkManager" && sleep 1
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux && setenforce 0 && echo "selinux 已关闭" && sleep 1
/bin/tar xvf ${DOCKER_FILE}
if [ -e ${DIR}/mysql ];then
action "mysql 已经安装" false
exit 3
else
mv ${DIR}/${PORINT_NAME} mysql
mkdir -p ${DIR}/mysql/logs
fi
grep mysql /etc/passwd &> /dev/null
if [ $? -eq 1 ];then
groupadd -r mysql && useradd -r -g mysql -s /sbin/nologin -M mysql
chown -R mysql:mysql ${DIR}/mysql
fi
\cp -rf ${DIR}/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
/lib/systemd/systemd-sysv-install enable mysqld
systemctl enable mysqld
if [ $? -eq 0 ];then
/lib/systemd/systemd-sysv-install enable mysqld
systemctl restart mysqld
fi
echo "export MYSQL_HOME=/opt/mysql" >> /etc/profile
echo "export PATH=\$PATH:\$MYSQL_HOME/bin" >> /etc/profile
source /etc/profile
yum install libaio* -y
cat > /etc/my.cnf <<-EOF
[mysqld]
datadir=${DIR}/mysql/data
basedir=${DIR}/mysql
socket=${DIR}/mysql/mysql.sock
lower_case_table_names=1
!includedir /etc/my.cnf.d
EOF
mysqld --initialize-insecure --user=mysql --basedir=${DIR}/mysql --datadir=${DIR}/mysql/data
systemctl start mysqld && systemctl status mysqld
ln -sv ${DIR}/mysql/mysql.sock /tmp/mysql.sock
service mysql restart && source /etc/profile && exit
fi
}
tomcat_install_docker(){
grep windows /etc/passwd &> /dev/null
if [ $? -eq 1 ];then
useradd windows && groupadd windows
fi
/bin/tar xvf ${DIR}/${PACKAGE_NAME2} -C ${DIR2}
chown -R windows.windows ${DOCKER_FILE2}
${DOCKER_FILE2}/bin/catalina.sh start
}
main(){
tomcat_install_docker
centos_install_docker
}
main
标签:bin,install,tomcat,etc,&&,mysql,docker,DIR
From: https://www.cnblogs.com/zikang/p/17103939.html