Linux 环境配置
Macos部分配置方法类似,不会在MacOS 环境配置里重复写。主要放在Linux这边。
sudo 免密
用户直接用root也行,但一般还是新建用户,免密的正确配置法:sudo vim /etc/sudoers.d/ark,添加ark ALL=(ALL:ALL) NOPASSWD:ALL。
不要在/etc/sudoers里加,那里不起作用。
tmux
tmux如果另一个没退,就又attach,可能分辨率会用另一个的,就会右边下边出现很多点点。tmux命令choose-client,选择分辨率,选小的就能撑满屏幕。
默认choose-client是shift-b,但我改了tmux的prefix,所以是ctrl-a,再shift-d。自己查自己tmux的keys,用choose-client bind的key。
window name highlight有点碍眼,可以在.tmux.conf里:
1
2
3
4
5
# 普通窗口名样式
set -g window-status-style fg=white,bg=default
# 活动窗口名样式(去除高亮或用浅色)
set -g window-status-current-style fg=yellow,bg=default
tmux里zsh无法用home end键:zshrc更改配置可以绑键:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#Rebind HOME and END to do the decent thing:
bindkey '\e[1~' beginning-of-line
bindkey '\e[4~' end-of-line
case $TERM in (xterm*)
bindkey '\eOH' beginning-of-line
bindkey '\eOF' end-of-line
esac
#To discover what keycode is being sent, hit ^v
#and then the key you want to test.
#And DEL too, as well as PGDN and insert:
bindkey '\e[3~' delete-char
bindkey '\e[6~' end-of-history
bindkey '\e[2~' redisplay
#Now bind pgup to paste the last word of the last command,
bindkey '\e[5~' insert-last-word
apt 源更换
tuna各个网络环境都比较稳定,但官网的换源方式更新了,配合更高的ubuntu版本。但目前ubuntu 22用的挺多,这里直接留一份换源方式,避免到处找。
1
2
3
4
5
6
7
8
9
10
11
12
13
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy universe
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates universe
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security universe
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security multiverse
EOF
24及以上版本就可以找tuna官网最新的配置方法,这里也贴一份24.04的:
1
2
3
4
5
6
7
8
9
10
11
12
13
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo tee /etc/apt/sources.list <<-'EOF'
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar main restricted
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-updates main restricted
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar universe
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-updates universe
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-updates multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-security main restricted
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-security universe
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-security multiverse
EOF
更换完源后,sudo apt update,update如果慢到基本不动,基本不用怀疑是源的问题,大概是网络问题,docker中特别容易出现,查Docker 网络问题排查。
VPN
ShellCrash 功能更多,但难度较高。如果v2rayApp能满足需求,推荐用它。但Clash系里最好用的还是ShellCrash。
ShellCrash 需要更改配置文件添加规则,面板只能查看。通过6-导入配置文件(是的,很费解,但就是走这儿),然后可以新增删除规则。批量操作有提示文件地址在哪里,例如/etc/ShellCrash/yamls/rules.yaml,可以直接编辑这个文件。可以5-自定义高级功能让它把所有配置文件都生成。
目前能把tailscale网络恢复的方法,主要用于git clone等操作:
- ShellCrash 中 6 - 2 添加自定义规则,或者直接编辑
/etc/ShellCrash/yamls/rules.yaml - 添加tailscale网段,
- IP-CIDR,100.64.0.0/10,DIRECT,no-resolve - 重启ShellCrash
- git项目使用ip而不要用域名,例如
git clone http://100.64.x.x/xxx.git