Debian11最小化安装新系统配置

Debian最小化安装新系统配置

1
2
3
4
timedatectl
date
# 24小时显示
sudo localectl set-locale LC_TIME=en_GB.UTF-8

su root

in /etc/default/grub change the GRUB_CMDLINE_LINUX parameter to

GRUB_CMDLINE_LINUX=“quiet console=tty0 console=ttyS0,115200”

update-grub

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
cd /etc/apt
mv sources.list sources.list.bak
cat > 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/ 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
deb https://mirrors.aliyun.com/debian-security/ bullseye-security main non-free contrib
deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main non-free contrib
EOF
apt update
apt upgrade
1
2
3
4
apt install sudo
adduser henry
nano /etc/sudoers 			# (henry ALL=(ALL:ALL) ALL)
passwd password

su henry

sudo apt install sysbench

1
2
3
sudo apt-get install zhcon
sudo adduser $(whoami) video
echo "alias zh='zhcon --utf8'" >> ~/.bashrc

touch .bash_profile

1
2
sudo apt-get install qemu-guest-agent git curl zsh automake autoconf pkg-config gcc libevent-dev ncurses-dev make byacc bsd-mailx libnss3-tools -y
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

source ~/.zshrc

1
2
3
4
5
6
sudo apt-get install libevent-dev ncurses-dev build-essential bison pkg-config -y
git clone https://github.com/tmux/tmux.git
cd tmux
sh autogen.sh
./configure && make
sudo make install

touch ~/.tmux.conf

source ~/.tmux.conf

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
sudo apt install rsync
sudo cp /usr/share/doc/rsync/examples/rsyncd.conf /etc/
sudo nano /etc/rsyncd.conf

# 修改以下:
# [website]
# path = /www/website
# read only = no
# uid = henry
# gid = henry

# 添加以下:(否则从windows同步过去权限会变为000)
# incoming chmod = Du=rwx,Dog=rx,Fu=rwx,Fgo=rx

sudo systemctl start rsync

sudo apt install debconf

sudo dpkg-reconfigure exim4-config

  • 选择"mail sent by smarthost; received via SMTP or fetchmail"选项;
  • 将"System mail name:“设置为“localhost”;
  • 设置"IP-addresses to listen on for incoming SMTP connections"为"127.0.0.1"来拒绝外部的连接;
  • 不要填写"Other destinations for which mail is accepted:“选项,值留空;
  • 也不要"Machines to relay mail for:“选项,值留空;
  • 设置"IP address or host name of the outgoing smarthost:“的值为"smtp.163.com:25”;
  • 设置"Hide local mail name in outgoing mail?“的值为“NO"选项;
  • 设置"Keep number of DNS-queries minimal (Dial-on-Demand)?“的值为”NO“选项;
  • 设置"Delivery method for local mail"的值为"mbox format in /var/mail/“选项;
  • 设置"Split configuration into small files?“的值为"YES"选项;
  • 设置”Root and postmaster mail recipient:“的值为空,不需要填写;
1
smtp.163.com:email.163.com:password 	# 它的结构为<163的SMTP服务器地址>:<发件人邮箱地址>:<邮箱授权码>
1
2
3
root: email.163.com			# 否则系统会告诉你发件人帐号与发件人不符合
henry: email.163.com
netdata: email.163.com        # 否则netdata报警邮件无法发送(因为系统会告诉你发件人帐号与发件人不符合)

systemctl restart exim4.service

echo "Email test body" | mail -s "Email test subject" email.163.com

root: email.163.com

newaliases

echo "Email test body" | mail -s "Email test subject" root

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
su root
mkdir -p /etc/pki/nssdb
echo -n | openssl s_client -connect smtp.163.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /etc/pki/nssdb/163.crt
certutil -A -n "GeoTrust SSL CA" -t "C,," -d /etc/pki/nssdb/ -i /etc/pki/nssdb/163.crt
certutil -A -n "GeoTrust Global CA" -t "C,," -d /etc/pki/nssdb/ -i /etc/pki/nssdb/163.crt
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d /etc/pki/nssdb/ -i /etc/pki/nssdb/163.crt
certutil -L -d /etc/pki/nssdb/

cat >> /etc/mail.rc <<EOF
set from=email.163.com
set smtp=smtps://smtp.163.com:465
set smtp-auth-user=email.163.com
set smtp-auth-password=password
set smtp-auth=login
set ssl-verify=ignore
set nss-config-dir=/etc/pki/nssdb
EOF

nano /etc/exim4/update-exim4.conf.conf			# dc_eximconfig_configtype='internet'
/etc/init.d/exim4 restart
echo  " 邮件正文内容 " | mail -v -s  " 邮件主题 "   email.163.com

尽量不要用dc / dk 这些alias,防止无法运行