SWGEmu Core3– 2021 Verbose Server Setup Guide (for Debian 9 guest and Windows 10 host)

Games guides for SWG
User avatar
Cyclone
Administrator
<b>Administrator</b>
Posts: 511
Joined: Thu Mar 29, 2018 1:41 am
Location: Australia

Unread post

SWGEmu Core3 Simple Server Setup using Debian 9.12.0

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
  1. Download and install VirtualBox
  2. Download the “netinst” network installer image for Debian 9.12.0
  3. 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
    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 needing do anything in the future.

  4. Configure the settings of the new virtual machine.
    • Click the settings button
    General > Advanced Tab
    • Shared Clipboard: Bidirectional
    System > Processor Tab
    • 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
    System > Acceleration Tab
    • Paravirtualization Interface: Default
    • Hardware Virtualziation: Enable VT-x/AMD-V and Enable Nested Paging.
    Display > Screen Tab
    • Video Memory: 64MB or more
    Storage
    • 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 > Adapter 1 Tab
    • Attached to: NAT
    • Advanced: Port Forwarding
    Image

    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

  5. 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

  6. 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.

  7. 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.

  8. 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.

  9. 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.

  10. 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*

  11. 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.
    Pointing to the TRE files on the Windows host system:
    • 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”
      and change it to
      • 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”
    Copying the TRE files into the virtual machine:
    • 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.

  12. 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.

  13. 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).

  14. 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).
    Extract the ZIP to a folder wherever you would like. This client, as of writing, is a simple client framework to connect to a locally hosted server, whether that be an Awakening based server, SWGEmu based server or MTG based server. You just need to drop in the tre files in the corresponding tre*** folder (e.g. treswgemu, tremtg and/or treawakening) and run the SWGAwakening.exe. By default, the client is configured to use the 127.0.0.1 IP and 44453 port (to change this edit the local_login.cfg) as well as the default SWGEmu tre files (to change this edit the swgemu.cfg as detailed below).
    • 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.

  15. 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.
  16. 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)

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.


Cyclone
SWG Awakening Administrator and Community Support Team Lead
Rules & Policies | ToS | Play Now | Awakening Discord | Events
User avatar
Cyclone
Administrator
<b>Administrator</b>
Posts: 511
Joined: Thu Mar 29, 2018 1:41 am
Location: Australia

Unread post

Update Log
February 16 2021 - linux-headers-4.9.0-11-amd64 changed to linux-headers-4.9.0-13-amd64 for the VirtualBox Guest Additions (thanks Asnokat for letting me know).


Cyclone
SWG Awakening Administrator and Community Support Team Lead
Rules & Policies | ToS | Play Now | Awakening Discord | Events
User avatar
retikulatus
Newbie
Newbie
Posts: 2
Joined: Sat Mar 20, 2021 5:35 pm

Unread post

That is simply awesome!
/deepbow Cyclone

i will use your astonish guide to try to make a server with (real , no VM) debian 10 as server and use it on another computer with windows swg client, so , everybody at my home will have the opportunity to try it on lan party :)
mega thanks, indeed!
kind regards from Guadeloupe


User avatar
retikulatus
Newbie
Newbie
Posts: 2
Joined: Sat Mar 20, 2021 5:35 pm

Unread post

Dear Cyclone,

i actually use your guide and the one from ModTheGalaxy
I am actually trying to use a windows 10 client computer to access my VM 9.8 Debian server hosted on a Debian 10 computer....

As the ip address of my server host is 192.168.1.10, do I need to change, in the "config.lua" file, the "DBHost = "127.0.0.1", to "DBHost = "192.168.1.10", and the MantisHost as well?
doing that create problems with authentication when starting core3:
“ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be load ed: /usr/lib64/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory\”
I had to upgrade to mariadb >10.1 (10.5) to be able to write :
ALTER USER 'root'@'localhost' IDENTIFIED VIA mysql_native_password USING PASSWORD('******');
then i have :
[MySqlDatabase0] ERROR - 1045: Access denied for user 'swgemu'@'linux-1.home' (using password: YES)
It is a never ending story...:/
when sticking with DBHost and MantisHost to 127.0.0.1 , the core3 initialize correctly but i cannot join the galaxy ( even if i have set the right IP accordingly to your guide in the swgemu galaxy database).
I really don't know what to do as nobody answer me on the MtG forum nor the swgemu one...

[EDIT]
i am now able to access the galaxy with my windows 10 computer client.
Creating an account works fine, but creating a character result with the following message:
[MySqlDatabase0] ERROR - DatabaseException caused by query: INSERT INTO `characters_dirty` (`character_oid`, `account_id`, `galaxy_id`, `firstname`, `surname`, `race`, `gender`, `template`) VALUES (281474993910192,1,2,'Vigi','Bebi',0,0,'object/creature/player/human_male.iff')
1364: Field 'creation_date' doesn't have a default value

i am trying to solve this problem with this guide but i am open to suggestions as well! :)
https://ourcodeworld.com/articles/read/ ... ault-value


Thank you
kind regards from Guadeloupe


User avatar
Cyclone
Administrator
<b>Administrator</b>
Posts: 511
Joined: Thu Mar 29, 2018 1:41 am
Location: Australia

Unread post

I'm glad you have found the guide useful. Out of interest what was the issue you had with connecting to the server? Was it user error or a matter of the guide detailing something incorrectly for your case?

Also, it probably just isn't inputting a creation date by default by the looks of things for the error on the character. I am no MYSQL wizard, if you can get in to play and experience no other issues I wouldn't worry about it too much. I didn't experience the issue myself, and since your intended use isn't for Awakening development unfortunately I won't be supplying any troubleshooting help as I don't really have the time. I hope you get it sorted though!


Cyclone
SWG Awakening Administrator and Community Support Team Lead
Rules & Policies | ToS | Play Now | Awakening Discord | Events
User avatar
oNdsen
Newbie
Newbie
Posts: 5
Joined: Thu Dec 17, 2020 6:02 pm

Unread post

retikulatus wrote: Thu Mar 25, 2021 10:58 pm [MySqlDatabase0] ERROR - DatabaseException caused by query: INSERT INTO `characters_dirty` (`character_oid`, `account_id`, `galaxy_id`, `firstname`, `surname`, `race`, `gender`, `template`) VALUES (281474993910192,1,2,'Vigi','Bebi',0,0,'object/creature/player/human_male.iff')
1364: Field 'creation_date' doesn't have a default value
can you please check if the default value (column_default) in the database itself is set correctly for creation_date?
looks like the mysql update has removed the default value. maybe you need to alter the table again after update.


User avatar
mdhogan
Newbie
Newbie
Posts: 2
Joined: Mon Feb 24, 2020 7:15 pm

Unread post

My launcher (SWGEmu-MTG-Awakening Local Dev Clien) stopped working today. I am getting this error when try to launch. Nothing has changed since yesterday. Any ideas?

automated crash dump from SWGAwakening.exe stage.119798


SWGAwakening.exe: stage.119798
unknown location : FATAL 4d962776: appearance/defaultappearance.apt could not be found. Are your paths set up correctly?


Ram: 2047mb
Os1: 6.2.9200
Os2: Unknown
NumProc: 4
GameFeatureBits: 1111111111111111
SubscriptionFeatureBits: 1


User avatar
Cyclone
Administrator
<b>Administrator</b>
Posts: 511
Joined: Thu Mar 29, 2018 1:41 am
Location: Australia

Unread post

mdhogan wrote: Fri Sep 09, 2022 5:32 pm My launcher (SWGEmu-MTG-Awakening Local Dev Clien) stopped working today. I am getting this error when try to launch. Nothing has changed since yesterday. Any ideas?

automated crash dump from SWGAwakening.exe stage.119798


SWGAwakening.exe: stage.119798
unknown location : FATAL 4d962776: appearance/defaultappearance.apt could not be found. Are your paths set up correctly?


Ram: 2047mb
Os1: 6.2.9200
Os2: Unknown
NumProc: 4
GameFeatureBits: 1111111111111111
SubscriptionFeatureBits: 1
First of all, we haven't changed anything on our end so it wouldn't be us that caused it if you're trying to connect to the Awakening server with the client. What is the contents of your "*.cfg" files? Also are all the tre files all still present? Feel free to PM me on Discord. I am most active there. Also is this for playing on Awakening or just connecting to your own private server setup?


Cyclone
SWG Awakening Administrator and Community Support Team Lead
Rules & Policies | ToS | Play Now | Awakening Discord | Events
User avatar
dbithead
Newbie
Newbie
Posts: 3
Joined: Mon Sep 25, 2023 5:36 pm

Unread post

At ,/core3 boot up I got:
22 s) [MySqlDatabase0] connecting to 127.0.0.1:3306...
(22 s) [MySqlDatabase0] ERROR - 1045: Access denied for user 'swgemu'@'localhost' (using password: YES)
(22 s) [Core] FATAL - 1045: Access denied for user 'swgemu'@'localhost' (using password: YES)


User avatar
dbithead
Newbie
Newbie
Posts: 3
Joined: Mon Sep 25, 2023 5:36 pm

Unread post

Maybe we can all install core3 or maybe this is the purview of the intellectual elite. We can only hope one of the great gods deems us fit to play SWG and lends a helping hand once in a while.


User avatar
Cyclone
Administrator
<b>Administrator</b>
Posts: 511
Joined: Thu Mar 29, 2018 1:41 am
Location: Australia

Unread post

dbithead wrote: Tue Sep 26, 2023 2:22 am At ,/core3 boot up I got:
22 s) [MySqlDatabase0] connecting to 127.0.0.1:3306...
(22 s) [MySqlDatabase0] ERROR - 1045: Access denied for user 'swgemu'@'localhost' (using password: YES)
(22 s) [Core] FATAL - 1045: Access denied for user 'swgemu'@'localhost' (using password: YES)
This means either the password is incorrect or that specific user hasn't been setup to access that database properly. Revisit step 12 in the guide. Please also note, this guide is likely out of date for the most up to date SWGEmu unstable code.

Refer to the readme for this repo for up to date setup instructions if you have issues with this guide: https://github.com/swgemu/Core3


Cyclone
SWG Awakening Administrator and Community Support Team Lead
Rules & Policies | ToS | Play Now | Awakening Discord | Events
User avatar
dbithead
Newbie
Newbie
Posts: 3
Joined: Mon Sep 25, 2023 5:36 pm

Unread post

Thanks for the help.

How do I enable all the planets?


User avatar
Cyclone
Administrator
<b>Administrator</b>
Posts: 511
Joined: Thu Mar 29, 2018 1:41 am
Location: Australia

Unread post

In the config file there will be a section where the disabled ones are commented out.


Cyclone
SWG Awakening Administrator and Community Support Team Lead
Rules & Policies | ToS | Play Now | Awakening Discord | Events