安裝
軟件包默認是桌面環境 + 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