diff --git a/os/get-mysql57.sh b/os/get-mysql.sh similarity index 70% rename from os/get-mysql57.sh rename to os/get-mysql.sh index cb7b5bf..d6360fb 100644 --- a/os/get-mysql57.sh +++ b/os/get-mysql.sh @@ -2,7 +2,7 @@ # by newrain # time 2019-11-28 # lv 2.0 -level=5.7 + password="QianFeng@123" remote_user="remote" remote_passwd="QianFeng@123" @@ -37,7 +37,14 @@ else color Error "网络错误" exit 22 fi -yum -y install mysql-community-server mysql-community-devel --disablerepo mysql80-community --enablerepo mysql57-community --nogpgcheck +if [ -z "$level" ];then + echo -e "使用此脚本:curl https://gitea.beyourself.org.cn/newrain001/shell-project/raw/branch/master/os/get-mysql.sh | level=5.7 sh\n版本号可选 5.6 5.7 8.0" +elif [ "$level" == "5.7" ];then + yum -y install mysql-community-server mysql-community-devel --disablerepo mysql80-community --enablerepo mysql57-community --nogpgcheck +elif [ "$level" == "8.0" ];then + yum install -y mysql-community-server --nogpgcheck +elif [ "$level" == "5.6" ];then + yum -y install mysql-community-server mysql-community-devel --disablerepo mysql80-community --enablerepo mysql56-community --nogpgcheck systemctl start mysqld color Warning "启动成功,初始密码如下(mysql5.7前版本没有初始密码)" passwd=$(grep -o 'root@localhost.*' /var/log/mysqld.log | awk 'END{print $NF}') diff --git a/os/get-repo.sh b/os/get-repo.sh index e9731f5..b021daa 100644 --- a/os/get-repo.sh +++ b/os/get-repo.sh @@ -16,8 +16,8 @@ bar=" =================================" echo -e $bar read -p "请选择配置项: " num -case $num in -1) + +if [[ $num -eq 1 ]];then cd /etc/yum.repos.d/ && \ dirname=$(mktemp -d repo-XXXXX) mv *.repo $dirname 2>/dev/null @@ -32,39 +32,35 @@ case $num in yum clean all && \ yum makecache && \ echo "缓存创建完成" - ;; -2) +elif [[ $num -eq 2 ]];then if [ ! -d "/etc/docker/" ]; then mkdir /etc/docker fi curl -o /etc/docker/daemon.json https://gitea.beyourself.org.cn/newrain001/download/raw/branch/master/repo/nexus-daemon.json echo "daemon.json 配置完成" - ;; -3) +elif [[ $num -eq 3 ]];then if [ ! -d $HOME/.pip ]; then mkdir $HOME/.pip fi curl -o $HOME/.pip/pip.conf https://gitea.beyourself.org.cn/newrain001/download/raw/branch/master/repo/pip.conf echo "pip.conf 配置完成" - ;; -4) +elif [[ $num -eq 4 ]];then echo "暂不支持" - ;; -5) +elif [[ $num -eq 5 ]];then echo "暂不支持" - ;; -6) +elif [[ $num -eq 6 ]];then cd /etc/yum.repos.d/ && \ dirname=$(mktemp -d repo-XXXXX) mv *.repo $dirname 2>/dev/null curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo echo "阿里云源配置完成" - ;; -q) + echo "开始创建缓存" + yum clean all && \ + yum makecache && \ + echo "缓存创建完成" +elif [[ $num == "q" ]];then exit 0 - ;; -*) +else echo "输入有误,请重新输入" - ;; -esac +fi