/vps-shell

个人收集的一些关于VPS的一键脚本

Primary LanguageShell

vps-shell

个人收集的一些关于VPS的一键脚本

使用方法

基本库安装

  • CentOS
yum -y updade
yum -y install wget
  • Debian/Ubuntu
apt-get -y update
apt-get -y install wget

AutoBackupToFtp.sh

  • 说明:自动备份网站文件和数据库并上传到FTP空间
  • 安装
# 1.首先安装EMAIL发送组件
yum install sendmail mutt

# 2.新建本地备份目录
mkdir -p /home/backup

# 3.安装AutoBackupToFtp.sh
wget -N --no-check-certificate https://raw.githubusercontent.com/Himly/vps-shell/master/AutoBackupToFtp.sh
chmod +x AutoBackupToFtp.sh
bash AutoBackupToFtp.sh
# CentOS系统安装crontab
yum install -y crond
# Debian/Ubuntu系统安装crontab
apt-get install -y cron

# CentOS系统检查cron的服务状态
service crond status
# Debian/Ubuntu系统检查cron的服务状态
service cron status

# CentOS系统手动启动crontab服务
service crond start
# Debian/Ubuntu系统手动启动crontab服务
service cron start

# 接下来打开定时设置,然后会出现文本编辑,按 I 键 进入编辑模式,根据需求添加下面的代码到这个文本编辑框内
crontab -e

# 每天2点10分重启一次AutoBackupToFtp.sh
10 2 * * * /etc/init.d/ssr restart
# 每隔2天的2点10分重启一次AutoBackupToFtp.sh
10 2 */2 * * /etc/init.d/ssr restart

BBR.sh

  • 说明:Debian/Ubuntu 开启 TCP BBR 拥塞算法
  • 安装
wget --no-check-certificate -qO 'BBR.sh' 'https://raw.githubusercontent.com/Himly/vps-shell/master/BBR.sh' && chmod a+x BBR.sh
  • 使用说明
# 普通模式,最后需要按下回车才会重启
bash BBR.sh

# 强制模式,全自动(如果中间不报错),不需要按下回车
bash BBR.sh -f

# 指定安装内核版本,以4.11.9为例
bash BBR.sh -f v4.11.9
  • 检测
# 重启后运行以下命令,结果不为空,则开启BBR成功
lsmod |grep 'bbr'

BBR_POWERED.sh

  • 说明:Debian/Ubuntu TCP BBR 改进版/增强版
  • 准备

 使用前,请确认能够开启BBR.

 可参考: Debian/Ubuntu 开启 TCP BBR 拥塞算法

  • 安装
wget --no-check-certificate -qO 'BBR_POWERED.sh' 'https://raw.githubusercontent.com/Himly/vps-shell/master/BBR_POWERED.sh' && chmod a+x BBR_POWERED.sh && bash BBR_POWERED.sh
#注意:执行此命令会自动重启.
  • 指定内核版本(以v4.11.9内核版本为例)
wget --no-check-certificate -qO 'BBR_POWERED.sh' 'https://raw.githubusercontent.com/Himly/vps-shell/master/BBR_POWERED.sh' && chmod a+x BBR_POWERED.sh && bash BBR_POWERED.sh -f v4.11.9
  • 说明

执行过程中会重新编译模.

模块默认为开机自动加载.

模块名称:tcp_bbr_powered.

可用 modprobe tcp_bbr_powered 命令进行加载模块.

可执行 lsmod |grep 'bbr_powered' ,结果不为空,则加载模块成功.

可执行 sysctl -w net.ipv4.tcp_congestion_control=bbr_powered 使用此模块.

#以上只是说明,直接使用一键脚本即可#.

  • 注意事项

如遇报错: Error! Header not be matched by Linux Kernel .

请重新开启BBR,或使用 -f 参数,可参考上面的准备步骤.

如遇报错: Error! Install makeError! Install gcc .

首先尝试 apt-get update ,再次执行此脚本.

如果未解决想办法自行安装gcc(>=4.9),或切换系统后再试.

本脚本在Debian8,Debian9,Ubuntu16.04上通过测试.

serverspeeder.sh

  • 说明:锐速破解版linux一键自动安装包
  • 安装
wget -N --no-check-certificate https://raw.githubusercontent.com/Himly/vps-shell/master/serverspeeder.sh
chmod +x serverspeeder.sh
bash serverspeeder.sh
  • 卸载
chattr -i /serverspeeder/etc/apx* && /serverspeeder/bin/serverSpeeder.sh uninstall -f

install_fs.sh

  • 说明:Finalspeed破解版一键自动安装包
  • 安装
wget -N --no-check-certificate https://raw.githubusercontent.com/Himly/vps-shell/master/install_fs.sh
chmod +x install_fs.sh
bash install_fs.sh
  • 卸载
wget -N --no-check-certificate https://raw.githubusercontent.com/Himly/vps-shell/master/install_fs.sh && bash install_fs.sh uninstall
  • 操作命令

启动命令:   /etc/init.d/finalspeed start

停止命令:   /etc/init.d/finalspeed stop

状态命令:   /etc/init.d/finalspeed status

  • 安装路径

安装路径:   /fs/

日志路径:   /fs/server.log

speedtest.py

  • 说明:Linux通过SpeedTest测速的一键脚本
  • 安装
wget -N --no-check-certificate https://raw.githubusercontent.com/Himly/vps-shell/master/speedtest.py
chmod +x speedtest.py
./speedtest.py
  • 使用说明
    $ speedtest-cli -h
    usage: speedtest-cli [-h] [--no-download] [--no-upload] [--bytes] [--share]
                         [--simple] [--csv] [--csv-delimiter CSV_DELIMITER]
                         [--csv-header] [--json] [--list] [--server SERVER]
                         [--mini MINI] [--source SOURCE] [--timeout TIMEOUT]
                         [--secure] [--no-pre-allocate] [--version]

    Command line interface for testing internet bandwidth using speedtest.net.
    --------------------------------------------------------------------------
    https://github.com/sivel/speedtest-cli

    optional arguments:
      -h, --help            show this help message and exit
      --no-download         Do not perform download test
      --no-upload           Do not perform upload test
      --bytes               Display values in bytes instead of bits. Does not
                            affect the image generated by --share, nor output from
                            --json or --csv
      --share               Generate and provide a URL to the speedtest.net share
                            results image, not displayed with --csv
      --simple              Suppress verbose output, only show basic information
      --csv                 Suppress verbose output, only show basic information
                            in CSV format. Speeds listed in bit/s and not affected
                            by --bytes
      --csv-delimiter CSV_DELIMITER
                            Single character delimiter to use in CSV output.
                            Default ","
      --csv-header          Print CSV headers
      --json                Suppress verbose output, only show basic information
                            in JSON format. Speeds listed in bit/s and not
                            affected by --bytes
      --list                Display a list of speedtest.net servers sorted by
                            distance
      --server SERVER       Specify a server ID to test against
      --mini MINI           URL of the Speedtest Mini server
      --source SOURCE       Source IP address to bind to
      --timeout TIMEOUT     HTTP timeout in seconds. Default 10
      --secure              Use HTTPS instead of HTTP when communicating with
                            speedtest.net operated servers
      --no-pre-allocate     Do not pre allocate upload data. Pre allocation is
                            enabled by default to improve upload performance. To
                            support systems with insufficient memory, use this
                            option to avoid a MemoryError
      --version             Show the version number and exit