ITPub博客

首页 > 数据库 > 数据库开发技术 > Linux系统初始化脚本之二

Linux系统初始化脚本之二

原创 数据库开发技术 作者:运维book思议 时间:2023-02-06 10:43:07 0 删除 编辑

先放个链接,万一有人关注呢

优质文章推荐

↓ ↓ ↓ ↓ ↓

Linux系统初始化脚本


分享一个Linux系统初始化脚本,话不多说,上干货!

#!/usr/bin/bashecho "欢迎使用初始化jio本"read -p "是否安装epel源?Y/N:" an1if [ $an1 = 'y' ] || [ $an1 = 'Y' ];then#安装epel源  echo "正在安装epel源,请耐心等待..."  yum -y install epel-release &> /dev/nullelse  breakfi{read -p "是否需要配置base源?Y/N:" an2if [ $an2 = 'y' ] || [ $an2 = 'Y' ];then#配置yum源/bin/cp  /etc/yum.repos.d/CentOS-Base.repo  /etc/yum.repos.d/CentOS-Base.repo.baksed -ri "s/\(mirrorlist=\)/#1/g" /etc/yum.repos.d/CentOS-Base.reposed -ri "s/#\(baseurl=\)/1/g" /etc/yum.repos.d/CentOS-Base.repoelse  breakfi}{read -p "是否需要配置epel源?Y/N:" an3if [ $an3 = 'y' ] || [ $an3 = 'Y' ];then  /bin/cp /etc/yum.repos.d/epel.repo  /etc/yum.repos.d/epel.repo.bak  sed -ri "s/\(mirrorlist=\)/#1/g" /etc/yum.repos.d/epel.repo  sed -ri "s/.*\(baseurl=\)/1/g" /etc/yum.repos.d/epel.repoelse  breakfi}read -p "是否清楚缓存并建立新的缓存?Y/N:" an4if [ $an4 = 'y' ] || [ $an4 = 'Y' ];then  echo "正在清理缓存并建立新的缓存,请稍后..."  #清除缓存  yum clean all  &> /dev/null  #新建缓存  yum makecache &> /dev/null  if [ $? -eq 0 ];then    echo "缓存建立完成!"  else     echo "缓存建立失败,请检查网络或者日志文件!"  fielse  breakfi#关闭防火墙systemctl stop firewalld  &> /dev/nullsystemctl disable firewalld &> /dev/null
#关闭selinuxsetenforce 0 &> /dev/nullsed -ri 's/\(SELINUX=\)enforcing/\1disabled' /etc/selinux/config &> /dev/nullyum -y install vim wget lsfo &> /dev/nullif [ $? -eq 0 ];then echo "常用工具安装完成,祝您使用愉快!"else echo "常用工具安装失败,请检查网络或日志"fi

谢谢你这么好看还关注我


原文作者:运维book思议;如有侵权,请联系管理员删除。

请登录后发表评论 登录
全部评论

注册时间:2022-09-24

  • 博文量
    333
  • 访问量
    215206