VPS常用命令
VPS常用命令记录。
宝塔面板
1# centos
2yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
3# ubuntu/deepin
4wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh
5# debian
6wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh
7# fedora
8wget -O install.sh http://download.bt.cn/install/install_6.0.sh && bash install.sh
9# 更新
10curl http://download.bt.cn/install/update6.sh|bash
11# 删除登录验证(适用于 7.8.0 以前版本)
12sed -i "s|if (bind_user == 'True') {|if (bind_user == 'REMOVED') {|g" /www/server/panel/BTPanel/static/js/index.js
13rm -rf /www/server/panel/data/bind.pl
14# 还原绑定
15sed -i "s|if (bind_user == 'REMOVED') {|if (bind_user == 'True') {|g" /www/server/panel/BTPanel/static/js/index.js
16# 开心版
17wget -O install.sh http://download.bt.sy/ltd/install/install-ubuntu_6.0.sh && sudo bash install.sh
BBR 加速
1# 国内版
2wget "https://dt.yixiagege.cn/shell/TCP-CN.sh" && chmod +x TCP-CN.sh && ./TCP-CN.sh
测速
1# SuperSpeed
2bash <(curl -Lso- https://git.io/J1SEh)
3# LemonBench
4curl -fsL https://ilemonra.in/LemonBenchIntl | bash -s fast
更改 SSH 端口
1# 备份
2cp /etc/ssh/sshd_config /etc/ssh/sshd_config.backup
3# 更改端口
4vim /etc/ssh/sshd_config
5# 重启服务
6systemctl restart sshd
7# 设置防火墙
8# firewall
9firewall-cmd --permanent --zone=public --add-port=xxxx/tcp
10firewall-cmd --reload
11# iptables
12iptables -A INPUT -p tcp --dport xxxx -j ACCEPT
13service iptables save
14systemctl enable iptables
一键安装 File2Ban
1 # 安装
2wget https://raw.githubusercontent.com/FunctionClub/Fail2ban/master/fail2ban.sh
3bash fail2ban.sh
4# 卸载
5wget https://raw.githubusercontent.com/FunctionClub/Fail2ban/master/uninstall.sh
6bash uninstall.sh
Brook 中转
1wget -N --no-check-certificate https://zhujiget.com/wp-content/uploads/2020/brook-pf.sh && chmod +x brook-pf.sh && ./brook-pf.sh
添加 Swap 分区
1wget https://www.moerats.com/usr/shell/swap.sh && bash swap.sh
buyvm 挂载存储块
1# 查询存储块ID
2ls /dev/disk/by-id/
3# 格式化硬盘
4mkfs.ext4 -F /dev/disk/by-id/scsi-0BUYVM_SLAB_VOLUME-xxxxx
5# 创建挂载点
6mkdir /mnt/pan
7# 挂载硬盘
8mount -o discard,defaults /dev/disk/by-id/scsi-0BUYVM_SLAB_VOLUME-xxxxx /mnt/pan
9# 开机自动挂载
10echo '/dev/disk/by-id/scsi-0BUYVM_SLAB_VOLUME-xxxxx /mnt/pan ext4 defaults,nofail,discard 0 0' | sudo tee -a /etc/fstab
流媒体解锁查询
1# 原版
2bash <(curl -L -s check.unlock.media)
3# 添加解锁方式查询
4bash <(curl -L -s media.ispvps.com)
Azure 使用 root 登录
1echo root:你的密码 |sudo chpasswd root
2sudo sed -i 's/^.*PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config;
3sudo sed -i 's/^.*PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config;
4sudo service sshd restart
工具箱
1# 科技 Lion
2curl -sS -O https://raw.githubusercontent.com/kejilion/sh/main/kejilion.sh && chmod +x kejilion.sh && ./kejilion.sh
3# Bluesky
4wget -O box.sh https://raw.githubusercontent.com/BlueSkyXN/SKY-BOX/main/box.sh && chmod +x box.sh && clear && ./box.sh
Dokcer常用命令
Docker 安装
1curl -sSL https://get.docker.com | bash
2systemctl enable docker
3systemctl start docker
Docker-compose 安装
1sudo curl -L "https://github.com/docker/compose/releases/download/1.29.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
2sudo chmod +x /usr/local/bin/docker-compose
常用命令
1docker ps --format "table {{.ID}}\t{{.Names}}\t{{.Image}}\t{{.Status}}" # 表格形式列出所有容器
2docker kill $(docker ps -a -q) # 停用全部运行中的容器
3docker rm $(docker ps -aq) # 删除全部容器
4docker rmi `docker images -q` # 删除所有镜像
最后修改于 2020-08-17