【技术】服务器新机开荒流水线

以下是本人对服务器新机用的比较舒服的一套配置,并不是最优解,仅供参考。如果对 Linux 和 ssh 操作不熟悉,建议去阅读详细讲解的教程,而不是看这个经验帖。

本地 ssh 配置

加下面这项

1
2
3
Host <alias>
HostName <IP>
User <username>

注意 Host Alias 是大小写敏感的。

ssh-copy-id

如果本地还没生成 ssh 配置,则本地运行

1
ssh-keygen

然后如果本地是 Linux,则

1
ssh-copy-id <alias>

如果没装 ssh-copy-id 或者是 Windows,则

1
cat ~/.ssh/id_rsa.pub | ssh <alias> "cat >> ~/.ssh/authorized_keys"

tmux 配置

cat 以下内容进 ~/.tmux.conf。注意改了以后 tmux 前缀会变成 Ctrl A,这也是为了和本地的 tmux 区分。

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
# in case the terminal does not display color
set -g default-terminal "screen-256color"

# Send prefix
set-option -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix

# Use Alt-arrow keys to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window

# Mouse mode
set -g mouse on

# Set easier window split keys
bind-key v split-window -h
bind-key h split-window -v

# Easy config reload
bind-key r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded"

# set more history
set-option -g history-limit 10000

【技术】服务器新机开荒流水线
https://zhoujy.com/2024/05/21/服务器新机开荒流水线/
作者
ZJsheep
发布于
2024年5月21日
许可协议