-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup-itsm
executable file
·56 lines (46 loc) · 1.63 KB
/
setup-itsm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
Setup_Variables(){
export NEWT_COLORS='root=,red'
DBUSER=$( whiptail --inputbox "Enter the ITSM-NG MySQL username" 10 100 3>&1 1>&2 2>&3)
DBPASSWORD=$(whiptail --passwordbox "Enter the ITSM-NG MySQL password" 10 100 3>&1 1>&2 2>&3)
DBNAME=$(whiptail --inputbox "Enter the name of the ITSM-NG MySQL database" 10 100 3>&1 1>&2 2>&3)
}
Secure_Mysql(){
{
echo -e "XXX\n0\nConfiguration of MariaDB... \nXXX"
mysql_secure_installation <<EOF
y
${DBPASSWORD}
${DBPASSWORD}
y
y
y
y
EOF
echo -e "XXX\n30\nCreation of the database... \nXXX"
mysql -uroot -p"${DBPASSWORD}" -e "CREATE DATABASE ${DBNAME};"
echo -e "XXX\n75\nCreation of the user... \nXXX"
mysql -uroot -p"${DBPASSWORD}" -e "CREATE USER ${DBUSER}@localhost IDENTIFIED BY '${DBPASSWORD}';"
echo -e "XXX\n0\nConfiguration of permissions... \nXXX"
mysql -uroot -p"${DBPASSWORD}" -e "GRANT ALL PRIVILEGES ON ${DBNAME}.* TO '${DBUSER}'@'localhost';"
} |whiptail --title "Configuration of MariaDB" --gauge "Please wait..." 6 60 0
}
Install_ITSM(){
{
cd /usr/share/itsm-ng || exit
echo -e "XXX\n50\nInstallation of ITSM-NG... \nXXX"
php bin/console itsmng:database:install -H localhost -u "${DBUSER}" -p "${DBPASSWORD}" -d "${DBNAME}" -n
echo -e "XXX\n100\nInstallation of ITSM-NG... \nXXX"
} |whiptail --title "Installation of ITSM-NG" --gauge "Please wait..." 6 60 0
}
Post_Install(){
rm /usr/share/itsm-ng/install/install.php
whiptail --title "Installation Finish" --msgbox "The installation is Finish\nITSM-NG is available on http://$(ip -4 addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')" 8 78
}
Main(){
Setup_Variables;
Secure_Mysql;
Install_ITSM;
Post_Install;
}
Main