Come installare Valheim con LinuxGSM su Ubuntu 22.04
Configurare un server Valheim con LinuxGSM su Ubuntu 22.04
Come installare un server Valheim con LinuxGSM su Ubuntu 22.04
Questo tutorial spiega come installare e configurare un server di gioco Valheim su una distribuzione Ubuntu 22.04 tramite LinuxGSM.
Valheim è un efferato gioco di esplorazione e sopravvivenza per 1-10 giocatori, ambientato in un purgatorio generato proceduralmente e ispirato alla cultura vichinga. Lotta, costruisci e fatti strada in una saga degna della benedizione di Odino!
LinuxGSM è uno strumento da riga di comando che permette di implementare e gestire in modo rapido e semplice i server di gioco dedicati Linux.
Prerequisiti
Per poter seguire gli step indicati in questo tutorial è necessario disporre di:
- Un server Ubuntu 22.04 Jammy Linux
- Accesso al server come utente non root con privilegi sudo
- Conoscenze di base di CLI Linux e dell’editor di testo vim
Connettersi al server
Accedi al server remoto tramite SSH come utente non root con privilegi sudo.
In questo esempio il nome del server è lgsm-host e l'utente è ubuntu.
Installazione
Attiva il supporto per l’architettura a 32 bit e aggiorna l'indice dei pacchetti e i pacchetti di sistema utilizzando i comandi seguenti:
sudo dpkg --add-architecture i386
packages sudo apt update
Installa le dipendenze e Steam:
sudo apt install curl wget file tar bzip2 gzip unzip bsdmainutils python3 util-linux ca-certificates binutils bc jq tmux netcat lib32gcc-s1 lib32stdc++6 libsdl2-2.0-0:i386 steamcmd libc6-dev
Quando richiesto, accetta le licenze e le richieste di riavvio del servizio:
GameDig
GameDig è un modulo aggiuntivo che sostituisce il modulo di interrogazione LinuxGSM utilizzato di default dal monitor. Oltre a verificare se il server di gioco è online, fornisce ai giocatori i dettagli della partita in diretta, comprese le mappe. Questo modulo permette ai ./gameserver di visualizzare le informazioni in tempo reale.
Installare Node.js
GameDig richiede l’uso di Node.js, un ambiente di runtime JavaScript.
Utilizza il seguente comando per installare Node.js:
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - sudo apt update && sudo apt install -y nodejs
Quando richiesto, seleziona OK e premi ENTER per continuare:
Installare GameDig
Per installare GameDig, esegui il seguente comando:
sudo npm install gamedig -g
Ti consigliamo di utilizzare il seguente comando per aggiornare il pacchetto npm:
sudo npm install -g [email protected]
Creare un utente dedicato
Per motivi di sicurezza, crea un utente che non disponga di privilegi sudo.
sudo adduser vhserver
Crea la password utente e aggiungi eventuali informazioni facoltative.
Passa all'utente appena creato:
su - vhserver
Installare LinuxGSM
Per installare linuxgsm, utilizza questo comando:
wget -O linuxgsm.sh https://linuxgsm.sh && chmod +x linuxgsm.sh && bash linuxgsm.sh vhserver
Installare il server Valheim
Installa Valheim server tramite LinuxGSM inserendo il seguente comando:
./vhserver install
Se richiesto, rispondi Y a tutte le domande.
L'installazione richiede alcuni minuti per essere completata. Al termine, utilizza il comando seguente per visualizzare i dettagli del server Valheim.
./vhserver details
vhserver@lgsm-host:~$ ./vhserver details Distro Details ============================================================================================================== Date: Tue May 10 08:13:32 UTC 2022 Distro: Ubuntu 22.04 LTS Arch: x86_64 Kernel: 5.15.0-25-generic Hostname: lgsm-host Uptime: 0d, 0h, 27m tmux: tmux 3.2a glibc: 2.35 Server Resource ============================================================================================================== CPU Model: Intel Core Processor (Broadwell, IBRS) Cores: 2 Frequency: 2399.994MHz Avg Load: 0.43, 0.26, 0.10 Memory Mem: total used free cached available Physical: 6.7GB 212MB 6.2GB 2.4GB 6.2GB Swap: 0B 0B 0B Storage Filesystem: /dev/sda1 Total: 49G Used: 3.4G Available: 45G Network IP: 0.0.0.0 Internet IP: 162.19.69.3 Game Server Resource Usage ============================================================================================================== CPU Used: 0% Mem Used: 0% 0MB Storage Total: 1.4G Serverfiles: 1.2G Valheim Server Details ============================================================================================================== Server name: Valheim Server App ID: 896660 Server IP: 0.0.0.0:2456 Internet IP: 162.19.69.3:2456 Server password: NOT SET Game world: vhserver Master server: not listed Stato: STOPPED vhserver Script Details ============================================================================================================== Script name: vhserver LinuxGSM version: v21.5.1 glibc required: 2.15 Discord alert: off Email alert: off Gotify alert: off IFTTT alert: off Mailgun (email) alert: off Pushbullet alert: off Pushover alert: off Rocketchat alert: off Slack alert: off Telegram alert: off Update on start: off User: vhserver Location: /home/vhserver Backups ============================================================================================================== No Backups created Command-line Parameters ============================================================================================================== ./valheim_server.x86_64 -name 'Valheim Server' -password -port 2456 -world vhserver -public 1 -savedir '/home/vhserver/.config/unity3d/IronGate/Valheim' Ports ============================================================================================================== Change ports by editing the parameters in: /home/vhserver/lgsm/config-lgsm/vhserver Useful port diagnostic command: ss -tuplwn | grep valheim_server. DESCRIPTION PORT PROTOCOL LISTEN Game 2456 udp 0 Query 2457 udp 0 Stato: STOPPED
Configurare il server Valheim
In base ai dettagli del server Valheim, prendi nota della directory contenente i file di configurazione: /home/vhserver/lgsm/config-lgsm/vhserver.
Il file _default.cfg contiene la configurazione di default del server Valheim. Questo file non deve essere modificato, ma utilizzato come modello per creare una configurazione personalizzata del server.
Apri questo file e copia le righe relative alle variabili servername e serverpassword . Se vuoi modificare anche il numero di porta, includi la linea contenente la variabile port.
vi /home/vhserver/lgsm/config-lgsm/vhserver/_default.cfg
Ora apri il file vhserver.cfg nella stessa directory, aggiungi le righe corrispondenti ai parametri da modificare e cambia i valori in questo modo:
vi /home/vhserver/lgsm/config-lgsm/vhserver/vhserver.cfg
servername="My Awesome Valheim Server" # Minimum password length is 5. serverpassword="mypassword" port="2456"
Avviare il server Valheim
Per avviare il server Valheim, utilizza il seguente comando:
./vhserver start
vhserver@lgsm-host:~$ ./vhserver start [ OK ] Starting vhserver: Applying steamclient.so sdk64 hardlink fix: Valheim [ OK ] Starting vhserver: Applying steamclient.so sdk32 link fix: Valheim [ OK ] Starting vhserver: My Awesome Valheim Server
Una volta avviato, verifica lo stato e tutte le informazioni dettagliate:
./vhserver details
vhserver@lgsm-host:~$ ./vhserver details Distro Details ============================================================================================================== Date: Tue May 10 08:21:51 UTC 2022 Distro: Ubuntu 22.04 LTS Arch: x86_64 Kernel: 5.15.0-25-generic Hostname: lgsm-host Uptime: 0d, 0h, 35m tmux: tmux 3.2a glibc: 2.35 Server Resource ============================================================================================================== CPU Model: Intel Core Processor (Broadwell, IBRS) Cores: 2 Frequency: 2399.994MHz Avg Load: 0.67, 0.24, 0.12 Memory Mem: total used free cached available Physical: 6.7GB 1.7GB 4.8GB 2.4GB 4.8GB Swap: 0B 0B 0B Storage Filesystem: /dev/sda1 Total: 49G Used: 3.4G Available: 45G Network IP: 0.0.0.0 Internet IP: 162.19.69.3 Game Server Resource Usage ============================================================================================================== CPU Used: 111% Mem Used: 22.2% 1506MB Storage Total: 1.4G Serverfiles: 1.2G Valheim Server Details ============================================================================================================== Server name: My Awesome Valheim Server App ID: 896660 Server Version: 1.0.0.0 Server IP: 0.0.0.0:2456 Internet IP: 162.19.69.3:2456 Server password: mypassword Players: 0/64 Current map: My Awesome Valheim Server Game world: vhserver Master server: listed Status: STARTED vhserver Script Details ============================================================================================================== Script name: vhserver LinuxGSM version: v21.5.1 glibc required: 2.15 Discord alert: off Email alert: off Gotify alert: off IFTTT alert: off Mailgun (email) alert: off Pushbullet alert: off Pushover alert: off Rocketchat alert: off Slack alert: off Telegram alert: off Update on start: off User: vhserver Location: /home/vhserver Backups ============================================================================================================== No Backups created Command-line Parameters ============================================================================================================== ./valheim_server.x86_64 -name 'My Awesome Valheim Server' -password mypassword -port 2456 -world vhserver -public 1 -savedir '/home/vhserver/.config/unity3d/IronGate/Valheim' Ports ============================================================================================================== Change ports by editing the parameters in: /home/vhserver/lgsm/config-lgsm/vhserver Useful port diagnostic command: ss -tuplwn | grep valheim_server. DESCRIPTION PORT PROTOCOL LISTEN Game 2456 udp 1 Query 2457 udp 1 Status: STARTED
Pianificare le attività di amministrazione
Con il lgsm, puoi utilizzare crontab per pianificare operazioni di manutenzione o di amministrazione.
Esempio:
crontab -e
*/5 * * * * /home/vhserver/vhserver monitor > /dev/null 2>&1 */30 * * * * /home/vhserver/vhserver update > /dev/null 2>&1 0 0 * * 0 /home/vhserver/vhserver update-lgsm > /dev/null 2>&1
Connettiti al server Valheim e inizia a giocare!
Per connetterti al server di gioco, apri Valheim e accedi al server effettuando una ricerca con il nome o inserendo l'indirizzo IP.
E ora tocca a te conquistare il regno di Odino!