SWGEmu – A Verbose Server Setup Guide (for Debian Linux)

I’ve seen a lot of people ask for a generic guide on how to setup a server and I’ve personally been asked many questions about the process over the years, so I decided that I would roll a server VM from scratch and document the entire process. Here is that document!

This is an intentionally verbose guide on how to download, install, and configure a SWGEmu server using a Windows host system, VirtualBox, and Debian Linux, because I hope doing this will help fill in the blanks left by other guides and tools on the subject. If you want to install the server on your server hardware directly, simply skip the VirtualBox stuff and install Debian using a CD or USB drive (and there are LOTS of guides on how to do that already). Hopefully the information provided here will be detailed enough to be useful when installing on any Linux distribution.

Tough Love Time:
Frankly and honestly, if you’re unable to follow this guide successfully, you don’t yet have enough knowledge to host or develop a server anyway. I’m not saying that you should give up, I’m saying that you should do your research on how to use Windows, Linux, VirtualBox, Git, MySQL, and so on until everything in this guide makes sense for you. I get a lot of questions from folks on this kind of thing, despite the fact that the answers are already out there on the internet for people to find. I’ve been using Windows and Linux every day since the 1990s so a massive amount of “tech stuff” is just part of my common knowledge base. Maybe you don’t have that background and that’s OK, but allow me to share with you that I got to my level of knowledge by reading web pages and books and by practicing what I read over and over again; I did not get here by pestering someone else to solve my problems for me. Don’t be a lazy pest, rather use all your problems as chances to learn something new and try your best to find the solution yourself – search, read, watch, learn! πŸ™‚

The main software/technologies used by SWGEmu:
– GNU/Linux
– C++
– Lua
– Java
– IDL Compiler
– Berkeley Database
– MySQL Database
– Boost library
– Zlib library
– Readline libary

Setup Steps:

1. Have a 64Bit Windows or Linux host system already running, with an AMD or Intel CPU that supports virtualization. This guide will focus on using a Windows host system.


2. Download and install the 64Bit (AMD64) version of VirtualBox from Oracle.


If you need help with this step, read the VirtualBox guides or watch the installation how-to video on YouTube.

3. Download the net-install iso image for the Debian 8 “Jessie” Linux Distribution.


4. Open VirtualBox and create a new virtual machine.
– Click the New button
– Name: My SWGEmu Server
– Type: Linux
– Version: Debian 64bit
– Memory: 2048MB minimum, more is better though, so use most or all of the green area if you won’t be doing much with the host system as well.
– Create a new virtual hard disk now
– VDI (VirtualBox Disk Image)
– Dynamically allocated
– 20GB

The final size of the VirtualBox image file will only be about 6GB on the disk, but it can expand up to 20GB without you neededing do anything, which is nice – probably unnecessary, but a nice potential time saver down the road.

5. Configure the setting of the new virtual machine.
– Click the settings button

General Window > Advanced Tab
– Shared Clipboard: Bidirectional

System Window > Processor Tab
– CPU Slider: Set it to the max green area.

If you have 6-8 CPUs available, but only 3 or 4 are showing in the green area, in my experience with AMD FX processors, it’s safe to use up to 4 of 6 or 6 of 8. More CPUs exposed to the virtual machine will reduce the compile time of the SWGEmu server considerably.

– Extended Features: Enable PAE/NX

System Window > Acceleration
– Paravirtualization Interface: Default
– Hardware Virtualziation: Enable VT-x/AMD-V and Enable Nexted Paging.

Display Window > Screen Tab
– Video Memory: 64MB or more

Storage Window
– This is where you can add “loop back file systems”, in the form of a new VDI files, which can be mounted in Linux as extra storage. The nice thing about Unix-like operating systems is that other devices, such as remote computers, other hard drives, or one of these loop back files, are seamlessly grafted onto the file system, so the OS treats it like any other part of the file system. You can use this for such things as using “mount bind in your fstab file” to put the Berkeley DB files for the server into their own file or just having a handy Linux formated backup file that is located on a different hard drive than the VDI file for your OS.
I personally have a small solid state drive (SSD), so I have my OS VDI file on the SSD with only a 512MB swap partition inside it to save space on the SSD. To augment the limited amount of swap space, I have another 8GB VDI file on my much larger normal hard drive, which acts as a Linux swap file. Linux allows for setting the priority of swap space, so it will first write to the fast 512MB on the SSD, and if that gets full it will use the slower, larger 8GB on the hard drive. Generally speaking, the swap space rarely gets used at all, even when compiling. There’s lots of powerful customization you can come up with here, if you’re willing to research on how to use it!

– Storage Tree: Click your FILENAME.vdi and if it is installed on an SSD, put a check in the Solid-state Drive box that pops up on the right side of the window.

Network Window > Adapter 1 Tab
– Attached to: Bridged Adapter

This will allow the virtual machine to get an IP address directly from your router, but we are going to setup a static ip address in Linix so that the game client can always find the server.

Shared Folders Window
– To save some sanity and storage space, you can have one folder to store the TRE files for both the game client and the server. It’s really easy to do by first sharing the game client folder in Windows, then accessing that shared folder from Linux in the virtual machine. Search for a guide on how to share a Windows folder if you don’t know how to do it. The Windows share will need to be given a name, I suggest calling it SWGEmu.

– Click the [+] button the right
– Folder Path: Other > Navigate to where you have SWGEmu installed > OK > OK

6. Install Debian Linux
– Make sure you are connected to the internet and that you can download upto 4GB of data!
– Select your VM and click the Start button
– In the Select Startup Disk window, navigate to where you saved the iso file for debian, select it, press Open, press Start

For anyone who wants to use Debian 8 without running SystemD, now is the time to prevent its use. From the initial Debian welcome screen, use the keyboard arrow keys to select Graphical Install, hit the TAB key, and append the following preseed line at the end of the boot command:

preseed/late_command=”in-target apt-get install -y sysvinit-core”

This will allow the systemd libraries to be installed so that any software that needlessly depends upon it (bluetooth, pulse audio, etc…) will still work, but the system will but using the much faster and easier to maintain “sysV5 init” system.

– Use the keyboard arrow keys to select Graphical Install and hit the Enter key.
– Language: Select yours!
– Country: Select yours!
– Keyboard Config: American English is the default
– *wait a while*
– Host Name: swgemu (or any other single word you’d like)
– Domain name: leave it blank
– Root Password: 123456 or anything else you would like. πŸ™‚
– Username: swgemu
– Username for account: swgemu
– User password: 123456 or anything else you would like. πŸ™‚
– Timezone: Select yours!
– Partitioning: Guided – Use entire disk

If you know lots about Linux or you want a custom partion setup, this is the step where you can set that up. There are lots of guides on the internet to help you with this step. However, the default “Guided – Use entire disk” will suffice!

– Hard disk selection: It’s the VDI you created earlier, so just click continue.
– Partitioning: All files in one partition (recomended for new users)
– Partitioning: Finish partitioning and write changes to disk
– Warning Message: Select Yes, press Continue again. πŸ™‚
– *wait a while*
– Configure Package Manager: Select your country
– FTP Mirror: ftp.[two letter contrycode].debian.org
– HTTP Proxy: Generally speaking, leave this blank. If you need to setup such a thing, look up how to do so on the internet.
– *wait a while*
– Popularity Contest: No
– Software Selection: Debian desktop environment, Xfce, standard system utilities

You could pick a different desktop environment, but the only ones I would personally use on a server or workspace VM are Xfce, MATE, or LXDE (in that order), because they don’t use a lot of resources. Xfce is GREAT, because it can be configured to look like any other OS, while also using very little RAM and CPU time.

– *wait a while*
– Grub boot loader: Yes
– Device for boot loader installation: /dev/sda (the VDI hard drive)
– Installation Complete: Continue and the system will reboot
– First system boot: login with swgemu / your password
– Toolbar config popup: Use default

The bottom panel with the large icons isn’t something I use, so I just delete it:
– Right click > Panel > Panel Preferences…
– Click the [-] button beside the Panel 2 drop down window to remove the panel.

Feel free to apply any other personalizations you want at this point. There are lots of guides on how to customize Xfce, with themes, artwork, etc.

Command Line and Software Info:

I will write out what to type. Press the Enter key after each command.
For installing software using the apt-get program, you must be or act as the root user. To access the root user, either log into that account or open a terminal window (Applications Menu > Terminal Emulator) and use the “su” command to become root in that window.

Linux uses a nifty system where most of the software uses a common set of libraries (of programming routines commonly referred to as “code”) that are available to the computer as whole, rather than stuffed into a single program’s folder. This is nice, because additional functionality can be added to the whole system by downloading (or making!) new libraries and fixing security issues means only updating the library in question, rather than updating every individual program that uses said library. Anyhow, at this point we will install all the libraries and programs that SWGEmu uses.

In Debian Linux, software is installed most often using the apt-get program on the command line. This will pull in pre-compiled and configured software that will work on your system from a repository created and maintained by the kind folks who work on Debian. Anything that we need that is not offered in the Debian repo will be downloaded from the main host, compiled, and installed. Sometimes this manual installation is required, because the Debian repo has an older or newer version of software than what is compatible with SWGEmu.

7. Upate the system:

apt-get update

8. Install the GCC Compiler, its toolchain, and dkms.

We need GCC to build SWGEmu, but before hand we will need to build other software, including the VirtualBox Guess Additions. The easiest way to install it in Debian is to use the shortcut:

apt-get install build-essential

DKMS is required for the VirtualBox Guest Additions:

apt-get install dkms

Users of other Linux distros will need to know the software installed by build-essential, so I have listed them below. You can reference the package names on the Debian repo website to learn exactly what versions of the software are being installed. You can get it using the tools provided to you in your distro of choice (YUM, RPM, Slack-Builds, source code, etc).

binutils dpkg-dev fakeroot g++ g++-4.9 gcc gcc-4.9 libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan1 libatomic1 libc-dev-bin libc6-dev libcilkrts5 libdpkg-perl libfakeroot libfile-fcntllock-perl libgcc-4.9-dev libitm1 liblsan0 libstdc++-4.9-dev libtsan0 libubsan0 linux-libc-dev make manpages-dev

9. Install VirtualBox Guest Additions

Guest Additions allow copy/paste to work to and from the Windows/Linux as well as the ability to mount the Windows shared folder. Very handy to get this working now.

– VirtualBox Window Frame > Devices > Insert Guest Additions CD Image
– Double click on the CD icon that appears on the desktop
– In the file manager window click File > Open Terminal Here
– Type: su and press the Enter key. Enter the root user password and press the Enter key.
– Type: bash VboxLinuxAdditions.run and press the Enter key
– *wait a while*
– Reboot and log back in.

10. Install SWGEmu dependencies from the Debian repos.
– Open the command prompt and install the following packages using apt-get install
– Packages in brackets are installed automatically

autoconf (automake autotools-dev)
gdb (gdb gdbserver libc6-dbg)
libtool (libltdl-dev)
mysql-server-core-5.5 (libaio1)
mysql-server-5.5 (libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18 libterm-readkey-perl mysql-client-5.5 mysql-common)

– You will be prompted for a root password for the MySQL Server. Remember it! 12345678 works well.

(libboost-doc libboost1.55-doc libboost-atomic1.55-dev libboost-chrono1.55-dev libboost-context1.55-dev libboost-coroutine1.55-dev libboost-date-time1.55-dev libboost-exception1.55-dev libboost-filesystem1.55-dev libboost-graph1.55-dev libboost-graph-parallel1.55-dev libboost-iostreams1.55-dev libboost-locale1.55-dev libboost-log1.55-dev libboost-math1.55-dev libboost-mpi1.55-dev libboost-mpi-python1.55-dev libboost-program-options1.55-dev libboost-python1.55-dev libboost-random1.55-dev libboost-regex1.55-dev libboost-serialization1.55-dev libboost-signals1.55-dev libboost-system1.55-dev libboost-test1.55-dev libboost-thread1.55-dev libboost-timer1.55-dev libboost-wave1.55-dev libboost1.55-tools-dev libmpfrc++-dev libntl-dev)

Tip: libdb5.3 can be a funky one that is best installed with Aptitude rather than apt-get. May as well reinstall it now for good measure.

aptitude reinstall libdb5.3

Users of other distros can reference the Debian 8 package website for details on these packages.

11. Install Lua 5.3 from source.

Lua 5.3
– Open terminal and make a new junk folder called tmp

mkdir tmp
cd tmp

– Download

wget http://www.lua.org/ftp/lua-5.3.3.tar.gz

– Unpack

tar xzf lua-5.3.3.tar.gz

– Compile and install

cd lua-5.3.3
[enter root password]
make linux install

12. Clone the SWGEmu repos.

SWGEmu has two parts, “Core3” that contains all the game specific programming, and “MMOEngine” which handles more low level things. Core3 is open sourced, while MMOEngine is only partly so. We will use Git to clone the repositories after we create some directories to put them in.

cd ~
mkdir git
cd git
git clone http://review.swgemu.com/p/PublicEngine.git
*wait a while*
git clone http://review.swgemu.com/p/Core3.git
*wait a while*

You now have two new directories with the SWGEmu software:

13. Configure the environment.

Some manual configuration is required so that the software can find all its parts when you compile it. We need to…

– Build the idl compiler and put it in the system path

cd PublicEngine/MMOEngine
chmod +x bin/idlc
[Enter system root password]
cp bin/idlc /usr/local/bin/idlc
exit (to leave the su “super user” level of the terminal)

– Add the idl compiler to the class path so Java can find it

echo ‘export CLASSPATH=”/home/swgemu/git/PublicEngine/MMOEngine/bin/idlc.jar”‘ >> /home/swgemu/.profile

– Reload your profile so it picks up the CLASSPATH without needing to reboot

source ~/.profile

– Add a symbolic link to MMOEngine so Core3 can find it

cd ~/git/Core3
ln -s ../PublicEngine/MMOEngine MMOEngine

14. Configure and build SWGEmu

In the terminal…

cd ~/git/Core3/MMOCoreORB
git checkout unstable
git pull
make config
make build

– If a dep is missing, as you will be able to acertian from the error message, install it and then…

make clean
make config
make build

15. Create a simple command line build script.

While you can continue to simply cd into the MMOCoreORB directory and type “make build” to compile the software, some folks prefer doin using Eclipse or a bash script to compile it. I prefer the bash script method, as you can type it from any location on the command line and times how long the compilation takes. The script I use was provided by Scurby.

– Tells how long the compilation took.
– Automatically maxes out multi-threaded compiliation

build (runs what is needed to build!)
build configure (creates initial makefile config)
build clean (removes any previously compiled object code)
build idl (only recomiples the idl based code)

– Create the script file in a text editor

Application Menu > Accessories > Mousepad


# build – simple command line build script

cd ~/git/Core3/MMOCoreORB
export CLASSPATH=/home/swgemu/git/Core3/MMOEngine/bin/idlc.jar


# Just in case they’ve not ran config yet
if [ ! -f build/unix/config.log ]; then

case $EXTRA in
config ) make config; make clean ;;
clean ) make clean ;;

# Always run build
if make -k build; then
exit 0

# opps.
echo “** BUILD FAILED **”
exit 1

######## End of File

– Save the file

File > Save
Click swgemu on the left
Click the Create Folder button, name it bin, and hit the Enter key to enter the folder
Name: build
Click the save button

– Open a terminal and make the file exicutable

chmod +x ~/bin/build

– Reload your profile so it picks up you custom bin directory without needing to reboot

source ~/.profile

16. Install and configure Sudo

Until this point we have been using the su command to become the root or “super user” on the command line. If you would like, you can install a program called sudo which will allow you to issue single commands as root, rather than opening a whole terminal session as root. Both methods will ask you for the password, so really it’s a toss up as to which is faster. I’m having you install sudo to allow you to use an alias to mount the shared folder quickly.

[enter root password]
apt-get install sudo

– In the text file that opened in the program called nano, arrow down to the line below root ALL=(ALL:ALL) ALL and type

swgemu ALL=(ALL:ALL) ALL

– Save the file
Press CTL+X
Type y and hit enter
hit enter again

Now you can issue root (super user) only commands by typing: sudo [command]

17. Access the Windows shared folder.

Virtualbox can automatically mount the Windows shares it knows about, but I find that it makes the mount directory name something strange hard to redeemer. Therefore, I always manually mount it in /media/share! It’s easy to do it by typing a simple command every time you boot your server OS or you could have Linux do it automatically by adding the correct entries to the /etc/fstab file. I’ll show you how to mount it with a command and how to make an alias for the command.

– Create the destination directory.

sudo mkdir /media/share

– Create a handy alias for mounting called mountshare, assuming you named the Windows share SWGEmu.

echo “alias mountshare=’sudo mount -t vboxsf SWGEmu /media/share'” >> ~/.bashrc

– Reload your bashrc so it picks up you custom bin directory without needing to reboot

source ~/.bashrc

– Mount the share

[enter root password when prompted]

– Check that it is mounted

df -h

You will see it listed as something like:
SWGEmu 383G 231G 152G 61% /media/share

18. Point the server to the TRE files.

This is pretty easy, as the TRE files are in the game folder in Windows and we mounted that in our Linux system at /media/share. So, we just need to edit the config file on the server.

– Open /home/swgemu/git/Core3/MMOCoreORB/bin/conf/config.lua

– Scroll down to TrePath = “/home/swgemu/Desktop/SWGEmu” and change it to

TrePath = “/media/share”

– Save the file and close it

19. Set a static IP Address

– In Windows open a command prompt

Start > Search Box > Type cmd > Hit the Enter Key

– Get your computer’s IP address


In the output, look for the heading Ethernet adapater Local Area Connection. Under it you will find your IPv4 address, which could look like or or on most home networks. The fist three numbers in those chains are the network address and the last number is your computer on the network. Your router (also referred to as a ‘gateway’) is most often the first device on the network, so its number would look like or etc. For your Linux VM, you want to use a unique number that won’t be used by another device as well. 87 is a safe bet!

– In Linux, create the static IP address, being sure to edit the correct ip addresses for your network (you can for the netmask 99.9% of the time).

Toolbar (Top-Right corner of the screen) > Right Click Network Icon > Edit Connections
Left Click Wired Connection 1 > Click Edit button
IPv4 Tab > Method: Select Manual
Click Add button beside the address and enter your network details, such as:

DNS Servers:

Click the save button
Close the network connection window
Left click on the Network icon on the toolbar and click Disconnect
Left click on the Network icon on the toolbar and click Wired connection 1 to reconnect using your new settings.

– If you’re using a different Linux disto that doesn’t have the network GUI you can try…

[Enter root password]
echo $’\niface eth0 inet static’ >> /etc/network/interfaces
echo “address” >> /etc/network/interfaces
echo “netmask” >> /etc/network/interfaces
echo “gateway” >> /etc/network/interfaces
/etc/init.d/networking reload

20. Configure the MySQL database server.

SWGEmu uses two database technologies, MySQL and Berkeley. The MySQL server is used to store account related information, such as character names, passwords, permission levels, and other various other bits of data. The majority of the “game data” that makes up the world, such as quest states, event timers, inventories, etc. is stored in a series of Berkeley database files. You don’t need to configure anything for the Berkeley DB, but you do need to setup the MySQL DB.

– Open up a terminal and type:

[Enter the system root password]
echo “mysql-server mysql-server/root_password password root” | debconf-set-selections
echo “mysql-server mysql-server/root_password_again password root” | debconf-set-selections
/etc/init.d/mysql start
exit (to exit the root prompt)

– Create the database
echo ‘CREATE DATABASE swgemu;’ | mysql -uroot -p123456

– Create the server user
echo ‘GRANT ALL ON *.* TO `swgemu`@`localhost` IDENTIFIED BY “123456”;’ | mysql -uroot -p123456

– Install the SWGEmu database templates

mysql -p123456 -e source -e ~/git/Core3/MMOCoreORB/sql/swgemu.sql;
mysql -p123456 swgemu -e source -e ~/git/Core3/MMOCoreORB/sql/datatables.sql;
mysql -p123456 swgemu -e source -e ~/git/Core3/MMOCoreORB/sql/mantis.sql;
mysql -p123456 swgemu -e source -e ~/git/Core3/MMOCoreORB/sql/updates/account_ips.sql;
mysql -p123456 swgemu -e source -e ~/git/Core3/MMOCoreORB/sql/updates/deletedcharacters_add_dbdeleted.sql;

– Update the server IP address in the SQL database

mysql -p123456 swgemu -v -e “update galaxy set address=’′”

21. Boot the server for the first time.

I always use a simple bash script for this, so I can launch it from anywhere. All the script does is the same as what you can do in the terminal:

cd ~/git/Core3/MMOCoreORB/bin

If all went well, after a while the server output will read (# s) [Core] initialized

22. Log into the server with the game client to create an admin account.

– Edit you swgemu_longin.cfg file


– Run the client

Double click SWGEmu.exe
User Name: swgemu
Password: 123456

– Log out before creating a character

– Save the server state

In the terminal where the server is running type save and hit enter. After a few seconds it will stop making output. Kill the server with CTL+C.

23. Give the swgemu account admin privileges

– Access the MySQL prompt and enter a query

mysql -p123456 swgemu
UPDATE swgemu.accounts SET admin_level=’15’ WHERE username=’swgemu’

24. Reboot the server, log into the game, make a character.

You now have a functioning SWGEmu server, client, and in game admin account.

25. Optional: Install development software

If you plan on using this virtual machine as your development environment, then the following software might be helpful.

– MySQL management

apt-get install mysql-workbench

– Code merging software

apt-get install meld

– Git GUI software

apt-get install git-cola

And… that’s it! πŸ™‚