|
@@ -128,22 +128,22 @@ comprobarError() {
|
|
error="\n$type $codeNum:\tSQL ya está configurado."
|
|
error="\n$type $codeNum:\tSQL ya está configurado."
|
|
;;
|
|
;;
|
|
300)
|
|
300)
|
|
- error="\n$type $codeNum:\tError interno (instalación PHP-7.2).\n"
|
|
|
|
|
|
+ error="\n$type $codeNum:\tError interno (instalación PHP-7).\n"
|
|
;;
|
|
;;
|
|
301)
|
|
301)
|
|
error="\n$type $codeNum:\tError interno (Web Server no seleccionado).\n"
|
|
error="\n$type $codeNum:\tError interno (Web Server no seleccionado).\n"
|
|
;;
|
|
;;
|
|
302)
|
|
302)
|
|
- error="\n$type $codeNum:\tError al instalar PHP-7.2.\nDetalles:\n$extraInfo\n"
|
|
|
|
|
|
+ error="\n$type $codeNum:\tError al instalar PHP-7.\nDetalles:\n$extraInfo\n"
|
|
;;
|
|
;;
|
|
303)
|
|
303)
|
|
error="\n$type $codeNum:\tError al instalar Repositorio Remi.\nDetalles:\n$extraInfo\n"
|
|
error="\n$type $codeNum:\tError al instalar Repositorio Remi.\nDetalles:\n$extraInfo\n"
|
|
;;
|
|
;;
|
|
304)
|
|
304)
|
|
- error="\n$type $codeNum:\tSistema Operativo no compatible con PHP-7.2 ($OS $DIST $REV).\n"
|
|
|
|
|
|
+ error="\n$type $codeNum:\tSistema Operativo no compatible con PHP-7 ($OS $DIST $REV).\n"
|
|
;;
|
|
;;
|
|
305)
|
|
305)
|
|
- error="\n$type $codeNum:\tImposible configurar PHP-7.2.\n"
|
|
|
|
|
|
+ error="\n$type $codeNum:\tImposible configurar PHP-7.\n"
|
|
;;
|
|
;;
|
|
401)
|
|
401)
|
|
error="\n$type $codeNum:\tError al instalar 'certbot' (Let's Encrypt).\n"
|
|
error="\n$type $codeNum:\tError al instalar 'certbot' (Let's Encrypt).\n"
|
|
@@ -238,6 +238,9 @@ comprobarError() {
|
|
816)
|
|
816)
|
|
error="$type $codeNum:\t'find' no instalado.\n"
|
|
error="$type $codeNum:\t'find' no instalado.\n"
|
|
;;
|
|
;;
|
|
|
|
+ 817)
|
|
|
|
+ error="$type $codeNum:\tLa Distribución '$OS $DIST $REV' no está soportada.\nSoportadas: Ubuntu 16.04, 18.04, Debian 9 y CentOS 7.\n"
|
|
|
|
+ ;;
|
|
900)
|
|
900)
|
|
error="$type $codeNum:\tError interno (habilitar servicio).\n"
|
|
error="$type $codeNum:\tError interno (habilitar servicio).\n"
|
|
;;
|
|
;;
|
|
@@ -299,6 +302,7 @@ comprobarError() {
|
|
|
|
|
|
OSInfo() {
|
|
OSInfo() {
|
|
# Detecta el OS en el que se está ejecutando el programa, así como su versión
|
|
# Detecta el OS en el que se está ejecutando el programa, así como su versión
|
|
|
|
+# Sólo continuará si se trata de una distribución compatible
|
|
echo -en "Detectando SO..." >> $logFile
|
|
echo -en "Detectando SO..." >> $logFile
|
|
OS=$(uname -s)
|
|
OS=$(uname -s)
|
|
if [ $OS = "Linux" ]; then
|
|
if [ $OS = "Linux" ]; then
|
|
@@ -309,49 +313,95 @@ OSInfo() {
|
|
ID=$(grep ^ID= /etc/os-release | cut -d = -f 2 | cut -d '"' -f 2)
|
|
ID=$(grep ^ID= /etc/os-release | cut -d = -f 2 | cut -d '"' -f 2)
|
|
ID_LIKE=$(grep ^ID_LIKE= /etc/os-release | cut -d = -f 2 | cut -d '"' -f 2)
|
|
ID_LIKE=$(grep ^ID_LIKE= /etc/os-release | cut -d = -f 2 | cut -d '"' -f 2)
|
|
VERSION=$(grep ^VERSION_ID= /etc/os-release | cut -d = -f 2 | cut -d '"' -f 2)
|
|
VERSION=$(grep ^VERSION_ID= /etc/os-release | cut -d = -f 2 | cut -d '"' -f 2)
|
|
- for i in $ID_LIKE; do
|
|
|
|
|
|
+ for i in $ID; do
|
|
case $i in
|
|
case $i in
|
|
- debian|ubuntu)
|
|
|
|
|
|
+ debian)
|
|
debianOS=true
|
|
debianOS=true
|
|
|
|
+ case $VERSION in
|
|
|
|
+ 9)
|
|
|
|
+ apacheName="apache2"
|
|
|
|
+ nginxName="nginx"
|
|
|
|
+ mysqlName="mysql"
|
|
|
|
+ mariadbName="mariadb"
|
|
|
|
+ phpFPMName="php7.0-fpm"
|
|
|
|
+ ;;
|
|
|
|
+ *)
|
|
|
|
+ comprobarError 1 817
|
|
|
|
+ ;;
|
|
|
|
+ esac
|
|
|
|
+ break
|
|
|
|
+ ;;
|
|
|
|
+ ubuntu)
|
|
|
|
+ debianOS=true
|
|
|
|
+ case $VERSION in
|
|
|
|
+ 18.04)
|
|
|
|
+ apacheName="apache2"
|
|
|
|
+ nginxName="nginx"
|
|
|
|
+ mysqlName="mysql"
|
|
|
|
+ mariadbName="mariadb"
|
|
|
|
+ phpFPMName="php7.2-fpm"
|
|
|
|
+ ;;
|
|
|
|
+ 16.04)
|
|
|
|
+ apacheName="apache2"
|
|
|
|
+ nginxName="nginx"
|
|
|
|
+ mysqlName="mysql"
|
|
|
|
+ mariadbName="mysql"
|
|
|
|
+ phpFPMName="php7.0-fpm"
|
|
|
|
+ ;;
|
|
|
|
+ *)
|
|
|
|
+ comprobarError 1 817
|
|
|
|
+ ;;
|
|
|
|
+ esac
|
|
|
|
+ break
|
|
|
|
+ ;;
|
|
|
|
+ rhel|centos)
|
|
|
|
+ rhelOS=true
|
|
|
|
+ case $VERSION in
|
|
|
|
+ 7)
|
|
|
|
+ apacheName="httpd"
|
|
|
|
+ nginxName="nginx"
|
|
|
|
+ mysqlName=""
|
|
|
|
+ mariadbName="mariadb"
|
|
|
|
+ phpFPMName="php-fpm"
|
|
|
|
+ remiRepo="http://remi.mirrors.cu.be/enterprise/remi-release-7.rpm"
|
|
|
|
+ ;;
|
|
|
|
+ *)
|
|
|
|
+ comprobarError 1 817
|
|
|
|
+ ;;
|
|
|
|
+ esac
|
|
break
|
|
break
|
|
;;
|
|
;;
|
|
- rhel|fedora)
|
|
|
|
|
|
+ fedora)
|
|
rhelOS=true
|
|
rhelOS=true
|
|
|
|
+ case $VERSION in
|
|
|
|
+ 28)
|
|
|
|
+ apacheName="httpd"
|
|
|
|
+ nginxName="nginx"
|
|
|
|
+ mysqlName=""
|
|
|
|
+ mariadbName="mariadb"
|
|
|
|
+ phpFPMName="php-fpm"
|
|
|
|
+ remiRepo="http://remi.mirrors.cu.be/fedora/remi-release-28.rpm"
|
|
|
|
+ ;;
|
|
|
|
+ *)
|
|
|
|
+ comprobarError 1 817
|
|
|
|
+ ;;
|
|
|
|
+ esac
|
|
break
|
|
break
|
|
;;
|
|
;;
|
|
*)
|
|
*)
|
|
debianOS=false
|
|
debianOS=false
|
|
rhelOS=false
|
|
rhelOS=false
|
|
|
|
+ comprobarError 1 817
|
|
;;
|
|
;;
|
|
esac
|
|
esac
|
|
done
|
|
done
|
|
- elif [ -f /etc/debian-version ]; then
|
|
|
|
- # Familia Debian (Debian, Ubuntu, Linux Mint, ...)
|
|
|
|
- DIST="Debian"
|
|
|
|
- REV=""
|
|
|
|
- ID_LIKE="debian"
|
|
|
|
- VERSION=""
|
|
|
|
- debianOS=true
|
|
|
|
- elif [ -f /etc/redhat-release ]; then
|
|
|
|
- # Familia Red-Hat (RHEL, Fedora, CentOS, ...)
|
|
|
|
- DIST="Red-Hat"
|
|
|
|
- REV=""
|
|
|
|
- ID_LIKE="rhel"
|
|
|
|
- VERSION=""
|
|
|
|
- rhelOS=true
|
|
|
|
else
|
|
else
|
|
# Other Linux (No Soportado)
|
|
# Other Linux (No Soportado)
|
|
- DIST=""
|
|
|
|
- REV=""
|
|
|
|
- ID_LIKE=""
|
|
|
|
- VERSION=""
|
|
|
|
|
|
+ comprobarError 1 817
|
|
fi
|
|
fi
|
|
else
|
|
else
|
|
# UNIX, OS X, ... (No Soportado)
|
|
# UNIX, OS X, ... (No Soportado)
|
|
- DIST=$OS
|
|
|
|
- REV=""
|
|
|
|
- ID_LIKE=""
|
|
|
|
- VERSION=""
|
|
|
|
|
|
+ comprobarError 1 817
|
|
fi
|
|
fi
|
|
echo -en " $OS $DIST $REV\n" >> $logFile
|
|
echo -en " $OS $DIST $REV\n" >> $logFile
|
|
HDInfo=$(df -h | head -1)"\n"$(df -h | grep ^/dev/sd)"\n"$(df -h | grep ^/dev/mapper)
|
|
HDInfo=$(df -h | head -1)"\n"$(df -h | grep ^/dev/sd)"\n"$(df -h | grep ^/dev/mapper)
|
|
@@ -508,6 +558,11 @@ inicializarVariables() {
|
|
hostname=""
|
|
hostname=""
|
|
logFile="./."$(basename $0)".log"
|
|
logFile="./."$(basename $0)".log"
|
|
maxUpload="100M"
|
|
maxUpload="100M"
|
|
|
|
+ apacheName=""
|
|
|
|
+ nginxName=""
|
|
|
|
+ mysqlName=""
|
|
|
|
+ mariadbName=""
|
|
|
|
+ remiRepo=""
|
|
webServerName=""
|
|
webServerName=""
|
|
webServerUser=""
|
|
webServerUser=""
|
|
webServerGroup=""
|
|
webServerGroup=""
|
|
@@ -544,10 +599,6 @@ mostrarBienvenida() {
|
|
# Pantalla de bienvenida y muestra SO y estado de los discos
|
|
# Pantalla de bienvenida y muestra SO y estado de los discos
|
|
ANCHO=$(tput cols)
|
|
ANCHO=$(tput cols)
|
|
ALTO=$(tput lines)
|
|
ALTO=$(tput lines)
|
|
- if [ $debianOS = false ] && [ $rhelOS = false ]; then
|
|
|
|
- whiptail --title "ERROR S.O. NO SOPORTADO" --msgbox "Este script automatiza la creación de una web MediaWiki SOLO para distribuciones Linux de la familia Debian (Ubuntu, Linux Mint, ...) y de la familia Red-Hat (CentOS, Fedora, ...).\n\nInformación del sistema:\nOS: $OS $DIST $REV\n$HDInfo" $((ALTO * 9 / 10)) $((ANCHO * 9 / 10)) --ok-button "Salir"
|
|
|
|
- exit 1
|
|
|
|
- fi
|
|
|
|
whiptail --title "INSTALACION MEDIAWIKI" --yesno "Este script automatiza completamente la instalación de una WIKI y un CAMPUS VIRTUAL.\nPara ello instala un servidor LAMP, el software MediaWiki y configura todo lo necesario.\n\nInformación del sistema:\nOS: $OS $DIST $REV\n$HDInfo" $((ALTO * 9 / 10)) $((ANCHO * 9 / 10)) --yes-button "Continuar" --no-button "Salir"
|
|
whiptail --title "INSTALACION MEDIAWIKI" --yesno "Este script automatiza completamente la instalación de una WIKI y un CAMPUS VIRTUAL.\nPara ello instala un servidor LAMP, el software MediaWiki y configura todo lo necesario.\n\nInformación del sistema:\nOS: $OS $DIST $REV\n$HDInfo" $((ALTO * 9 / 10)) $((ANCHO * 9 / 10)) --yes-button "Continuar" --no-button "Salir"
|
|
comprobarError $? 1
|
|
comprobarError $? 1
|
|
}
|
|
}
|
|
@@ -765,7 +816,7 @@ mostrarMoodle() {
|
|
|
|
|
|
mostrarConfirmacion() {
|
|
mostrarConfirmacion() {
|
|
# Pantalla que presenta una confirmación antes de realizar la instalación
|
|
# Pantalla que presenta una confirmación antes de realizar la instalación
|
|
- whiptail --title "INSTALACION" --yesno "ESTA TODO LISTO PARA LA INSTALACION.\n¿DESEA CONTINUAR?" $((ALTO * 9 / 10)) $((ANCHO * 9 / 10)) --yes-button "Instalar" --no-button "Salir"
|
|
|
|
|
|
+ whiptail --title "INSTALACION" --yesno "ESTA TODO LISTO PARA LA INSTALACION.\nNO SE OLVIDE DE GUARDAR LAS CONFIGURACIONES EN UN LUGAR SEGURO, YA QUE SERÁN IMPORTANTES POR SI DESEA HACER ALGÚN CAMBIO EN EL FUTURO.\n¿DESEA CONTINUAR?" $((ALTO * 9 / 10)) $((ANCHO * 9 / 10)) --yes-button "Instalar" --no-button "Salir"
|
|
comprobarError $? 1
|
|
comprobarError $? 1
|
|
}
|
|
}
|
|
|
|
|
|
@@ -784,12 +835,11 @@ establecerFQDN() {
|
|
|
|
|
|
instalarApache() {
|
|
instalarApache() {
|
|
# Instala Apache2
|
|
# Instala Apache2
|
|
|
|
+ webServerName=$apacheName
|
|
if [ $debianOS = true ];then
|
|
if [ $debianOS = true ];then
|
|
- webServerName="apache2"
|
|
|
|
result=$(apt-get -q -y install apache2 2>&1)
|
|
result=$(apt-get -q -y install apache2 2>&1)
|
|
comprobarError $? 101 $result
|
|
comprobarError $? 101 $result
|
|
elif [ $rhelOS = true ]; then
|
|
elif [ $rhelOS = true ]; then
|
|
- webServerName="httpd"
|
|
|
|
result=$(yum -y install httpd 2>&1)
|
|
result=$(yum -y install httpd 2>&1)
|
|
comprobarError $? 101 $result
|
|
comprobarError $? 101 $result
|
|
if [ $sslOn = true ];then
|
|
if [ $sslOn = true ];then
|
|
@@ -872,7 +922,7 @@ configurarApache() {
|
|
|
|
|
|
instalarNginx() {
|
|
instalarNginx() {
|
|
# Instala Nginx
|
|
# Instala Nginx
|
|
- webServerName="nginx"
|
|
|
|
|
|
+ webServerName=$nginxName
|
|
if [ $debianOS = true ];then
|
|
if [ $debianOS = true ];then
|
|
result=$(apt-get -q -y install nginx 2>&1)
|
|
result=$(apt-get -q -y install nginx 2>&1)
|
|
comprobarError $? 102 $result
|
|
comprobarError $? 102 $result
|
|
@@ -1087,7 +1137,7 @@ establecerSQLPasswd() {
|
|
|
|
|
|
instalarMySQL() {
|
|
instalarMySQL() {
|
|
# Instala MySQL (sólo para Debian)
|
|
# Instala MySQL (sólo para Debian)
|
|
- sqlServerName="mysql"
|
|
|
|
|
|
+ sqlServerName=$mysqlName
|
|
if [ $debianOS = true ];then
|
|
if [ $debianOS = true ];then
|
|
result=$(apt-get -q -y install mysql-server mysql-client 2>&1)
|
|
result=$(apt-get -q -y install mysql-server mysql-client 2>&1)
|
|
comprobarError $? 201 $result
|
|
comprobarError $? 201 $result
|
|
@@ -1104,7 +1154,7 @@ instalarMySQL() {
|
|
|
|
|
|
instalarMariaDB() {
|
|
instalarMariaDB() {
|
|
# Instala MariaDB
|
|
# Instala MariaDB
|
|
- sqlServerName="mariadb"
|
|
|
|
|
|
+ sqlServerName=$mariadbName
|
|
if [ $debianOS = true ];then
|
|
if [ $debianOS = true ];then
|
|
result=$(apt-get -q -y install mariadb-server mariadb-client 2>&1)
|
|
result=$(apt-get -q -y install mariadb-server mariadb-client 2>&1)
|
|
comprobarError $? 202 $result
|
|
comprobarError $? 202 $result
|
|
@@ -1160,7 +1210,6 @@ instalarPHP() {
|
|
result=$(apt-get -q -y install php libapache2-mod-php php-mysql php-intl php-mbstring php-xml php-apcu php-gd php-curl php-zip php-soap php-xmlrpc 2>&1)
|
|
result=$(apt-get -q -y install php libapache2-mod-php php-mysql php-intl php-mbstring php-xml php-apcu php-gd php-curl php-zip php-soap php-xmlrpc 2>&1)
|
|
comprobarError $? 302 $result
|
|
comprobarError $? 302 $result
|
|
elif [ $nginxOn = true ];then
|
|
elif [ $nginxOn = true ];then
|
|
- phpFPMName="php7.2-fpm"
|
|
|
|
result=$(apt-get -q -y install php-fpm php-mysql php-intl php-mbstring php-xml php-apcu php-gd php-curl php-zip php-soap php-xmlrpc 2>&1)
|
|
result=$(apt-get -q -y install php-fpm php-mysql php-intl php-mbstring php-xml php-apcu php-gd php-curl php-zip php-soap php-xmlrpc 2>&1)
|
|
comprobarError $? 302 $result
|
|
comprobarError $? 302 $result
|
|
deshabilitarServicio $phpFPMName
|
|
deshabilitarServicio $phpFPMName
|
|
@@ -1173,15 +1222,8 @@ instalarPHP() {
|
|
comprobarError $? 103 $result
|
|
comprobarError $? 103 $result
|
|
# Necesitamos un repositorio adicional para PHP-7 (REMI-RELEASE)
|
|
# Necesitamos un repositorio adicional para PHP-7 (REMI-RELEASE)
|
|
if [ ! -f /etc/yum.repos.d/remi-php72.repo ];then
|
|
if [ ! -f /etc/yum.repos.d/remi-php72.repo ];then
|
|
- if [ $VERSION = "7" ];then
|
|
|
|
- result=$(yum -y install http://remi.mirrors.cu.be/enterprise/remi-release-7.rpm 2>&1)
|
|
|
|
- comprobarError $? 303 $result
|
|
|
|
- elif [ $VERSION = "28" ];then
|
|
|
|
- result=$(yum -y install http://remi.mirrors.cu.be/fedora/remi-release-28.rpm 2>&1)
|
|
|
|
- comprobarError $? 303 $result
|
|
|
|
- else
|
|
|
|
- comprobarError 1 304
|
|
|
|
- fi
|
|
|
|
|
|
+ result=$(yum -y install "$remiRepo" 2>&1)
|
|
|
|
+ comprobarError $? 303 $result
|
|
fi
|
|
fi
|
|
# Activamos repositorio remi-php72
|
|
# Activamos repositorio remi-php72
|
|
result=$(yum-config-manager --enable remi-php72 2>&1)
|
|
result=$(yum-config-manager --enable remi-php72 2>&1)
|
|
@@ -1191,7 +1233,6 @@ instalarPHP() {
|
|
result=$(yum -y install php php-mysql php-intl php-mbstring php-mcrypt php-xml php-pecl-apcu php-gd php-pear-Net-Curl php-pecl-zip php-soap php-xmlrpc 2>&1)
|
|
result=$(yum -y install php php-mysql php-intl php-mbstring php-mcrypt php-xml php-pecl-apcu php-gd php-pear-Net-Curl php-pecl-zip php-soap php-xmlrpc 2>&1)
|
|
comprobarError $? 302 $result
|
|
comprobarError $? 302 $result
|
|
elif [ $nginxOn = true ];then
|
|
elif [ $nginxOn = true ];then
|
|
- phpFPMName="php-fpm"
|
|
|
|
result=$(yum -y install php php-fpm php-mysql php-intl php-mbstring php-mcrypt php-xml php-pecl-apcu php-gd php-pear-Net-Curl php-pecl-zip php-soap php-xmlrpc 2>&1)
|
|
result=$(yum -y install php php-fpm php-mysql php-intl php-mbstring php-mcrypt php-xml php-pecl-apcu php-gd php-pear-Net-Curl php-pecl-zip php-soap php-xmlrpc 2>&1)
|
|
comprobarError $? 302 $result
|
|
comprobarError $? 302 $result
|
|
deshabilitarServicio $phpFPMName
|
|
deshabilitarServicio $phpFPMName
|
|
@@ -1845,7 +1886,7 @@ configurarBackups() {
|
|
echo -en " OK.\n" | tee -a $logFile
|
|
echo -en " OK.\n" | tee -a $logFile
|
|
fi
|
|
fi
|
|
|
|
|
|
-# Instalación PHP-7.2
|
|
|
|
|
|
+# Instalación PHP-7
|
|
if [ $phpOn = true ]; then
|
|
if [ $phpOn = true ]; then
|
|
echo -en "Instalando PHP-7..." | tee -a $logFile
|
|
echo -en "Instalando PHP-7..." | tee -a $logFile
|
|
instalarPHP
|
|
instalarPHP
|