This commit is contained in:
wzj 2021-11-18 13:11:00 +08:00
commit f97b55fc45
2 changed files with 77 additions and 0 deletions

3
README.md Normal file
View File

@ -0,0 +1,3 @@
new centos script
...
git clone http://gitea.liuyan.wang/wzj/new_system_set.git;cd new_system_set;bash newset.sh

74
newset.sh Normal file
View File

@ -0,0 +1,74 @@
#!/bin/bash
#新系统脚本
#by author of wzj
#2021年8月20日
#####################
#安装基本工具
BASE_INSTALL()
{
echo -e "\033[32m安装基本工具\033[0m"
sleep 1.5
for i in wget
do
yum install -y ${i}
done
}
REPO_REPLACE()
{
echo -e "\033[32m备份旧yum源并导入阿里源\033[0m"
sleep 1.5
DATE=`date +"%Y-%m-%d"`
if [ ! -d /etc/yum.repos.d/bak/${DATE} ];then
mkdir -p /etc/yum.repos.d/bak/${DATE}
fi
for i in `ls /etc/yum.repos.d|grep -v bak`
do
\mv /etc/yum.repos.d/${i} /etc/yum.repos.d/bak/${DATE}
done
wget http://mirrors.aliyun.com/repo/Centos-7.repo -O /etc/yum.repos.d/CentOS-Base.repo
wget http://mirrors.aliyun.com/repo/Centos-7.repo -P /etc/yum.repos.d
wget http://mirrors.aliyun.com/repo/epel-7.repo -P /etc/yum.repos.d/
yum clean all
yum makecache
}
TOOL_INSTALL()
{
echo -e "\033[32m安装常用工具\033[0m"
sleep 1.5
for TOOL in net-tools lrzsz vim
do
echo "安装${TOOL}..."
sleep 1
#rpm -qa|grep ${TOOL} >>/dev/null 2>&1
#if [ $? -ne 0 ];then
yum -y install ${TOOL}
#fi
done
}
FIREWALLD()
{
echo -e "\033[32m关闭防火墙FIREWALLD\033[0m"
sleep 1.5
systemctl disable firewalld
systemctl stop firewalld
}
IPTABLES()
{
echo -e "\033[32m关闭防火墙IPTABLES\033[0m"
sleep 1.5
setenforce 0
if [ ! -f /etc/selinux/config.bak ];then
cp -r /etc/selinux/config /etc/selinux/config.bak
fi
sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
}
BASE_INSTALL
REPO_REPLACE
TOOL_INSTALL
FIREWALLD
IPTABLES