zoukankan      html  css  js  c++  java
  • centos7的基础优化你都做了吗?

    #!/bin/sh
    #因为现在大多都用的是centos7了所以6就没怎么写
    #其它系统脑补 #优化命令提示符PS1,添加颜色 release
    =`cat /etc/redhat-release | awk -F'[ |.]' '{print $4}'` echo "PS1='[[e[32;1m]u[e[0m]@[e[33;1m]h[e[0m] [e[34;1m]W[e[0m]]$ '" >>/etc/bashrc #优化yum下载源 if [ `cat /etc/redhat-release | awk '{print $1}'` == 'CentOS' ];then curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo yum makecache else echo '这不是CentOS添加其它系统的软件仓库' && exit 1 fi #安装常用工具软件 yum install -y vim tree nc nmap dos2unix wget lrzsz bash-completion net-tools #关闭seLinux sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config #关闭并且禁用firewalld 或者iptables if [ $release == 7 ];then systemctl stop firewalld systemctl disable firewalld elif [ $release == 6 ];then sevice iptables stop chkconfig iptables off fi #设置时区 if [ $release == 7 ];then timedatectl set-timezone Asia/Shanghai elif [ $release == 6 ];then
    echo '手动修改/etc/sysconfig/clock' fi #安装时间服务 if [ $release == 7 ];then yum install -y chrony && systemctl start chronyd timedatectl set-ntp 1 && timedatectl status elif [ $release == 6 ];then yum install -y ntp service ntpd start chkconfig ntpd on else echo "不存的版本,退出" && exit 3 fi read -p "输入你的主机名称:" name echo "你的主机名称是 $name" if [ $release == 7 ];then hostnamectl set-hostname $name elif [ $release == 6 ];then echo "HOSTNAME=$name" >> /etc/sysconfig/network fi

    grep 'GSSAPIAuthentication' /etc/ssh/sshd_config
    if [ `echo $?` == 0 ];then
    sed -i 's@GSSAPIAuthentication yes@GSSAPIAuthentication no@g' /etc/ssh/sshd_config
    fi
    sed -i 's@UseDNS yes@UseDNS no@g' /etc/ssh/sshd_config
    if [ `echo $?` != 0 ];then
    sed -i 's@#UseDNS yes@UseDNS no@g' /etc/ssh/sshd_config
    fi

     
  • 相关阅读:
    springboot 整合 pagehelper
    Linux maven安装
    linux 查看端口状态
    mysql执行顺序
    Java int/int 保留2位小数
    【每日一题】30.储物点的距离 (区间处理,前缀和/线段树//树状数组)
    【每日一题】29.maze (BFS 进阶)
    2016年第七届 蓝桥杯C组 C/C++决赛题解
    2016年第七届 蓝桥杯A组 C/C++决赛题解
    第六届蓝桥杯C++A组 A~F题题解
  • 原文地址:https://www.cnblogs.com/michael2018/p/11975236.html
Copyright © 2011-2022 走看看