From 2348b8d82cd3ba24977e93c161b680daa7608420 Mon Sep 17 00:00:00 2001 From: NZESupB Date: Wed, 16 Nov 2022 10:35:57 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=84=9A=E6=9C=AC,?= =?UTF-8?q?=E4=BF=AE=E6=94=B9CentOS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc.md | 12 +++++--- docker-compose.yml | 4 --- reader.sh | 68 ++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 70 insertions(+), 14 deletions(-) diff --git a/doc.md b/doc.md index 140ff8fa..3c6cfc79 100644 --- a/doc.md +++ b/doc.md @@ -15,6 +15,7 @@ - [服务器版](#服务器版) - [Docker版](#docker版) - [Docker-Compose版(推荐)](#docker-compose版推荐) + - [脚本部署(CentOS&甲骨文非Ubuntu可能不支持)](#通过脚本一键部署) - [Nginx反向代理](#nginx反向代理) - [开发编译](#开发编译) - [编译脚本](#编译脚本) @@ -283,10 +284,9 @@ reader添加环境变量:-e "READER_APP_REMOTEWEBVIEWAPI=http://localhost:8050 #安装docker 及 docker-compose #Debian/Ubuntu apt install docker-compose -y -#CentOS -yum install docker -y -curl -L "https://ghproxy.com/https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose -chmod +x /usr/local/bin/docker-compose +#CentOS 建议修改为Debian/Ubuntu,或者网上搜索Docker/Docker-compose安装教程 +curl -fsSL https://get.docker.com | bash -s docker #国外服务器 +curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun #国内服务器 # 下载项目里的 docker-compose.yaml wget https://ghproxy.com/https://raw.githubusercontent.com/hectorqin/reader/master/docker-compose.yaml @@ -304,6 +304,9 @@ docker-compose stop # 查看实时日志 docker logs -f reader +# 自行导入远程书源(打开链接后复制网址导入即可) +https://legado.pages.dev + # 手动更新 docker-compose pull && docker-compose up -d ``` @@ -311,6 +314,7 @@ docker-compose pull && docker-compose up -d ### 通过脚本一键部署 ```shell +# 此脚本对甲骨文非Ubuntu以及CentOS支持程度极低。此两系统建议网上手动搜索 bash <(wget -qO- --no-check-certificate https://ghproxy.com/https://raw.githubusercontent.com/hectorqin/reader/master/reader.sh) ``` diff --git a/docker-compose.yml b/docker-compose.yml index c4cd3f4e..7b022d14 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,10 +5,6 @@ services: # 阅读官方书源 : [https://legado.pages.dev](https://legado.pages.dev) 或者 [http://legado.git.llc](https://legado.pages.dev) 点击打开连接,添加远程书源即可 # 公众号汇总 : [https://mp.weixin.qq.com/s/5t8nfSnRfHjJNAvT76fA_A](https://mp.weixin.qq.com/s/5t8nfSnRfHjJNAvT76fA_A) # 手动更新方式 : 在此文件所在的目录下执行 docker-compose pull && docker-compose up -d -# Debian 10+/Ubuntu18+ 一键安装命令 浏览器打开ip:4396即可,国内服务器需手动放行映射端口(默认为4396 -# cd /home && wget https://raw.nxnow.top/NZESupB/Profile/main/dockercompose/reader/docker-compose.yml && apt update && apt install docker-compose -y && docker-compose up -d -# CentOS7+ 一键安装命令 (未测试) -# cd /home && wget https://raw.nxnow.top/NZESupB/Profile/main/dockercompose/reader/docker-compose.yml && yum update && yum install docker && curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose && docker-compose up -d reader: #image: hectorqin/reader # 普通镜像 image: hectorqin/reader:openj9-latest # Openj9镜像,arm64架构或小内存机器优先使用 diff --git a/reader.sh b/reader.sh index 5a7a1232..e7a8e619 100644 --- a/reader.sh +++ b/reader.sh @@ -7,6 +7,11 @@ plain='\033[0m' file_dir="" remotePort="" +isMultiUser="" +adminPassword="" +registerCode="" +strTrue="true" +dockerImages="" # CheckRoot if [[ $EUID -ne 0 ]]; then @@ -62,7 +67,8 @@ fi install_dockercompose() { if [[ x"${release}" == x"centos" ]]; then - yum update && yum install wget curl docker -y + yum update -y && yum install wget curl docker -y + systemctl restart docker curl -L "https://ghproxy.com/https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose else apt update && apt install wget curl docker-compose -y @@ -70,13 +76,21 @@ install_dockercompose() { } install_reader() { - mkdir ${orgin_file_dir} + mkdir -p ${orgin_file_dir}/storage/data/default cd ${orgin_file_dir} rm docker-compose* - wget https://ghproxy.com/https://raw.githubusercontent.com/hectorqin/reader/master/docker-compose.yml + wget https://ghproxy.com/https://raw.githubusercontent.com/hectorqin/reader/master/docker-compose.yaml + echo -e "${green} 正在下载默认书源 ${plain}" + wget https://legado.pages.dev/sy-yc.json -O storage/data/default/bookSource.json + echo -e "${green} 正在配置docker变量 ${plain}" sed -i "s/\/home\/reader/${file_dir}/" docker-compose.yml sed -i "s/4396/${remotePort}/" docker-compose.yml + sed -i "s/openj9-latest/${dockerImages}/" docker-compose.yml # 多用户 + sed -i "s/READER_APP_SECURE\=true/READER_APP_SECURE\=${isMultiUser}/" docker-compose.yml + sed -i "s/adminpwd/${adminPassword}/" docker-compose.yml + sed -i "s/registercode/${registerCode}/" docker-compose.yml + echo -e "${green} 准备启动 ${plain}" # 远程webview docker-compose up -d } @@ -103,7 +117,7 @@ getRemotePort () { getfileDir () { echo -e "${green} 请输入数据存放目录,例如 /home/reader : ${plain}" - read -p "不填默认为/home/reader: " file_dir + read -p "不填默认为/home/reader : " file_dir if [[ -z "$file_dir" ]];then file_dir="/home/reader" fi @@ -111,18 +125,60 @@ getfileDir () { file_dir=${file_dir//\//\\\/} } +getMultiUser () { + echo -e "${green} 是否需要开启多用户 : ${plain}" + read -p "填0不开启,不填开启 : " isMultiUser + if [[ -z "$isMultiUser" ]];then + isMultiUser="true" + else + isMultiUser="false" + fi +} + +getPwdOrCode () { + echo -e "${green} 请输入管理密码,用于加载用户空间 : ${plain}" + read -p "建议修改此参数,默认为adminpwd : " adminPassword + if [[ -z "$adminPassword" ]];then + adminPassword="adminpwd" + fi + echo -e "${green} 请输入邀请码,用于注册使用 : ${plain}" + read -p "不填默认为空 : " registerCode + if [[ -z "$registerCode" ]];then + registerCode="" + fi +} + +getDockerImages () { + echo -e "${green} 请输入需要的镜像 arm或者小内存(1G)机器建议openj9,其余建议基础镜像 : ${plain}" + read -p "不输入为基础镜像,输入其他值为openj9 : " dockerImages + if [[ -z "$dockerImages" ]];then + dockerImages="latest" + else + dockerImages="openj9-latest" + fi +} + Server_IP='' getIpaddr () { Server_IP=`ip addr | grep 'state UP' -A2 | grep inet | egrep -v '(127.0.0.1|inet6|docker)' | awk '{print $2}' | tr -d "addr:" | head -n 1 | cut -d / -f1` } echo -e "${green}开始安装${plain}" +echo -e "${green}甲骨文系统可能需要手动安装docker,本脚本仅测试CentOS7,Ubuntu20+,Debian10+${plain}" +echo -e "${green}建议放弃CentOS,此脚本不对该系统继续适配,不会写${plain}" install_dockercompose getfileDir getRemotePort +getMultiUser +if [ $isMultiUser == "true" ]; then + getPwdOrCode +fi +getDockerImages install_reader getIpaddr + echo -e "${green}初步部署完成,国内服务器请在控制台打开端口${remotePort}${plain}" echo -e "${green}浏览器打开网页${plain} http://${Server_IP}:${remotePort}" -echo -e "${green}如需修改其他配置请前往${orgin_file_dir}根据注释修改docker-compose.yml文件后${plain}" -echo -e "${green}通过命令docker-compose up -d 重启即可${plain}" +echo -e "${green}如需修改其他配置请前往 cd${orgin_file_dir} 根据注释修改 vim docker-compose.yml文件后${plain}" +echo -e "${green}先自行学习vim用法,否者建议使用sftp或WindTerm等ssh自带sftp的软件直接打开编辑${plain}" +echo -e "${green}通过命令docker-compose up -d 重启即可${plain}" \ No newline at end of file From f29c42f93c91059a348796373a6e2a6918bfe4b2 Mon Sep 17 00:00:00 2001 From: NZESupB Date: Wed, 16 Nov 2022 11:53:04 +0800 Subject: [PATCH 2/8] update shell --- doc.md | 6 +++--- reader.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 51 insertions(+), 10 deletions(-) diff --git a/doc.md b/doc.md index 3c6cfc79..4a0c6919 100644 --- a/doc.md +++ b/doc.md @@ -15,7 +15,7 @@ - [服务器版](#服务器版) - [Docker版](#docker版) - [Docker-Compose版(推荐)](#docker-compose版推荐) - - [脚本部署(CentOS&甲骨文非Ubuntu可能不支持)](#通过脚本一键部署) + - [脚本部署(甲骨文非Ubuntu可能不支持)](#通过脚本一键部署) - [Nginx反向代理](#nginx反向代理) - [开发编译](#开发编译) - [编译脚本](#编译脚本) @@ -284,7 +284,7 @@ reader添加环境变量:-e "READER_APP_REMOTEWEBVIEWAPI=http://localhost:8050 #安装docker 及 docker-compose #Debian/Ubuntu apt install docker-compose -y -#CentOS 建议修改为Debian/Ubuntu,或者网上搜索Docker/Docker-compose安装教程 +#CentOS curl -fsSL https://get.docker.com | bash -s docker #国外服务器 curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun #国内服务器 @@ -314,7 +314,7 @@ docker-compose pull && docker-compose up -d ### 通过脚本一键部署 ```shell -# 此脚本对甲骨文非Ubuntu以及CentOS支持程度极低。此两系统建议网上手动搜索 +# 此脚本对甲骨文非Ubuntu系统,CentOS9可能不兼容。建议网上手动搜索 bash <(wget -qO- --no-check-certificate https://ghproxy.com/https://raw.githubusercontent.com/hectorqin/reader/master/reader.sh) ``` diff --git a/reader.sh b/reader.sh index e7a8e619..505a5338 100644 --- a/reader.sh +++ b/reader.sh @@ -67,8 +67,14 @@ fi install_dockercompose() { if [[ x"${release}" == x"centos" ]]; then - yum update -y && yum install wget curl docker -y - systemctl restart docker + yum install wget curl -y + yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine -y + yum install -y yum-utils device-mapper-persistent-data lvm2 -yaml + yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo + yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y + yum install docker-ce-20.10.18 -y + systemctl start docker + systemctl enable docker curl -L "https://ghproxy.com/https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose else apt update && apt install wget curl docker-compose -y @@ -79,7 +85,7 @@ install_reader() { mkdir -p ${orgin_file_dir}/storage/data/default cd ${orgin_file_dir} rm docker-compose* - wget https://ghproxy.com/https://raw.githubusercontent.com/hectorqin/reader/master/docker-compose.yaml + wget https://ghproxy.com/https://raw.githubusercontent.com/hectorqin/reader/master/docker-compose.yml echo -e "${green} 正在下载默认书源 ${plain}" wget https://legado.pages.dev/sy-yc.json -O storage/data/default/bookSource.json echo -e "${green} 正在配置docker变量 ${plain}" @@ -159,13 +165,43 @@ getDockerImages () { } Server_IP='' +Public_IP='' getIpaddr () { - Server_IP=`ip addr | grep 'state UP' -A2 | grep inet | egrep -v '(127.0.0.1|inet6|docker)' | awk '{print $2}' | tr -d "addr:" | head -n 1 | cut -d / -f1` + # Server_IP=`ip addr | grep 'state UP' -A2 | grep inet | egrep -v '(127.0.0.1|inet6|docker)' | awk '{print $2}' | tr -d "addr:" | head -n 1 | cut -d / -f1` + Server_IP=$(hostname -I | awk -F " " '{printf $1}') + Public_IP=$(curl http://pv.sohu.com/cityjson 2>> /dev/null | awk -F '"' '{print $4}') + # hosts=("checkip.amazonaws.com" "api.ipify.org" "ifconfig.me/ip" "icanhazip.com" "ipinfo.io/ip" "ipecho.net/plain" "checkipv4.dedyn.io") + + # CURL=`which curl` + # DIG=`which dig` + + # Public_IP=$($DIG +short myip.opendns.com @resolver1.opendns.com A) + + # if [ ! $? -eq 0 ] || [ -z "$Public_IP" ] || [[ ! $Public_IP =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + # echo "Unable to get your public IP address by OpenDNS service, try to another way." + # count=${#hosts[@]} + + # while [ -z "$Public_IP" ] && [[ $count -ne 0 ]]; do + # selectedhost=${hosts[ $RANDOM % ${#hosts[@]} ]} + # Public_IP=$($CURL -4s https://$selectedhost | grep '[^[:blank:]]') && { + # if [ -n "$Public_IP" ] && [[ $Public_IP =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + # break + # else + # Public_IP="" + # count=$(expr $count - 1) + # echo "The host $selectedhost returned an invalid IP address." + # fi + # } || { + # Public_IP="" + # count=$(expr $count - 1) + # echo "The host $selectedhost did not respond." + # } + # done + # fi } echo -e "${green}开始安装${plain}" -echo -e "${green}甲骨文系统可能需要手动安装docker,本脚本仅测试CentOS7,Ubuntu20+,Debian10+${plain}" -echo -e "${green}建议放弃CentOS,此脚本不对该系统继续适配,不会写${plain}" +echo -e "${green}甲骨文系统可能需要手动安装docker,本脚本仅测试CentOS7,8,Ubuntu20+,Debian10+${plain}" install_dockercompose getfileDir getRemotePort @@ -178,7 +214,12 @@ install_reader getIpaddr echo -e "${green}初步部署完成,国内服务器请在控制台打开端口${remotePort}${plain}" -echo -e "${green}浏览器打开网页${plain} http://${Server_IP}:${remotePort}" +if [ $Server_IP == $Public_IP ];then + echo -e "${green}网址:${plain} http://${Server_IP}:${remotePort}" +else + echo -e "${green}网址:${plain} http://${Public_IP}:${remotePort}" +fi + echo -e "${green}如需修改其他配置请前往 cd${orgin_file_dir} 根据注释修改 vim docker-compose.yml文件后${plain}" echo -e "${green}先自行学习vim用法,否者建议使用sftp或WindTerm等ssh自带sftp的软件直接打开编辑${plain}" echo -e "${green}通过命令docker-compose up -d 重启即可${plain}" \ No newline at end of file From 481f7e82f40b4d64b7d46b01e95c8e3d419e99a6 Mon Sep 17 00:00:00 2001 From: NZESupB Date: Wed, 16 Nov 2022 15:02:02 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reader.sh | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/reader.sh b/reader.sh index 505a5338..ba345dd0 100644 --- a/reader.sh +++ b/reader.sh @@ -72,7 +72,6 @@ install_dockercompose() { yum install -y yum-utils device-mapper-persistent-data lvm2 -yaml yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y - yum install docker-ce-20.10.18 -y systemctl start docker systemctl enable docker curl -L "https://ghproxy.com/https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose @@ -167,37 +166,8 @@ getDockerImages () { Server_IP='' Public_IP='' getIpaddr () { - # Server_IP=`ip addr | grep 'state UP' -A2 | grep inet | egrep -v '(127.0.0.1|inet6|docker)' | awk '{print $2}' | tr -d "addr:" | head -n 1 | cut -d / -f1` Server_IP=$(hostname -I | awk -F " " '{printf $1}') Public_IP=$(curl http://pv.sohu.com/cityjson 2>> /dev/null | awk -F '"' '{print $4}') - # hosts=("checkip.amazonaws.com" "api.ipify.org" "ifconfig.me/ip" "icanhazip.com" "ipinfo.io/ip" "ipecho.net/plain" "checkipv4.dedyn.io") - - # CURL=`which curl` - # DIG=`which dig` - - # Public_IP=$($DIG +short myip.opendns.com @resolver1.opendns.com A) - - # if [ ! $? -eq 0 ] || [ -z "$Public_IP" ] || [[ ! $Public_IP =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - # echo "Unable to get your public IP address by OpenDNS service, try to another way." - # count=${#hosts[@]} - - # while [ -z "$Public_IP" ] && [[ $count -ne 0 ]]; do - # selectedhost=${hosts[ $RANDOM % ${#hosts[@]} ]} - # Public_IP=$($CURL -4s https://$selectedhost | grep '[^[:blank:]]') && { - # if [ -n "$Public_IP" ] && [[ $Public_IP =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - # break - # else - # Public_IP="" - # count=$(expr $count - 1) - # echo "The host $selectedhost returned an invalid IP address." - # fi - # } || { - # Public_IP="" - # count=$(expr $count - 1) - # echo "The host $selectedhost did not respond." - # } - # done - # fi } echo -e "${green}开始安装${plain}" @@ -217,7 +187,8 @@ echo -e "${green}初步部署完成,国内服务器请在控制台打开端口${ if [ $Server_IP == $Public_IP ];then echo -e "${green}网址:${plain} http://${Server_IP}:${remotePort}" else - echo -e "${green}网址:${plain} http://${Public_IP}:${remotePort}" + echo -e "${green}网址:${plain} http://${Server_IP}:${remotePort}" + echo -e "http://${Public_IP}:${remotePort}" fi echo -e "${green}如需修改其他配置请前往 cd${orgin_file_dir} 根据注释修改 vim docker-compose.yml文件后${plain}" From ab1944e5e001d3e52c927d703997c1b1e31bfd2e Mon Sep 17 00:00:00 2001 From: NZESupB Date: Thu, 17 Nov 2022 08:40:26 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9ssl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc.md b/doc.md index 4a0c6919..a4c5f9c2 100644 --- a/doc.md +++ b/doc.md @@ -321,7 +321,7 @@ bash <(wget -qO- --no-check-certificate https://ghproxy.com/https://raw.githubus ## Nginx反向代理(如果有域名可以考虑80端口复用) ```shell -# 此教程仅限非宝塔等各种面板使用 +# 宝塔等各种面板不适用下列教程 # Debian/Ubuntu apt install nginx -y # CentOS @@ -338,7 +338,8 @@ server { listen 80; server_name 域名; #开启ssl解除注释 - #不使用宝塔获取证书脚本 https://github.com/Misaka-blog/acme-1key + # SSL证书获取 + # https://github.com/acmesh-official/acme.sh/wiki/%E8%AF%B4%E6%98%8E #listen 443 ssl; #ssl_certificate 证书.cer; #ssl_certificate_key 证书.key; From 9e0333a3df89bc23be6a3eeaf4505e3a4f4a819d Mon Sep 17 00:00:00 2001 From: NZESupB Date: Thu, 17 Nov 2022 17:03:55 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E5=A2=9E=E5=8A=A0curl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc.md b/doc.md index a4c5f9c2..c1bd4551 100644 --- a/doc.md +++ b/doc.md @@ -315,7 +315,12 @@ docker-compose pull && docker-compose up -d ```shell # 此脚本对甲骨文非Ubuntu系统,CentOS9可能不兼容。建议网上手动搜索 +#curl +bash <(curl -L -s https://ghproxy.com/https://raw.githubusercontent.com/NZESupB/reader/master/reader.sh) + +#wget bash <(wget -qO- --no-check-certificate https://ghproxy.com/https://raw.githubusercontent.com/hectorqin/reader/master/reader.sh) + ``` ## Nginx反向代理(如果有域名可以考虑80端口复用) From 3e0bf63921e470a0bb8ed7b8b5a27fdc8241bffc Mon Sep 17 00:00:00 2001 From: NZESupB Date: Thu, 17 Nov 2022 17:12:39 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc.md b/doc.md index c1bd4551..76fdefde 100644 --- a/doc.md +++ b/doc.md @@ -316,7 +316,7 @@ docker-compose pull && docker-compose up -d ```shell # 此脚本对甲骨文非Ubuntu系统,CentOS9可能不兼容。建议网上手动搜索 #curl -bash <(curl -L -s https://ghproxy.com/https://raw.githubusercontent.com/NZESupB/reader/master/reader.sh) +bash <(curl -L -s https://ghproxy.com/https://raw.githubusercontent.com/hectorqin/reader/master/reader.sh) #wget bash <(wget -qO- --no-check-certificate https://ghproxy.com/https://raw.githubusercontent.com/hectorqin/reader/master/reader.sh) From 33cdf24557546f87cb7c0913a2f26b0e9aabfee2 Mon Sep 17 00:00:00 2001 From: NZESupB Date: Thu, 17 Nov 2022 17:24:18 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E5=A2=9E=E5=8A=A0restart=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reader.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/reader.sh b/reader.sh index ba345dd0..8374a625 100644 --- a/reader.sh +++ b/reader.sh @@ -73,6 +73,7 @@ install_dockercompose() { yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y systemctl start docker + systemctl restart docker systemctl enable docker curl -L "https://ghproxy.com/https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose else From a9f62b7e76fd2606b2013431bac31d9fe55bfb26 Mon Sep 17 00:00:00 2001 From: NZESupB Date: Thu, 17 Nov 2022 18:09:52 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E9=83=A8=E5=88=86=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reader.sh | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/reader.sh b/reader.sh index 8374a625..bbe8d96c 100644 --- a/reader.sh +++ b/reader.sh @@ -68,15 +68,20 @@ fi install_dockercompose() { if [[ x"${release}" == x"centos" ]]; then yum install wget curl -y + echo -e "${green} 正在移除CentOS遗留无效Docker文件 ${plain}" yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine -y - yum install -y yum-utils device-mapper-persistent-data lvm2 -yaml + echo -e "${green} 正在安装Docker ${plain}" + yum install yum-utils device-mapper-persistent-data lvm2 -y yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y + echo -e "${green} 正在启动Docker ${plain}" systemctl start docker systemctl restart docker systemctl enable docker + echo -e "${green} 正在安装docker-compose ${plain}" curl -L "https://ghproxy.com/https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose else + echo -e "${green} 正在安装docker-compose ${plain}" apt update && apt install wget curl docker-compose -y fi } @@ -86,7 +91,7 @@ install_reader() { cd ${orgin_file_dir} rm docker-compose* wget https://ghproxy.com/https://raw.githubusercontent.com/hectorqin/reader/master/docker-compose.yml - echo -e "${green} 正在下载默认书源 ${plain}" + echo -e "${green} 正在配置默认书源 ${plain}" wget https://legado.pages.dev/sy-yc.json -O storage/data/default/bookSource.json echo -e "${green} 正在配置docker变量 ${plain}" sed -i "s/\/home\/reader/${file_dir}/" docker-compose.yml @@ -109,12 +114,12 @@ getRemotePort () { fi if [ "$remotePort" -gt 0 ] 2>/dev/null;then if [[ $remotePort -lt 0 || $remotePort -gt 65535 ]];then - echo -e "端口号不正确,请输入0-65535" + echo -e "${red} 端口号不正确,请输入0-65535${plain}" getRemotePort exit 0 fi else - echo -e "端口号不正确,请输入0-65535" + echo -e "${red} 端口号不正确,请输入0-65535${plain}" getRemotePort exit 0 fi @@ -171,8 +176,8 @@ getIpaddr () { Public_IP=$(curl http://pv.sohu.com/cityjson 2>> /dev/null | awk -F '"' '{print $4}') } -echo -e "${green}开始安装${plain}" -echo -e "${green}甲骨文系统可能需要手动安装docker,本脚本仅测试CentOS7,8,Ubuntu20+,Debian10+${plain}" +echo -e "${green}准备部署reader${plain}" +echo -e "${green}甲骨文官方系统可能并不适用此脚本,本脚本仅测试CentOS7,8,Ubuntu20+,Debian10+${plain}" install_dockercompose getfileDir getRemotePort @@ -184,14 +189,14 @@ getDockerImages install_reader getIpaddr -echo -e "${green}初步部署完成,国内服务器请在控制台打开端口${remotePort}${plain}" +echo -e "${green}初步部署完成,已配置默认书源,国内服务器等有控制台面板的服务器厂商请手动在控制台打开reader所需的端口${remotePort}${plain}" if [ $Server_IP == $Public_IP ];then echo -e "${green}网址:${plain} http://${Server_IP}:${remotePort}" else - echo -e "${green}网址:${plain} http://${Server_IP}:${remotePort}" - echo -e "http://${Public_IP}:${remotePort}" + echo -e "${green}内网网址:${plain} http://${Server_IP}:${remotePort}" + echo -e "${green}公网网址:${plain} http://${Public_IP}:${remotePort}" fi echo -e "${green}如需修改其他配置请前往 cd${orgin_file_dir} 根据注释修改 vim docker-compose.yml文件后${plain}" echo -e "${green}先自行学习vim用法,否者建议使用sftp或WindTerm等ssh自带sftp的软件直接打开编辑${plain}" -echo -e "${green}通过命令docker-compose up -d 重启即可${plain}" \ No newline at end of file +echo -e "${green}修改后前往 cd${orgin_file_dir} 后通过命令docker-compose up -d 重启即可${plain}" \ No newline at end of file