Compare commits
45 Commits
Author | SHA1 | Date | |
---|---|---|---|
0ba6a51549 | |||
9648dbce5b | |||
414974294a | |||
9307877afb | |||
03620c68a6 | |||
461a0bad66 | |||
![]() |
6921aed7a0 | ||
![]() |
a2bedde880 | ||
![]() |
00ab3458c9 | ||
![]() |
81fe138c7d | ||
![]() |
c12d9163c5 | ||
![]() |
a3edf7c08a | ||
![]() |
bed5847683 | ||
![]() |
50a040f784 | ||
![]() |
2bd42d6e3a | ||
![]() |
0efa3cb786 | ||
![]() |
f39dcb1e44 | ||
![]() |
a6cc347e27 | ||
![]() |
f17291148b | ||
![]() |
6895daf9f1 | ||
![]() |
64b63e0b3d | ||
![]() |
0171c8f1a7 | ||
![]() |
d72609ad4d | ||
![]() |
2536fafd20 | ||
![]() |
b916ca3611 | ||
![]() |
c4ba171095 | ||
![]() |
86df8d82dd | ||
![]() |
ff96ca34b8 | ||
![]() |
76a57bc4f1 | ||
![]() |
14f2f6f312 | ||
![]() |
2696b97d05 | ||
![]() |
a8981bd64e | ||
![]() |
dcc4f077f0 | ||
![]() |
f2173baad4 | ||
![]() |
4c04138e32 | ||
![]() |
0b517521b1 | ||
![]() |
eb6e8f8dda | ||
![]() |
e720b4e355 | ||
![]() |
373c0658c2 | ||
![]() |
d9cbf68384 | ||
![]() |
b016977fe8 | ||
![]() |
cd6a6e9b48 | ||
![]() |
451c68a393 | ||
![]() |
0f17616182 | ||
![]() |
4e66543487 |
104
.cnb.yml
104
.cnb.yml
@ -10,12 +10,14 @@ $:
|
|||||||
tags: cnb:arch:amd64
|
tags: cnb:arch:amd64
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
imports: https://cnb.cool/btpanel/secret/-/blob/main/docker.yml
|
||||||
env:
|
env:
|
||||||
IMAGE_TAG: ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:latest-linux-amd64
|
IMAGE_TAG: btpanel/baota:lnmp-linux-amd64
|
||||||
stages:
|
stages:
|
||||||
- name: docker login
|
- name: docker login
|
||||||
script: docker login -u ${CNB_TOKEN_USER_NAME} -p "${CNB_TOKEN}" ${CNB_DOCKER_REGISTRY}
|
script: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWD"
|
||||||
- name: docker build
|
- name: docker build
|
||||||
|
timeout: 7200s
|
||||||
script: docker build -t ${IMAGE_TAG} .
|
script: docker build -t ${IMAGE_TAG} .
|
||||||
- name: docker push
|
- name: docker push
|
||||||
script: docker push ${IMAGE_TAG}
|
script: docker push ${IMAGE_TAG}
|
||||||
@ -26,14 +28,17 @@ $:
|
|||||||
|
|
||||||
- runner:
|
- runner:
|
||||||
tags: cnb:arch:arm64:v8
|
tags: cnb:arch:arm64:v8
|
||||||
|
cpus: 16
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
imports: https://cnb.cool/btpanel/secret/-/blob/main/docker.yml
|
||||||
env:
|
env:
|
||||||
IMAGE_TAG: ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:latest-linux-arm64
|
IMAGE_TAG: btpanel/baota:lnmp-linux-arm64
|
||||||
stages:
|
stages:
|
||||||
- name: docker login
|
- name: docker login
|
||||||
script: docker login -u ${CNB_TOKEN_USER_NAME} -p "${CNB_TOKEN}" ${CNB_DOCKER_REGISTRY}
|
script: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWD"
|
||||||
- name: docker build
|
- name: docker build
|
||||||
|
timeout: 7200s
|
||||||
script: docker build -t ${IMAGE_TAG} .
|
script: docker build -t ${IMAGE_TAG} .
|
||||||
- name: docker push
|
- name: docker push
|
||||||
script: docker push ${IMAGE_TAG}
|
script: docker push ${IMAGE_TAG}
|
||||||
@ -42,10 +47,14 @@ $:
|
|||||||
options:
|
options:
|
||||||
key: build-arm64
|
key: build-arm64
|
||||||
|
|
||||||
- services:
|
- runner:
|
||||||
|
tags: cnb:arch:amd64
|
||||||
|
cpus: 2
|
||||||
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
imports: https://cnb.cool/btpanel/secret/-/blob/main/docker.yml
|
||||||
env:
|
env:
|
||||||
IMAGE_TAG: ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:latest
|
IMAGE_TAG: btpanel/baota:lnmp
|
||||||
stages:
|
stages:
|
||||||
- name: await the amd64
|
- name: await the amd64
|
||||||
type: cnb:await
|
type: cnb:await
|
||||||
@ -55,6 +64,81 @@ $:
|
|||||||
type: cnb:await
|
type: cnb:await
|
||||||
options:
|
options:
|
||||||
key: build-arm64
|
key: build-arm64
|
||||||
|
- name: manifest
|
||||||
|
image: cnbcool/manifest
|
||||||
|
settings:
|
||||||
|
username: $DOCKER_USERNAME
|
||||||
|
password: $DOCKER_PASSWD
|
||||||
|
target: ${IMAGE_TAG}
|
||||||
|
template: ${IMAGE_TAG}-OS-ARCH
|
||||||
|
platforms:
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm64
|
||||||
|
- name: clear
|
||||||
|
image: lumir/remove-dockerhub-tag
|
||||||
|
args:
|
||||||
|
- --user
|
||||||
|
- $DOCKER_USERNAME
|
||||||
|
- --password
|
||||||
|
- $DOCKER_PASSWD
|
||||||
|
- ${IMAGE_TAG}-linux-amd64
|
||||||
|
- ${IMAGE_TAG}-linux-arm64
|
||||||
|
|
||||||
|
- runner:
|
||||||
|
tags: cnb:arch:amd64
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
env:
|
||||||
|
IMAGE_TAG: ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:lnmp-linux-amd64
|
||||||
|
stages:
|
||||||
|
- name: docker login
|
||||||
|
script: docker login -u ${CNB_TOKEN_USER_NAME} -p "${CNB_TOKEN}" ${CNB_DOCKER_REGISTRY}
|
||||||
|
- name: docker build
|
||||||
|
timeout: 7200s
|
||||||
|
script: docker build -t ${IMAGE_TAG} .
|
||||||
|
- name: docker push
|
||||||
|
script: docker push ${IMAGE_TAG}
|
||||||
|
- name: resolve
|
||||||
|
type: cnb:resolve
|
||||||
|
options:
|
||||||
|
key: cnb-build-amd64
|
||||||
|
|
||||||
|
- runner:
|
||||||
|
tags: cnb:arch:arm64:v8
|
||||||
|
cpus: 16
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
env:
|
||||||
|
IMAGE_TAG: ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:lnmp-linux-arm64
|
||||||
|
stages:
|
||||||
|
- name: docker login
|
||||||
|
script: docker login -u ${CNB_TOKEN_USER_NAME} -p "${CNB_TOKEN}" ${CNB_DOCKER_REGISTRY}
|
||||||
|
- name: docker build
|
||||||
|
timeout: 7200s
|
||||||
|
script: docker build -t ${IMAGE_TAG} .
|
||||||
|
- name: docker push
|
||||||
|
script: docker push ${IMAGE_TAG}
|
||||||
|
- name: resolve
|
||||||
|
type: cnb:resolve
|
||||||
|
options:
|
||||||
|
key: cnb-build-arm64
|
||||||
|
|
||||||
|
- runner:
|
||||||
|
tags: cnb:arch:amd64
|
||||||
|
cpus: 2
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
env:
|
||||||
|
IMAGE_TAG: ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:lnmp
|
||||||
|
stages:
|
||||||
|
- name: await the amd64
|
||||||
|
type: cnb:await
|
||||||
|
options:
|
||||||
|
key: cnb-build-amd64
|
||||||
|
- name: await the arm64
|
||||||
|
type: cnb:await
|
||||||
|
options:
|
||||||
|
key: cnb-build-arm64
|
||||||
- name: manifest
|
- name: manifest
|
||||||
image: cnbcool/manifest
|
image: cnbcool/manifest
|
||||||
settings:
|
settings:
|
||||||
@ -65,3 +149,11 @@ $:
|
|||||||
platforms:
|
platforms:
|
||||||
- linux/amd64
|
- linux/amd64
|
||||||
- linux/arm64
|
- linux/arm64
|
||||||
|
- name: remove tag
|
||||||
|
type: artifact:remove-tag
|
||||||
|
options:
|
||||||
|
name: ${CNB_REPO_NAME}
|
||||||
|
tags:
|
||||||
|
- lnmp-linux-amd64
|
||||||
|
- lnmp-linux-arm64
|
||||||
|
type: docker
|
73
.gitea/workflows/build-docker-images.yml
Normal file
73
.gitea/workflows/build-docker-images.yml
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
name: Docker Image Build and Push
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: '宝塔版本'
|
||||||
|
required: true
|
||||||
|
default: '9.5.0'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push-multiarch:
|
||||||
|
name: Build and Push Multi-Arch Docker Image
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code from lnmp branch
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: lnmp
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build AMD64 Docker image
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: false
|
||||||
|
tags: |
|
||||||
|
ldxw/btpanel:latest-amd64
|
||||||
|
ldxw/btpanel:${{ github.event.inputs.version }}-amd64
|
||||||
|
|
||||||
|
- name: Build ARM64 Docker image
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./arm64/Dockerfile
|
||||||
|
platforms: linux/arm64
|
||||||
|
push: false
|
||||||
|
tags: |
|
||||||
|
ldxw/btpanel:latest-arm64
|
||||||
|
ldxw/btpanel:${{ github.event.inputs.version }}-arm64
|
||||||
|
|
||||||
|
- name: Create and push multi-arch manifest
|
||||||
|
run: |
|
||||||
|
docker manifest create \
|
||||||
|
ldxw/btpanel:latest \
|
||||||
|
ldxw/btpanel:latest-amd64 \
|
||||||
|
ldxw/btpanel:latest-arm64
|
||||||
|
docker manifest annotate \
|
||||||
|
ldxw/btpanel:latest \
|
||||||
|
ldxw/btpanel:latest-arm64 \
|
||||||
|
--os linux --arch arm64
|
||||||
|
docker manifest push ldxw/btpanel:latest
|
||||||
|
|
||||||
|
docker manifest create \
|
||||||
|
ldxw/btpanel:${{ github.event.inputs.version }} \
|
||||||
|
ldxw/btpanel:${{ github.event.inputs.version }}-amd64 \
|
||||||
|
ldxw/btpanel:${{ github.event.inputs.version }}-arm64
|
||||||
|
docker manifest annotate \
|
||||||
|
ldxw/btpanel:${{ github.event.inputs.version }} \
|
||||||
|
ldxw/btpanel:${{ github.event.inputs.version }}-arm64 \
|
||||||
|
--os linux --arch arm64
|
||||||
|
docker manifest push ldxw/btpanel:${{ github.event.inputs.version }}
|
||||||
|
|
102
Dockerfile
102
Dockerfile
@ -1,13 +1,9 @@
|
|||||||
FROM debian:bookworm
|
FROM debian:bookworm
|
||||||
|
|
||||||
# 切换 Debian 镜像源为腾讯云源
|
# 切换 Debian 镜像源为腾讯云源,更新包列表并安装依赖 #sed -i 's/deb.debian.org/mirrors.tencent.com/g' /etc/apt/sources.list.d/debian.sources \
|
||||||
RUN sed -i 's/deb.debian.org/mirrors.tencent.com/g' /etc/apt/sources.list.d/debian.sources
|
#&&
|
||||||
|
RUN apt update && apt upgrade -y \
|
||||||
# 更新包列表并升级系统中已经安装的软件包
|
&& apt install -y \
|
||||||
RUN apt update && apt upgrade -y
|
|
||||||
|
|
||||||
# 安装前置依赖
|
|
||||||
RUN apt install -y \
|
|
||||||
locales \
|
locales \
|
||||||
wget iproute2 openssh-server libgd-dev cmake make gcc g++ autoconf \
|
wget iproute2 openssh-server libgd-dev cmake make gcc g++ autoconf \
|
||||||
libsodium-dev libonig-dev libssh2-1-dev libc-ares-dev libaio-dev sudo curl dos2unix \
|
libsodium-dev libonig-dev libssh2-1-dev libc-ares-dev libaio-dev sudo curl dos2unix \
|
||||||
@ -15,53 +11,57 @@ RUN apt install -y \
|
|||||||
diffutils unzip tar libbz2-dev libncurses5 libncurses5-dev libtool libevent-dev libssl-dev libsasl2-dev \
|
diffutils unzip tar libbz2-dev libncurses5 libncurses5-dev libtool libevent-dev libssl-dev libsasl2-dev \
|
||||||
libltdl-dev zlib1g-dev libglib2.0-0 libglib2.0-dev libkrb5-dev libpq-dev libpq5 gettext libcap-dev \
|
libltdl-dev zlib1g-dev libglib2.0-0 libglib2.0-dev libkrb5-dev libpq-dev libpq5 gettext libcap-dev \
|
||||||
libc-client2007e-dev psmisc patch git e2fsprogs libxslt1-dev xz-utils libgd3 libwebp-dev libvpx-dev \
|
libc-client2007e-dev psmisc patch git e2fsprogs libxslt1-dev xz-utils libgd3 libwebp-dev libvpx-dev \
|
||||||
libfreetype6-dev libjpeg62-turbo libjpeg62-turbo-dev
|
libfreetype6-dev libjpeg62-turbo libjpeg62-turbo-dev iptables libudev-dev libldap2-dev \
|
||||||
|
&& apt clean \
|
||||||
# 配置区域设置
|
|
||||||
RUN locale-gen en_US.UTF-8
|
|
||||||
|
|
||||||
ENV LANG en_US.UTF-8
|
|
||||||
ENV LANGUAGE en_US:en
|
|
||||||
ENV LC_ALL en_US.UTF-8
|
|
||||||
|
|
||||||
# 复制 bt.sh 文件
|
|
||||||
COPY bt.sh /bt.sh
|
|
||||||
|
|
||||||
# 转换 bt.sh 文件的换行符
|
|
||||||
RUN dos2unix /bt.sh
|
|
||||||
|
|
||||||
# 设置构建参数
|
|
||||||
ARG RANDOM_NAME
|
|
||||||
|
|
||||||
# 设置一个btd12-前缀的随机主机名
|
|
||||||
RUN echo "btd12-${RANDOM_NAME}" > /etc/hostname
|
|
||||||
|
|
||||||
# 下载并安装宝塔面板
|
|
||||||
RUN curl -sSO https://download.bt.cn/install/install_panel.sh \
|
|
||||||
&& echo y | bash install_panel.sh -P 8888 --ssl-disable
|
|
||||||
|
|
||||||
# 配置宝塔面板安全入口和用户名及密码
|
|
||||||
RUN echo btpanel | bt 6 \
|
|
||||||
&& echo btpaneldocker | bt 5 \
|
|
||||||
&& echo "/btpanel" > /www/server/panel/data/admin_path.pl
|
|
||||||
|
|
||||||
# 设置 root 用户密码
|
|
||||||
RUN echo "root:btpaneldocker" | chpasswd
|
|
||||||
|
|
||||||
# 赋予 bt.sh 可执行权限
|
|
||||||
RUN chmod +x /bt.sh
|
|
||||||
|
|
||||||
# 清理缓存
|
|
||||||
RUN apt clean \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# 设置标识文件
|
# 复制脚本
|
||||||
RUN echo "dk_lib_test_d12" > /www/server/panel/data/o.pl
|
COPY ["bt.sh", "init_mysql.sh", "/"]
|
||||||
|
COPY ["phpmyadmin.sh", "/lnmp/"]
|
||||||
|
|
||||||
|
# 转换启动脚本
|
||||||
|
RUN dos2unix /bt.sh && dos2unix /init_mysql.sh
|
||||||
|
|
||||||
|
# 下载并安装宝塔面板及 lnmp 环境
|
||||||
|
RUN curl -sSO https://download.bt.cn/install/install_panel.sh \
|
||||||
|
&& echo y | bash install_panel.sh -P 8888 --ssl-disable \
|
||||||
|
&& curl -o /lnmp/nginx.sh https://download.bt.cn/install/3/nginx.sh \
|
||||||
|
&& sh /lnmp/nginx.sh install 1.27 \
|
||||||
|
&& curl -o /lnmp/php.sh https://download.bt.cn/install/4/php.sh \
|
||||||
|
&& sh /lnmp/php.sh install 8.3 \
|
||||||
|
&& curl -o /lnmp/mysql.sh https://download.bt.cn/install/4/mysql.sh \
|
||||||
|
&& sh /lnmp/mysql.sh install 5.5 \
|
||||||
|
&& sh /lnmp/phpmyadmin.sh install 5.2 \
|
||||||
|
&& rm -rf /lnmp \
|
||||||
|
&& rm -rf /www/server/php/83/src \
|
||||||
|
&& rm -rf /www/server/mysql/mysql-test \
|
||||||
|
&& rm -rf /www/server/mysql/src.tar.gz \
|
||||||
|
&& rm -rf /www/server/mysql/src \
|
||||||
|
&& rm -rf /www/server/data/* \
|
||||||
|
&& rm -rf /www/server/nginx/src \
|
||||||
|
&& echo "docker_btlnmp_d12" > /www/server/panel/data/o.pl \
|
||||||
|
&& echo '["memuA", "memuAsite", "memuAdatabase", "memuAcontrol", "memuAfiles", "memuAlogs", "memuAxterm", "memuAcrontab", "memuAsoft", "memuAconfig", "dologin", "memu_btwaf", "memuAssl"]' > /www/server/panel/config/show_menu.json \
|
||||||
|
&& apt clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& chmod +x /bt.sh \
|
||||||
|
&& chmod +x /init_mysql.sh
|
||||||
|
|
||||||
|
|
||||||
|
# 配置宝塔面板安全入口和用户名及密码,以及 SSH 密码
|
||||||
|
RUN echo btpanel | bt 6 \
|
||||||
|
&& echo btpaneldocker | bt 5 \
|
||||||
|
&& echo "/btpanel" > /www/server/panel/data/admin_path.pl \
|
||||||
|
&& echo "root:btpaneldocker" | chpasswd
|
||||||
|
|
||||||
|
# 打包宝塔面板,并清除www
|
||||||
|
RUN bt 2 \
|
||||||
|
&& tar -zcf /www.tar.gz /www \
|
||||||
|
&& rm -rf /www
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/sh","-c","/bt.sh"]
|
ENTRYPOINT ["/bin/sh","-c","/bt.sh"]
|
||||||
|
|
||||||
# 暴漏所有端口
|
# 暴漏特定端口
|
||||||
EXPOSE 0-65535
|
EXPOSE 22 80 443 888 3306 8888
|
||||||
|
|
||||||
# 健康检查
|
# 健康检查
|
||||||
HEALTHCHECK --interval=5s --timeout=3s CMD curl -i http://127.0.0.1:$(cat /www/server/panel/data/port.pl)$(cat /www/server/panel/data/admin_path.pl) | grep -E '(200|404)' || exit 1
|
HEALTHCHECK --interval=5s --timeout=3s CMD prot="http"; if [ -f "/www/server/panel/data/ssl.pl" ]; then prot="https"; fi; curl -k -i $prot://127.0.0.1:$(cat /www/server/panel/data/port.pl)$(cat /www/server/panel/data/admin_path.pl) | grep -E '(200|404)' || exit 1
|
62
arm64/Dockerfile
Normal file
62
arm64/Dockerfile
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
FROM debian:bookworm
|
||||||
|
|
||||||
|
# 切换 Debian 镜像源为腾讯云源,更新包列表并安装依赖 #sed -i 's/deb.debian.org/mirrors.tencent.com/g' /etc/apt/sources.list.d/debian.sources \
|
||||||
|
#&&
|
||||||
|
RUN apt update && apt upgrade -y \
|
||||||
|
&& apt install -y \
|
||||||
|
locales \
|
||||||
|
wget iproute2 openssh-server libgd-dev cmake make gcc g++ autoconf \
|
||||||
|
libsodium-dev libonig-dev libssh2-1-dev libc-ares-dev libaio-dev sudo curl dos2unix \
|
||||||
|
build-essential re2c cron bzip2 libzip-dev libc6-dev bison file rcconf flex vim m4 gawk less cpp binutils \
|
||||||
|
diffutils unzip tar libbz2-dev libncurses5 libncurses5-dev libtool libevent-dev libssl-dev libsasl2-dev \
|
||||||
|
libltdl-dev zlib1g-dev libglib2.0-0 libglib2.0-dev libkrb5-dev libpq-dev libpq5 gettext libcap-dev \
|
||||||
|
libc-client2007e-dev psmisc patch git e2fsprogs libxslt1-dev xz-utils libgd3 libwebp-dev libvpx-dev \
|
||||||
|
libfreetype6-dev libjpeg62-turbo libjpeg62-turbo-dev iptables libudev-dev libldap2-dev \
|
||||||
|
&& apt clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# 复制脚本
|
||||||
|
COPY ["bt.sh", "init_mysql.sh", "/"]
|
||||||
|
COPY ["phpmyadmin.sh", "/lnmp/"]
|
||||||
|
|
||||||
|
# 转换启动脚本
|
||||||
|
RUN dos2unix /bt.sh && dos2unix /init_mysql.sh
|
||||||
|
|
||||||
|
# 下载并安装宝塔面板及 lnmp 环境
|
||||||
|
RUN curl -sSO https://download.bt.cn/install/install_panel.sh \
|
||||||
|
&& echo y | bash install_panel.sh -P 8888 --ssl-disable \
|
||||||
|
&& curl -o /lnmp/nginx.sh https://download.bt.cn/install/3/nginx.sh \
|
||||||
|
&& sh /lnmp/nginx.sh install openresty \
|
||||||
|
&& curl -o /lnmp/php.sh https://download.bt.cn/install/4/php.sh \
|
||||||
|
&& sh /lnmp/php.sh install 8.3 \
|
||||||
|
&& curl -o /lnmp/mysql.sh https://download.bt.cn/install/4/mysql.sh \
|
||||||
|
&& sh /lnmp/mysql.sh install 5.5 \
|
||||||
|
&& sh /lnmp/phpmyadmin.sh install 5.2 \
|
||||||
|
&& rm -rf /lnmp \
|
||||||
|
&& rm -rf /www/server/php/83/src \
|
||||||
|
&& rm -rf /www/server/mysql/mysql-test \
|
||||||
|
&& rm -rf /www/server/mysql/src.tar.gz \
|
||||||
|
&& rm -rf /www/server/mysql/src \
|
||||||
|
&& rm -rf /www/server/data/* \
|
||||||
|
&& rm -rf /www/server/nginx/src \
|
||||||
|
&& echo "docker_btlnmp_d12" > /www/server/panel/data/o.pl \
|
||||||
|
&& echo '["memuA", "memuAsite", "memuAdatabase", "memuAcontrol", "memuAfiles", "memuAlogs", "memuAxterm", "memuAcrontab", "memuAsoft", "memuAconfig", "dologin", "memu_btwaf", "memuAssl"]' > /www/server/panel/config/show_menu.json \
|
||||||
|
&& apt clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& chmod +x /bt.sh \
|
||||||
|
&& chmod +x /init_mysql.sh
|
||||||
|
|
||||||
|
|
||||||
|
# 配置宝塔面板安全入口和用户名及密码,以及 SSH 密码
|
||||||
|
RUN echo btpanel | bt 6 \
|
||||||
|
&& echo btpaneldocker | bt 5 \
|
||||||
|
&& echo "/btpanel" > /www/server/panel/data/admin_path.pl \
|
||||||
|
&& echo "root:btpaneldocker" | chpasswd
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/sh","-c","/bt.sh"]
|
||||||
|
|
||||||
|
# 暴漏特定端口
|
||||||
|
EXPOSE 22 80 443 888 3306 8888
|
||||||
|
|
||||||
|
# 健康检查
|
||||||
|
HEALTHCHECK --interval=5s --timeout=3s CMD prot="http"; if [ -f "/www/server/panel/data/ssl.pl" ]; then prot="https"; fi; curl -k -i $prot://127.0.0.1:$(cat /www/server/panel/data/port.pl)$(cat /www/server/panel/data/admin_path.pl) | grep -E '(200|404)' || exit 1
|
76
arm64/bt.sh
Normal file
76
arm64/bt.sh
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
init_path=/etc/init.d
|
||||||
|
Root_Path=`cat /var/bt_setupPath.conf`
|
||||||
|
Setup_Path=$Root_Path/server/mysql
|
||||||
|
Data_Path=$Root_Path/server/data
|
||||||
|
O_pl=$(cat /www/server/panel/data/o.pl)
|
||||||
|
|
||||||
|
soft_start(){
|
||||||
|
# 扫描并启动所有服务
|
||||||
|
init_scripts=$(ls ${init_path})
|
||||||
|
for script in ${init_scripts}; do
|
||||||
|
case "${script}" in
|
||||||
|
"bt"|"mysqld"|"nginx"|"httpd")
|
||||||
|
continue
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
${init_path}/${script} start
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -f ${init_path}/nginx ]; then
|
||||||
|
${init_path}/nginx start
|
||||||
|
elif [ -f ${init_path}/httpd ]; then
|
||||||
|
${init_path}/httpd start
|
||||||
|
fi
|
||||||
|
|
||||||
|
${init_path}/bt stop
|
||||||
|
${init_path}/bt start
|
||||||
|
|
||||||
|
pkill crond
|
||||||
|
/sbin/crond
|
||||||
|
|
||||||
|
chmod 600 /etc/ssh/ssh_host_*
|
||||||
|
/usr/sbin/sshd -D &
|
||||||
|
}
|
||||||
|
|
||||||
|
init_mysql(){
|
||||||
|
if [ "${O_pl}" != "docker_btlamp_d12" ] && [ "${O_pl}" != "docker_btlnmp_d12" ];then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [ -d "${Data_Path}" ]; then
|
||||||
|
check_z=$(ls "${Data_Path}")
|
||||||
|
echo "check_z:"
|
||||||
|
echo ${check_z}
|
||||||
|
if [[ ! -z "${check_z}" ]]; then
|
||||||
|
echo "check_z is not empty"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ -f /init_mysql.sh ] && [ -d "${Setup_Path}" ];then
|
||||||
|
sh /init_mysql.sh
|
||||||
|
rm -f /init_mysql.sh
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
is_empty_Data(){
|
||||||
|
return "$(ls -A ${Data_Path}/|wc -w)"
|
||||||
|
}
|
||||||
|
|
||||||
|
start_mysql(){
|
||||||
|
if [ -d "${Setup_Path}" ] && [ -f "${init_path}/mysqld" ];then
|
||||||
|
chown -R mysql:mysql ${Data_Path}
|
||||||
|
chgrp -R mysql ${Setup_Path}/.
|
||||||
|
${init_path}/mysqld start
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
is_empty_Data > /dev/null
|
||||||
|
init_mysql > /dev/null
|
||||||
|
start_mysql > /dev/null
|
||||||
|
soft_start > /dev/null
|
||||||
|
#tail -f /dev/null
|
||||||
|
${init_path}/bt log
|
41
arm64/init_mysql.sh
Normal file
41
arm64/init_mysql.sh
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
Root_Path=`cat /var/bt_setupPath.conf`
|
||||||
|
Setup_Path=$Root_Path/server/mysql
|
||||||
|
Data_Path=$Root_Path/server/data
|
||||||
|
|
||||||
|
Mysql_Initialize(){
|
||||||
|
if [ -d "${Data_Path}" ]; then
|
||||||
|
check_z=$(ls "${Data_Path}")
|
||||||
|
if [[ ! -z "${check_z}" ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p ${Data_Path}
|
||||||
|
chown -R mysql:mysql ${Data_Path}
|
||||||
|
chgrp -R mysql ${Setup_Path}/.
|
||||||
|
|
||||||
|
${Setup_Path}/bin/mysqld --initialize-insecure --basedir=${Setup_Path} --datadir=${Data_Path} --user=mysql
|
||||||
|
|
||||||
|
cat > /etc/ld.so.conf.d/mysql.conf<<EOF
|
||||||
|
${Setup_Path}/lib
|
||||||
|
EOF
|
||||||
|
ldconfig
|
||||||
|
ln -sf ${Setup_Path}/lib/mysql /usr/lib/mysql
|
||||||
|
ln -sf ${Setup_Path}/include/mysql /usr/include/mysql
|
||||||
|
/etc/init.d/mysqld start
|
||||||
|
|
||||||
|
mysqlpwd=`cat /dev/urandom | head -n 16 | md5sum | head -c 16`
|
||||||
|
${Setup_Path}/bin/mysqladmin -u root password "${mysqlpwd}"
|
||||||
|
|
||||||
|
cd "${Setup_Path}"
|
||||||
|
rm -f src.tar.gz
|
||||||
|
rm -rf src
|
||||||
|
/etc/init.d/mysqld start
|
||||||
|
rm -rf /init_mysql.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
Mysql_Initialize
|
108
arm64/phpmyadmin.sh
Normal file
108
arm64/phpmyadmin.sh
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
public_file=/www/server/panel/install/public.sh
|
||||||
|
if [ ! -f $public_file ];then
|
||||||
|
wget -O $public_file https://download.bt.cn/install/public.sh -T 5;
|
||||||
|
fi
|
||||||
|
. $public_file
|
||||||
|
|
||||||
|
download_Url=$NODE_URL
|
||||||
|
Root_Path=`cat /var/bt_setupPath.conf`
|
||||||
|
Setup_Path=$Root_Path/server/phpmyadmin
|
||||||
|
webserver=""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Install_phpMyAdmin()
|
||||||
|
{
|
||||||
|
if [ -d "${Root_Path}/server/apache" ];then
|
||||||
|
webserver='apache'
|
||||||
|
elif [ -d "${Root_Path}/server/nginx" ];then
|
||||||
|
webserver='nginx'
|
||||||
|
elif [ -f "/usr/local/lsws/bin/lswsctrl" ];then
|
||||||
|
webserver='openlitespeed'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${webserver}" == "" ];then
|
||||||
|
echo "No Web server installed!"
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
PHPVersion=""
|
||||||
|
for phpVer in 52 53 54 55 56 70 71 72 73 74 80 81 82 83;
|
||||||
|
do
|
||||||
|
if [ -d "/www/server/php/${phpVer}/bin" ]; then
|
||||||
|
PHPVersion=${phpVer}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z $PHPVersion ];then
|
||||||
|
echo "======================================"
|
||||||
|
echo "当前没有可用php,停止安装!"
|
||||||
|
echo "请先安装好php后再进行安装phpmyadmin!"
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
wget -O phpMyAdmin.zip $download_Url/src/phpMyAdmin-${1}.zip -T20
|
||||||
|
mkdir -p $Setup_Path
|
||||||
|
|
||||||
|
unzip -o phpMyAdmin.zip -d $Setup_Path/ > /dev/null
|
||||||
|
rm -f phpMyAdmin.zip
|
||||||
|
rm -rf $Root_Path/server/phpmyadmin/phpmyadmin*
|
||||||
|
|
||||||
|
|
||||||
|
phpmyadminExt=`cat /dev/urandom | head -n 32 | md5sum | head -c 16`;
|
||||||
|
mv $Setup_Path/databaseAdmin $Setup_Path/phpmyadmin_$phpmyadminExt
|
||||||
|
chmod -R 755 $Setup_Path/phpmyadmin_$phpmyadminExt
|
||||||
|
chown -R www.www $Setup_Path/phpmyadmin_$phpmyadminExt
|
||||||
|
chmod 755 /www/server/phpmyadmin
|
||||||
|
|
||||||
|
secret=`cat /dev/urandom | head -n 32 | md5sum | head -c 32`;
|
||||||
|
\cp -a -r $Setup_Path/phpmyadmin_$phpmyadminExt/config.sample.inc.php $Setup_Path/phpmyadmin_$phpmyadminExt/config.inc.php
|
||||||
|
sed -i "s#^\$cfg\['blowfish_secret'\].*#\$cfg\['blowfish_secret'\] = '${secret}';#" $Setup_Path/phpmyadmin_$phpmyadminExt/config.inc.php
|
||||||
|
sed -i "s#^\$cfg\['blowfish_secret'\].*#\$cfg\['blowfish_secret'\] = '${secret}';#" $Setup_Path/phpmyadmin_$phpmyadminExt/libraries/config.default.php
|
||||||
|
|
||||||
|
echo $1 > $Setup_Path/version.pl
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [ "${webserver}" == "nginx" ];then
|
||||||
|
sed -i "s#$Root_Path/wwwroot/default#$Root_Path/server/phpmyadmin#" $Root_Path/server/nginx/conf/nginx.conf
|
||||||
|
rm -f $Root_Path/server/nginx/conf/enable-php.conf
|
||||||
|
\cp $Root_Path/server/nginx/conf/enable-php-$PHPVersion.conf $Root_Path/server/nginx/conf/enable-php.conf
|
||||||
|
sed -i "/pathinfo/d" $Root_Path/server/nginx/conf/enable-php.conf
|
||||||
|
if [ ! -f "/www/server/nginx/conf/enable-php.conf" ];then
|
||||||
|
touch /www/server/nginx/conf/enable-php.conf
|
||||||
|
fi
|
||||||
|
/etc/init.d/nginx reload
|
||||||
|
|
||||||
|
PMA_PORT=$(cat $Root_Path/server/nginx/conf/nginx.conf|grep "listen "|grep -oE '[0-9]+')
|
||||||
|
else
|
||||||
|
sed -i "s#$Root_Path/wwwroot/default#$Root_Path/server/phpmyadmin#" $Root_Path/server/apache/conf/extra/httpd-vhosts.conf
|
||||||
|
sed -i "0,/php-cgi/ s/php-cgi-\w*\.sock/php-cgi-${PHPVersion}.sock/" $Root_Path/server/apache/conf/extra/httpd-vhosts.conf
|
||||||
|
/etc/init.d/httpd reload
|
||||||
|
|
||||||
|
PMA_PORT=$(cat /www/server/apache/conf/extra/httpd-vhosts.conf |grep "Listen "|grep -oE '[0-9]+')
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ${PMA_PORT} > /www/server/phpmyadmin/port.pl
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_phpMyAdmin()
|
||||||
|
{
|
||||||
|
rm -rf $Root_Path/server/phpmyadmin/phpmyadmin*
|
||||||
|
rm -f $Root_Path/server/phpmyadmin/version.pl
|
||||||
|
rm -f $Root_Path/server/phpmyadmin/version_check.pl
|
||||||
|
}
|
||||||
|
|
||||||
|
actionType=$1
|
||||||
|
version=$2
|
||||||
|
|
||||||
|
if [ "$actionType" == 'install' ];then
|
||||||
|
Install_phpMyAdmin $version
|
||||||
|
elif [ "$actionType" == 'uninstall' ];then
|
||||||
|
Uninstall_phpMyAdmin
|
||||||
|
fi
|
101
bt.sh
101
bt.sh
@ -1,5 +1,96 @@
|
|||||||
/etc/init.d/bt restart
|
#!/bin/bash
|
||||||
pkill crond
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||||
/sbin/crond
|
export PATH
|
||||||
/usr/sbin/sshd -D &
|
|
||||||
tail -f /dev/null
|
init_path=/etc/init.d
|
||||||
|
Root_Path=`cat /var/bt_setupPath.conf`
|
||||||
|
Setup_Path=$Root_Path/server/mysql
|
||||||
|
Data_Path=$Root_Path/server/data
|
||||||
|
O_pl=$(cat /www/server/panel/data/o.pl)
|
||||||
|
|
||||||
|
backup_database() {
|
||||||
|
if [ -d "${Data_Path}" ] && [ ! -z "$(ls -A ${Data_Path})" ]; then
|
||||||
|
if [ ! -d "${Setup_Path}" ] || [ -z "$(ls -A ${Setup_Path})" ]; then
|
||||||
|
timestamp=$(date +"%s")
|
||||||
|
tar czf /www/server/data_backup_$timestamp.tar.gz -C ${Data_Path} .
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
restore_panel_data() {
|
||||||
|
if [ -f /www.tar.gz ]; then
|
||||||
|
if [ ! -d /www ] || [ -z "$(ls -A /www)" ] || [ ! -d /www/server/panel ] || [ -z "$(ls -A /www/server/panel)" ] || [ ! -d /www/server/panel/pyenv ] || [ -z "$(ls -A /www/server/panel/pyenv)" ]; then
|
||||||
|
tar xzf /www.tar.gz -C / --skip-old-files
|
||||||
|
rm -rf /www.tar.gz
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
soft_start(){
|
||||||
|
# 扫描并启动所有服务
|
||||||
|
init_scripts=$(ls ${init_path})
|
||||||
|
for script in ${init_scripts}; do
|
||||||
|
case "${script}" in
|
||||||
|
"bt"|"mysqld"|"nginx"|"httpd")
|
||||||
|
continue
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
${init_path}/${script} start
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -f ${init_path}/nginx ]; then
|
||||||
|
${init_path}/nginx start
|
||||||
|
elif [ -f ${init_path}/httpd ]; then
|
||||||
|
${init_path}/httpd start
|
||||||
|
fi
|
||||||
|
|
||||||
|
${init_path}/bt stop
|
||||||
|
${init_path}/bt start
|
||||||
|
|
||||||
|
pkill crond
|
||||||
|
/sbin/crond
|
||||||
|
|
||||||
|
chmod 600 /etc/ssh/ssh_host_*
|
||||||
|
/usr/sbin/sshd -D &
|
||||||
|
}
|
||||||
|
|
||||||
|
init_mysql(){
|
||||||
|
if [ "${O_pl}" != "docker_btlamp_d12" ] && [ "${O_pl}" != "docker_btlnmp_d12" ];then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [ -d "${Data_Path}" ]; then
|
||||||
|
check_z=$(ls "${Data_Path}")
|
||||||
|
echo "check_z:"
|
||||||
|
echo ${check_z}
|
||||||
|
if [[ ! -z "${check_z}" ]]; then
|
||||||
|
echo "check_z is not empty"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ -f /init_mysql.sh ] && [ -d "${Setup_Path}" ];then
|
||||||
|
sh /init_mysql.sh
|
||||||
|
rm -f /init_mysql.sh
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
is_empty_Data(){
|
||||||
|
return "$(ls -A ${Data_Path}/|wc -w)"
|
||||||
|
}
|
||||||
|
|
||||||
|
start_mysql(){
|
||||||
|
if [ -d "${Setup_Path}" ] && [ -f "${init_path}/mysqld" ];then
|
||||||
|
chown -R mysql:mysql ${Data_Path}
|
||||||
|
chgrp -R mysql ${Setup_Path}/.
|
||||||
|
${init_path}/mysqld start
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
restore_panel_data > /dev/null
|
||||||
|
backup_database > /dev/null
|
||||||
|
is_empty_Data > /dev/null
|
||||||
|
init_mysql > /dev/null
|
||||||
|
start_mysql > /dev/null
|
||||||
|
soft_start > /dev/null
|
||||||
|
#tail -f /dev/null
|
||||||
|
${init_path}/bt log
|
41
init_mysql.sh
Normal file
41
init_mysql.sh
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
Root_Path=`cat /var/bt_setupPath.conf`
|
||||||
|
Setup_Path=$Root_Path/server/mysql
|
||||||
|
Data_Path=$Root_Path/server/data
|
||||||
|
|
||||||
|
Mysql_Initialize(){
|
||||||
|
if [ -d "${Data_Path}" ]; then
|
||||||
|
check_z=$(ls "${Data_Path}")
|
||||||
|
if [[ ! -z "${check_z}" ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p ${Data_Path}
|
||||||
|
chown -R mysql:mysql ${Data_Path}
|
||||||
|
chgrp -R mysql ${Setup_Path}/.
|
||||||
|
|
||||||
|
${Setup_Path}/bin/mysqld --initialize-insecure --basedir=${Setup_Path} --datadir=${Data_Path} --user=mysql
|
||||||
|
|
||||||
|
cat > /etc/ld.so.conf.d/mysql.conf<<EOF
|
||||||
|
${Setup_Path}/lib
|
||||||
|
EOF
|
||||||
|
ldconfig
|
||||||
|
ln -sf ${Setup_Path}/lib/mysql /usr/lib/mysql
|
||||||
|
ln -sf ${Setup_Path}/include/mysql /usr/include/mysql
|
||||||
|
/etc/init.d/mysqld start
|
||||||
|
|
||||||
|
mysqlpwd=`cat /dev/urandom | head -n 16 | md5sum | head -c 16`
|
||||||
|
${Setup_Path}/bin/mysqladmin -u root password "${mysqlpwd}"
|
||||||
|
|
||||||
|
cd "${Setup_Path}"
|
||||||
|
rm -f src.tar.gz
|
||||||
|
rm -rf src
|
||||||
|
/etc/init.d/mysqld start
|
||||||
|
rm -rf /init_mysql.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
Mysql_Initialize
|
108
phpmyadmin.sh
Normal file
108
phpmyadmin.sh
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
public_file=/www/server/panel/install/public.sh
|
||||||
|
if [ ! -f $public_file ];then
|
||||||
|
wget -O $public_file https://download.bt.cn/install/public.sh -T 5;
|
||||||
|
fi
|
||||||
|
. $public_file
|
||||||
|
|
||||||
|
download_Url=$NODE_URL
|
||||||
|
Root_Path=`cat /var/bt_setupPath.conf`
|
||||||
|
Setup_Path=$Root_Path/server/phpmyadmin
|
||||||
|
webserver=""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Install_phpMyAdmin()
|
||||||
|
{
|
||||||
|
if [ -d "${Root_Path}/server/apache" ];then
|
||||||
|
webserver='apache'
|
||||||
|
elif [ -d "${Root_Path}/server/nginx" ];then
|
||||||
|
webserver='nginx'
|
||||||
|
elif [ -f "/usr/local/lsws/bin/lswsctrl" ];then
|
||||||
|
webserver='openlitespeed'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${webserver}" == "" ];then
|
||||||
|
echo "No Web server installed!"
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
PHPVersion=""
|
||||||
|
for phpVer in 52 53 54 55 56 70 71 72 73 74 80 81 82 83;
|
||||||
|
do
|
||||||
|
if [ -d "/www/server/php/${phpVer}/bin" ]; then
|
||||||
|
PHPVersion=${phpVer}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z $PHPVersion ];then
|
||||||
|
echo "======================================"
|
||||||
|
echo "当前没有可用php,停止安装!"
|
||||||
|
echo "请先安装好php后再进行安装phpmyadmin!"
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
wget -O phpMyAdmin.zip $download_Url/src/phpMyAdmin-${1}.zip -T20
|
||||||
|
mkdir -p $Setup_Path
|
||||||
|
|
||||||
|
unzip -o phpMyAdmin.zip -d $Setup_Path/ > /dev/null
|
||||||
|
rm -f phpMyAdmin.zip
|
||||||
|
rm -rf $Root_Path/server/phpmyadmin/phpmyadmin*
|
||||||
|
|
||||||
|
|
||||||
|
phpmyadminExt=`cat /dev/urandom | head -n 32 | md5sum | head -c 16`;
|
||||||
|
mv $Setup_Path/databaseAdmin $Setup_Path/phpmyadmin_$phpmyadminExt
|
||||||
|
chmod -R 755 $Setup_Path/phpmyadmin_$phpmyadminExt
|
||||||
|
chown -R www.www $Setup_Path/phpmyadmin_$phpmyadminExt
|
||||||
|
chmod 755 /www/server/phpmyadmin
|
||||||
|
|
||||||
|
secret=`cat /dev/urandom | head -n 32 | md5sum | head -c 32`;
|
||||||
|
\cp -a -r $Setup_Path/phpmyadmin_$phpmyadminExt/config.sample.inc.php $Setup_Path/phpmyadmin_$phpmyadminExt/config.inc.php
|
||||||
|
sed -i "s#^\$cfg\['blowfish_secret'\].*#\$cfg\['blowfish_secret'\] = '${secret}';#" $Setup_Path/phpmyadmin_$phpmyadminExt/config.inc.php
|
||||||
|
sed -i "s#^\$cfg\['blowfish_secret'\].*#\$cfg\['blowfish_secret'\] = '${secret}';#" $Setup_Path/phpmyadmin_$phpmyadminExt/libraries/config.default.php
|
||||||
|
|
||||||
|
echo $1 > $Setup_Path/version.pl
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if [ "${webserver}" == "nginx" ];then
|
||||||
|
sed -i "s#$Root_Path/wwwroot/default#$Root_Path/server/phpmyadmin#" $Root_Path/server/nginx/conf/nginx.conf
|
||||||
|
rm -f $Root_Path/server/nginx/conf/enable-php.conf
|
||||||
|
\cp $Root_Path/server/nginx/conf/enable-php-$PHPVersion.conf $Root_Path/server/nginx/conf/enable-php.conf
|
||||||
|
sed -i "/pathinfo/d" $Root_Path/server/nginx/conf/enable-php.conf
|
||||||
|
if [ ! -f "/www/server/nginx/conf/enable-php.conf" ];then
|
||||||
|
touch /www/server/nginx/conf/enable-php.conf
|
||||||
|
fi
|
||||||
|
/etc/init.d/nginx reload
|
||||||
|
|
||||||
|
PMA_PORT=$(cat $Root_Path/server/nginx/conf/nginx.conf|grep "listen "|grep -oE '[0-9]+')
|
||||||
|
else
|
||||||
|
sed -i "s#$Root_Path/wwwroot/default#$Root_Path/server/phpmyadmin#" $Root_Path/server/apache/conf/extra/httpd-vhosts.conf
|
||||||
|
sed -i "0,/php-cgi/ s/php-cgi-\w*\.sock/php-cgi-${PHPVersion}.sock/" $Root_Path/server/apache/conf/extra/httpd-vhosts.conf
|
||||||
|
/etc/init.d/httpd reload
|
||||||
|
|
||||||
|
PMA_PORT=$(cat /www/server/apache/conf/extra/httpd-vhosts.conf |grep "Listen "|grep -oE '[0-9]+')
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ${PMA_PORT} > /www/server/phpmyadmin/port.pl
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Uninstall_phpMyAdmin()
|
||||||
|
{
|
||||||
|
rm -rf $Root_Path/server/phpmyadmin/phpmyadmin*
|
||||||
|
rm -f $Root_Path/server/phpmyadmin/version.pl
|
||||||
|
rm -f $Root_Path/server/phpmyadmin/version_check.pl
|
||||||
|
}
|
||||||
|
|
||||||
|
actionType=$1
|
||||||
|
version=$2
|
||||||
|
|
||||||
|
if [ "$actionType" == 'install' ];then
|
||||||
|
Install_phpMyAdmin $version
|
||||||
|
elif [ "$actionType" == 'uninstall' ];then
|
||||||
|
Uninstall_phpMyAdmin
|
||||||
|
fi
|
Loading…
x
Reference in New Issue
Block a user