• linux虚拟机初始配置


    1- CentOS7配置静态IP地址:

    iface="网络接口名"
    cd /etc/sysconfig/network-scripts/; sed -i 's/^/#/' ifcfg-${iface}
    cat
    <<EOF >>/etc/sysconfig/network-scripts/ifcfg-${iface} TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=none DEFROUTE=yes NAME=${iface} DEVICE=${iface} ONBOOT=yes IPADDR=192.168.122.11 PREFIX=24 GATEWAY=192.168.122.1 DNS1=223.5.5.5 DNS2=192.168.122.1 DNS3=8.8.8.8 EOF
    systemctl restart network #可以先不重启网络,先配置完下面的ssh再重启

    2- 解决ssh速度很慢的问题:

    sed -ri 's/^(GSSAPIAuthentication).*/1 no/; $aUseDNS no' /etc/ssh/sshd_config; systemctl restart sshd  #GSSAPI认证关闭,DNS关闭

      

    3- CentOS7使用阿里源:  

    sed -ri 's/^enabled=1/enabled=0/; s/^plugins=1/plugins=0/'  /etc/yum/pluginconf.d/fastestmirror.conf /etc/yum.conf  #去掉寻找最快源的功能Determining fastest mirrors
    cd /etc/yum.repos.d/; mv CentOS-Base.repo CentOS-Base.repo.bak; curl -Lo CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo && {  yum clean all; yum makecache; } #替换成阿里源

    4- CentOS7关闭防火墙/SELINUX

    systemctl stop firewalld; systemctl disable firewalld ; setenforce 0;sed -ri 's/^(SELINUX).*/1=disabled/' /etc/selinux/config
  • 相关阅读:
    (图论)树的直径
    HDU 4607
    类属性的增删改查
    python内置常用模块
    字典的使用
    元组的使用
    列表的基本函数
    字符串练习题
    python3.7字符串基本函数
    python简单的while语句和if语句的练习
  • 原文地址:https://www.cnblogs.com/mind-water/p/10719659.html
Copyright © 2020-2023  润新知