Tips

测试

以下是存放一些服务器上的经常使用的脚本

一键安装snell脚本

1
wget -O snell.sh --no-check-certificate https://git.io/Snell.sh && chmod +x snell.sh && ./snell.sh

检测流媒体解锁服务

1
bash <(curl -L -s media.ispvps.com)

万能工具箱-咕咕鸽

1
wget -O box.sh https://raw.githubusercontent.com/BlueSkyXN/SKY-BOX/main/box.sh && chmod +x box.sh && clear && ./box.sh

科技狮一键脚本

1
curl -sS -O https://raw.githubusercontent.com/kejilion/sh/main/kejilion.sh && chmod +x kejilion.sh && ./kejilion.sh

caddy安装部署脚本

1
wget -O caddy.sh https://raw.githubusercontent.com/chushu1945/FMO-scripts/refs/heads/main/caddy.sh && chmod +x caddy.sh && ./caddy.sh

omz安装部署脚本

1
wget -O omz.sh https://github.com/chushu1945/FMO-scripts/raw/refs/heads/main/omz.sh && chmod +x omz.sh && ./omz.sh

Ipv6 only 小鸡连接github

1
2
3
4
5
6
7
8
9
cat >> /etc/hosts << EOF
# https://danwin1210.de/github-ipv6-proxy.php
2a01:4f8:c010:d56::2 github.com
2a01:4f8:c010:d56::3 api.github.com
2a01:4f8:c010:d56::4 codeload.github.com
2a01:4f8:c010:d56::5 objects.githubusercontent.com
2a01:4f8:c010:d56::6 ghcr.io
2a01:4f8:c010:d56::7 pkg.github.com npm.pkg.github.com maven.pkg.github.com nuget.pkg.github.com rubygems.pkg.github.com
EOF

面板安装

3x-ui安装

1
bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)

x-ui安装

1
bash <(curl -Ls https://raw.githubusercontent.com/FranzKafkaYu/x-ui/master/install.sh)

singbox安装

1
2
3
bash <(wget -qO- -o- https://github.com/233boy/sing-box/raw/main/install.sh)

wget -N https://raw.githubusercontent.com/chushu1945/FMO-scripts/refs/heads/main/sb.sh && chmod +x sb.sh && ./sb.sh

warp安装

1
wget -N https://gitlab.com/fscarmen/warp/-/raw/main/menu.sh && bash menu.sh

smart-gost安装

1
wget --no-check-certificate -O gost.sh https://raw.githubusercontent.com/KANIKIG/Multi-EasyGost/master/gost.sh && chmod +x gost.sh && ./gost.sh

realm一键脚本

1
wget -N https://github.com/chushu1945/EZrealm/raw/refs/heads/main/realm.sh && chmod +x realm.sh && ./realm.sh

管理ipv46脚本

1
bash <(curl -Lso- https://sh.vps.dance/ip46.sh)

管理BBR脚本

1
wget -N https://raw.githubusercontent.com/chushu1945/FMO-scripts/refs/heads/main/bbr.sh && chmod +x bbr.sh && ./bbr.sh

修改服务器名字

1
wget -N https://raw.githubusercontent.com/chushu1945/FMO-scripts/refs/heads/main/hosts.sh && chmod +x hosts.sh && ./hosts.sh

Frp安装脚本

1
wget -N https://raw.githubusercontent.com/chushu1945/FMO-scripts/refs/heads/main/frp.sh && chmod +x frp.sh && ./frp.sh

手动安装singbox

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
wget https://github.com/SagerNet/sing-box/releases/download/v1.9.6/sing-box-1.9.6-linux-amd64.tar.gz

tar -zxvf sing-box-1.9.6-linux-amd64.tar.gz

mv sing-box-1.9.6-linux-amd64 sing-box

cd sing-box

chmod +x sing-box

cp sing-box /usr/local/bin/sing-box

sudo mkdir -p /usr/local/etc/sing-box

sudo chmod +x /etc/init.d/sing-box

sudo rc-update add sing-box

sudo rc-service sing-box start

sudo rc-service sing-box status

/home/ssl/public.pem

/home/ssl/peivate.key

配置vless

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
# 生成公钥和私钥
sing-box generate reality-keypair

之后将私钥复制到服务器,公钥保存

# 配置示例为

{
"tag": "VLESS-REALITY-xxx.json",
"type": "vless",
"listen": "::",
"listen_port": xxx,## 修改
"users": [
{
"flow": "xtls-rprx-vision",
"uuid": "xxx"## 修改
}
],
"tls": {
"enabled": true,
"server_name": "aws.amazon.com",
"reality": {
"enabled": true,
"handshake": {
"server": "aws.amazon.com",
"server_port": 443
},
"private_key": "xxx",## 修改
"short_id": [
""
]
}
}
}

caddy安装

1
2
3
4
5
6
7
8
9
10
11
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https

curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg

curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list

sudo apt update

sudo apt install caddy

sudo systemctl reload caddy

caddy 配置

1
2
3
4
5
6
7
xxx.xxx.xyz {
# 根路径重定向到 /xxx/
redir / /xxx/ 301

# 反向代理所有请求到本地xxxx端口
reverse_proxy localhost:xxxx
}

开启bbr

1
2
3
4
5
6
7
echo "net.core.default_qdisc=fq" | sudo tee -a /etc/sysctl.conf

echo "net.ipv4.tcp_congestion_control=bbr" | sudo tee -a /etc/sysctl.conf

sudo sysctl -p

lsmod | grep bbr

修改服务器防火墙

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
sudo ufw disable
# 禁用 ufw 防火墙,允许所有流量通过。

sudo iptables -F
# 清除所有 iptables 规则,删除现有的防火墙规则以开放所有端口。

sudo netfilter-persistent save
# 保存当前的 iptables 配置,确保更改在重启后仍然有效。

sudo systemctl stop firewalld
# 停止 firewalld 防火墙服务。

sudo systemctl disable firewalld
# 禁用 firewalld 防火墙服务,以便在系统重启后不再启动。

sudo nano /etc/ssh/sshd_config
# 使用 nano 编辑 SSH 配置文件,以更改 SSH 服务的端口。

在 SSH 配置文件中添加以下内容并保存:

Port 2233
# 将 SSH 端口更改为 2233(可以是你想要的端口)。

sudo ufw allow 2233/tcp
# 使用 ufw 防火墙允许 TCP 端口 2233 的流量,以便通过新端口进行 SSH 连接。

sudo systemctl restart ssh
# 重启 SSH 服务以应用新的端口配置。

ssh -p 2233 your_username@your_server_ip
# 使用 SSH 连接到服务器,指定新的端口 2233,替换 `your_username` 和 `your_server_ip`。

sudo ufw delete allow 22/tcp
# 删除 ufw 防火墙中对旧的 SSH 端口 22 的访问权限,确保只有新端口 2233 开放。

为容器配置代理网络访问

由于frp的ip经常被屏蔽,因此在frpc使用了代理访问,但是docker内部的容器却无法访问,因此有以下方式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 查看容器的ip
ip addr show docker0

# 修改docker-compose.yml文件
# 在environment添加

- HTTP_PROXY=http://172.17.0.1:7890
- HTTPS_PROXY=http://172.17.0.1:7890
- NO_PROXY=localhost,127.0.0.1,172.17.0.1

# 重启容器

docker-compose down
docker-compose up -d

# 验证代理

docker exec -it sub-store /bin/sh
curl -I https://www.google.com

VPS开启ROOT登录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 切换root用户
sudo -i

# 编辑ssh配置文件

vim /etc/ssh/sshd_config

# 需要修改的配置项目如下,在32行和56行:

PermitRootLogin yes
PasswordAuthentication yes

# 保存并退出vim
ESC :wq

# 执行重启服务器的操作
reboot

# 即可生效,并且无需再执行/etc/init.d/ssh restart这个命令
# 设置密码
passwd

Windows使用Git管理github

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
# git初始化
git config --global user.name "xxx"
git config --global user.email "xxx@outlook.com"

# 生成密钥对,一路Enter
ssh-keygen -t rsa -b 4096 -C "xxx@outlook.com"

# 输入文件路径
/c/Users/Administrator/.ssh/git_rsa

# 测试连接
ssh -T git@github.com

# 初始化仓库
git init

# 修改master为main
git branch -m master main

# 添加所有修改文件
git add .

# 提交修改
git commit -m "moditify readme.md"

# 推送
git push -u origin main #推送到远程
git push -f origin main #强制推送到远程,以本地为准

# 修改ssh配置
nano ~/.ssh/config
Host github.com
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes

frp配置安装

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
wget https://github.com/fatedier/frp/releases/download/v0.61.1/frp_0.61.1_linux_amd64.tar.gz

tar zxvf frp_0.61.1_linux_amd64.tar.gz

mv frp_0.61.1_linux_amd64 frp

cd frp

chmod +x frps

# frps.toml配置文件为

bindPort = 7000
auth.token = "xxxx"

# 配置frps.service

[Unit]
Description = frp server
After = network.target syslog.target
Wants = network.target

[Service]
Type = simple
ExecStart = /root/data/taozi/frp/frps -c /root/data/taozi/frp/frps.toml

[Install]
WantedBy = multi-user.target

Debian换源

1
2
3
# 换清华源

https://mirrors.tuna.tsinghua.edu.cn/help/debian/

国内小鸡安装Docker

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
# 第一步,换源

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo rm /etc/apt/sources.list
sudo nano /etc/apt/sources.list

# 安装必要依赖

sudo apt install curl vim wget gnupg dpkg apt-transport-https lsb-release ca-certificates

# 加入Docker GPG公钥

curl -sSL https://download.docker.com/linux/debian/gpg | gpg --dearmor > /usr/share/keyrings/docker-ce.gpg

# 安装

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin


# 一键脚本

export DOWNLOAD_URL="https://mirrors.tuna.tsinghua.edu.cn/docker-ce"
# 如使用 curl
curl -fsSL https://raw.githubusercontent.com/docker/docker-install/master/install.sh | sh
# 如使用 wget
wget -O- https://raw.githubusercontent.com/docker/docker-install/master/install.sh | sh

# 安装docker-compose

curl -L https://gh-proxy.com/https://github.com/docker/compose/releases/download/v2.34.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

服务器同步文件级自动化脚本配置

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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# 首先需要配置ssh连接到目标服务器

## 生成 SSH 密钥对
ssh-keygen -t rsa -b 4096 -f ~/.ssh/jinhua

## 验证密钥生成,会看到 jinhua 和 jinhua.pub 两个文件
ls -l ~/.ssh/

## 复制公钥到服务器
ssh-copy-id -i ~/.ssh/jinhua.pub -p 端口 root@ip

## 远端服务器开始密钥访问
nano /etc/ssh/sshd_config

PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

## 设置本地服务器ssh config

nano ~/.ssh/cofig

### 添加以下命令

Host ip
Port 端口
User root
IdentityFile /root/.ssh/jinhua

## 创建同步脚本

cd /root/data/taozi
nano /root/data/taozi/sync_ip_results.sh


### 填入:
#!/bin/bash

# 定义源目录和目标目录
SOURCE_DIR="/root/data/docker-data/dufs/data/IP-results/"
DESTINATION_DIR="root@IP:/root/data/docker-data/dufs/data/IP-results/"

# 使用 rsync 同步文件
rsync -avz --delete "$SOURCE_DIR" "$DESTINATION_DIR"

# 记录日志 (可选)
echo "$(date) - IP-results 目录同步完成" >> /var/log/sync_ip_results.log

## 添加权限
chmod +x /root/data/taozi/sync_ip_results.sh

## 创建 systemd 服务文件
nano /etc/systemd/system/sync_ip_results.service

### 填入:
[Unit]
Description=Sync IP-results directory to remote server
After=network.target

[Service]
Type=simple
ExecStart=/root/data/taozi/sync_ip_results.sh

[Install]
WantedBy=multi-user.target

## 创建 systemd 定时器文件

### 填入:
[Unit]
Description=Run sync IP-results every 30 minutes

[Timer]
OnCalendar=*:00/30
Persistent=true

[Install]
WantedBy=timers.target

## 启动定时器
systemctl enable sync_ip_results.timer
systemctl start sync_ip_results.timer
systemctl status sync_ip_results.timer
systemctl status sync_ip_results.service

配置ohmyzsh

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
## 安装主体及插件
sh -c "$(curl -fsSL https://gh-proxy.com/https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

git clone https://gh-proxy.com/https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting

git clone https://gh-proxy.com/https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions

##修改.zshrc
nano .zshrc

### 输入:
plugins=(
git
zsh-syntax-highlighting
zsh-autosuggestions
)

alias cls='clear'
alias ll='ls -al'
alias vi='vim'
alias grep="grep --color=auto"
alias dup="docker-compose up -d"
alias ddown="docker-compose down"
alias dre="docker-compose restart"
alias sstart="systemctl start"
alias srestart="systemctl restart"
alias sstatus="systemctl status"
alias sstop="systemctl stop"

## 配置生效
source .zshrc