#!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH #=================================================================# # System Required: CentOS 7 X86_64 # # Description: Aria2+AriaNG+KodExplorer Soft Install # # Author: LALA # # Website: https://www.lala.im # #=================================================================# clear echo echo "#############################################################" echo "# Aria2 + AriaNG + KodExplorer Soft Install #" echo "# Author: LALA #" echo "# Website: https://www.lala.im #" echo "# System Required: CentOS 7 X86_64 #" echo "#############################################################" echo # Color red='\033[0;31m' green='\033[0;32m' yellow='\033[0;33m' font="\033[0m" # HostIP input read -p "请输入你的主机公网IP地址:" HostIP # CPUcore input read -p "选择使用多少个CPU线程进行编译(多个线程将有效提升编译效率):" CPUcore # Create Swap read -p "如果机器内存小于2GB需临时创建Swap,是否创建Swap?(yes/no):" Choose if [ $Choose = "yes" ];then dd if=/dev/zero of=/var/swap bs=1024 count=2097152 mkswap /var/swap chmod 0600 /var/swap swapon /var/swap fi if [ $Choose = "no" ] then echo -e "${yellow} 你选择不创建swap,脚本将继续进行下一步操作 ${font}" fi # Disable SELinux Function disable_selinux(){ if [ -s /etc/selinux/config ] && grep 'SELINUX=enforcing' /etc/selinux/config; then sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config setenforce 0 fi } # Stop SElinux disable_selinux # Disable Firewalld systemctl stop firewalld.service systemctl disable firewalld.service # Update System yum -y update if [ $? -eq 0 ];then echo -e "${green} 系统更新完成 ${font}" else echo -e "${red} 系统更新失败 ${font}" exit 1 fi # Install Required yum -y install epel-release if [ $? -eq 0 ];then echo -e "${green} EPEL源安装成功 ${font}" else echo -e "${red} EPEL源安装失败 ${font}" exit 1 fi yum -y groupinstall "Development Tools" if [ $? -eq 0 ];then echo -e "${green} 开发工具包安装成功 ${font}" else echo -e "${red} 开发工具包安装失败 ${font}" exit 1 fi yum -y install openssl-devel if [ $? -eq 0 ];then echo -e "${green} Openssl-Devel安装成功 ${font}" else echo -e "${red} Openssl-Devel安装失败 ${font}" exit 1 fi yum -y install unzip if [ $? -eq 0 ];then echo -e "${green} Unzip安装成功 ${font}" else echo -e "${red} Unzip安装失败 ${font}" exit 1 fi yum -y install wget if [ $? -eq 0 ];then echo -e "${green} wget安装成功 ${font}" else echo -e "${red} wget安装失败 ${font}" exit 1 fi #Install Nginx touch /etc/yum.repos.d/nginx.repo cat > /etc/yum.repos.d/nginx.repo < /etc/aria2/aria2.conf < # 设置的RPC访问密码, 此选项新版已废弃, 建议改用 --rpc-secret 选项 #rpc-passwd= # 是否启用 RPC 服务的 SSL/TLS 加密, # 启用加密后 RPC 服务需要使用 https 或者 wss 协议连接 #rpc-secure=true # 在 RPC 服务中启用 SSL/TLS 加密时的证书文件, # 使用 PEM 格式时,您必须通过 --rpc-private-key 指定私钥 #rpc-certificate=/path/to/certificate.pem # 在 RPC 服务中启用 SSL/TLS 加密时的私钥文件 #rpc-private-key=/path/to/certificate.key ## BT/PT下载相关 ## # 当下载的是一个种子(以.torrent结尾)时, 自动开始BT任务, 默认:true #follow-torrent=true # BT监听端口, 当端口被屏蔽时使用, 默认:6881-6999 listen-port=51413 # 单个种子最大连接数, 默认:55 bt-max-peers=500 # 打开DHT功能, PT需要禁用, 默认:true enable-dht=true # 打开IPv6 DHT功能, PT需要禁用 enable-dht6=true # DHT网络监听端口, 默认:6881-6999 dht-listen-port=6881-6999 # 本地节点查找, PT需要禁用, 默认:false bt-enable-lpd=true # 种子交换, PT需要禁用, 默认:true enable-peer-exchange=true # 每个种子限速, 对少种的PT很有用, 默认:50K #bt-request-peer-speed-limit=50K # 客户端伪装, PT需要 #peer-id-prefix=-TR2770- #user-agent=Transmission/2.77 # 当种子的分享率达到这个数时, 自动停止做种, 0为一直做种, 默认:1.0 seed-ratio=0 # 强制保存会话, 即使任务已经完成, 默认:false # 较新的版本开启后会在任务完成后依然保留.aria2文件 #force-save=false # BT校验相关, 默认:true #bt-hash-check-seed=true # 继续之前的BT任务时, 无需再次校验, 默认:false bt-seed-unverified=true # 保存磁力链接元数据为种子文件(.torrent文件), 默认:false bt-save-metadata=true EOF # Download AriaNG mkdir -p /usr/share/nginx/ariang && cd /usr/share/nginx/ariang wget --no-check-certificate https://github.com/mayswind/AriaNg/releases/download/0.5.0/AriaNg-0.5.0.zip if [ $? -eq 0 ];then echo -e "${green} AriaNG下载成功 ${font}" else echo -e "${red} AriaNG下载失败 ${font}" exit 1 fi unzip AriaNg-0.5.0.zip if [ $? -eq 0 ];then echo -e "${green} AriaNG解压成功 ${font}" else echo -e "${red} AriaNG解压失败 ${font}" exit 1 fi # Download Kodexplorer mkdir -p /usr/share/nginx/kodexplorer && cd /usr/share/nginx/kodexplorer wget --no-check-certificate http://static.kodcloud.com/update/download/kodexplorer4.36.zip if [ $? -eq 0 ];then echo -e "${green} Kodexplorer下载成功 ${font}" else echo -e "${red} Kodexplorer下载失败 ${font}" exit 1 fi unzip kodexplorer4.36.zip if [ $? -eq 0 ];then echo -e "${green} Kodexplorer解压成功 ${font}" else echo -e "${red} Kodexplorer解压失败 ${font}" exit 1 fi # Create Nginx MasterConfigFile touch /etc/nginx/conf.d/ariang.conf cat > /etc/nginx/conf.d/ariang.conf < /etc/nginx/conf.d/kodexplorer.conf < /etc/systemd/system/aria2.service <