YUM仓库配置
    yum install wget -y

    cd /etc/yum.repos.d/
    cp -r ../yum.repos.d/ ../yum.repos.d.back
    rm -rf *.repo

    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo

    wget -O /etc/yum.repos.d/epel.repo http://mirrors.cloud.tencent.com/repo/epel-7.repo

    yum clean all
    yum makecache

    yum install -y net-tools vim lrzsz tree screen lsof tcpdump bash-completion-extras wget ntp

    关闭networkmanager
    systemctl disable NetworkManager && systemctl stop NetworkManager

    关闭防火墙
    systemctl disable firewalld && systemctl stop firewalld

    关闭 SELinux
    # 检查 SELinux 的状态,如果它已经禁用,可以跳过后面的命令
    sestatus
    可以使用以下命令禁用 SELinux,或者修改配置文件。
    # 通过命令临时禁用 SELinux
    setenforce 0
    # 或者修改配置文件
    sed -i ‘s/^SELINUX=enforcing/SELINUX=disabled/g’ /etc/selinux/config
    接着,重启机器:
    reboot

    配置SSH服务
    sed -i ‘s%#UseDNS yes%UseDNS no%g’ /etc/ssh/sshd_config
    systemctl restart sshd

    配置NTP服务
    yum -y install chrony ntp
    vim /etc/chrony.conf
    server ntp1.aliyun.com iburst
    image.png
    systemctl enable chronyd
    systemctl start chronyd
    ntpstat

    调整文件描述符
    ulimit -n
    cp /etc/security/limits.conf /etc/security/limits.confbak

    1. cat >>/etc/security/limits.conf<< EOF
    2. root soft nofile 102400
    3. root hard nofile 102400
    4. EOF

    ulimit -n

    配置pip国内源
    腾讯源

    1. mkdir -p ~/.pip/
    2. cat > ~/.pip/pip.conf<<EOF
    3. [global]
    4. index-url = https://mirrors.cloud.tencent.com/pypi/simple
    5. trusted-host = mirrors.cloud.tencent.com
    6. EOF

    清理模板虚拟机

    1. > /var/log/messages
    2. > /var/log/secre
    3. history -c
    4. > /root/.bash_history
    5. poweroff