Hello, i forgot install mariadb in my server, i don’t know how can i add this package without reinstall all system.
I have debian12, my ram 4gb
I’ll assume you are using amd64 architecture.
I just created a script to install it using Hestia way.
Disclaimer: It should work but I didn’t test it so use it at your own risk.
curl -fsSL https://7j.gg/insmardeb | sudo bash --
Above command will execute this script as root:
#!/usr/bin/env bash
set -euo pipefail
mariadb_v="10.11"
ARCH="amd64"
VERSION="debian"
codename="bookworm"
apt="/etc/apt/sources.list.d"
HESTIA_BIN="/usr/local/hestia/bin"
HESTIA_INSTALL_DIR="/usr/local/hestia/install/deb"
mycnf="my-large.cnf"
if [[ $EUID -ne 0 ]]; then
echo "Error: you must be root to execute this script" >&2
exit 1
fi
gen_pass() {
matrix=$1
length=$2
if [ -z "$matrix" ]; then
matrix="A-Za-z0-9"
fi
if [ -z "$length" ]; then
length=16
fi
head /dev/urandom | tr -dc $matrix | head -c$length
}
echo "deb [arch=$ARCH signed-by=/usr/share/keyrings/mariadb-keyring.gpg] https://dlm.mariadb.com/repo/mariadb-server/$mariadb_v/repo/$VERSION $codename main" >$apt/mariadb.list
curl -s https://mariadb.org/mariadb_release_signing_key.asc | gpg --dearmor | tee /usr/share/keyrings/mariadb-keyring.gpg >/dev/null 2>&1
apt update
apt install mariadb-client mariadb-client-compat mariadb-server mariadb-server-compat mariadb-common -y
cp -f "$HESTIA_INSTALL_DIR/mysql/$mycnf" /etc/mysql/my.cnf
mariadb-install-db
update-rc.d mariadb defaults
systemctl -q enable mariadb
systemctl start mariadb
mpass=$(gen_pass)
echo -e "[client]\npassword='$mpass'\n" >/root/.my.cnf
chmod 600 /root/.my.cnf
mysql_server="mariadb"
$mysql_server -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$mpass'; FLUSH PRIVILEGES;"
$mysql_server -e "UPDATE mysql.global_priv SET priv=json_set(priv, '$.password_last_changed', UNIX_TIMESTAMP(), '$.plugin', 'mysql_native_password', '$.authentication_string', 'invalid', '$.auth_or', json_array(json_object(), json_object('plugin', 'unix_socket'))) WHERE User='root';"
$mysql_server -e "DELETE FROM mysql.global_priv WHERE User='';"
$mysql_server -e "DROP DATABASE IF EXISTS test"
$mysql_server -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'"
$mysql_server -e "FLUSH PRIVILEGES;"
"$HESTIA_BIN"/v-change-sys-config-value DB_SYSTEM "mysql"
systemctl restart mariadb
Thanks bro, i’ll try today
1 Like