持续更新中!

网络配置

更换ip和dns(虚拟机常用)
/etc/network/interfaces/etc/resolv.conf修改.
具体可见 https://blog.juis.top/posts/18c2a451.html

更换apt源
比如清华源可以进入 https://mirror.tuna.tsinghua.edu.cn/help/debian/选择版本
以debian-11 bullseye为例如下

1
2
3
4
5
6
7
8
9
10
11
12
# 默认注释了源码镜像以提高 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

以及一些更新软件源

1
2
3
4
apt update
apt upgrade
apt install vim -y
apt install curl -y

可能需要网络代理
参考 https://blog.juis.top/posts/b22f73a1

终端配置

设置用户的终端提示颜色
~/.bashrc文件里更改

debian系统可以直接照抄如下

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
# ~/.bashrc: executed by bash(1) for non-login shells.

# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
# umask 022

# You may uncomment the following lines if you want `ls' to be colorized:
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'

alias grep='grep --color=auto'
# Set prompt colors for root user

PS1='\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

alias php='php -c /www/server/php/56/etc/php-cli.ini'
alias php56='php56 -c /www/server/php/56/etc/php-cli.ini'

ssh设置

/etc/ssh/ssh_config添加如下防止断连

1
2
ServerAliveInterval 60
ServerAliveCountMax 5

允许root远程登录

1
2
3
4
vim /etc/ssh/sshd_config
# 找到PermitRootLogin prohibit-password
# 修改为PermitRootLogin yes
systemctl restart sshd

免密登录
把自己的公钥复制到服务器的~/.ssh/authorized_keys

1
2
vim ~/.ssh/authorized_keys
# 然后粘贴客户端的公钥

此外还要保证/etc/ssh/sshd_config如下没被注释

1
2
3
RSAAuthentication yes 
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

添加用户

1
2
3
useradd -m -s /bin/bash user
usermod -aG sudo user
passwd user

常用环境

docker:

1
2
sudo curl -fsSL https://get.docker.com > get-docker.sh
sudo bash get-docker.sh -s docker --mirror Aliyun

参考文章

https://zhuanlan.zhihu.com/p/431249844