VPS常用脚本

常用工具

  1. 科技Lion:
    这是一个常用脚本汇总工具箱,里面包含诸多常用脚本,服务器配置,网站搭建,容器使用等等。
1
curl -sS -O https://raw.githubusercontent.com/kejilion/sh/main/kejilion.sh && chmod +x kejilion.sh && ./kejilion.sh
  1. Docker安装
1
2
3
4
5
# Docker安装
curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh && apt install docker-compose -y

# 设置docker compose快捷键
chmod a+x /usr/local/bin/docker-compose && rm -rf `which dcp` && ln -s /usr/local/bin/docker-compose /usr/bin/dcp
  1. Sing-Box节点搭建
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# fscarmen: Sing-Box全家桶
bash <(wget -qO- https://raw.githubusercontent.com/fscarmen/sing-box/main/sing-box.sh) # Sing-box全家桶
bash <(wget -qO- https://raw.githubusercontent.com/fscarmen/sba/main/sba.sh) # Sing-box
bash <(wget -qO- https://raw.githubusercontent.com/fscarmen/argox/main/argox.sh) # ArgoX

bash <(curl -Ls https://gitlab.com/rwkgyg/sing-box-yg/raw/main/sb.sh) # 勇哥Sing-box四合一脚本

wget -N https://gitlab.com/fscarmen/warp/-/raw/main/menu.sh && bash menu.sh [option] [lisence/url/token] # Warp+
bash <(curl -sSL https://raw.githubusercontent.com/hamid-gh98/x-ui-scripts/main/install_warp_proxy.sh)
wget -N https://gitlab.com/Misaka-blog/warp-script/-/raw/main/warp.sh && bash warp.sh # Misaka

bash <(wget -qO- -o- https://git.io/v2ray.sh)
bash <(wget -qO- -o- https://github.com/233boy/Xray/raw/main/install.sh)
wget -N --no-check-certificate https://raw.githubusercontent.com/Misaka-blog/hysteria-install/main/hy2/hysteria.sh && bash hysteria.sh
wget -N --no-check-certificate https://gitlab.com/Misaka-blog/tuic-script/-/raw/main/tuic.sh && bash tuic.sh
  1. 开启root账户
1
sudo -i && echo root:PassWord |chpasswd root && sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config; && sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config; && service sshd restart
  1. RustDesk Server
1
wget https://raw.githubusercontent.com/dinger1986/rustdeskinstall/master/install.sh && chmod +x install.sh && ./install.sh
  1. Code-Server
1
curl -fOL https://github.com/coder/code-server/releases/download/v4.17.1/code-server_4.17.1_amd64.deb && sudo dpkg -i code-server_4.17.1_amd64.deb && sudo systemctl enable --now code-server@root
  1. IP检测脚本
1
2
3
4
5
6
curl ip.sb # 获取服务器出口IP
curl -s4m5 https://www.cloudflare.com/cdn-cgi/trace # Cloudflare落地IPv4
curl -s6m5 https://www.cloudflare.com/cdn-cgi/trace # Cloudflare落地IPv6

curl https://chat.openai.com/cdn-cgi/trace # OpenAI落地IP
bash <(curl -Ls https://cdn.jsdelivr.net/gh/missuo/OpenAI-Checker/openai.sh) # OpenAI连通检测
  1. Conda安装
1
2
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && bash Miniconda3-latest-Linux-x86_64.sh # X86_64架构
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh && bash Miniconda3-latest-Linux-aarch64.sh # ARM架构
  1. 系统更新和升级
1
sudo apt -y update && sudo apt -y upgrade
  1. Cloudflare优选IP
1
2
curl -sSL https://gitlab.com/rwkgyg/CFwarp/raw/main/point/cfip.sh -o cfip.sh && chmod +x cfip.sh && bash cfip.sh # 优选IP
curl -sSL https://gitlab.com/rwkgyg/CFwarp/raw/main/point/CFcdnym.sh -o CFcdnym.sh && chmod +x CFcdnym.sh && bash CFcdnym.sh # 优选域名
  1. 添加新用户
1
2
sudo adduser ub && sudo usermod -aG sudo ub # 添加新用户ub,并为它分配sudo权限
su - ub # 切换到用户ub

常用面板

  1. 哪吒监控面板
1
curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && ./nezha.sh
  1. 1Panel服务器管理面板
1
curl -sSL https://resource.fit2cloud.com/1panel/package/quick_start.sh -o quick_start.sh && sudo bash quick_start.sh 
  1. X-UI节点搭建面板
1
2
3
4
5
6
bash <(curl -Ls https://raw.githubusercontent.com/alireza0/x-ui/master/install.sh) # 
bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh) # 3X-ui
bash <(curl -Ls https://raw.githubusercontent.com/FranzKafkaYu/x-ui/master/install.sh) # FranzKafkaYu
bash <(curl -Ls https://gitlab.com/rwkgyg/x-ui-yg/raw/main/install.sh) # 勇哥

sudo apt update && sudo apt install -y curl && sudo bash -c "$(curl -Lfo- https://raw.githubusercontent.com/hiddify/hiddify-config/main/common/download_install.sh)" # Hiddify面板
  1. XBoard机场面板

使用Docker部署XBoard机场面板,容器使用host与主机共享网络,访问链接的默认端口为7001。

1
git clone -b  docker-compose --depth 1 https://github.com/cedar2025/Xboard && cd Xboard && docker compose run -it --rm xboard php artisan xboard:install && docker compose up -d
  1. V2Board面板

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
# 原版部署
git clone https://github.com/v2board/v2board-docker.git v2b && cd v2b && git submodule update --init && echo ' branch = dev' >> .gitmodules && git submodule update --remote

# wyx2685修改版
git clone https://github.com/v2board/v2board-docker.git v2b && cd v2b && git config -f .gitmodules submodule.www.url https://github.com/wyx2685/v2board.git && git submodule update --init --recursive && git submodule update --remote

# LotusBoard
git clone https://github.com/lotusnetwork/lotusboard-docker.git && cd lotusboard-docker && git submodule update --init && git submodule update --remote

# 安装V2Board
docker compose exec www bash # 进入V2Board容器

# 配置环境及安装
wget https://getcomposer.org/download/1.9.0/composer.phar
php composer.phar global require hirak/prestissimo
php -d memory_limit=-1 composer.phar install
php artisan v2board:install

# 设置数据库

# 启动horizon
php artisan horizon &

# 升级
sh update.sh
php artisan horizon &

# PS: 清除高磁盘占用的日志文件
docker compose exec www bash
cd storage/logs

  1. SSPanel机场面板(PHP8.3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 使用OneInStack
wget -c http://mirrors.oneinstack.com/oneinstack-full.tar.gz && tar xzf oneinstack-full.tar.gz && ./oneinstack/install.sh --nginx_option 1 --php_option 13 --phpcache_option 1 --php_extensions ioncube,fileinfo,redis,yaml --phpmyadmin --db_option 5 --dbinstallmethod 1 --dbrootpwd oneinstack --redis --reboot

# 手动安装
sudo apt update && sudo apt -y upgrade && sudo apt install ca-certificates apt-transport-https software-properties-common lsb-release -y
sudo add-apt-repository ppa:ondrej/php -y && sudo apt update && sudo apt upgrade -y

sudo apt -y install php8.3 php8.3-fpm php8.3-cli
sudo systemctl enable php8.3-fpm --now

sudo apt -y install php8.3-{cli,fpm,curl,mysql,gd,opcache,zip,intl,common,bcmath,imagick,xmlrpc,readline,memcached,redis,mbstring,apcu,xml,dom,memcache}

sudo apt search php8.3-
php --version
php8.3 -m

Docker部署PHP

1
2
# 部署Mysql+phpmyAdmin
mkdir db && cd db && nono docker-compose.yml

在docker-compose.yml中填入以下内容,并根据实际情况修改相应配置:

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
version: "2"

services:
# mysql容器
web-mysql:
image: mysql:5.7.26
container_name: web-mysql
volumes:
- /root/db/mysql/data:/var/lib/mysql
- /root/db/mysql/example_db:/var/example_db
- /root/db/mysql/conf.d:/etc/mysql/conf.d
environment:
- MYSQL_USER=root
- MYSQL_ROOT_PASSWORD=请修改root密码
- MYSQL_ALLOW_EMPTY_PASSWORD=no
- MYSQL_DATABASE=test
ports:
- 请修改你希望的端口号:3306
command: mysqld --lower_case_table_names=1 --skip-ssl --character_set_server=utf8 --explicit_defaults_for_timestamp
networks:
- net-mysql
restart: always

# phpmyadmin容器
web-pma:
image: phpmyadmin/phpmyadmin:latest
container_name: web-pma
ports:
- "请修改你希望的端口号:80"
environment:
- MYSQL_USER=root
- MYSQL_PASSWORD=请修改root密码
- MYSQL_ROOT_PASSWORD=请修改root密码
- PMA_HOST=web-mysql
- UPLOAD_LIMIT=300M
networks:
- net-mysql
restart: always

networks:
net-mysql:
driver: bridge

拉取源代码,并修改网站配置

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
# 拉取源代码
git clone https://github.com/codionx/lcmp-docker.git && mv lcmp-docker web && cd web

# 创建docker-compose、env、caddy配置文件
cp docker-compose.yml.sample docker-compose.yml && cp .env.sample .env && cp services/caddy/etc/caddy/Caddyfile.sample services/caddy/etc/caddy/Caddyfile

# 修改caddyfile
# 示例PHP:
hellobitch.com {
root * /srv/hellobitch.com
encode gzip
file_server
php_fastcgi php:9000
}

# 示例HTML:
hellobitch.com {
root * /srv/hellobitch.com
encode gzip
file_server
}

# 示例反代:
hellobitch.com {
reverse_proxy http://you.are.bitch
}

# 上传文件到WWW目录

# 在web目录下调整权限
chown -R 1000:1000 www

# 在web目录下启动
docker-compose up -d
  1. XrayR机场后端
1
2
3
4
5
6
7
8
# wyx2685修改版
wget -N https://raw.githubusercontent.com/wyx2685/XrayR-release/master/install.sh && bash install.sh

# 原版
wget -N https://raw.githubusercontent.com/XrayR-project/XrayR-release/master/install.sh && bash install.sh && cd /etc/XrayR

# Docker安装
git clone https://github.com/XrayR-project/XrayR-release xrayr && cd xrayr
  1. 机场后端节点搭建
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# V2bX可用来对接V2Board的节点,支持vmess, vless, hy2, tuic5等协议
bash <(wget -qO- https://raw.githubusercontent.com/wyx2685/V2bX-script/master/install.sh)
wget -N https://raw.githubusercontent.com/wyx2685/V2bX-script/master/install.sh && bash install.sh

# Bodhi: 用来对接机场的hysteria2节点,这几个hy2节点对接方式其实本质都是一样的
# Docker方式搭建机场hysteria2节点, 机场参数在data/config.yaml中配置
git clone https://github.com/lotusnetwork/bodhi-docker.git

# Hysteria2
bash <(wget -qO- https://raw.githubusercontent.com/lydia0doc/Hysteria2-Backend-Install/main/setup.sh) # hysteria2-v2board

# Docker部署Hysteria2后端
cd /etc && mkdir hysteria && git clone https://github.com/Vincent-Ksr/hysteria2-v2b.git hysteria && cd /etc/hysteria

# bash <(curl -fsSL https://get.hy2.sh/) # 原版hysteria2安装脚本
  1. 极光面板(AuroraPanel端口转发)
1
2
bash <(curl -fsSL https://raw.fastgit.org/Aurora-Admin-Panel/deploy/main/install.sh) --mirror # 加速镜像
bash <(curl -fsSL https://raw.githubusercontent.com/Aurora-Admin-Panel/deploy/main/install.sh) # 官方源
  1. Linux科学上网面板
1
2
3
4
5
6
7
8
# Yacd(Yet another clash dashboard)
docker run -p 1234:80 -d --name yacd --rm ghcr.io/haishanh/yacd:master

# Daed管理面板
docker run -d --privileged --network=host --pid=host --restart=unless-stopped -v /sys:/sys -v /etc/daed:/etc/daed --name=daed ghcr.io/daeuniverse/daed:latest

# V2rayA面板 也可以使用 xray 包
sudo apt -y install v2raya xray && sudo systemctl start v2raya.service && sudo systemctl enable v2raya.service