mirror of
https://github.com/akatsukiro/lsky-pro-install-script.git
synced 2025-06-08 22:23:05 +08:00
Compare commits
No commits in common. "master" and "0.2.2" have entirely different histories.
84
install.sh
84
install.sh
@ -102,26 +102,12 @@ install_soft() {
|
||||
install_base() {
|
||||
echo -e "${green}开始安装基础组件${plain}"
|
||||
(command -v git >/dev/null 2>&1 && command -v curl >/dev/null 2>&1 && command -v wget >/dev/null 2>&1 && command -v unzip >/dev/null 2>&1 && command -v getenforce >/dev/null 2>&1 && command -v gnupg >/dev/null 2>&1 && command -v lsb_release >/dev/null) ||
|
||||
(install_soft curl wget git unzip gnupg lsb-release apt-transport-https ca-certificates)
|
||||
(install_soft curl wget git unzip gnupg lsb-release ca-certificates)
|
||||
}
|
||||
|
||||
install_base
|
||||
pre_check
|
||||
|
||||
echo -e "${yellow}是否进行全自动安装?${plain}"
|
||||
read -e -r -p "[Y/n]:" autoFlag
|
||||
case $autoFlag in
|
||||
[yY][eE][sS] | [yY])
|
||||
autoFlag="1"
|
||||
;;
|
||||
[nN][oO] | [nN])
|
||||
autoFlag="0"
|
||||
;;
|
||||
*)
|
||||
autoFlag="1"
|
||||
;;
|
||||
esac
|
||||
|
||||
install_php() {
|
||||
echo -e "${green}开始安装PHP${plain}"
|
||||
echo "默认安装php8.1"
|
||||
@ -199,34 +185,21 @@ install_maraidb() {
|
||||
dnf install ${MARIADB_PACKAGE_URL}/yum/10.6/centos/${os_version}/x86_64/mariadb-release-10.6-1.el8.noarch.rpm -y
|
||||
dnf install MariaDB-server MariaDB-client -y
|
||||
fi
|
||||
if [[ $autoFlag == "0" ]]; then
|
||||
read -e -r -p "是否快速配置MariaDB? [Y/n] 默认 Y(es)" input
|
||||
case $input in
|
||||
[yY][eE][sS] | [yY])
|
||||
echo "开始快速配置MariaDB"
|
||||
mysql_secure_installation
|
||||
;;
|
||||
[nN][oO] | [nN])
|
||||
echo "不快速配置MariaDB"
|
||||
;;
|
||||
*)
|
||||
echo "开始快速配置MariaDB"
|
||||
mysql_secure_installation
|
||||
;;
|
||||
esac
|
||||
else
|
||||
PWD = "$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
|
||||
mysql_secure_installation <<EOF
|
||||
read -e -r -p "是否快速配置MariaDB? [Y/n] 默认 Y(es)" input
|
||||
case $input in
|
||||
[yY][eE][sS] | [yY])
|
||||
echo "开始快速配置MariaDB"
|
||||
mysql_secure_installation
|
||||
;;
|
||||
|
||||
y
|
||||
$PWD
|
||||
$PWD
|
||||
y
|
||||
y
|
||||
y
|
||||
y
|
||||
EOF
|
||||
fi
|
||||
[nN][oO] | [nN])
|
||||
echo "不快速配置MariaDB"
|
||||
;;
|
||||
*)
|
||||
echo "开始快速配置MariaDB"
|
||||
mysql_secure_installation
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
install_php
|
||||
@ -236,22 +209,16 @@ install_maraidb
|
||||
setup_database() {
|
||||
echo -e "${green}开始配置数据库${plain}"
|
||||
echo -e "${yellow}请无比妥善保存以下信息${plain}"
|
||||
if [[ $autoFlag == "0" ]]; then
|
||||
echo "自动生成数据库信息请输入1,手动输入请输入2,其他情况自动生成"
|
||||
read -e -r -p "请输入您的选择: " dbFlag
|
||||
if [[ $dbFlag == "1" ]]; then
|
||||
db_user="lsky_$(openssl rand -base64 12 | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)"
|
||||
db_name="lsky_$(openssl rand -base64 12 | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)"
|
||||
db_password="$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
|
||||
elif [[ $dbFlag == "2" ]]; then
|
||||
read -e -r -p "请输入数据库用户名: " db_user
|
||||
read -e -r -p "请输入数据库名称: " db_name
|
||||
read -e -r -p "请输入数据库密码: " db_password
|
||||
else
|
||||
db_user="lsky_$(openssl rand -base64 12 | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)"
|
||||
db_name="lsky_$(openssl rand -base64 12 | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)"
|
||||
db_password="$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
|
||||
fi
|
||||
echo "自动生成数据库信息请输入1,手动输入请输入2,其他情况自动生成"
|
||||
read -e -r -p "请输入您的选择: " dbFlag
|
||||
if [[ $dbFlag == "1" ]]; then
|
||||
db_user="lsky_$(openssl rand -base64 12 | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)"
|
||||
db_name="lsky_$(openssl rand -base64 12 | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)"
|
||||
db_password="$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
|
||||
elif [[ $dbFlag == "2" ]]; then
|
||||
read -e -r -p "请输入数据库用户名: " db_user
|
||||
read -e -r -p "请输入数据库名称: " db_name
|
||||
read -e -r -p "请输入数据库密码: " db_password
|
||||
else
|
||||
db_user="lsky_$(openssl rand -base64 12 | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)"
|
||||
db_name="lsky_$(openssl rand -base64 12 | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)"
|
||||
@ -311,5 +278,4 @@ download_lsky
|
||||
setup_apache
|
||||
|
||||
echo -e "${green}安装完成${plain}"
|
||||
|
||||
echo -e "${green}请访问 http://${domain} 完成后续配置 ${plain}"
|
Loading…
x
Reference in New Issue
Block a user