Skip to content

Instantly share code, notes, and snippets.

@perseoq
Last active December 3, 2024 03:54
Show Gist options
  • Select an option

  • Save perseoq/4e65344c105a2ca4d03c6f9fe6f5df21 to your computer and use it in GitHub Desktop.

Select an option

Save perseoq/4e65344c105a2ca4d03c6f9fe6f5df21 to your computer and use it in GitHub Desktop.
Debian / Ubuntu Post install configuration
#!/bin/bash
sudo apt update
sudo apt install -y clang llvm make cmake g++ virtualenv python3-devel python3-tkinter git curl mysql-server openjdk-23* mpv gimp inkscape scribus *yaru* build-essential checkinstall automake autoconf neofetch htop ntfs-3g gdebi gdebi-core synaptic p7zip-full p7zip-rar rar unrar ffmpeg libavcodec-extra gstreamer1.0-libav gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-pulseaudio vorbis-tools fonts-freefont-ttf fonts-freefont-otf fonts-inconsolata fonts-droid-fallback xfonts-terminus fonts-droid-fallback ttf-bitstream-vera fonts-cantarell fonts-liberation fonts-oflb-asana-math fonts-mathjax ttf-mscorefonts-installer fonts-ubuntu
sudo apt -y install linux-headers-$(uname -r)
sudo apt -y upgrade
# Add Docker's official GPG key:
sudo apt update
sudo apt install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-compose
sudo systemctl enable docker.service
sudo groupadd docker
sudo chmod 666 /var/run/docker.sock
sudo usermod -aG docker $USER
# Ruta al archivo daemon.json
DAEMON_JSON="/etc/docker/daemon.json"
# Configuración de logging para Docker
CONFIG='{
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
}
}'
# Crear archivo daemon.json si no existe
if [ ! -f "$DAEMON_JSON" ]; then
echo "El archivo $DAEMON_JSON no existe. Creando..."
echo "$CONFIG" | sudo tee "$DAEMON_JSON" > /dev/null
else
echo "El archivo $DAEMON_JSON ya existe. Actualizando..."
sudo jq '. + {"log-driver": "json-file", "log-opts": {"max-size": "10m", "max-file": "3"}}' "$DAEMON_JSON" | sudo tee "$DAEMON_JSON" > /dev/null
fi
# Reiniciar Docker para aplicar los cambios
echo "Reiniciando el servicio Docker..."
sudo systemctl restart docker
echo "La configuración del controlador de registros se ha actualizado correctamente."
# Ruta del archivo de configuración de repositorios
REPO_FILE="/etc/apt/sources.list"
# Repositorios a agregar
REPOS='
deb http://deb.debian.org/debian bookworm main non-free-firmware contrib
deb-src http://deb.debian.org/debian bookworm main non-free-firmware contrib
deb http://security.debian.org/debian-security bookworm-security main non-free-firmware contrib
deb-src http://security.debian.org/debian-security bookworm-security main non-free-firmware contrib
deb http://deb.debian.org/debian bookworm-updates main non-free-firmware contrib
deb-src http://deb.debian.org/debian bookworm-updates main non-free-firmware contrib
'
# Respaldar el archivo sources.list actual
if [ -f "$REPO_FILE" ]; then
echo "Respaldando el archivo actual $REPO_FILE como $REPO_FILE.bak..."
sudo cp "$REPO_FILE" "$REPO_FILE.bak"
fi
# Crear un nuevo archivo sources.list con los repositorios proporcionados
echo "Creando un nuevo archivo $REPO_FILE con los repositorios especificados..."
echo "$REPOS" | sudo tee "$REPO_FILE" > /dev/null
# Actualizar la lista de paquetes
echo "Actualizando la lista de paquetes..."
sudo apt update
echo "Nuevo archivo de repositorios creado y lista de paquetes actualizada."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment