
SWGEmu Server Setup Reference
This reference is a little messy
Windows WSL2 Setup
Installing WSL2 on windows should be as simple as opening a powershell terminal as admin and typing wsl --install
. If it’s your first time installing, you’ll need to restart afterwords. See this guide for more details on installing. Below is a command reference for WSL. You want to open up a powershell console as admin and…
- Install WSL (if not already installed)
- Install your distro of choice (i’m using debian)
- If you already have a distro installed, you can delete/unregister it using the command below
- Follow the setup for your distro after it finishes installing (usually just creating a username/password)
Powershell commands to set up WSL:
# list current distro
# it will tell you if none are installed
wsl -l
# install latest debian
wsl --install -d debian
# delete (unregister) distro
# get the distro name using wsl -l
wsl --unregister <distroName>
WSL2 Debian SWGEmu Setup
Once the distro is installed successfully, switch over to the WSL console and run that as admin. Once you’re inside of WSL, you are just inside of your chosen distro and can begin linuxing! Now we will set up the server inside of our debian distro itself. You can try it with Docker Desktop for Windows, but to me that seemed slower. Also, if you ever want to set this up on a VPS or something, you won’t have Docker Desktop for Windows. Here’s what the process will be…
- Update/upgrade debian
- Install docker engine + docker compose for debian
- Clone the pSWG repo
- Copy TRE files from windows
- Build docker image via docker compose and run the docker image
- Build the SWGEmu code
- Test the server is working
WSL SWGEmu server setup debian guide:
# update & upgrade debian
sudo apt update -y && sudo apt upgrade -y
# install docker for debian following the guide:
# https://docs.docker.com/engine/install/debian/
# ensure you install docker-compose as well
# clone pSWG repo, checkout the dev branch
git clone https://github.com/pstrawberrie/pSWG.git
git checkout dev
# copy tre files from windows into the pSWG folder
# pSWG is forked from syndicate/aftermath... so you'll need either the syndicate or aftermath tre files
# on windows, my syndicate install is located at E:\SWGSyndicate - update this accordingly (/mnt/<driveLetter>/<installLocation>/*.tre)
# this might take a few seconds
cd ~/pSWG && mkdir -p tre
cp /mnt/e/SWGSyndicate/*.tre ~/pSWG/tre
# navigate to the docker folder, and build it with docker-compose
cd ~/pSWG/docker
sudo docker compose build
# start up the docker compose for the first time to make sure it's all good
sudo docker compose up
# if no errors, you can exit the docker compose with CTRL+C and then start it in detached mode
sudo docker compose up -d
# attach to the swgemu docker container in a new screen (we'll install screen) and build the swgemu code!
# if you've made it this far, the only reason a build might fail would probably be insufficient RAM or some hardware/docker limitation
# this will take a little while...
sudo apt install -y screen
screen -S swgemu
sudo docker compose attach swgemu
cd /build/pSWG/MMOCoreORB
make -j$(nproc)
# now detach from the swgemu screen with CTRL+A, D
# we need to get the IP of the WSL so that we can connect to the game
# make sure you have detached from all screens (CTRL+A, D)
# copy the ip address of your WSL (should be eth0), something like 172.22.218.115
ip addr
# finally, let's exec into the db container (default pass is 123456) and ensure that the galaxy address is set to the IP you just copied
sudo docker compose exec -it db mariadb -u swgemu -p
use swgemu;
update galaxy set address = 'IP_YOU_COPIED';
select * from galaxy; # so you can confirm the change
exit
# now reattach to your swgemu screen and start the server!
screen -r swgemu
cd /build/pSWG/MMOCoreORB/bin
./core3
# once the server starts, you can login!
# either set swgemu_login.cfg or configure whichever launcher you're using with the IP you copied from your WSL
# connect to your server with whichever launcher you're using
# hopefully everything works for you!
# To set yourself as admin, create your acocunt by logging in and then exit the game
# check out the SQL Reference for an example of how to set your account to admin
# one last thing to make sure: you need to have the following lines in your user.cfg file to be able to use admin commands:
# [ClientGame]
# 0fd345d9=true
# HAVE FUN!
Docker Reference
Docker compose start in detached mode:
cd ~/pSWG/docker
sudo docker compose up -d
Docker compose attach to swgemu
container:
sudo docker compose attach swgemu
Docker exec mariadb cli on db
container as user mariadb user swgemu
sudo docker compose exec -it db mariadb -u swgemu -p
SQL Reference
Basic syntax reminders:
show databases; -- show all databases
use swgemu; -- use a database
show tables; -- display existing tables on database
select * from tablename; -- show all column data from table
update tablename set columnname = 154; -- update single column
update tablename set columnname = 'superJohnson' where columnvalue = 'johnson'; -- update a column existing value
Logging into MariaDB SQL after fresh Install (user with sudo privileges)
sudo mariadb -u root
Creating a new DB
create database 'swgemu';
Creating a new User
create user 'swgemu'@localhost identified by '123456';
select user from mysql.user; -- check it worked
Granting DB Privileges to User
grant all privileges on swgemu.* to 'swgemu'@localhost;
flush privileges; -- make sure to do this to ensure the new privileges take effect
Importing a DB from SQL File
- this is done in linux/outside of the sql cli
mariadb -u john -p dbName < johnImport.sql # import the file 'johnImport.sql' as user 'john' into db 'dbName'
Exporting (dumping) into SQL File
- this is done in linux/outside of the sql cli
mariadb-dump -u bob -p dbName > bobDump.sql # dump data from db 'dbName' into file 'bobDump.sql' as user 'bob'
SWG SQL References
Set admin level for account johnson
:
update accounts set admin_level = 15 where username = 'johnson';
Linux Reference
Screen syntax:
screen -ls # list all screens, will also say (Attached) if this is your active screen
screen -S hello # start new screen with name 'hello'
screen -r hello # attach to existing screen 'hello'
# [CTRL+A, D] detaches from screen