Ubuntu SteamCMD install for Palworld

603 詞

前言

因為懶得使用Windows,想到還要花錢買系統,我就覺得麻煩,因此決定透過Ubunut來安裝SteamCMD來開一個帕魯的伺服器

根據測試來說,配置要求一點高

  • CPU: 4Core
  • RAM: 16G or more
  • Storage: 40G or more

さあ、始めましょう (ゝ∀・)b

1
2
#更新
sudo apt update && apt upgrade -y
1
2
#安裝 software-properties-common
sudo apt install software-properties-common
1
2
#準備與安裝SteamCMD
sudo dpkg --add-architecture i386 | sudo add-apt-repository multiverse ; apt update ; apt install steamcmd
1
2
#新增使用者
sudo useradd -m steam

之後要去調整一下環境變數,免得啟動發生異常

1
2
3
4
sudo vim /home/steam/.bashrc

#找個地方新增
export PATH="/usr/games/:$PATH"

切換使用者

1
sudo -u steam -s ; cd ~

下載 Steamworks SDK 可再發行元件

1
steamcmd +force_install_dir '/home/steam/Steam/steamapps/common/steamworks' +login anonymous +app_update 1007 +quit

建立一個目錄,Palworld 伺服器將在其中尋找「steamclient.so」檔案。

1
mkdir -p /home/steam/.steam/sdk64

複製steamclient.so

1
cp '/home/steam/Steam/steamapps/common/steamworks/linux64/steamclient.so' /home/steam/.steam/sdk64/

下載Palworld伺服器

1
steamcmd +force_install_dir '/home/steam/Steam/steamapps/common/PalServer' +login anonymous +app_update 2394010 validate +quit

測試啟動

1
2
cd /home/steam/Steam/steamapps/common/PalServer
./PalServer.sh

會跑很多訊息主要看到這行就代表成功開開啟了

[S_API FAIL] Tried to access Steam interface SteamNetworkingUtils004 before SteamAPI_Init succeeded.

之後按下 CTRL + C 退出。

把預設值複製到運行伺服器用,裡面有許多設定可以使用,詳細設定可以參考官方資訊

1
cp /home/steam/Steam/steamapps/common/PalServer/DefaultPalWorldSettings.ini /home/steam/Steam/steamapps/common/PalServer/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini

開機自動啟動

編寫執行系統

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
sudo vim /etc/systemd/system/palworld.service

#Systemd內容如下
[Unit]
Description=Palworld Server
Wants=network-online.target
After=network-online.target

[Service]
User=steam
Group=steam
WorkingDirectory=/home/steam/
ExecStartPre=/usr/games/steamcmd +force_install_dir '/home/steam/Steam/steamapps/common/PalServer' +login anonymous +app_update 2394010 +quit
ExecStart=/home/steam/Steam/steamapps/common/PalServer/PalServer.sh -useperfthreads -NoAsyncLoadingThread -UseMultithreadForDS > /dev/null
Restart=always

[Install]
WantedBy=multi-user.target

官方推薦再開啟伺服器的時候附帶以下參數:

  • -useperfthreads
    這是一個虛幻引擎選項,告訴引擎使用線程來嘗試提高效能。
  • -NoAsyncLoadingThread
    使用這個,我們告訴伺服器不要使用使用者單獨的執行緒進行非同步載入。這樣做是為了減少運行線程的數量並提高伺服器的效能。
  • -UseMultithreadForDS
    最後一個選項是一個簡單的選項,告訴引擎為專用伺服器使用多執行緒。

設定自動啟動

1
sudo systemctl enable palworld ; sudo systemctl start palworld  

搞定啦~~可以開始完啦 (ゝ∀・)