• CentOS-7基础配置脚本


    #!/bin/bash
    
    currentTime=$(date +"%Y-%m-%d_%H:%M:%S")
    
    echo "blacklist i2c_piix4"  >> /etc/modprobe.d/blacklist.conf
    echo "blacklist pcspkr" >> /etc/modprobe.d/blacklist.conf
    
    sed -i '/SELINUX=enforcing/s/^/#/'  /etc/selinux/config
    sed -i '/#SELINUX=enforcing/a SELinux=disabled'  /etc/selinux/config
    
    sed -i '/UseDNS yes/s/^/#/' /etc/ssh/sshd_config
    sed -i '/#UseDNS yes/a UseDNS no' /etc/ssh/sshd_config
    sed -i '/#UseDNS no/a UseDNS no' /etc/ssh/sshd_config
    
    # firewall-cmd --zone=public --add-port=5432/tcp --permanent
    firewall-cmd --reload
    
    systemctl stop postfix
    systemctl disable postfix
    yum -y remove postfix
    mariadb_rpm=$(yum list installed | grep mariadb | awk '{print $1}')
    yum -y remove $mariadb_rpm
    
    ###yum_conf
    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup$currentTime
    
    cat > /etc/yum.repos.d/CentOS-Base.repo << EOF
    [base]
    name=CentOS-$releasever - Base
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
    baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
    
    #released updates
    [updates]
    name=CentOS-$releasever - Updates
    # mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
    baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
    
    #additional packages that may be useful
    [extras]
    name=CentOS-$releasever - Extras
    # mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
    baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
    
    #additional packages that extend functionality of existing packages
    [centosplus]
    name=CentOS-$releasever - Plus
    # mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
    baseurl=https://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
    gpgcheck=1
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
    EOF
    
    yum makecache
    yum -y install java-1.8.0-openjdk
    yum -y groupinstall "Development Tools"
    
    
  • 相关阅读:
    带你了解什么是Push消息推送
    小白学习如何打日志
    最近学到的前后端分离知识
    记一次愚蠢的操作--线程安全问题
    在工作中常用到的SQL
    在工作中常用的Linux命令
    记一次愚蠢的经历--String不可变性
    在公司做的项目和自己在学校做的有什么区别?
    程序员的快乐就是这么朴素无华且枯燥
    《大型网站系统与Java中间件》读书笔记 (中)
  • 原文地址:https://www.cnblogs.com/javaite/p/10558217.html
Copyright © 2020-2023  润新知