常用服务器命令备份

Glider 十月 31, 2019 Updated: 十月 31, 2019 #脚本 #服务器
  1. 网易云脚本
    wget -N --no-check-certificate https://raw.githubusercontent.com/XIU2/SHELL/master/unblock163.sh && chmod +x unblock163.sh && bash unblock163.sh

  2. ssr安装
    wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/ssr.sh && chmod +x ssr.sh && sudo bash ssr.sh

  3. v2ray带伪装脚本

wget https://raw.githubusercontent.com/hijkpw/scripts/master/centos_install_v2ray2.sh && chmod +x centos_install_v2ray2.sh && sudo bash centos_install_v2ray2.sh
  1. 各种魔改内核加速脚本
wget -N --no-check-certificate https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/tcp.sh && chmod +x tcp.sh && sudo bash tcp.sh
  1. 服务器端口转发 (第一个只支持tcp,第二个tcp,udp都支持)
wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubiBackup/doubi/master/haproxy.sh && chmod +x haproxy.sh && bash haproxy.sh
wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubiBackup/doubi/master/iptables-pf.sh && chmod +x iptables-pf.sh && bash iptables-pf.sh

以下为centos原生支持的firewalld进行转发功能(在内存较小的机子上运行这个,例如nat的小鸡)

#安装
yum install -y firewalld
systemctl enable firewalld
systemctl start firewalld

#查看运行状态
firewall-cmd --state
firewall-cmd --list-all #查看当前规则
firewall-cmd --zone=public --list-ports  # 查看开放的端口

#规则管理
echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf
sysctl -p
firewall-cmd --permanent --add-masquerade
# 8080可以改成其他端口
firewall-cmd --permanent --add-port=8080/tcp
firewall-cmd --permanent --add-port=8080/tcp
# 8080和上面保持一致,国外ip改成你国外vps的ip,443改成国外ss/ssr/v2ray等软件的端口
firewall-cmd --permanent --add-forward-port=port=8080:proto=tcp:toaddr=国外ip:toport=443
firewall-cmd --permanent --add-forward-port=port=8080:proto=udp:toaddr=国外ip:toport=443

# 移除添加的端口
firewall-cmd --permanent --remove-port=80/tcp

# 重载服务
firewall-cmd --reload
  1. 服务器贴吧签到重启
service docker start
docker-compose up -d
  1. 服务器例行检查
cat /var/log/secure | grep -i "accepted password" 
who
  1. switch_lan_play维护
cd /root/switch-lan-play/server
git pull
npm run build
npm run server