zoukankan      html  css  js  c++  java
  • centos7 初始化安装

    CENTOS7 初装

    一、分区

    挂载路径 格式 容量
    / xfs 102400
        |swap | 等同内存大小
    

    /home |xfs |剩余

    二、时区

    Asia/Shanghai

    三、安装包选择

    选择最小化安装

    minimal
    

    然后安装一下安装包

    yum  install -y epel-release  #扩展源
    
    yum install -y vim wget openssl openssl-devel openssl pcre pcre-devel telnet setuptool ntsysv git python-urllib3 sqlite  sqlite-devel bzip2 bzip2-devel gcc gcc-c++ cmake lsof sysstat bind-utils ntp iftop iotop tree screen iftop ntpdate
    
    # 如果是开发机的话,建议安装下面的组件
    yum groupinstall -y "Development tools"
    

    四、配置

    1. 网络配置

        DEVICE=eth0
        ONBOOT=yes
        BOOTPROTO=static
        IPADDR=192.168.1.1
        NETMASK=255.255.255.0
        GATEWAY=192.168.1.1
        
        #重启网卡
        /etc/init.d/network restart
        
        #测试 
        ping g.cn
    

    2. 禁用selinux

        # vim /etc/selinux/config
    
        SELINUX=disabled
    

    4. 系统服务

    services只保留crond、lvm2-monitor、microcode_ctl、netfs、network、sshd、postfix.

    5. 时间同步

    先修正时区
    
    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 
    
    同步时间 并写入到硬件
    
    d
    
    
    crontab -e
    
    */5 * * * * /usr/sbin/ntpdate time.windows.com
    

    6. 文件&连接

     vim /etc/security/limits.conf
     
     #加上
     *                -       nofile          65535
     
     vim /etc/security/limits.d/90-nproc.conf
     
     #修改
     *                soft    nproc           10240
    

    7. 内核优化

    参数说明,请查看我的nginx安装文档

    fs.file-max = 999999
    net.ipv4.tcp_tw_reuse = 1
    net.ipv4.tcp_keepalive_time = 600
    net.ipv4.tcp_fin_timeout = 30
    net.ipv4.tcp_max_tw_buckets = 5000
    net.ipv4.ip_local_port_range = 1024    61000
    net.ipv4.tcp_rmem = 4096 32768 262142
    net.ipv4.tcp_wmem = 4096 32768 262142
    net.core.netdev_max_backlog = 8096
    net.core.rmem_default = 262144
    net.core.wmem_default = 262144
    net.core.rmem_max = 2097152
    net.core.wmem_max = 2097152
    net.ipv4.tcp_syncookies = 1
    net.ipv4.tcp_max_syn_backlog = 1024
    
    #使之生效
    
    sysctl -p
    

    8. ssh 配置

    vim /etc/ssh/sshd_config
    修改:#UseDNS yes为 UseDNS no
    
    vim /etc/ssh/ssh_config
    Host *
        GSSAPIAuthentication no
    

    9. dns 设置

    vim /etc/resolv.conf
    #具体可以找运营商要
    nameserver 223.5.5.5
    nameserver 1.2.4.8
    

    10. postfix

    发邮件需要这个

    # service postfix restart && chkconfig postfix on
    
    #测试发送邮件
    #echo “mail content” | mail –s test xxxx@163.com
    

    11. 更新&重启

    yum install update -y
    
    reboot
    
    # update 会更新内核,所以这里必须要重启才能使用
    

    12. 补充 grep 高亮

    编辑 ~/.bashrc
    alias grep = 'grep --color=auto'
    

    系统初装到此结束

  • 相关阅读:
    Windows下图文详解PHP三种运行方式(php_mod、cgi、fastcgi)
    【强烈推荐】利用NAT、Host-Only双虚拟网卡,实现Virtual Box中CentOS6.3联网
    PHP批量清空删除指定文件夹内容
    MySQL收藏
    Eclipse快捷键与使用技巧总结
    “知乎网”技术方案初探
    PHP数组常用函数
    PHP常用字符串的操作函数
    Linux下,如何给PHP安装pdo_mysql扩展
    PHP二维数组排序(list_order)
  • 原文地址:https://www.cnblogs.com/colder219/p/6980205.html
Copyright © 2011-2022 走看看