Debian 系统安装

Debian 系统安装信息备忘, F2 进入BIOS,F10 快捷启动


分区方案

分区

系统优化

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# 安装 vim, sudo, git
apt-get install vim git zsh sudo -y
# setup sudo
sudo usermod -aG sudo <username>

chsh -s $(which zsh)
# install oh-my-zsh
sh -c "$(wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"

# /etc/network/interfaces start
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug enp88s0
auto enp88s0
iface enp88s0 inet static
address 192.168.68.254/24
gateway 192.168.68.253
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 223.6.6.6 8.8.8.8
dns-search lan

iface enp88s0 inet6 auto
# /etc/network/interfaces end

# ipv4优先 /etc/gai.conf, 取消注释 precedence ::ffff:0:0/96 100
sudo /etc/init.d/networking restart

sudo apt install resolvconf
## /etc/resolvconf/resolv.conf.d/head
nameserver 1.1.1.1
nameserver 8.8.8.8
## 生效
sudo resolvconf -u

# 启动 TRIM (SSD 优化)
sudo systemctl enable fstrim.timer

# 配置防火墙
sudo apt install ufw -y
sudo ufw allow from 192.168.8.0/24 proto tcp to any port 2222
sudo ufw enable # 启用防火墙

UPS 配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# 1. 安装 NUT
sudo apt install nut -y
dpkg -l | grep nut
lsusb # 查看 usb 设备
# 2. 配置 UPS 驱动
sudo vim /etc/nut/ups.conf

[santak]
driver = usbhid-ups
port = auto
desc = "Santak UPS"

# 3. 配置 UPS 服务
sudo vim /etc/nut/upsd.conf

LISTEN 127.0.0.1 3493

# 4. 配置 UPS 用户
sudo vim /etc/nut/upsd.users

[admin]
password = 12345678
actions = SET
instcmds = ALL

# 5. 配置 UPS 自动关机
sudo vim /etc/nut/upsmon.conf

MONITOR santak@localhost 1 admin yourpassword primary

# 6. 配置 NUT 运行模式
sudo vim /etc/nut/nut.conf

MODE=standalone
# 7. 启动 NUT 服务
sudo systemctl enable nut-server
sudo systemctl enable nut-monitor
sudo systemctl start nut-server
sudo systemctl start nut-monitor

# 8. 测试服务,以下命令可以查看到ups状态信息
upsc santak@localhost

磁盘优化

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# SSD 优化
sudo systemctl enable fstrim.timer
sudo systemctl start fstrim.timer

# HD 优化
sudo apt install hdparm -y
# 查看硬盘基本信息
sudo hdparm -I /dev/sda1
# 启用硬盘的高效读取模式
sudo hdparm -W1 /dev/sda1
# 启用硬盘的电源管理
sudo hdparm -B 254 /dev/sda1
sudo hdparm -A1 /dev/sda1
sudo hdparm -S 120 /dev/sda1

# 健康检查工具安装
sudo apt install smartmontools -y
sudo smartctl -a /dev/sda1

sudo systemctl start smartd

sudo cat /var/log/smartd.log