Fixes in scripts
This commit is contained in:
parent
9690b65a09
commit
d3d3483d0b
3 changed files with 19 additions and 12 deletions
|
|
@ -13,7 +13,7 @@ LOG_FILE="/tmp/incus_ollama_install.log"
|
||||||
# Función para mostrar mensajes de error y salir
|
# Función para mostrar mensajes de error y salir
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo "${RED}Error: $1${NC}" >&2
|
echo -e "${RED}Error: $1${NC}" >&2
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -22,7 +22,7 @@ run_command() {
|
||||||
local cmd="$1"
|
local cmd="$1"
|
||||||
local description="$2"
|
local description="$2"
|
||||||
|
|
||||||
echo "${YELLOW}Ejecutando: ${description}...${NC}"
|
echo -e "${YELLOW}Ejecutando: ${description}...${NC}"
|
||||||
echo "Comando: ${cmd}\n" >> "${LOG_FILE}"
|
echo "Comando: ${cmd}\n" >> "${LOG_FILE}"
|
||||||
eval "${cmd} < /dev/null" >> "${LOG_FILE}" 2>&1
|
eval "${cmd} < /dev/null" >> "${LOG_FILE}" 2>&1
|
||||||
|
|
||||||
|
|
@ -32,7 +32,7 @@ run_command() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo "Instalando Incus"
|
echo -e "${YELLOW}Instalando Incus"
|
||||||
|
|
||||||
# Configuración (puedes modificar estos valores)
|
# Configuración (puedes modificar estos valores)
|
||||||
STORAGE_POOL="default"
|
STORAGE_POOL="default"
|
||||||
|
|
@ -44,10 +44,10 @@ NETWORK_DHCP_RANGE="10.0.0.2-10.0.0.254"
|
||||||
NETWORK_DHCP_STATIC="10.0.0.1"
|
NETWORK_DHCP_STATIC="10.0.0.1"
|
||||||
TRUST_PASSWORD="" # Déjalo vacío para no configurar contraseña
|
TRUST_PASSWORD="" # Déjalo vacío para no configurar contraseña
|
||||||
|
|
||||||
echo "${YELLOW}Inicializando Incus con la siguiente configuración:${NC}"
|
echo -e "${YELLOW}Inicializando Incus con la siguiente configuración:${NC}"
|
||||||
echo " - Pool de almacenamiento: $STORAGE_POOL ($STORAGE_DRIVER)"
|
echo " - Pool de almacenamiento: $STORAGE_POOL ($STORAGE_DRIVER)"
|
||||||
echo " - Red: $NETWORK_NAME ($NETWORK_TYPE, $NETWORK_ADDR)"
|
echo " - Red: $NETWORK_NAME ($NETWORK_TYPE, $NETWORK_ADDR)"
|
||||||
echo "${YELLOW}Esto configurará Incus con valores por defecto.${NC}"
|
echo -e "${YELLOW}Esto configurará Incus con valores por defecto.${NC}"
|
||||||
|
|
||||||
# Confirmar antes de continuar
|
# Confirmar antes de continuar
|
||||||
#read -p "¿Deseas continuar? (y/N) " -n 1 -r
|
#read -p "¿Deseas continuar? (y/N) " -n 1 -r
|
||||||
|
|
@ -58,7 +58,7 @@ echo "${YELLOW}Esto configurará Incus con valores por defecto.${NC}"
|
||||||
#fi
|
#fi
|
||||||
|
|
||||||
# Ejecutar incus admin init con las configuraciones
|
# Ejecutar incus admin init con las configuraciones
|
||||||
echo "${YELLOW}Inicializando Incus...${NC}"
|
echo -e "${YELLOW}Inicializando Incus...${NC}"
|
||||||
|
|
||||||
cat <<EOF | incus admin init --minimal
|
cat <<EOF | incus admin init --minimal
|
||||||
config:
|
config:
|
||||||
|
|
@ -89,8 +89,8 @@ EOF
|
||||||
|
|
||||||
# Verificar si la inicialización fue exitosa
|
# Verificar si la inicialización fue exitosa
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "${GREEN}¡Incus se ha inicializado correctamente!${NC}"
|
echo -e "${GREEN}¡Incus se ha inicializado correctamente!${NC}"
|
||||||
echo "Puedes ver la información con: ${YELLOW}incus info${NC}"
|
echo -e "Puedes ver la información con: ${YELLOW}incus info${NC}"
|
||||||
else
|
else
|
||||||
die "Hubo un problema al inicializar Incus"
|
die "Hubo un problema al inicializar Incus"
|
||||||
fi
|
fi
|
||||||
|
|
@ -106,7 +106,7 @@ IMAGE="images:debian/12"
|
||||||
#incus launch "${IMAGE}" "ollama-container" < /dev/null
|
#incus launch "${IMAGE}" "ollama-container" < /dev/null
|
||||||
run_command "incus launch ${IMAGE} ollama-container" "Crear contenedor Ollama"
|
run_command "incus launch ${IMAGE} ollama-container" "Crear contenedor Ollama"
|
||||||
|
|
||||||
echo "Adding gpu to container"
|
echo -e "${YELLOW}Adding gpu to container${NC}"
|
||||||
|
|
||||||
incus restart ollama-container
|
incus restart ollama-container
|
||||||
|
|
||||||
|
|
@ -169,9 +169,9 @@ echo "Install Ollama in container ollama-container"
|
||||||
#run_command "incus exec ollama-container -- apt -y install curl " ""
|
#run_command "incus exec ollama-container -- apt -y install curl " ""
|
||||||
run_command "incus exec ollama-container -- bash -c 'curl -fsSL https://ollama.com/install.sh | sh'" "Installing Ollama..."
|
run_command "incus exec ollama-container -- bash -c 'curl -fsSL https://ollama.com/install.sh | sh'" "Installing Ollama..."
|
||||||
|
|
||||||
run_command "incus exec ollama-container -- ollama run gemma3:4b" "Installing model gemma3:4b..."
|
run_command "incus exec ollama-container -- ollama pull gemma3:4b" "Installing model gemma3:4b..."
|
||||||
|
|
||||||
echo "Done!!!"
|
echo -e "${GREEN}Done!!!${NC}"
|
||||||
|
|
||||||
sleep 3
|
sleep 3
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
echo "Install new repos for debian..."
|
echo "Install new repos for debian..."
|
||||||
|
|
||||||
|
sudo apt -y install gpg
|
||||||
|
|
||||||
sudo bash -c 'echo "deb http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware" > /etc/apt/sources.list.d/backports.list'
|
sudo bash -c 'echo "deb http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware" > /etc/apt/sources.list.d/backports.list'
|
||||||
|
|
||||||
sudo curl -fsSL https://pkgs.zabbly.com/key.asc | gpg --show-keys --fingerprint
|
sudo curl -fsSL https://pkgs.zabbly.com/key.asc | gpg --show-keys --fingerprint
|
||||||
|
|
@ -72,3 +74,6 @@ sudo apt -y install incus
|
||||||
|
|
||||||
sudo usermod -a -G incus,incus-admin $USER
|
sudo usermod -a -G incus,incus-admin $USER
|
||||||
|
|
||||||
|
echo "Please, reboot the server..."
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ You need execute two scripts. First script, prepare the baremetal server for use
|
||||||
curl -fsSL https://git.cuchulu.com/smartest/aiscripts/raw/branch/master/install_nvidia.sh | bash
|
curl -fsSL https://git.cuchulu.com/smartest/aiscripts/raw/branch/master/install_nvidia.sh | bash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Reboot the server for the next script.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl -fsSL https://git.cuchulu.com/smartest/aiscripts/raw/branch/master/install_incus_ollama.sh | bash
|
curl -fsSL https://git.cuchulu.com/smartest/aiscripts/raw/branch/master/install_incus_ollama.sh | bash
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue