Skip to content
Written: May 15, 2025 by pstraw

SWGEmu Server Setup Reference

Jump to
This reference may be missing information

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>

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. Here’s what the process will be…

  • Update/upgrade debian
  • Clone the pswg repo
  • Copy TRE files from windows
  • 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

# clone pSWG repo, checkout the dev branch
cd ~
git clone https://github.com/pstrawberrie/pswg.git
git checkout dev

# copy tre files from windows into the pswg folder
# pSWG is forked from core3... so you'll need the default SWGEmu tre (client) files
# on windows, my syndicate install is located at E:\pSWG - update this accordingly (/mnt/<driveLetter>/<installLocation>/*.tre)
# this might take a few seconds
cd ~/pswg && mkdir -p tre
cp /mnt/e/pSWG/*.tre ~/tre

# follow the "linux manual build instructions" from the core3 repo to get debian set up
# https://github.com/swgemu/Core3?tab=readme-ov-file#linux-manual-build
# recommended to set up the db BEFORE building the code/starting the server, or you may not be able to delete characters

# set up the swgemu db user
sudo mariadb -u root
create user 'swgemu'@localhost identified by '123456';
grant all privileges on swgemu.* to 'swgemu'@localhost;
flush privileges;
exit

# create the swgemu db
sudo mariadb -u swgemu -p # default password 123456
create database swgemu;
exit

# import the swgemu sql file into the db
cd ~/pswg/MMOCoreORB/sql
mariadb -u swgemu -p swgemu < swgemu.sql
mariadb -u swgemu -p
use swgemu;
show tables; # confirm the swgemu tables are populated

# we need to get the IP of the WSL so that we can connect to the game
# copy the ip address of your WSL (should be eth0), something like 172.22.218.115
ip addr

# ensure that the galaxy address in the DB is set to the IP you just copied
mariadb -u swgemu -p
use swgemu;
update galaxy set address = 'IP_YOU_COPIED';
select * from galaxy; # so you can confirm the change
exit

# build the code
cd ~/pswg/MMOCoreORB
make -j$(nproc)

# now start the server!
cd ~/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!

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

Enable Error logs in MariaDB after fresh install

nano /etc/mysql/mariadb.conf.d/50-server.cnf
# uncomment the log_error line

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

Docker Reference

Docker compose start in detached mode:

cd ~/swgproject/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

Troubleshooting

First Steps

If the server has been shutdown without the shutdown command, this can cause things to break. Be sure to always shut down the server with the shutdown command and NOT by killing the process with ctrl+c!!

Nuking

The easiest way to nuke the server is to simply delete the entire code folder as well as the database ie:

rm -rf ~/pswg
mariadb -u swgemu -p
> drop database swgemu;
  • MAKE SURE YOU BACK UP YOUR TRE FILES!!
  • After that, just follow the install steps again

Can’t Delete Characters

This seems to be an issue with the SQL setup. As of this guide, the swgemu.sql file includes all necessary tables for deleting characters. The issue is most likely the way the database was setup or if the server was shut down without the shutdown command. Ensure that you have correctly imported the swgemu.sql file.