Added install_nvidia
This commit is contained in:
parent
765406ad79
commit
cd33a3c484
1 changed files with 87 additions and 2 deletions
|
|
@ -1,8 +1,85 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
newgrp incus-admin
|
echo "Instalando Incus"
|
||||||
|
|
||||||
sg incus-admin -c "incus admin init"
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Script para inicializar Incus (LXD) con configuraciones básicas
|
||||||
|
# Autor: [Tu nombre]
|
||||||
|
# Fecha: $(date +%Y-%m-%d)
|
||||||
|
|
||||||
|
# Colores para la salida
|
||||||
|
RED='\033[0;31m'
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
|
# Función para mostrar mensajes de error y salir
|
||||||
|
function die() {
|
||||||
|
echo -e "${RED}Error: $1${NC}" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Configuración (puedes modificar estos valores)
|
||||||
|
STORAGE_POOL="default"
|
||||||
|
STORAGE_DRIVER="dir" # Puede ser 'btrfs', 'zfs', 'lvm', 'dir', etc.
|
||||||
|
NETWORK_NAME="incusbr0"
|
||||||
|
NETWORK_TYPE="bridge"
|
||||||
|
NETWORK_ADDR="10.0.0.1/24"
|
||||||
|
NETWORK_DHCP_RANGE="10.0.0.2-10.0.0.254"
|
||||||
|
NETWORK_DHCP_STATIC="10.0.0.1"
|
||||||
|
TRUST_PASSWORD="" # Déjalo vacío para no configurar contraseña
|
||||||
|
|
||||||
|
echo -e "${YELLOW}Inicializando Incus con la siguiente configuración:${NC}"
|
||||||
|
echo " - Pool de almacenamiento: $STORAGE_POOL ($STORAGE_DRIVER)"
|
||||||
|
echo " - Red: $NETWORK_NAME ($NETWORK_TYPE, $NETWORK_ADDR)"
|
||||||
|
echo -e "${YELLOW}Esto configurará Incus con valores por defecto.${NC}"
|
||||||
|
|
||||||
|
# Confirmar antes de continuar
|
||||||
|
#read -p "¿Deseas continuar? (y/N) " -n 1 -r
|
||||||
|
#echo
|
||||||
|
#if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||||
|
# echo -e "${GREEN}Operación cancelada por el usuario.${NC}"
|
||||||
|
# exit 0
|
||||||
|
#fi
|
||||||
|
|
||||||
|
# Ejecutar incus admin init con las configuraciones
|
||||||
|
echo -e "${YELLOW}Inicializando Incus...${NC}"
|
||||||
|
|
||||||
|
cat <<EOF | incus admin init --minimal
|
||||||
|
config:
|
||||||
|
core.https_address: '[::]:8443'
|
||||||
|
core.trust_password: ${TRUST_PASSWORD}
|
||||||
|
storage_pools:
|
||||||
|
- name: ${STORAGE_POOL}
|
||||||
|
driver: ${STORAGE_DRIVER}
|
||||||
|
networks:
|
||||||
|
- name: ${NETWORK_NAME}
|
||||||
|
type: ${NETWORK_TYPE}
|
||||||
|
config:
|
||||||
|
ipv4.address: ${NETWORK_ADDR}
|
||||||
|
ipv4.nat: "true"
|
||||||
|
ipv6.address: none
|
||||||
|
profiles:
|
||||||
|
- name: default
|
||||||
|
devices:
|
||||||
|
root:
|
||||||
|
path: /
|
||||||
|
pool: ${STORAGE_POOL}
|
||||||
|
type: disk
|
||||||
|
eth0:
|
||||||
|
name: eth0
|
||||||
|
network: ${NETWORK_NAME}
|
||||||
|
type: nic
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Verificar si la inicialización fue exitosa
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo -e "${GREEN}¡Incus se ha inicializado correctamente!${NC}"
|
||||||
|
echo -e "Puedes ver la información con: ${YELLOW}incus info${NC}"
|
||||||
|
else
|
||||||
|
die "Hubo un problema al inicializar Incus"
|
||||||
|
fi
|
||||||
|
|
||||||
# Install ollama container
|
# Install ollama container
|
||||||
|
|
||||||
|
|
@ -10,6 +87,14 @@ echo "Create ollama container"
|
||||||
|
|
||||||
incus launch images:debian/12 ollama-container
|
incus launch images:debian/12 ollama-container
|
||||||
|
|
||||||
|
if [$? -eq 0]; then
|
||||||
|
echo -e "${GREEN}¡Ollama-container se ha inicializado correctamente!${NC}"
|
||||||
|
else
|
||||||
|
|
||||||
|
die "No se puede crear el container para Ollama"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
incus restart ollama-container
|
incus restart ollama-container
|
||||||
|
|
||||||
incus config device add ollama-container gpu gpu
|
incus config device add ollama-container gpu gpu
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue