• 综合架构_前优化


    #把以下内容vi到123.sh里 sh 123.sh即可运行
    #1优化yum源为阿里云镜像源
    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
    #下载常用软件
    yum install -y vim wget net-tools telnet bash-completion bash-completion-extras tree lrzsz htop ntpdate

    #关闭防火墙
    systemctl stop firewalld.service
    systemctl disable firewalld.service

    #临时及永久关闭selinux
    setenforce 0
    sed -i 's#SELINUX=enforcing#SELINUX=disabled#g'

    #高亮显示命令行(可选)
    echo "
    export PS1='[e[32;1m][[e[0m][e[35;1m]u[e[0m][e[31;1m]@[e[0m][e[36;1m]h[e[0m] W[e[32;1m]][e[0m][e[34;1m]$[e[0m]' " >>/etc/profile

    #关闭邮件服务器(可选)
    systemctl stop postfix
    systemctl disable postfix

    #主机解析(可选)
    cat >>/etc/hosts<<EOF
    172.16.1.81 firewalld
    172.16.1.5 lb01
    172.16.1.6 lb02
    172.16.1.7 web01
    172.16.1.8 web02
    172.16.1.9 web03
    172.16.1.51 db01
    172.16.1.31 nfs01
    172.16.1.41 backup
    172.16.1.61 m01
    172.16.1.71 zabbix
    EOF

    #定时更新时间(可选)
    echo "#定时更新时间
    */5 * * * * /usr/sbin/ntpdate ntp1.aliyun.com &> dev/null " >>/var/spool/cron/root

    #ssh优化(可选)
    sed -i 's#GSSAPIAuthentication yes#GSSAPIAuthentication no#g' /etc/ssh/sshd_config
    sed -i 's##UseDNS yes#UseDNS no#g' /etc/ssh/sshd_config

    #删除UUID HWADDR(只是删除现有网卡UUID)
    sed -ri '/UUID|HWADDR/d' /etc/sysconfig/network-scripts/ifcfg-eth[01]

    #一键更改主机名在其它脚本(此功能暂不开放)
    #mkdir -p /server/scripts
    #cat >>/etc/hosts<<EOF
    #"#!/bin/bash
    #name=$1
    #ip=$2
    #
    ##参数限制配置
    #if [ $# -ne 2 ]
    #then
    #echo '你没有输入两个参数'
    #exit
    #fi
    #
    ##修改主机名称
    #hostnamectl set-hostname $name
    #
    ##修改网卡地址
    #sed -i "s#200#$ip#g" /etc/sysconfig/network-scripts/ifcfg-eth[01] " > /server/scripts/init.sh
    #EOF

  • 相关阅读:
    简单函数调用分析
    从函数层面看栈溢出
    C语言漏洞基础(一)
    C语言函数篇(一)
    开发一种填表机器
    阿米洛varmilo键盘
    Flops
    助力高校计算机教育 —— 码云为老师推出免费高校版
    Numerical Methods LetThereBeMath
    Git Cookbook
  • 原文地址:https://www.cnblogs.com/zhanghongqi/p/11886238.html
Copyright © 2020-2023  润新知