emq-TE1/install/docker.sh

75 lines
2.0 KiB
Bash

#!/bin/sh
if [[ $EUID -ne 0 ]]; then
whiptail --title "ADN server" --msgbox "Debe ejecutar este script como usuario ROOT" 0 50
exit 0
fi
(crontab -l | grep -v "sync ; echo 3 > /proc/sys/vm/drop_caches >/dev/null 2>&1") | crontab -
cpu_info=$(cat /proc/cpuinfo)
is_raspberry=false
is_supported_arch=false
# Buscar información de CPU
if [[ $cpu_info =~ "Raspberry" ]]; then
is_raspberry=true
fi
if [[ $is_raspberry == true ]]; then
# Buscar información de arquitectura
arch=$(uname -m)
if [[ $arch == "aarch64" ]]; then
is_supported_arch=true
fi
if [[ $is_supported_arch == true ]]; then
echo "Arquitectura de Raspberry Pi $arch"
echo "Instalando ADN server"
else
echo "La arquitectura de la Raspberry Pi, no es compatible. Se requiere aarch64."
exit 1
fi
else
echo "Instalando ADN server"
fi
######################################
bash -c "$(curl -fsSLk https://gitlab.com/hp3icc/emq-TE1/-/raw/main/install/ipv6off.sh)" &&
echo ADN-DMR-Peer-Server Docker installer...
echo Installing required packages...
echo Install Docker Community Edition...
apt-get -y remove docker docker-engine docker.io &&
apt-get -y update &&
apt-get -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common &&
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - &&
ARCH=`/usr/bin/arch`
echo "System architecture is $ARCH"
if [ "$ARCH" == "x86_64" ]
then
ARCH="amd64"
fi
add-apt-repository \
"deb [arch=$ARCH] https://download.docker.com/linux/debian \
$(lsb_release -cs) \
stable" &&
apt-get -y update &&
apt-get -y install docker-ce &&
echo Install Docker Compose...
apt-get -y install docker-compose &&
echo Set userland-proxy to false...
cat <<EOF > /etc/docker/daemon.json &&
{
"userland-proxy": false,
"experimental": true,
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
}
}
EOF
echo Restart docker...
systemctl restart docker