Friday, June 19, 2020

Simple guide to create a self hosted SWG server on Ubuntu 18 using SWGEmu (update 2020)

If you want to set up your own Star Wars Galaxies dev environment on SWGEmu, it's pretty straightforward. There's a lot of info out there, and this doesn't cover all of it, but it's a simple how-to that allows you to log in and play around.


We're going to use Virtualbox and Ubuntu 18 Server. You will need to install SWGEmu beforehand. We will also create a shared folder with the host in order to copy needed game world, so Virtualbox Guest Additions is required

Install Ubuntu 18 Server with a static IP and at least 4 CPU cores and 4GB RAM (the more, the better).


Find the SWGEmu Folder location by going to SWGEmu Launchpad > Settings > Options and note the location.


 For this install, the location is C:/Program Files/SWGEmu

Create a shared folder in Virtualbox with that location.


Check "Read-Only" "Auto-Mount" "Make Permanent" and set the mount point to /var/swgtre
This is where we will set the map world location. (alternatively you can just copy the TRE files to the server)

Now we're ready to power on the VM and set up the server.

Install Virtualbox Guest Additions

sudo apt install -y build-essential dkms linux-headers-$(uname -r)
sudo mkdir -p /mnt/cdrom && sudo mount /dev/cdrom /mnt/cdrom 2> /dev/null
cd /mnt/cdrom && sudo sh ./VBoxLinuxAdditions.run --nox11
sudo usermod -G vboxsf -a $USER
sudo reboot

Verify you have access to the share
ls /var/swgtre

  Install dependencies


sudo apt-get update && sudo apt install -y build-essential libmysqlclient-dev liblua5.3-dev libdb5.3-dev libssl-dev cmake git default-jre mariadb-server-10.1 mariadb-server-core-10.1

Create the working environment


mkdir ~/swg && cd ~/swg
git clone http://review.swgemu.com/Core3
cd ~/swg/Core3/MMOCoreORB
GETC=$(cat /proc/cpuinfo | grep processor | wc -l) && make -j$GETC
(This will take a long time to finish)

 

Point the world maps to the share

sed -i 's/TrePath \= \"\/home\/swgemu\/Desktop\/SWGEmu\"\,/TrePath \= \"\/var\/swgtre\"\,/g' $HOME/swg/Core3/MMOCoreORB/bin/conf/config.lua

 

Set up the database

cd ~/swg && sudo mysql_secure_installation
Existing password blank, enter 123456 for the new password.

echo 'CREATE DATABASE swgemu;' | sudo mysql -uroot -p123456
echo 'GRANT ALL ON *.* TO 'swgemu'@'localhost' IDENTIFIED BY "123456";' | sudo mysql -uroot -p123456
sudo mysql -p123456 -e source -e ~/swg/Core3/MMOCoreORB/sql/swgemu.sql;
sudo mysql -p123456 swgemu -e source -e ~/swg/Core3/MMOCoreORB/sql/datatables.sql;
sudo mysql -p123456 swgemu -e source -e ~/swg/Core3/MMOCoreORB/sql/mantis.sql;
ips=$(ip -o addr show up primary scope global | while read -r num dev fam addr rest; do echo ${addr%/*}; done) && echo $ips
sudo mysql -p123456 swgemu -v -e "update galaxy set address='$ips'"

Run the server


cd ~/swg/Core3/MMOCoreORB/bin
./core3

Create a SWGEmu Launchpad 

Add the IP to your server

Log into the server as an admin 

Use the username:

swgadmin/testing

Create a player, then disconnect, log out and close the game. Also, kill the process for the server in the terminal with ctrl-c.

Update the admin user



sudo mysql -p123456 swgemu -v -e "UPDATE swgemu.accounts SET admin_level='15' WHERE username='swgadmin'"

Run the server again

cd ~/swg/Core3/MMOCoreORB/bin
./core3



That's it. You should have a test environment to play around in. This guide is nowhere near ready for you to host this outside of your network but should be fine for testing. Further information can be found at the official SWGEmu site.