💡

OracleCloud A1 + Ark Server

2024/06/04に公開

はじめに

ほぼ作業メモです。

env

            .-/+oossssoo+/-.               root@oracle
        `:+ssssssssssssssssss+:`           -------------------------
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 22.04.4 LTS aarch64
    .ossssssssssssssssssdMMMNysssso.       Host: KVM Virtual Machine virt-4.2
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 6.5.0-1020-oracle
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 7 mins
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 557 (dpkg), 4 (snap)
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: bash 5.1.16
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Resolution: 1024x768
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   CPU: (4)
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   GPU: 00:01.0 Red Hat, Inc. Virtio GPU
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Memory: 204MiB / 23981MiB
.ssssssssdMMMNhsssssssssshNMMMdssssssss.
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/
  +sssssssssdmydMMMMMMMMddddyssssssss+
   /ssssssssssshdmNNNNmyNMMMMhssssss/
    .ossssssssssssssssssdMMMNysssso.
      -+sssssssssssssssssyyyssss+-
        `:+ssssssssssssssssss+:`
            .-/+oossssoo+/-.


Prepare

sudo su -
vim .ssh/authorized_keys

面倒なのでrootで直接ログインできるようにした
以降すべてrootで作業

timedatectl set-timezone Asia/Tokyo
apt update
apt install -y vim bash-completion net-tools tcpdump screen git build-essential cmake
apt full-upgrade -y
reboot

box86 install

cd ~
git clone https://github.com/ptitSeb/box86
dpkg --add-architecture armhf
apt update
apt install -y gcc-arm-linux-gnueabihf libc6:armhf libncurses5:armhf libstdc++6:armhf
cd ~/box86
mkdir build; cd build
cmake .. -DRPI4ARM64=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make -j$(nproc)
make install
systemctl restart systemd-binfmt

box64 install

cd ~
git clone https://github.com/ptitSeb/box64.git
cd ~/box64
mkdir build; cd build
cmake .. -DARM_DYNAREC=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo; make -j$(nproc)
make install
systemctl restart systemd-binfmt

steamcmd install

apt install -y python3-pip
pip3 install --upgrade requests
mkdir ~/steamcmd; cd ~/steamcmd
curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf -
./steamcmd.sh +quit

ark_server install

mkdir -p ~/ark_server
cd ~/steamcmd
./steamcmd.sh +force_install_dir ~/ark_server +login anonymous +app_update 376030 validate +quit
cd ~/ark_server/ShooterGame/Binaries/Linux/
vim start.sh

start.sh

#! /bin/bash
MAP="TheIsland"
SERVERNAME="Ark Server"
MAXPLAYERS="70"
SERVERPW="hoge"
ADMINPW=""
PORTGAME="7777"
PORTQUERY="27015"
RCONON="true"
PORTRCON="27020"
RCONPW=""

screen -DmS ark ./ShooterGameServer $MAP?listen?SessionName="$SERVERNAME"?MaxPlayers=$MAXPLAYERS?ServerPassword=${SERVERPW}?ServerAdminPassword=$ADMINPW?Port=$PORTGAME?QueryPort=$PORTQUERY?RCONEnabled=$RCONON?RCONPort=$PORTRCON?PreventDownloadSurvivors=False?PreventDownloadItems=False?PreventDownloadDinos=False?PreventUploadSurvivors=False?PreventUploadItems=False?PreventUploadDinos=False?noTributeDownloads=False -nosteamclient -server -log
chmod +x start.sh
cat << EOF > /etc/systemd/system/ark-dedicated.service
[Unit]
Description=ARK: Survival Evolved dedicated server
Wants=network-online.target
After=syslog.target network.target nss-lookup.target network-online.target

[Service]
Group=root
User=root
ExecStartPre=bash /root/steamcmd/steamcmd.sh +login anonymous +force_install_dir /root/ark_server/ +app_update 376030 +quit
ExecStart=bash /root/ark_server/ShooterGame/Binaries/Linux/start.sh
WorkingDirectory=/root/ark_server/ShooterGame/Binaries/Linux
LimitNOFILE=100000
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s INT $MAINPID

[Install]
WantedBy=multi-user.target
EOF

iptables & apparmor

iptables -I INPUT 5 -m multiport -p udp --dport 7777,7778,27015 -j ACCEPT
/etc/init.d/netfilter-persistent save
systemctl disable --now apparmor.service

start server

systemctl daemon-reload
systemctl start ark-dedicated.service

Discussion