安装
软件包默认是桌面环境 + gnome + 标准安装。如果做服务器,建议标准安装 + ssh server
设置静态ip
cd /etc/network/interfaces.d vi ifcfg-ens3 auto ens3 iface ens3 inet static address 172.29.50.32 netmask 255.255.255.0 gateway 172.29.50.10 dns-nameservers 223.5.5.5 dns-nameservers 8.8.8.8 mtu 1500
设置dns
vi /etc/resolv.conf nameserver 223.5.5.5 nameserver 8.8.8.8
配置apt源
vi /etv/apt/source.list
- 注释掉默认的cdrom源
- 修改为清华源。如果https不行,那么deb和http之间添加
[trusted=true]
,并将https改为http - 改完能直接下载后,再执行
apt install apt-transport-https ca-certificates
- 最终:
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free # deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
配置sshd
- 如果安装时候没安装ssh server,那就需要安装
openssh-server
- 设置允许root登录
vi /etc/ssh/sshd_config # 找到PermitRootLogin,将其值修改为yes
安装常用包
apt install -y wget git curl sysstat lrzsz net-tools neovim tcpdump bpftrace bpftool python3-pip zip unzip supervisor iotop free dos2unix ntp fio mlocate lsof psmisc python3-pip ipython3
配置vim
- 取消鼠标左键选中进入
visual mode
cd /usr/share/vim/vim82 vim ./default.vim # 找到 set mouse=a,改为set mouse-=a
修改系统语言
因为安装的时候选择的系统语言是中文,所以在此改为英文,便于处理字符集问题。
# 查看当前的系统语言 env | grep LANG export LANG=en_US.UTF-8 # 进入伪GUI。空格是选中 dpkg-reconfigure locales shutdown -r now
配置pip源
mkdir ~/.pip vim ~/.pip/pip.conf [global] index-url = https://mirrors.aliyun.com/pypi/simple/ [install] trusted-host=mirrors.aliyun.com
bash美化
占位
系统参数优化
limits.conf
在debian11中,limits.conf的通配符*
对root不生效,必须显式指定
root hard nofile 65535 root soft nofile 65535 * hard nofile 65535 * soft nofile 65535
sysctl.conf
net.ipv4.ip_forward = 1 net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.core.somaxconn = 2048 net.ipv4.ip_local_port_range= 1024 65535 net.core.rmem_default = 262144 net.core.wmem_default = 262144 fs.file-max = 104857 net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 net.ipv4.tcp_rmem = 4096 4096 16777216 net.ipv4.tcp_wmem = 4096 4096 16777216 net.ipv4.tcp_mem = 786432 3145728 4194304 net.ipv4.tcp_max_syn_backlog = 16384 net.core.netdev_max_backlog = 20000 net.ipv4.tcp_fin_timeout = 15 net.ipv4.tcp_max_syn_backlog = 16384 net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_max_orphans= 131072
问题记录
- git clone提示“GnuTLS recv error (-110)”
git config --global http.sslVerify false