转载自喵叭博客:云播多用户VIP版-一键脚本,原作者为hostloc的gaoji.me(搞基么,手动滑稽)

项目介绍

  • 项目来自Github
  • 此一键脚本仅适用于Debian7 64位(8都不行哦,因为写的很死,无责任预测是逗比的忠实信徒233)
  • 实际思路不复杂,可以自己手动来做,本质是网站前端 + Aria2
  1. 手工编译/LN(A)MP/oneinstack环境
  2. Aria2安装
  3. YunBT网站程序搭建
  4. 锐速安装
  5. 定时任务

功能

  • 离线下载支持BT种子,Magnet链接以特征码等下载
  • 已经开启邀请码,管理员可以分配账户下载量
  • 默认文件最大不超过10GB,当单个文件不超过6小时下载时间。
  • 可以支持的在线查看的文件:
    视频:mp4,webm,ogg;
    音频:mp3;
    图片:jpg,png,gif;
    文件:pdf text html;

一键脚本

wget --no-check-certificate https://www.miao8.top/shell/YunBt;chmod +x YunBt;./YunBt
  • 备份地址
wget --no-check-certificate https://storage.liyuans.com/09.Shell/YunBt;chmod +x YunBt;./YunBt

注意事项

  • 默认大小写敏感。若需要修改为不敏感,在{webdir}/ThinkPHP/Conf/convention.php 中将'URL_CASE_INSENSITIVE' =˃ false 改为'URL_CASE_INSENSITIVE' =˃ true
  • 默认用户名密码:Admin/a123456,默认管理登录地址是 http://your_domain/index.php/Admin
  • 数据库密码需要手工输入好几次,注意要一样
  • YunBT的数据库连接信息在 {webdir}/Bt/Conf/config.php
  • YunBT的默认连接信息在 {webdir}/index.php

演示网址

Yunbt.png

脚本详细内容

#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

clear
echo '
    ************************************************************
    *****                                                  *****
    *****         本脚本在debian7 x64上通过测试            *****
    *****                                                  *****
    ************************************************************


                                -Powered by 喵叭博客-猫剩
'
    if [ -f /etc/redhat-release ];then
        OS=CentOS

    elif [ ! -z "`cat /etc/issue | grep bian`" ];then
        OS=Debian

    elif [ ! -z "`cat /etc/issue | grep Ubuntu`" ];then
        OS=Ubuntu
    else
        echo "Not support OS, Please reinstall OS and retry!"
        exit 1
    fi


function update(){
    if [ "$OS" == 'CentOS' ]; then
        echo "Centos凑什么热闹!换系统去"
    else
        echo "准备更新清理系统"
        sleep 5
        apt-get update -y >/dev/null 2>&1
        apt-get remove http* apache* -y >/dev/null 2>&1
        apt-get install vim wget unzip tar screen -y >/dev/null 2>&1
    fi
}


function setconfig(){
echo 
 echo -e "请选择模式(默认:域名模式)" 
 echo -e "1:公网ip模式" 
 echo -e "2:域名模式" 
 read moshi 
  if [[ ${moshi} == '1' ]]
 then 
read -p '请输入你的IP地址: ' web;
[ -z "$web" ] && echo "你是猪吗,让你填外网ip地址 已经给你设置为127.0.0.1,自己改" && web="127.0.0.1"
read -p '请输入地址端口: ' port1;
[ -z "$port1" ] && echo "你是猪吗,让你填端口 已经给你设置为8546,自己改" && port1="8546"
sleep 3
else
read -p '请输入域名(例如 web.xxx.com): ' web;
port1='80'; 
[ -z "$web" ] && echo "你是猪吗,让你填域名 已经给你设置为www.baidu.com,自己改" && web="www.baidu.com"
sleep 3
fi
read -p '请输入你要设置的mysql密码(务必输入): '  sqlpwd;
[ -z "$sqlpwd" ] && echo "你没有输入,默认设置为123456,请自行修改,后面安装mysql时请输入123456否则会出错" && sqlpwd='123456';
}

function lnmp(){
echo '开始安装LNMP环境 这里没有卡住,时间由你服务器性能 网络决定'
sleep 5
echo "deb ftp://ftp.deb-multimedia.org wheezy main" >>/etc/apt/sources.list 
apt-get update -y >/dev/null 2>&1
apt-get install -y --force-yes deb-multimedia-keyring >/dev/null 2>&1
apt-get update -y >/dev/null 2>&1
apt-get install -y -t wheezy nginx ffmpeg >/dev/null 2>&1
echo "deb http://packages.dotdeb.org wheezy-php56 all" >> /etc/apt/sources.list.d/dotdeb.list
echo "deb-src http://packages.dotdeb.org wheezy-php56 all" >> /etc/apt/sources.list.d/dotdeb.list
wget http://www.dotdeb.org/dotdeb.gpg -O- | apt-key add -
aptitude update -y
aptitude install php5-fpm php5-gd php5-common php5-mysql php5-curl -y
echo '开始安装mysql,请务必输入刚刚你设置的密码'
sleep 8
apt-get install mysql-server -y

}

function makeconfig(){
echo '开始创建配置文件'
sleep 5

mkdir -p /home/wwwroot/${web}
cd /etc/nginx/
rm -rf fastcgi_params
wget --no-check-certificate https://raw.githubusercontent.com/godzlalala/yunBT/master/fastcgi_params

cd conf.d

echo "
server {
    listen ${port1};
    server_name ${web};
    root /home/wwwroot/${web};
" >> ${web}.conf

echo '

    location / {
        index index.html index.php;
    }
    location ~ \.php {  
                #fastcgi_pass 127.0.0.1:9000;   
                #fastcgi_pass unix:/dev/shm/php-cgi.sock;   
                fastcgi_pass  unix:/var/run/php5-fpm.sock;  
                fastcgi_index index.php;  
                include fastcgi_params;  
                set $real_script_name $fastcgi_script_name;  
                if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {  
                set $real_script_name $1;  
                set $path_info $2;  
            }  
                fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;  
                fastcgi_param SCRIPT_NAME $real_script_name;  
                fastcgi_param PATH_INFO $path_info;  
            }  
}
' >> ${web}.conf


cd

wget --no-check-certificate https://raw.githubusercontent.com/godzlalala/yunBT/master/dht.dat /root/.aria2/dht.dat

mkdir .aria2

wget --no-check-certificate https://raw.githubusercontent.com/godzlalala/yunBT/master/aria2.conf /root/.aria2/aria2.conf

echo '' > /root/aria2.session

}


function main(){
echo '开始安装主程序'
apt-get install aria2  -y
cd /home/wwwroot/${web}
wget --no-check-certificate https://raw.githubusercontent.com/godzlalala/yunBT/master/btmain.zip >/dev/null 2>&1
unzip btmain.zip >/dev/null 2>&1
echo '
<?php
return array(
    "DB_TYPE"      =>  "mysql",     // 数据库类型  ss
    "DB_HOST"      =>  "localhost",     // 服务器地址  
    "DB_NAME"      =>  "yunbt",     // 数据库名  
    "DB_USER"      =>  "root",     // 用户名  
    "DB_PWD"       =>  "'${sqlpwd}'",     // 输入安装MySQL时设置的密码  
    "DB_PORT"      =>  "3306",     // 端口  
    "DB_PREFIX"    =>  "tr_",     // 数据库表前缀  
   // "SHOW_PAGE_TRACE"=>True,
    "LAYOUT_ON"=>true,
    "LAYOUT_NAME"=>"Public/index"
);
?>
' >> ./Bt/Conf/config.php


chmod 777 /home/wwwroot/${web}/uploads
chmod 777 /home/wwwroot/${web}/download
chmod 777 /home/wwwroot/${web}/Bt/Runtime
wget --no-check-certificate https://raw.githubusercontent.com/godzlalala/yunBT/master/yunbt.sql

mysql -hlocalhost -uroot -p${sqlpwd} -e "create database IF NOT EXISTS yunbt"
mysql -hlocalhost -uroot -p${sqlpwd} --default-character-set=utf8<<EOF
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY '${sqlpwd}' WITH GRANT OPTION;
flush privileges;
use yunbt;
source ./yunbt.sql;
EOF

rm -rf yunbt.sql

}


function startc(){
echo '配置完毕,启动程序'
screen -dmS aria2  aria2c --enable-rpc --rpc-listen-all=true --rpc-allow-origin-all -c >/dev/null 2>&1
service nginx restart >/dev/null 2>&1
service php5-fpm restart >/dev/null 2>&1

}


function serverspeeder(){
cd
read -p '是否安装锐速。(输入y安装,其他不安装)不一定支持你的内核' isspeeder;
echo '支持内核请查看https://www.91yun.org/wp-content/plugins/91yun-serverspeeder/systemlist.html '
if [ ${isspeeder} == 'y' ];then
    wget -N --no-check-certificate https://raw.githubusercontent.com/91yun/serverspeeder/master/serverspeeder-all.sh && bash serverspeeder-all.sh
    wget -N --no-check-certificate https://raw.githubusercontent.com/godzlalala/start/master/rs.sh
    mv rs.sh rs
    chmod +x rs
else  
    echo '你选择不安装锐速,如需要可以执行 ./debian7 serverspeeder 来安装'
fi
}



function installover(){

echo "
    *************************************************************
    *                                                           *
    *                        程序安装完毕                       *
        你设置的域名为${web}:${port1}
        后台地址为${web}:${port1}/index.php/Admin
        默认管理员帐号admin密码a123456
                ./rs start 启动锐速
                ./rs stop 停止锐速
                ./rs restart 重启锐速
                ./rs status 查看锐速状态
                ./rs config 更改锐速配置文件
                执行一下两行代码卸载锐速
        chattr -i /serverspeeder/etc/apx* 
        /serverspeeder/bin/serverSpeeder.sh uninstall -f

    *                                                           *
    *************************************************************
                              感谢gaoji.me大佬开源              

                                            -Powered by 喵叭博客-猫剩
"


}


function run(){
starttime=`date +%s`
update
setconfig
lnmp
makeconfig
main
serverspeeder
startc
installover
stop=`date +%s`
echo " 脚本总共运行了  $[ stop - starttime ] 秒"
}

if [ ! -n "$1" ]; then
 run
elif [ $1 = "run" ]; then
 run
elif [ $1 = "serverspeeder" ]; then
 serverspeeder
else 
    echo "
        未知命令,脚本退出
    "
    exit 1
fi