From d6bcb0f5bf04fde5077a47713af8568364d3e6a7 Mon Sep 17 00:00:00 2001 From: zwb <1465302821@qq.com> Date: Thu, 26 Dec 2024 09:43:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20MD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MD/centos.sh | 76 +++++++++++++++++++++++++++++++++++++++++++++ MD/install-mysql.sh | 18 +++++++++++ 2 files changed, 94 insertions(+) create mode 100644 MD/centos.sh create mode 100644 MD/install-mysql.sh diff --git a/MD/centos.sh b/MD/centos.sh new file mode 100644 index 0000000..d3d1c88 --- /dev/null +++ b/MD/centos.sh @@ -0,0 +1,76 @@ +#!/usr/bin/bash +list(){ +echo "--------------------------------------" +echo "------------性能优化工具箱------------" +echo "------------1.更换YUM源---------------" +echo "------------2.关闭防火墙--------------" +echo "------------3.时间同步----------------" +echo "------------4.创建用户----------------" +echo "------------5.安装软件----------------" +echo "------------6.EXIT--------------------" +} +yuan(){ + rm -rf /etc/yum.repos.d/* + curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo &>/dev/null + curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo &>/dev/null + yum clean all + yum makecache fast +} +fire(){ + systemctl stop firewalld + systemctl disable firewalld + setenforce 0 #临时关闭 + sed -ri s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config #永久关闭 +} +timed(){ + yum -y install ntpdate &>/dev/null + ntpdate aliyun.com +} +user(){ + read -p "请输入你要创建的用户名字:" name + useradd $name + userpasswd=`echo $RANDOM` + echo $userpasswd|passwd --stdin $name &>/dev/null + if [ $? -eq 0 ];then + echo "用户名:$name的密码:$userpasswd">>/opt/user.txt + echo "用户创建成功" + else + exit + fi +} +anzhuang(){ + yum -y install vim lsof unzip wget &>/dev/null +} +while : +do +list +read -p "请输入您的选项:" num +case $num in +1) + yuan + sleep 3 +;; +2) + fire + sleep 3 +;; +3) + timed + sleep 3 +;; +4) + user + sleep 3 +;; +5) + anzhuang + sleep 3 +;; +6) + exit +;; +*) + echo "请您按要求输入:(12345)" +;; +esac +done diff --git a/MD/install-mysql.sh b/MD/install-mysql.sh new file mode 100644 index 0000000..36fe151 --- /dev/null +++ b/MD/install-mysql.sh @@ -0,0 +1,18 @@ +#!/usr/bin/bash + +#准备MySQL的yum仓库 + yum -y install https://dev.mysql.com/get/mysql80-community-release-el7-11.noarch.rpm +#修改安装版本,启用5.7版本 + yum -y install yum-utils + yum-config-manager --disable mysql80-community + yum-config-manager --enable mysql57-community +#安装 + yum -y install mysql mysql-server + yum -y install mysql-community-client + yum -y install mysql-community-server +#初始化 + systemctl start mysqld + systemctl enable mysqld +#修改密码 + +