mirror of https://gitlab.com/hp3icc/emq-TE1.git
74 lines
2.5 KiB
Bash
74 lines
2.5 KiB
Bash
#!/bin/sh
|
|
if [ $EUID -ne 0 ]; then
|
|
whiptail --title "sudo su" --msgbox "requiere ser usuario root , escriba (sudo su) antes de entrar a menu / requires root user, type (sudo su) before entering menu" 0 50
|
|
exit 1
|
|
fi
|
|
(crontab -l | grep -v "sync ; echo 3 > /proc/sys/vm/drop_caches >/dev/null 2>&1") | crontab -
|
|
#!/bin/bash
|
|
|
|
echo "Installing required packages..."
|
|
echo "Install Docker Community Edition..."
|
|
|
|
# Eliminar versiones antiguas de Docker si las hay, ignorando errores si no existen
|
|
apt-get -y remove docker docker-engine docker.io containerd runc --ignore-missing
|
|
|
|
# Actualizar el índice de paquetes
|
|
#apt update
|
|
|
|
# Instalar paquetes necesarios para Docker (forzar sin intervención)
|
|
apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
|
|
|
|
# Descargar y agregar la clave GPG oficial de Docker, sobrescribiendo si es necesario
|
|
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor --batch --yes -o /usr/share/keyrings/docker-archive-keyring.gpg
|
|
|
|
# Detectar la arquitectura del sistema
|
|
ARCH=$(dpkg --print-architecture)
|
|
echo "System architecture is $ARCH"
|
|
|
|
# Ajustar el nombre de la arquitectura según sea necesario
|
|
if [ "$ARCH" == "amd64" ]; then
|
|
ARCH="amd64"
|
|
elif [ "$ARCH" == "arm64" ]; then
|
|
ARCH="arm64"
|
|
elif [ "$ARCH" == "armhf" ]; then
|
|
ARCH="armhf"
|
|
else
|
|
echo "Architecture $ARCH not supported"
|
|
exit 1
|
|
fi
|
|
|
|
# Agregar el repositorio de Docker para la arquitectura correcta
|
|
echo "Adding Docker repository for $ARCH..."
|
|
echo "deb [arch=$ARCH signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
|
|
|
# Actualizar el índice de paquetes nuevamente
|
|
apt update
|
|
|
|
# Instalar Docker Community Edition, forzando la instalación sin preguntas
|
|
apt-get install -y docker-ce docker-ce-cli containerd.io
|
|
|
|
echo "Install Docker Compose..."
|
|
|
|
# Instalar Docker Compose, forzando la instalación sin preguntas
|
|
apt-get install -y docker-compose
|
|
|
|
# Configurar Docker con opciones personalizadas, sobrescribiendo si es necesario
|
|
echo "Set userland-proxy to false and configure log options..."
|
|
cat <<EOF | sudo tee /etc/docker/daemon.json > /dev/null
|
|
{
|
|
"userland-proxy": false,
|
|
"experimental": true,
|
|
"log-driver": "json-file",
|
|
"log-opts": {
|
|
"max-size": "10m",
|
|
"max-file": "3"
|
|
}
|
|
}
|
|
EOF
|
|
|
|
# Reiniciar el servicio Docker para aplicar cambios
|
|
echo "Restarting Docker service..."
|
|
sudo systemctl restart docker
|
|
|
|
echo "Docker setup completed successfully!"
|