多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
### 主机名修改(这个主机名主机规划好) hostnamectl set-hostname name #### 1、查看内核版本 :uname -r ``` yum -y install kernel-ml-5.7.8-1.el7.elrepo.x86_64.rpm kernel-ml-devel-5.7.8-1.el7.elrepo.x86_64.rpm 调整默认启动内核 cat /boot/grub2/grub.cfg | grep menuentry 查看是否设置成功 grub2-editenv list reboot ``` #### 2、开启ipvs支持 ``` cat > /etc/sysconfig/modules/ipvs.modules <<EOF #!/bin/bash ipvs_modules="ip_vs ip_vs_lc ip_vs_wlc ip_vs_rr ip_vs_wrr ip_vs_lblc ip_vs_lblcr ip_vs_dh ip_vs_sh ip_vs_fo ip_vs_nq ip_vs_sed ip_vs_ftp" for kernel_module in \${ipvs_modules}; do /sbin/modinfo -F filename \${kernel_module} > /dev/null 2>&1 if [ $? -eq 0 ]; then /sbin/modprobe \${kernel_module} fi done EOF chmod 755 /etc/sysconfig/modules/ipvs.modules bash /etc/sysconfig/modules/ipvs.modules lsmod | grep ip_vs ``` #### 3、关闭防火墙 ``` systemctl stop firewalld && systemctl disable firewalld ``` #### 4、关闭swap分区 ``` swapoff -a && sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab ``` #### 5、关闭SELinux ``` setenforce 0 sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config ``` #### 6、修改文件句柄数 ``` vim /etc/security/limits.conf * soft nofile 65536 * hard nofile 65536 * soft nproc 65536 * hard nproc 65536 * soft memlock unlimited * hard memlock unlimited ``` #### 7、 修改系统参数 ``` vim /etc/sysctl.d/k8s.conf net.ipv4.tcp_keepalive_time = 600 net.ipv4.tcp_keepalive_intvl = 30 net.ipv4.tcp_keepalive_probes = 10 net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1 net.ipv4.neigh.default.gc_stale_time = 120 net.ipv4.conf.all.rp_filter = 0 net.ipv4.conf.default.rp_filter = 0 net.ipv4.conf.default.arp_announce = 2 net.ipv4.conf.lo.arp_announce = 2 net.ipv4.conf.all.arp_announce = 2 net.ipv4.ip_forward = 1 net.ipv4.tcp_max_tw_buckets = 5000 net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_max_syn_backlog = 1024 net.ipv4.tcp_synack_retries = 2 net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 net.netfilter.nf_conntrack_max = 2310720 fs.inotify.max_user_watches=89100 fs.may_detach_mounts = 1 fs.file-max = 52706963 fs.nr_open = 52706963 net.bridge.bridge-nf-call-arptables = 1 vm.swappiness = 0 vm.overcommit_memory=1 vm.panic_on_oom=0 sysctl --system ``` #### 8、 时间同步服务安装 ``` yum -y install ntp ntpdate ntpdate 0.asia.pool.ntp.org hwclock --systohc systemctl enable ntpd systemctl start ntpd systemctl status ntpd ``` #### 9、调整yum源 安装 epel-release ` yum install epel-release -y` #### 10、安装一些必要的工具 `yum install wget net-tools tree nmap sysstat lrszs dos2unix bind-utils -y`