Debian 11 最小化安装及基本配置

1. 安装

2. 网络

  • DHCP
1
2
3
4
$ vi /etc/network/interfaces
auto ens33
iface ens33 inet dhcp
$ systemctl restart networking
  • STATIC
1
2
3
4
5
auto ens33
iface ens33 inet static
address 10.4.7.100
netmask 255.255.255.0
gateway 10.4.7.2

3. 用户

1
2
3
4
5
6
7
8
9
$ su -
$ apt install sudo
$ usermod -aG sudo liubin
# $ sudo -V | grep path
# $ visudo

$ chmod +w /etc/sudoers
$ vi /etc/sudoers
liubin ALL=(ALL) NOPASSWD: NOPASSWD: ALL

4. 镜像源

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ sudo tee /etc/apt/sources.list << EOF
deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
#deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb https://mirrors.aliyun.com/debian-security/ bullseye-security main
#deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main
deb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
#deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
#deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
EOF
$ sudo apt update
$ sudo apt upgrade -y

# # PVE
# $ cat sources.list.d/pve-enterprise.list
# #deb https://enterprise.proxmox.com/debian/pve bullseye pve-enterprise

5. 常用软件

1
$ sudo apt install wget net-tools vim bash-completion git -y

6. 时间同步

1
2
3
4
5
$ sudo timedatectl set-timezone Asia/Shanghai
$ timedatectl

$ sudo apt install ntpdate -y
$ sudo ntpdate cn.pool.ntp.org

7. 个性化配置

1
2
3
4
5
6
7
8
9
10
11
12
13
$ sudo tee /etc/profile.d/alias.sh << EOF
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias ls='ls --color=auto'
alias ll='ls --color=auto -lA'
alias l='ls --color=auto -l'
EOF
$ sudo tee /etc/profile.d/my.sh << EOF
export PS1="\[\e[35;1m\][\u@\h \W]$>\[\e[0m\]"
EOF

$ source /etc/profile

8. 密钥登录

1
2
3
4
$ mkdir ~/.ssh/
$ tee ~/.ssh/authorized_keys << EOF
(公钥内容)
EOF

9. ZSH

1
2
3
4
5
6
7
$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
$ cd ~/.oh-my-zsh/custom/plugins/
$ git clone https://github.com/zsh-users/zsh-syntax-highlighting
$ git clone https://github.com/zsh-users/zsh-autosuggestions
$ vi ~/.zshrc
ZSH_THEME="amuse"
plugins=(git zsh-syntax-highlighting zsh-autosuggestions z extract)

参考