debian11系统初始化
更改apt源
根据自己的实际情况进行修改,腾讯/阿里云/华为云/中科大/清华源都可以
vi /etc/apt/sources.list
,清除原来的内容,写入下面内容
deb https://mirrors.cloud.tencent.com/debian/ bullseye main non-free contrib
deb-src https://mirrors.cloud.tencent.com/debian/ bullseye main non-free contrib
deb https://mirrors.cloud.tencent.com/debian/ bullseye-updates main non-free contrib
deb-src https://mirrors.cloud.tencent.com/debian/ bullseye-updates main non-free contrib
deb https://mirrors.cloud.tencent.com/debian/ bullseye-backports main non-free contrib
deb-src https://mirrors.cloud.tencent.com/debian/ bullseye-backports main non-free contrib
deb https://mirrors.cloud.tencent.com/debian-security bullseye-security/updates main non-free contrib
deb-src https://mirrors.cloud.tencent.com/debian-security bullseye-security/updates main non-free contrib
安装基础包
apt install vim curl wget tar unzip zip htop lsof iotop iftop nload net-tools telnet chrony sudo resolvconf -y
配置时间同步
cat > /etc/chrony/sources.d/public-ntp-server.sources <<EOF
server ntp.tencent.com iburst
server ntp.aliyun.com iburst
EOF
systemctl restart chrony && systemctl enable chrony
调整vim
- 启用鼠标复制粘贴
cat > /etc/vim/vimrc.local <<EOF
source \$VIMRUNTIME/defaults.vim
let skip_defaults_vim = 1
if has('mouse')
set mouse=r
endif
EOF
- 修改vim编辑方式,
vim /etc/vim/vimrc.tiny
set nocompatible
set backspace=2
- 关闭vim编辑自动缩进,
vim /usr/share/vim/vim82/defaults.vim
, 使用"
注释如下行
" filetype plugin indent on
调整内核参数和limit参数
cat > /etc/sysctl.conf <<EOF
net.core.netdev_max_backlog = 32768
net.core.rmem_default = 8388608
net.core.somaxconn = 32768
net.core.wmem_default = 8388608
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1
net.ipv4.ip_forward = 1
net.ipv4.conf.all.arp_ignore = 0
net.ipv4.conf.lo.arp_announce = 0
net.ipv4.conf.lo.arp_ignore = 0
net.ipv4.ip_local_port_range = 5000 65000
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_max_syn_backlog = 65536
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_tw_reuse = 1
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.conf.all.secure_redirects = 0
net.ipv4.conf.default.secure_redirects = 0
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.neigh.default.gc_thresh1 = 2048
net.ipv4.neigh.default.gc_thresh2 = 4096
net.ipv4.neigh.default.gc_thresh3 = 8192
net.core.wmem_max = 327679
net.core.rmem_max = 327679
fs.file-max = 1000000
fs.inotify.max_queued_events = 327679
fs.inotify.max_user_watches = 10000000
kernel.unknown_nmi_panic = 0
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.sysrq = 1
vm.swappiness = 10
vm.max_map_count = 655360
vm.overcommit_memory = 1
EOF
调整limit参数
cat >> /etc/security/limits.conf <<EOF
* hard core 0
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
root soft nproc unlimited
EOF
修改网卡序号
修改网卡序号为 eth0
vim /etc/default/grub
修改GRUB_CMDLINE_LINUX
,
GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"
更新grub
update-grub
vim /etc/network/interfaces
修改文件内容中的网卡名称,全部改为eth0
本文来自博客园,作者:银河系派件员,转载请注明原文链接:https://www.cnblogs.com/zhaojli/p/17583804.html