zoukankan      html  css  js  c++  java
  • centos7安装后,一些小优化

    1.设置静态ip

    vim /etc/sysconfig/network-scripts/ifcfg-ens33

      将BOOTPROTO=dhcp修改为BOOTPROTO=static
    
      ONBOOT=no修改为ONBOOT=yes
    
    新增
    
      IPADDR=192.168.80.129
      PREFIX=24    #NETMASK=255.255.255.0
      GATEWAY=192.168.80.2
      DNS1=114.114.114.114
      DNS2=8.8.8.8

    之后重启网络服务

    systemctl restart network

    2.关闭NetworkManager

    systemctl status NetworkManager
    
    systemctl stop NetworkManager
    
    systemctl disable NetworkManager

    3.关闭selinux

    vim /etc/selinux/config
    
    将SELINUX=enforcing注释掉,并添加SELINUX=disabled,之后重启电脑生效

    4.修改主机名

    hostnamectl set-hostname centos2

    5.修改yum源为阿里云

    cd /etc/yum.repos.d
    
    wget http://mirrors.aliyun.com/repo/Centos-7.repo
    
    mv CentOS-Base.repo CentOS-Base.repo.bak
    
    mv Centos-7.repo CentOS-Base.repo
    
    yum clean all
    
    yum makecache
    
    yum update

    6.设置环境变量

     

    cd /etc/profile.d/
    
     vim custom.sh  
    
        export PS1="[e[35;1m][u@h w]\$[e[m] "
    
        alias sudo='sudo '
    
        alias egrep='egrep --color=auto'
        alias fgrep='fgrep --color=auto'
        alias grep='grep --color=auto'
        alias ls='ls --color=auto'
        alias l.='ls -d .* --color=auto'
        alias ll='ls -l --color=auto'
        alias l='ls -laF'
    
        alias cp='cp -i'
        alias mv='mv -i'
        alias rm='rm -i'
    
        alias now='date +%Y%m%d%H%M%S'
    
     source custom.sh

     7.ssh无密码登录

    生成公钥私钥

    ssh-keygen -t rsa

    新建文件并添加主机公钥

    touch authorized_keys
    
    #vim authorized_keys

    8.修改最大文件打开数

    先查看默认最大文件打开数

    ulimit -n
    
    ulimit -a

    修改配置文件 

    vim /etc/security/limits.conf

    在最后添加

    * soft nofile 65535
    
    * hard nofile 65535

     之后重启电脑生效

  • 相关阅读:
    Loki 初体验
    柠檬研究院及第一期活动预告
    Apache SkyWalking 为.NET Core带来开箱即用的分布式追踪和应用性能监控
    聊聊AspectCore动态代理中的拦截器
    使用AspectCore动态代理
    AspectCore中的IoC容器和依赖注入
    AspectCore.Extension.Reflection : .NET Core反射扩展库
    Asp.Net Core轻量级Aop解决方案:AspectCore
    [精品书单] C#/.NET 学习之路——从入门到放弃
    创建vue项目
  • 原文地址:https://www.cnblogs.com/sswind/p/11778182.html
Copyright © 2011-2022 走看看