Update INSTALL.sh
This commit is contained in:
parent
4899f384f2
commit
6340d5d87c
55
INSTALL.sh
55
INSTALL.sh
|
@ -216,14 +216,16 @@ FUNCTIONS=(
|
|||
configure_nginx
|
||||
configure_modsecurity
|
||||
|
||||
mysql_for_ubuntu
|
||||
|
||||
|
||||
run_mysql_docker_container
|
||||
setup_ufw
|
||||
setup_opencli
|
||||
install_all_locales
|
||||
helper_function_for_nginx_on_aws_and_azure
|
||||
download_and_import_docker_images
|
||||
|
||||
configure_mysql
|
||||
|
||||
start_services
|
||||
set_system_cronjob
|
||||
cleanup
|
||||
|
@ -607,7 +609,7 @@ configure_nginx() {
|
|||
|
||||
echo "Setting Nginx configuration.."
|
||||
|
||||
# https://dev.openpanel.co/services.html#Nginx
|
||||
# https://dev.openpanel.co/services/nginx
|
||||
debug_log cp -fr ${OPENPANEL_DIR}conf/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# dir for domlogs
|
||||
|
@ -630,53 +632,6 @@ configure_nginx() {
|
|||
}
|
||||
|
||||
|
||||
|
||||
mysql_for_ubuntu() {
|
||||
|
||||
ubuntu_version=$(lsb_release -rs)
|
||||
|
||||
# Check if the version is 22.04
|
||||
if [[ "$ubuntu_version" == "22.04" ]]; then
|
||||
#echo "This is Ubuntu 22.04"
|
||||
run_mysql_docker_container
|
||||
configure_mysql
|
||||
elif [[ "$ubuntu_version" == "24.04" ]]; then
|
||||
#echo "This is Ubuntu 24.04"
|
||||
install_mysql_for_ubuntu24
|
||||
else
|
||||
radovan 1 "$ubuntu_version - This version of Ubuntu is not supported. Please use 22.04 or 24.02"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
install_mysql_for_ubuntu24() {
|
||||
echo "Tweaking MySQL configuration.."
|
||||
|
||||
$PACKAGE_MANAGER -qq install mysql-server -y
|
||||
|
||||
# https://dev.openpanel.co/services.html#MySQL
|
||||
|
||||
debug_log cp -fr ${OPENPANEL_DIR}/conf/mysqld.cnf /etc/mysql/mysql.conf.d/mysqld.cnf
|
||||
debug_log service mysql start
|
||||
|
||||
echo "Populating the 'panel' database.."
|
||||
generate_random_password() {
|
||||
openssl rand -base64 12 | tr -dc 'a-zA-Z0-9'
|
||||
}
|
||||
|
||||
RANDOM_PASSWORD=$(generate_random_password)
|
||||
SQL_FILE="${OPENPANEL_DIR}DATABASE.sql"
|
||||
mysql -u root -e "CREATE DATABASE panel;"
|
||||
mysql -u root -e "CREATE USER 'panel'@'localhost' IDENTIFIED BY '${RANDOM_PASSWORD}';"
|
||||
mysql -u root -e "GRANT ALL PRIVILEGES ON panel.* TO 'panel'@'localhost';"
|
||||
mysql -u root panel < "${SQL_FILE}"
|
||||
sed -i "s/\"mysql_password\": \"NewPassword\"/\"mysql_password\": \"${RANDOM_PASSWORD}\"/g" ${OPENPADMIN_DIR}config.json
|
||||
sed -i "s/password = \"NewPassword\"/password = \"${RANDOM_PASSWORD}\"/g" ${OPENPADMIN_DIR}db.cnf
|
||||
|
||||
echo -e "${GREEN}Database is ready.${RESET}"
|
||||
}
|
||||
|
||||
|
||||
run_mysql_docker_container() {
|
||||
|
||||
# MySQL
|
||||
|
|
Loading…
Reference in a new issue