---
title: 修改系统配置项
description: "CentOS 8.1系统下执行该章节操作，其他系统下无需执行。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengwebs/ecosystemEnable/SpringBoot/kunpengspringboot_02_0036.html
sourcePath: /source/zh/kunpengwebs/ecosystemEnable/SpringBoot/kunpengspringboot_02_0036.html
indexId: 5c00149729ef4c4599f10fa27bca4243c77b89e0bf1ccd4680e449057892413e80
---
# 修改系统配置项

CentOS 8.1系统下执行该章节操作，其他系统下无需执行。


#### 修改limits.conf

1. 编辑“/etc/security/limits.conf”配置文件。
  1 vim /etc/security/limits.conf

2. 按“i”进入编辑模式，文件末尾添加如下配置。
  1 2 3 4 * soft nofile 65536 * hard nofile 65536 * soft nproc 131072 * hard nproc 131072

3. 按“Esc”键，输入:wq!，按“Enter”保存并退出编辑。


#### 重启系统

1. 重启系统使前面的修改生效。
  1 reboot

2. 确认修改生效。
  1 sestatus

  1 ulimit -n


#### 优化内核参数

1. 编辑“/etc/sysctl.conf”配置文件。
  1 vim /etc/sysctl.conf

2. 按“i”进入编辑模式，增加配置。
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 kernel.shmmax = 500000000 kernel.shmmni = 4096 kernel.shmall = 4000000000 kernel.sem = 250 512000 100 2048 kernel.sysrq = 1 kernel.core_uses_pid = 1 kernel.msgmnb = 65536 kernel.msgmax = 65536 kernel.msgmni = 2048 net.ipv4.tcp_syncookies = 1 net.ipv4.ip_forward = 0 net.ipv4.conf.default.accept_source_route = 0 net.ipv4.tcp_max_syn_backlog = 4096 net.ipv4.conf.all.arp_filter = 1 net.ipv4.ip_local_port_range = 1025 65535 net.core.netdev_max_backlog = 10000 net.core.rmem_max = 2097152 net.core.wmem_max = 2097152 vm.overcommit_memory = 2

3. 按“Esc”键，输入:wq!，按“Enter”保存并退出编辑。
4. 配置生效。
  1 sysctl -p


#### 配置resolv.conf

1. 查看resolv.conf文件。
  1 ls /etc/resolv.conf

2. 打开resolv.conf。
  1 vim /etc/resolv.conf

3. 按“i”进入编辑模式，添加如下内容。
  1 2 3 # Generated by NetworkManager nameserver 114.114.114.114 nameserver 8.8.8.8

4. 按“Esc”键，输入:wq!，按“Enter”保存并退出编辑。
5. 查看resolv.conf文件。
  1 cat /etc/resolv.conf
