Serv00 免费服务器(二)SSH登录-清理-和搭建节点
本文最后更新于 2024-08-31,文章内容可能已经过时。
参考上一期文章:注册一台免费十年VPS服务器
服务器SSH登录
下载FinalShellSSH服务器管理软件。
新建SSH连接,按照格式输入主机用户名和密码,点击确认之后会再次提示输入密码,这个时候点击取消,然后再次输入密码就行了。
PS:在这里输入密码就可以登录成功了。
如果登录不成功的话有几种方法:1.设置代理服务器。2.启动软件自带的智能加速。3.把主机名称的s改为web,例如web7.serv00.com。4.进入https://www.serv00.com/ip_unban/选择对应的服务器解除IP封锁。
服务器清理
连接上服务器按顺序输入下面这5行代码。第一个用户名改成自己的用户名。
pkill -kill -u 用户名
chmod -R 755 ~/*
chmod -R 755 ~/.*
rm -rf ~/.*
rm -rf ~/*
代理节点有两种搭建方式(选其中一种就行)
搭建节点准备工作
1:在web面板打开应用程序的权限,选择Enabled,显示打√就行。
2:随机添加三个端口,一个TCP,两个UDP。
搭建节点(第一种)
一键四协议安装脚本,集成哪吒探针,原作地址:点击进入。缺点:(有时候服务器会自动重启导致节点超时,需重复操作安装命令才能正常使用)。在SSH输入下面一键安装脚本代码:——UUID修改成自己的,UUID在线生成网站:点击进入
UUID=自定义 bash <(curl -Ls https://raw.githubusercontent.com/eooce/sing-box/main/sb_serv00.sh)
输入后按照这个格式填写,最后会生成4个节点,复制到剪贴板就可以导入v2rayn了。
搭建节点(第二种)
下面这个sh脚本是修改了Sing-box 6的一键四协议安装脚本, 执行即安装, 但是没有哪吒探针和ARGO,需要在web面板开放一个55501的tcp端口, 55502的udp端口, 55503的udp端口(如果开放不了端口的话就不用开了,我发现不开也可以)。第24行的username用户名用FinalShell操作的话会断开连接,可以使用其他SSH工具或者不修改。——原作者:点击这里
#!/bin/bash
# 定义颜色
re="\033[0m"
red="\033[1;91m"
green="\e[1;32m"
yellow="\e[1;33m"
purple="\e[1;35m"
red() { echo -e "\e[1;91m$1\033[0m"; }
green() { echo -e "\e[1;32m$1\033[0m"; }
yellow() { echo -e "\e[1;33m$1\033[0m"; }
purple() { echo -e "\e[1;35m$1\033[0m"; }
reading() { read -p "$(red "$1")" "$2"; }
USERNAME=$(whoami)
HOSTNAME=$(hostname)
export UUID=${UUID:-'bc97f674-c578-4940-9234-0a1da46041b9'}
[[ "$HOSTNAME" == "s1.ct8.pl" ]] && WORKDIR="domains/${USERNAME}.ct8.pl/logs" || WORKDIR="domains/${USERNAME}.serv00.net/logs"
[ -d "$WORKDIR" ] || (mkdir -p "$WORKDIR" && chmod 777 "$WORKDIR")
install_singbox() {
cd $WORKDIR
pkill -kill -u username
generate_config
download_singbox && wait
run_sb && sleep 3
get_links
}
# Download Dependency Files
download_singbox() {
ARCH=$(uname -m) && DOWNLOAD_DIR="." && mkdir -p "$DOWNLOAD_DIR" && FILE_INFO=()
if [ "$ARCH" == "arm" ] || [ "$ARCH" == "arm64" ] || [ "$ARCH" == "aarch64" ]; then
FILE_INFO=("https://github.com/eooce/test/releases/download/arm64/sb web" "https://github.com/eooce/test/releases/download/arm64/bot13 bot" "https://github.com/eooce/test/releases/download/ARM/swith npm")
elif [ "$ARCH" == "amd64" ] || [ "$ARCH" == "x86_64" ] || [ "$ARCH" == "x86" ]; then
FILE_INFO=("https://eooce.2go.us.kg/web web" "https://eooce.2go.us.kg/bot bot" "https://eooce.2go.us.kg/npm npm")
else
echo "Unsupported architecture: $ARCH"
exit 1
fi
for entry in "${FILE_INFO[@]}"; do
URL=$(echo "$entry" | cut -d ' ' -f 1)
NEW_FILENAME=$(echo "$entry" | cut -d ' ' -f 2)
FILENAME="$DOWNLOAD_DIR/$NEW_FILENAME"
if [ -e "$FILENAME" ]; then
green "$FILENAME already exists, Skipping download"
else
wget -q -O "$FILENAME" "$URL"
green "Downloading $FILENAME"
fi
chmod +x $FILENAME
done
}
# Generating Configuration Files
generate_config() {
openssl ecparam -genkey -name prime256v1 -out "private.key"
openssl req -new -x509 -days 3650 -key "private.key" -out "cert.pem" -subj "/CN=$USERNAME.serv00.net"
cat >config.json <<EOF
{
"log": {
"disabled": true,
"level": "info",
"timestamp": true
},
"dns": {
"servers": [
{
"tag": "google",
"address": "tls://8.8.8.8",
"strategy": "ipv4_only",
"detour": "direct"
}
],
"rules": [
{
"rule_set": [
"geosite-openai"
],
"server": "wireguard"
},
{
"rule_set": [
"geosite-netflix"
],
"server": "wireguard"
},
{
"rule_set": [
"geosite-category-ads-all"
],
"server": "block"
}
],
"final": "google",
"strategy": "",
"disable_cache": false,
"disable_expire": false
},
"inbounds": [
{
"tag": "hysteria-in",
"type": "hysteria2",
"listen": "::",
"listen_port": 55502,
"users": [
{
"password": "$UUID"
}
],
"masquerade": "https://bing.com",
"tls": {
"enabled": true,
"alpn": [
"h3"
],
"certificate_path": "cert.pem",
"key_path": "private.key"
}
},
{
"tag": "vmess-ws-in",
"type": "vmess",
"listen": "::",
"listen_port": 55501,
"users": [
{
"uuid": "$UUID"
}
],
"transport": {
"type": "ws",
"path": "/vmess",
"early_data_header_name": "Sec-WebSocket-Protocol"
}
},
{
"tag": "tuic-in",
"type": "tuic",
"listen": "::",
"listen_port": 55503,
"users": [
{
"uuid": "$UUID",
"password": "admin123"
}
],
"congestion_control": "bbr",
"tls": {
"enabled": true,
"alpn": [
"h3"
],
"certificate_path": "cert.pem",
"key_path": "private.key"
}
}
],
"outbounds": [
{
"type": "direct",
"tag": "direct"
},
{
"type": "block",
"tag": "block"
},
{
"type": "dns",
"tag": "dns-out"
},
{
"type": "wireguard",
"tag": "wireguard-out",
"server": "162.159.195.100",
"server_port": 4500,
"local_address": [
"172.16.0.2/32",
"2606:4700:110:83c7:b31f:5858:b3a8:c6b1/128"
],
"private_key": "mPZo+V9qlrMGCZ7+E6z2NI6NOV34PD++TpAR09PtCWI=",
"peer_public_key": "bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=",
"reserved": [
26,
21,
228
]
}
],
"route": {
"rules": [
{
"protocol": "dns",
"outbound": "dns-out"
},
{
"ip_is_private": true,
"outbound": "direct"
},
{
"rule_set": [
"geosite-openai"
],
"outbound": "wireguard-out"
},
{
"rule_set": [
"geosite-netflix"
],
"outbound": "wireguard-out"
},
{
"rule_set": [
"geosite-category-ads-all"
],
"outbound": "block"
}
],
"rule_set": [
{
"tag": "geosite-netflix",
"type": "remote",
"format": "binary",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-netflix.srs",
"download_detour": "direct"
},
{
"tag": "geosite-openai",
"type": "remote",
"format": "binary",
"url": "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/sing/geo/geosite/openai.srs",
"download_detour": "direct"
},
{
"tag": "geosite-category-ads-all",
"type": "remote",
"format": "binary",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-category-ads-all.srs",
"download_detour": "direct"
}
],
"final": "direct"
},
"experimental": {
"cache_file": {
"path": "cache.db",
"cache_id": "mycacheid",
"store_fakeip": true
}
}
}
EOF
}
# running files
run_sb() {
if [ -e web ]; then
nohup ./web run -c config.json >/dev/null 2>&1 &
sleep 2
pgrep -x "web" >/dev/null && green "web is running" || {
red "web is not running, restarting..."
pkill -x "web" && nohup ./web run -c config.json >/dev/null 2>&1 &
sleep 2
purple "web restarted"
}
fi
if [ -e bot ]; then
nohup ./bot tunnel --edge-ip-version auto --no-autoupdate --protocol http2 --logfile boot.log --loglevel info --url http://localhost:55501 >/dev/null 2>&1 &
sleep 2
pgrep -x "bot" >/dev/null && green "bot is running" || {
red "bot is not running, restarting..."
pkill -x "bot" && nohup ./bot "${tunnel --edge-ip-version auto --no-autoupdate --protocol http2 --logfile boot.log --loglevel info --url http://localhost:55501}" >/dev/null 2>&1 &
sleep 2
purple "bot restarted"
}
fi
}
get_links() {
# get ip
IP=$(curl -s ipv4.ip.sb || {
ipv6=$(curl -s --max-time 1 ipv6.ip.sb)
echo "[$ipv6]"
})
sleep 1
# get ipinfo
ISP=$(curl -s https://speed.cloudflare.com/meta | awk -F\" '{print $26"-"$18}' | sed -e 's/ /_/g')
sleep 1
# yellow "注意:v2ray或其他软件的跳过证书验证需设置为true,否则hy2或tuic节点可能不通\n"
cat >list.txt <<EOF
vmess://$(echo "{ \"v\": \"2\", \"ps\": \"$ISP\", \"add\": \"$IP\", \"port\": \"55501\", \"id\": \"$UUID\", \"aid\": \"0\", \"scy\": \"none\", \"net\": \"ws\", \"type\": \"none\", \"host\": \"\", \"path\": \"/vmess?ed=2048\", \"tls\": \"\", \"sni\": \"\", \"alpn\": \"\", \"fp\": \"\"}" | base64 -w0)
vmess://$(echo "{ \"v\": \"2\", \"ps\": \"$ISP\", \"add\": \"www.visa.com.tw\", \"port\": \"443\", \"id\": \"$UUID\", \"aid\": \"0\", \"scy\": \"none\", \"net\": \"ws\", \"type\": \"none\", \"host\": \"$argodomain\", \"path\": \"/vmess?ed=2048\", \"tls\": \"tls\", \"sni\": \"$argodomain\", \"alpn\": \"\", \"fp\": \"\"}" | base64 -w0)
hysteria2://$UUID@$IP:55502/?sni=www.bing.com&alpn=h3&insecure=1#$ISP
tuic://$UUID:admin123@$IP:55503?sni=www.bing.com&congestion_control=bbr&udp_relay_mode=native&alpn=h3&allow_insecure=1#$ISP
EOF
cat list.txt
purple "list.txt saved successfully"
purple "Running done!"
sleep 3
rm -rf web bot npm boot.log config.json sb.log core tunnel.yml tunnel.json
}
#主菜单
menu() {
clear
green "安装sing-box"
install_singbox
}
menu
打开服务器面板点击Menedzer plikow(文件管理)。新建个文件,名称为taka.sh(可以自己更改)。然后找到Edytuj(编辑)把代码复制进去,粘贴代码后左上角点击Zapisz(保存),最后给文件权限全部打钩,保存。
回到SSH输入./taka.sh(文件名不同的话输入自己自定义的文件名)。然后就可以自动安装了。
使用节点
下载使用v2rayN,把4个节点的链接全部复制导入到v2rayN软件里
1:第一种方式搭建的链接,导入后发现只有一个链接有延迟,只需要把主机名称改成IP就可以了,443那个改了也没用(废了)。电脑输入windows+R,CMD,打开终端ping s7.serv00.com(ping+空格+你的主机名),在SSH服务器里也可以,把获取的IP更换掉主机名就可以了。
2:第二种方式搭建的链接,导入节点后直接就是三个可用,还是那个443的不行0.0。
3:设为活动服务器跑下Youtube瞧一瞧,4K最高5万5,作为免费的很厉害了。