This guide assumes you possess a low-moderate level of VM management, Linux/Debian and MySQL knowledge/experience, if you can't follow it please go and educate yourself more in these areas so you can understand its content. It is mainly aimed at people who may have an interest in beginning to develop with Awakening, so they can get a VM with the server software up and running on it.
Using this guide will give you a working system that will build and run the server code, but you’re on your own for tech support.
This guide is an edited version of a setup guide by the author of the SEMI-NERDLY blog over at: https://semi-nerdly.ca (no longer accessible).
An archive of the original blog post can be found here, I take no credit for his words, I have just made it a bit more up to date for the current version of Core3, and in my mind more streamlined. I also changed it from Devuan back to Debian 9.
Keep in mind that it’s not a good idea to use the generic passwords that are provided in this guide if the server will be remotely accessible, however make sure you remember the password if you use a different one than in the guide and update their references wherever needed.
Instructions
- Download and install VirtualBox
- Use version 5.2.16 in Window 10 Home 64Bit
https://www.virtualbox.org/wiki/Downloads
- Use version 5.2.16 in Window 10 Home 64Bit
- Download the “netinst” network installer image for Debian 9.12.0
- Direct File Download Link
https://cdimage.debian.org/cdimage/arch ... etinst.iso
- Direct File Download Link
- Open VirtualBox and create a new virtual machine.
- Click the New button
- Name: SWG Server Development
- Type: Linux
- Version: Debian 64bit
- Click Next
- 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.
- Click Next
- Create a new virtual hard disk now
- Create
- VDI (VirtualBox Disk Image)
- Next
- Dynamically allocated
- Next
- 20GB
- Configure the settings of the new virtual machine.
- Click the settings button
- Shared Clipboard: Bidirectional
- CPU Slider: Set it to the max green area.
NOTE: The more CPUs that are exposed to the virtual machine the faster the compile time of the SWGEmu server. - Extended Features: Enable PAE/NX
- Paravirtualization Interface: Default
- Hardware Virtualziation: Enable VT-x/AMD-V and Enable Nested Paging.
- Video Memory: 64MB or more
- 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.
- Attached to: NAT
- Advanced: Port Forwarding
NOTE: This configuration will only allow you to connect to the server via the host machine, external machines will not be able to connect. If you want to make it publicly accessible that’s up to you to setup your networking in that way.
Shared Folders- To save some storage space and make tre management easier if you are likely to be doing client file development, you can have one folder to store the TRE files for both the game client and the server. All you have to do is share your development game client folder in Windows (right click the folder > Properties > Sharing Tab > Share button > choose “Everyone” in the drop down and click the Share button), then accessing that shared folder from Linux in the virtual machine. The Windows share will need to be given a name; I suggest calling it SWGShare. If you don't have a client setup for developing locally there is information on the one I use at point 14 of this post.
- Click the [+] button the right
- Folder Path: Other > Navigate to where you have the tre files for the client (for this guide use the default SWGEmu ones not SWGAwakening’s tre files)
- Folder Name: SWGShare
- Auto-mount ticked
- OK
- OK
- Install Debian Linux
- Make sure you are connected to the internet.
- Select your VM and click the Start button
- Select the Devices tab > Optical Drives > Choose disk image… navigate to where you saved the iso file for Debian, select it.
- Select the Machine tab > Reset > Reset
- 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
- 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 partition 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 (recommended for new users)
- Partitioning: Finish partitioning and write changes to disk
- Warning Message: Select Yes, press Continue again.
- *wait a while*
- Configure Package Manager: Say No to scanning another disc
- Select your country
- FTP Mirror: default Debian mirror
- 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
- *wait a while*
- sysvinit
- Grub boot loader: Yes
- Device for boot loader installation: /dev/sda (the VDI hard drive)
- Installation Complete: Continue and the system will reboot
- Configure the Sudo
- Open a terminal and add the swgemu user account to the sudoers file
- su
- *enter password for the root user account*
- apt-get install sudo -y
- visudo
- *arrow down to the line below root ALL=(ALL:ALL) ALL and type*
- swgemu ALL=(ALL:ALL) ALL
- *ctl+x, yes save the file, press enter*
- Exit terminal
- Open new terminal
- sudo apt-get update
- *enter password for the swgemu user account*
- The system is already up to date, due to the network installer downloading the latest versions of everything! This was just a test to make sure you have sudo permissions, if it didn’t work follow the steps above again, you made an error somewhere.
- Open a terminal and add the swgemu user account to the sudoers file
- Configure VirtualBox
- Install the system software we will need to use the VirtualBox Guest Additions
- Open a terminal
- sudo apt-get install build-essential dkms linux-headers-amd64 linux-headers-4.9.0-13-amd64
- In the VirtualBox window click Devices > Insert Guest Additions CDROM image…
- Applications Menu > File Manager
- In the File Manager click the CD icon that is labeled VBox_GAs… to mount the CDROM image.
- File > Open Terminal Here
- In the terminal type
- sudo sh VBoxLinuxAdditions.run
- reboot (Applications Menu > Logout > Restart)
- Login again, now you can copy and paste between host and guest.
- Open a terminal and add the user to the VirtualBox share group so it can access the Windows shared directory.
- sudo adduser $USER vboxsf
- reboot (Applications Menu > Logout > Restart)
- Login again, you should now have permissions to access the sf_SWGShare directory and files.
- Install the other software that is required and is available from Debian
- Open a terminal
- sudo apt install build-essential default-libmysqlclient-dev liblua5.3-dev libdb5.3-dev libssl-dev cmake git default-jre mariadb-server mariadb-client
- This will install a bunch of other packages automatically, which is normal/good.
- Open a terminal
- Clone the SWGEmu server software
- Open a terminal
- mkdir -p ~/workspace
- cd ~/workspace
- git clone http://review.swgemu.com/Core3
- *wait a while*
- NOTE: You now have one new directory with the SWGEmu software: /home/swgemu/workspace/Core3
- NOTE: Core3 is on the unstable branch by default.
- Open a terminal
- Configure and build SWGEmu
- Open a terminal
- cd ~/workspace/Core3/MMOCoreORB
- git checkout unstable
- git pull
- NOTE: You should have already been on the unstable branch and up to date.
- make -j4
- NOTE: Use make -j# where # is the number of cores you allocated to the virtual machine.
- *wait a while*
- Open a terminal
- Give the server access to the game client files
- The server references a significant amount of data directly from the files that get installed with the game itself (“TRE” files). As such, you will need to install SWG from your original CDs, download the official SWGEmu launcher, and run the launcher so it can update your SWG installation to be compatible with SWGEmu.
- As suggested in step 4, you can simply point your virtual machine to the Windows folder where you installed SWGEmu, thus granting the server access to the TRE files that it needs. Alternately you can open that shared folder from the VM and copy the TRE files into the VM itself. I’ll describe how to do both; you can choose which suits your needs.
- The windows share is automatically mounted at /media/sf_ SWGShare
- Open /home/swgemu/workspace/Core3/MMOCoreORB/bin/conf/config.lua (with the default text editor, Mousepad, by double clicking the file).
- Scroll down to
- TrePath = “/home/swgemu/Desktop/SWGEmu”
- TrePath = “/media/sf_ SWGShare”
- Save the file and close it.
- NOTE: TrePath = “/media/sf_ SWGShare” should specify the directory where the TRE files reside. E.g. if the tre files are in a sub directory called “tre” on the share, you would do TrePath = “/media/sf_ SWGShare/tre”
- Open a terminal
- mkdir ~/Desktop/SWGTRE
- cp -v /media/sf_ SWGShare /*.tre ~/Desktop/SWGTRE
- Specify where the tre files reside in the /home/swgemu/workspace/Core3/MMOCoreORB/bin/conf/config.lua as detailed above.
- 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. NOTE: Debian uses MariaDB, a fork of MySQL.
- Open up a terminal and configure the root password (to 123456). Initial password is blank. Answer Y to all questions.
- sudo mysql_secure_installation
- Create the database (if you copy and paste the following you may have to delete and redo the quotations manually, otherwise you can get bash: ”: command not found)
- echo "CREATE DATABASE swgemu;" | sudo mysql -uroot -p123456
- echo "GRANT ALL ON *.* TO swgemu@localhost IDENTIFIED BY '123456';" | sudo mysql -uroot -p123456
- echo "GRANT ALL PRIVILEGES ON swgemu.* TO swgemu@localhost;" | sudo mysql -uroot -p123456
- echo "FLUSH PRIVILEGES;" | sudo mysql -uroot -p123456
- Install the SWGEmu database templates
- mysql -p123456 -e source -e ~/workspace/Core3/MMOCoreORB/sql/swgemu.sql;
- mysql -p123456 swgemu -e source -e ~/workspace/Core3/MMOCoreORB/sql/datatables.sql;
- mysql -p123456 swgemu -e source -e ~/workspace/Core3/MMOCoreORB/sql/mantis.sql;
- NOTE: You can download MySQL Workbench to interface with the database in a graphical manner if you aren’t comfortable with the CLI.
- NOTE: If you are making the server accessible remotely (not just from 127.0.0.1) then you will need to update the IP address in the “galaxy” table to represent your set IP address.
- Open up a terminal and configure the root password (to 123456). Initial password is blank. Answer Y to all questions.
- Boot the server for the first time
- Open a terminal
- cd ~/workspace/Core3/MMOCoreORB/bin
- ./core3
- You will notice some error messages like the following, because only the planet Tatooine is enabled by default.
ERROR: Unable to load screenplay SidorasBey, zone rori is not enabled. - If all is well, you will see the following message:
- (47 s) [Core] initialized
- After that, the first time the server boots it will calculate the navigation meshes that are used by the AI, which can take a long time (and must be done for every planet).
- Open a terminal
- Configure the game client
This section assumes you know how to locate tre files and which ones you are using (by default this guide uses the SWGEmu tre files).
- Download this basic client to your host Windows machine, it's the framework of one I use to connect to my local test/development environment.
Google Drive Share Link:
https://drive.google.com/file/d/1kSeCXf ... sp=sharing
- Changing which tre files to use (not needed for this guide but useful for if you are going to be looking at other Core3 repositories:
- Open the swgemu.cfg.
- Edit the line that reads “.include "swgemu_live.cfg"”, exchanging “swgemu”, for “mtg” or “awakening” depending on which tre system you will be using for your server.
- NOTE: All *_live.cfg files are setup for the tre files used on each server variant as of 16/07/2020, they may need amending in the future if more tre files are added.
- Download this basic client to your host Windows machine, it's the framework of one I use to connect to my local test/development environment.
- Log into the server with the game client to create the admin account and begin being able to test
- Username: DevelopmentAdmin
- Password: 123456
- Log out and close the game.
- On the server in the VM, open a terminal and give the swgemu game account admin privileges
- mysql -p123456 swgemu -v -e "UPDATE swgemu.accounts SET admin_level='15' WHERE username='DevelopmentAdmin'"
- Log back into the game on the DevelopmentAdmin account and create a character that will now have “God Mode” privileges.
- Install useful software for development and management
If you plan on using this virtual machine as your development environment, then the following software might be helpful.
- MySQL management
- sudo apt install mysql-workbench
- Code merging software
- sudo apt install meld
- Git GUI software
- sudo apt install git-cola
- Geany lightweight text editor with IDE features
- sudo apt install geany
- Eclipse IDE (old version via package, new versions are available from their website)
- sudo apt install eclipse
- Atom text editor (get it from their website)
- MySQL management
That is all that is really needed to run a server. It should be noted that you can skip all the VirtualBox stuff and simply install Debian directly onto the hard drive of a real computer and then copy the TRE files from your desktop to your server using a USB stick. Nothing says you must use a virtual machine. Just remember you will need to make the server accessible to other PCs.
A BIG WARNING: I basically fumbled my way through the SQL portion of this guide – it “works”, but it is not my area of expertise. It is important to understand that, as with any public facing networked computer, you need to pay close attention to the configuration and security of your server. While this guide gets you a functioning SWGEmu server, it does that and ONLY that. There is no implied security of said server provided by this guide.