• 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

     
  • 相关阅读:
    Android Studio移动鼠标显示悬浮提示的设置方法
    解决adb push时出现的"Read-only file system"问题
    VIM常见用法总结
    忘记oracle的sys用户密码怎么修改以及Oracle 11g 默认用户名和密码
    Oracle中session和processes的设置
    ssh相关原理学习与常见错误总结
    如何利用Oracle VM Templates 在几分钟内部署Oracle Real Application Clusters (RAC)
    Oracle导入导出常用命令
    Tomcat 到底依赖JRE还是JDK
    截取url参数值
  • 原文地址:https://www.cnblogs.com/michael2018/p/11975236.html
Copyright © 2020-2023  润新知