一个CentOS 8 2004 的OS初始化配置脚本

这个 OS 初始化脚本是我用于初始化实验主机用的,适用操作系统为 CentOS 8 2004 版本。

脚本内容:

     1 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.original

     2 dnf --version

     3 dnf -y install wget && wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo

     4 dnf clean all && dnf makecache

     5 dnf -y upgrade && dnf repolist

     6 systemctl stop firewalld && systemctl disable firewalld

     7 sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config && setenforce 0

     8 wget https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm

     9 dnf -y install https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm

    10 dnf clean all && dnf makecache

    11 dnf -y upgrade

    12 dnf list installed | grep chrony

    13 if [ $?=0 ];then

    14     echo "Package $(dnf list installed | grep chrony) has been installed "

    15 else

    16     echo "There is no package $(dnf list installed | grep chrony) and it will be installing"

    17     dnf -y install chrony

    18 fi

    19 wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm

    20 dnf -y localinstall google-chrome-stable_current_x86_64.rpm

    21 chronyc add server cn.ntp.org.cn

    22 chronyc sourcestats -v

    23 chronyc sources -v

    24 chronyc tracking

    25 dnf -y install tree

    26 dnf list installed

    27 who | grep googlebigtable | sed -n '1p' | cut -d' ' -f 1 | sort | uniq

    28 DescriptionUser=$(who | grep googlebigtable | sed -n '1p' | cut -d' ' -f 1 | sort | uniq)

    29 echo $DescriptionUser

    30 echo "$DescriptionUser  ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

    31 init 6

 

脚本执行过程请参见 本人的 51CTO博客:https://blog.51cto.com/6286393/2518215

CSDN博客限制篇幅字数呀!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值