ReWriten MySQL Module for MariaDB
This commit is contained in:
@@ -56,7 +56,7 @@ unset dist_ver dist APTMODE
|
||||
|
||||
|
||||
#Repo Vars
|
||||
repo=https://git.ictmaatwerk.com/VPS-scripts/MySQL
|
||||
repo=https://git.ictmaatwerk.com/VPS-scripts/MariaDB
|
||||
branch=master
|
||||
|
||||
###Select Module type
|
||||
@@ -84,7 +84,7 @@ fi
|
||||
|
||||
msg "Starting installer." 8 78
|
||||
$PKGI curl > $OUTPUT 2>&1
|
||||
curl --retry 7 --retry-delay 5 -s https://git.ictmaatwerk.com/VPS-scripts/General/raw/branch/Main/Setup-Repo.sh |repo=init osrel=$shortdist bash > $OUTPUT 2>&1
|
||||
|
||||
|
||||
|
||||
##-------------------------##
|
||||
13
README.md
13
README.md
@@ -1,15 +1,12 @@
|
||||
# MySQL
|
||||
# MariaDB
|
||||
Only install this module, download and run MySQL-ModInst.sh
|
||||
|
||||
#### This repo is a dependency of:
|
||||
```
|
||||
* Ubuntu-Web
|
||||
* Ubuntu-Mail
|
||||
```
|
||||
-----
|
||||
Alternative for MySQL module (Not validated for Production, and not maintained after testing for debian 11 is conpleted )
|
||||
Made for testing Web-V2 on debian 11 since the offical MySQL repo was not avalible yet, and mysql-server did not resolve as a alias
|
||||
|
||||
|
||||
### Validated to work on:
|
||||
* Ubuntu 18.04
|
||||
* Ubuntu 20.04
|
||||
* Debian 10
|
||||
* Debian 11
|
||||
* CentOS 8
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
#MySQL GIT repo Settings
|
||||
mrepo=https://git.ictmaatwerk.com/VPS-scripts/MySQL
|
||||
mrepo=https://git.ictmaatwerk.com/VPS-scripts/MariaDB
|
||||
mbranch=master
|
||||
|
||||
#Removing old version
|
||||
|
||||
24
conf.sh
24
conf.sh
@@ -1,30 +1,34 @@
|
||||
###Fetch Config
|
||||
mrepo=https://git.ictmaatwerk.com/VPS-scripts/MySQL
|
||||
mrepo=https://git.ictmaatwerk.com/VPS-scripts/MariaDB
|
||||
mbranch=master
|
||||
|
||||
if [ -z ${password+x} ]; then echo 'Error $password is not set' > $OUTPUT 2>&1 ; fi
|
||||
if [ -z ${PHPMyadmin+x} ]; then echo 'Error $PHPMyadmin is not set, Setting default OFF' > $OUTPUT 2>&1 && PHPMyadmin=0;fi #check if Var is set
|
||||
|
||||
if [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] || [ "$shortdist" = "deb11" ] ; then
|
||||
mv /etc/mysql/debian-start /tmp/debian-start
|
||||
mv /etc/mysql/debian.cnf /tmp/debian.cnf
|
||||
fi
|
||||
|
||||
rm -rf /etc/mysql/ /etc/my.cnf.d/ /etc/my.cnf
|
||||
mkdir /etc/mysql/
|
||||
touch /etc/mysql/my.cnf.fallback
|
||||
curl --retry 7 --retry-delay 5 -s "$mrepo"/raw/branch/"$mbranch"/config/MySQL/mysqld-V8.cnf -o /etc/mysql/my.cnf
|
||||
if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then
|
||||
MYSQLSNAME=mysql
|
||||
systemctl stop $MYSQLSNAME
|
||||
sed -i 's#MySQLlog#/var/log/mysql/error.log#g' /etc/mysql/my.cnf
|
||||
elif [ "$shortdist" = "el8" ]; then
|
||||
MYSQLSNAME=mysqld
|
||||
MYSQLSNAME=mariadb
|
||||
systemctl stop $MYSQLSNAME
|
||||
if [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] || [ "$shortdist" = "deb11" ] ; then
|
||||
sed -i 's#MySQLlog#/var/log/mysql/error.log#g' /etc/mysql/my.cnf
|
||||
mv /tmp/debian-start /etc/mysql/debian-start
|
||||
mv /tmp/debian.cnf /etc/mysql/debian.cnf
|
||||
elif [ "$shortdist" = "el8" ]; then
|
||||
sed -i 's#MySQLlog#/var/log/mysqld.log#g' /etc/mysql/my.cnf
|
||||
fi
|
||||
|
||||
systemctl start $MYSQLSNAME
|
||||
systemctl enable $MYSQLSNAME
|
||||
|
||||
if [ "$shortdist" = "el8" ]; then
|
||||
mysql -u root -p$(awk '/A temporary password is generated for/ {a=$0} END{ print a }' /var/log/mysqld.log | awk '{print $(NF)}') --connect-expired-password -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$password'";
|
||||
fi
|
||||
mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$password'; flush privileges";
|
||||
|
||||
|
||||
if [ $PHPMyadmin = 1 ]; then
|
||||
mkdir -p /usr/share/phpmyadmin/
|
||||
|
||||
@@ -1 +1 @@
|
||||
mysql-server
|
||||
mariadb-server
|
||||
137
mysql-8.0.sh
137
mysql-8.0.sh
@@ -1,137 +0,0 @@
|
||||
###########################
|
||||
# MySQL 8.0 Installer #
|
||||
###########################
|
||||
|
||||
|
||||
##-----------------##
|
||||
# Defining Vars #
|
||||
##-----------------##
|
||||
|
||||
#Enforcing Legacy Mode
|
||||
if [ -z ${OUTPUT+x} ]; then OUTPUT='/dev/tty' ; fi
|
||||
if [ -z ${IMODE+x} ]; then IMODE=l ; fi
|
||||
|
||||
#PackageManager-config
|
||||
|
||||
dist_ver=$(grep --color=never -Po "^VERSION_ID=\K.*" "/etc/os-release")
|
||||
dist=$(grep --color=never -Po "^ID=\K.*" "/etc/os-release")
|
||||
|
||||
if [[ "${dist}" == *"ubuntu"* ]] && [[ "${dist_ver}" == *"18.04"* ]]; then
|
||||
echo "Ubuntu 18.04 Detected"
|
||||
PKGM="$APTMODE"
|
||||
PKGI="${PKGM} install -y --no-install-recommends"
|
||||
PKGLIST="apt.pkg.list"
|
||||
shortdist=ubu1804
|
||||
elif [[ "${dist}" == *"ubuntu"* ]] && [[ "${dist_ver}" == *"20.04"* ]]; then
|
||||
echo "Ubuntu 20.04 Detected"
|
||||
PKGM="$APTMODE"
|
||||
PKGI="${PKGM} install -y --no-install-recommends"
|
||||
PKGLIST="apt.pkg.list"
|
||||
echo "This os in not supported"
|
||||
exit
|
||||
shortdist=ubu2004
|
||||
elif [[ "${dist}" == *"debian"* ]] && [[ "${dist_ver}" == *"10"* ]]; then
|
||||
echo "Debian 10 Detected"
|
||||
PKGM="$APTMODE"
|
||||
PKGI="${PKGM} install -y --no-install-recommends"
|
||||
PKGLIST="apt.pkg.list"
|
||||
shortdist=deb10
|
||||
echo "This os in not supported"
|
||||
exit
|
||||
elif [[ "${dist}" == *"centos"* ]] && [[ "${dist_ver}" == *"8"* ]]; then
|
||||
echo "Centos 8 Detected"
|
||||
PKGM="dnf"
|
||||
PKGI="${PKGM} install --setopt=install_weak_deps=False --best -y"
|
||||
PKGLIST="dnf.pkg.list"
|
||||
shortdist=el8
|
||||
echo "This os in not supported"
|
||||
exit
|
||||
else
|
||||
echo "This os in not supported"
|
||||
exit
|
||||
fi
|
||||
|
||||
unset dist_ver dist APTMODE
|
||||
|
||||
|
||||
#Repo Vars
|
||||
mrepo=https://git.ictmaatwerk.com/VPS-scripts/MySQL
|
||||
mbranch=master
|
||||
|
||||
###Select Module type
|
||||
mtype=""$mrepo"/raw/branch/"$mbranch""
|
||||
|
||||
#SelfBuilding Vars
|
||||
if [ -z ${PKGI+x} ]; then PKGI="${PKGM} install -y" ; fi
|
||||
|
||||
|
||||
|
||||
|
||||
##---------------##
|
||||
# Functions #
|
||||
##---------------##
|
||||
|
||||
msg () {
|
||||
echo "$1"
|
||||
}
|
||||
|
||||
##--------------------------##
|
||||
# Installer-Requirements #
|
||||
##--------------------------##
|
||||
|
||||
msg "Starting installer." 8 78
|
||||
$PKGI curl > $OUTPUT 2>&1
|
||||
curl --retry 7 --retry-delay 5 -s https://git.ictmaatwerk.com/VPS-scripts/General/raw/branch/Main/Setup-Repo.sh |repo=init osrel=$shortdist bash > $OUTPUT 2>&1
|
||||
|
||||
|
||||
|
||||
|
||||
##-------------------------##
|
||||
# Generating APT list #
|
||||
##-------------------------##
|
||||
#Webserver specific aptList
|
||||
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$mtype"/generic.pkg.list; then
|
||||
curl "$mtype"/generic.pkg.list >>/tmp/pkg.list
|
||||
fi
|
||||
|
||||
|
||||
##--------------------##
|
||||
# Pre-Requirements #
|
||||
##--------------------##
|
||||
|
||||
msg "Preconfiguring."
|
||||
$PKGM update -y
|
||||
$PKGM upgrade -y
|
||||
|
||||
|
||||
##-------------------##
|
||||
# Pre-configuring #
|
||||
##-------------------##
|
||||
|
||||
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$mtype"/preconf.sh; then
|
||||
source <(curl --retry 7 --retry-delay 5 -s "$mtype"/preconf.sh)
|
||||
fi
|
||||
|
||||
##-------------##
|
||||
# Installer #
|
||||
##-------------##
|
||||
|
||||
$PKGM update
|
||||
sed -i 's/PHPver/'$phpver'/g' /tmp/pkg.list
|
||||
cat /tmp/pkg.list | xargs $PKGI
|
||||
|
||||
|
||||
##---------------##
|
||||
# Configuring #
|
||||
##---------------##
|
||||
|
||||
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$mtype"/conf.sh; then
|
||||
source <(curl --retry 7 --retry-delay 5 -s "$mtype"/conf.sh)
|
||||
fi
|
||||
|
||||
|
||||
##-------##
|
||||
# end #
|
||||
##-------##
|
||||
|
||||
msg "done"
|
||||
15
preconf.sh
15
preconf.sh
@@ -1,19 +1,6 @@
|
||||
mrepo=https://git.ictmaatwerk.com/VPS-scripts/MySQL
|
||||
mrepo=https://git.ictmaatwerk.com/VPS-scripts/MariaDB
|
||||
mbranch=master
|
||||
if [ -z ${password+x} ]; then echo 'Error $password is not set'; fi
|
||||
|
||||
if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then
|
||||
if [ -z ${DEBIAN_FRONTEND+x} ]; then echo 'dpkg env not set' > $OUTPUT 2>&1 ; else CurDebFrond="$DEBIAN_FRONTEND"; fi #checking and saving DEBIAN_FRONTEND
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
debconf-set-selections <<< "mysql-community-server mysql-community-server/root-pass password $password"
|
||||
debconf-set-selections <<< "mysql-community-server mysql-community-server/re-root-pass password $password"
|
||||
debconf-set-selections <<< "mysql-community-server mysql-server/default-auth-override select Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)"
|
||||
|
||||
if [ -z ${CurDebFrond+x} ]; then unset DEBIAN_FRONTEND ; else export DEBIAN_FRONTEND=$CurDebFrond; fi #Restore DEBIAN_FRONTEND
|
||||
fi
|
||||
|
||||
curl --retry 7 --retry-delay 5 -s https://git.ictmaatwerk.com/VPS-scripts/General/raw/branch/Main/Setup-Repo.sh |repo=mysql osrel=$shortdist bash
|
||||
|
||||
unset mrepo
|
||||
unset mbranch
|
||||
Reference in New Issue
Block a user