更新系统包: yum -y update 关联包: yum install gcc gcc-c++ make cmake ntp redhat-lsb lrzsz flex byacc libpcap ncursesdevel libpcap-devel psmisc 编译安装 iftop安装: yum install -y flex byacc libpcap ncurses-devel libpcap-devel wget http://www.ex-parrot.com/pdw/iftop/download/iftop-1.0pre4.tar.gz tar -zxvf iftop-1.0pre4.tar.gz cd iftop-1.0pre4 ./configure make && make install 命令补全: yum install bash-completion sh /usr/share/bash-completion/bash_completion 从新开启终端就不全命令恢复正常。 时间同步定时任务 crontab -e */30 * * * * /usr/sbin/ntpdate 1.cn.pool.ntp.org */35 * * * * /usr/sbin/ntpdate 2.asia.pool.ntp.org */40 * * * * /usr/sbin/ntpdate 3.asia.pool.ntp.org 给普通账号增加sudo权限: vim /etc/sudoers 关闭Selinux: vim /etc/selinux/config 修改参数如下: SELINUX=disabled 增加文件打开数: vim /etc/security/limits.conf 增加如下内容: * soft nofile 300000 * hard nofile 300000 关闭开机启动firewalld: systemctl disable firewalld.service 关闭firewalld服务: systemctl stop firewalld.service #关闭服务 systemctl disable firewalld.service #永久关闭服务。 内核参数优化: 编辑以下文件: [root@lvs-01 ~]# vim /etc/sysctl.conf 添加以下内容: net.ipv4.tcp_max_tw_buckets = 300000 net.ipv4.tcp_sack = 1 net.ipv4.tcp_window_scaling = 1 net.ipv4.tcp_rmem = 4096 87380 16777216 net.ipv4.tcp_wmem = 4096 16384 16777216 net.ipv4.tcp_syncookies = 1 net.core.wmem_default = 8388608 net.core.rmem_default = 8388608 net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 net.core.netdev_max_backlog = 32768 net.core.somaxconn = 32768 net.ipv4.tcp_max_orphans = 3276800 net.ipv4.tcp_max_syn_backlog = 262144 net.ipv4.tcp_timestamps = 0 net.ipv4.tcp_synack_retries = 1 net.ipv4.tcp_syn_retries = 1 net.ipv4.tcp_tw_recycle = 0 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_mem = 94500000 915000000 927000000 net.ipv4.tcp_fin_timeout = 1 net.ipv4.tcp_keepalive_time = 1800 net.ipv4.ip_forward = 1 net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.default.accept_source_route = 0 kernel.shmmax = 134217728 kernel.sysrq = 0 kernel.core_uses_pid = 1 kernel.msgmni=1000 kernel.msgmax=81920 kernel.msgmnb=163840 kernel.shmmax = 4294967295 kernel.shmall = 268435456 kernel.sem = 250 32000 100 128 fs.file-max = 3299360 vm.swappiness=10 fs.inotify.max_user_watches=8192000 修改SSH,关闭root 登录: vim /etc/ssh/sshd_config Port 11111 #修改ssh端口号 PermitRootLogin no #ssh禁止root登录 网卡配置: vim /etc/sysconfig/network-scripts/ifcfg-ens33 BOOTPROTO="none" ONBOOT="yes" IPADDR="192.168.8.145" NETMASK="255.255.255.0" GATEWAY="192.168.8.2" DNS1="114.114.114.114" systemctl restart network.service #重启网卡。
标签:初始化,kernel,步骤,tcp,ipv4,max,服务器,net,core From: https://www.cnblogs.com/yasheidelei/p/17531360.html