Centos安装与配置

一、安装

  • 默认安装

二、配置

  1. 配置网卡
    BOOTPROTO=none
    ONBOOT=yes
    IPADDR=xxx.xxx.x.xx
    PREFIX=24
    GATEWAY=xxx.xxx.x.x
    DNS1=xxx.xxx.x.x
    
    注:删掉网卡内的UUID ,通用唯一识别码和HWADDR   MAC地址  这两行。  所有网卡都需要删除
  2. 安装wget:yum -y install wget;
  3. 修改为阿里的yum源
    1、cd /etc/yum.repos.d
    2、备份
        mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
        或
        mv /etc/yum/repos.d/CentOS-Base.repo{,.date -I}
    3、下载版本
      wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    4、添加epel
      wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
    5、生成缓存
     yum clean all
     yum makecache
  4. 下载常用工具
    yum -y install wget net-tools screen lsof tcpdump nc mtr openssl-devel vim bash-completion lrzsz nmap telnet tree ntpdate bash-completion chrony vsftpd
    提升效率:
    yum -y install ncdu glances mosh rsync
  5. 关闭selinux
    sed -i.bak 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
  6. 关闭防火墙
    systemctl stop firewalld
    systemctl disable firewalld
  7. 修改主机名
    hostnamectl set-hostname 7mini
  8. 修改字符集
    localectl status      #查看当前字符集
    # localectl set-locale LANG=zh_CN.UTF-8     #修改字符集为zh_CN.UTF-8,命令行和配置文件都生效
    # cat /etc/locale.conf       #查看配置文件
    LANG=zh_CN.UTF-8
  9. 修改文件数限制
    ulimit -n         #默认大小
    1024
    echo "* soft nofile 65536" >> /etc/security/limits.conf         #xi修改最大限制为65535
    echo "* hard nofile 65536" >> /etc/security/limits.conf
    reboot           #重启后生效 
  10. 时间同步
    ntpdate ntp1.aliyun.com 
    cp /etc/chrony.conf{,.bak}
    
    vim /etc/chrony.conf
    server ntp6.aliyun.com iburst
     
    systemctl start chronyd
    systemctl enable chronyd #开机启动
    systemctl restart chronyd
    chronyc sources #查看同步源
    [root@7mini-node2 ~]# chronyc sources 
    210 Number of sources = 1
    MS Name/IP address Stratum Poll Reach LastRx Last sample 
    ===============================================================================
    ^* 203.107.6.88 2 6 17 31 +653us[+1965us] +/- 32ms
    
    2)或者通过计划任务进行同步
    [root@linux-node1 ~]# crontab -e
    no crontab for root - using an empty one
    crontab: installing new crontab
    [root@linux-node1 ~]# crontab -l
    */5 * * * * /usr/sbin/ntpdate time1.aliyun.com > /dev/null
  11. 可参考:https://www.cnblogs.com/jokerbj/p/9133093.html
posted @ 2020-05-07 16:17  Water540  阅读(206)  评论(0编辑  收藏  举报