2024年10月12日 星期六

Notes for Erupe

 ## Tested on Ampere instance with Ubuntu 24.04 ##

Erupe: https://github.com/ZeruLight/Erupe


#1 Install related package

apt update && apt -y upgrade
apt -y install vim git p7zip-full
apt -y install golang-go && go version
apt -y install postgresql-16


#2 Create DB, change password and setup remote connection

Reference Docs:
https://www.server-world.info/en/note?os=Ubuntu_24.04&p=postgresql&f=1
https://www.server-world.info/en/note?os=Ubuntu_24.04&p=postgresql&f=2

su - postgres
createdb erupe
psql -d erupe
\password
\q

vim /etc/postgresql/16/main/postgresql.conf
> listen_addresses = '*'
vim /etc/postgresql/16/main/pg_hba.conf
> replace 127.0.0.1/32 with 0.0.0.0/0
systemctl restart postgresql


#3 Setup firewall on ubuntu & OCI

Reference Doc:
https://stackoverflow.com/questions/75487905/problems-connecting-to-remote-psql-on-linux-server

vim /etc/iptables/rules.v4
-A INPUT -p tcp -m state --state NEW -m tcp --dport 5432 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 53310 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 53312 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 54001 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 54002 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 54003 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 54004 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 54005 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 54006 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 54007 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 54008 -j ACCEPT

netfilter-persistent restart # Or you can just reboot
iptables -L


#4 Download & Unarchive Erupe & Quest files

git clone https://github.com/ZeruLight/Erupe.git
cd Erupe
wget https://files.catbox.moe/xf0l7w.7z
7z x xf0l7w.7z


#5 Setup DB

In this step, I use pgAdmin 4 windows version
Register Server > Restore DB with init.sql from the schema folder you have downloaded from github
Open Query tool with right click the "Schema" > update-schema > patch-schema > bundled-schema


#6 Config your server and start the server

Reference Docs:
https://github.com/ZeruLight/Erupe/wiki/Erupe-Configuration
https://github.com/ZeruLight/Erupe/wiki/Enumerations

vim config.json
# you need to change the Host IP to public IP if you're using the OCI
go run.
# After start the server, you can close the SSH session and the server will not stop


#7 Config DNS on your gaming desktop

Add DNS in hosts file:
<your server IP> erupe.custom
You can start your game and select custom server


#Notes: Clean and re-build the DB

su - postgres
dropdb erupe
createdb erupe


* 20241012 Known issue: delete public.distribution column "Data" manually or distribution will not work