[Guide] Setting up server on VPS

Himalayas

Member
Joined
Jan 19, 2016
Messages
106
Hello,

I thought I would contribute to a guide on how to setup a Dev Environment on VPS for Core3 or MtG Repo's for those interested in having available online. I'm relatively a newbie at this type of server hosting, so if anyone has any critique or expertise to contribute that would be great as well.

References:
  1. Neopixie's SWGemu setup guide - First and foremost this is the majority of the setup guide that will be used to create the server. I will summarize Neopixie's steps below but please read his guide carefully as well. (https://www.swgemu.com/forums/showthread.php?t=236411)
  2. Cloud Tech GUI setup guide - From the blank VPS environment I had struggled using an only text based PuTTY server creation and having the GUI aspect was important for modding and accessing file structures more conveniently. (
    )
  3. Mod the Galaxy Repo - GitHub link to swgemu repository. Included reference to core3 as well if preferring to install vanilla environment. (https://github.com/ModTheGalaxy)
1. Getting Started

Step one in the process to hosting a swgemu server on a VPS, is well... to get the VPS. For my service provider I rented a VPS from Contabo, https://contabo.com/en/, but there are many different VPS providers out there so look for one that suits you. I decided to go with Contabo for a few reasons: (1) Was relatively inexpensive, for $6.99/mo was able to secure a sever with 4 cores, 8gb RAM, 200gb SSD memory (2) Operating System supported - although swgemu can be installed on most Linux distributions I determined to use a provider that offered Ubuntu 20.04 to match the OS used by Neopixie's installation guide. (3) Geography, being located in California there is a surprising lack of VPS vendors that offer servers within the United States and on the West Coast. Most places I found have their servers in Canada for North America without having a specific West Coast presence - Contabo offered servers based out of Seattle, WA which results in about ~54 ping on my server being located in rural California.

So with that being said, please select a VPS service that works best for you.

2. Accessing the VPS

Once you've selected your VPS provider they should send you more information on your server. Important criteria including:
  1. IP Address (including user and password to access server).
  2. VNC IP and Port (including password).
Now to access the VPS you'll likely need to setup a SSH connection. To do so when accessing from Windows you'll need to download an application titled "PuTTY". This can be found on the Microsoft App Store for convenience, or can be downloaded online. Once you've download PuTTY run the application and it should look like this:


877

From this application, enter your External IP address provided to you by your VPS service provider. Make sure the Connection type is SSH and click open. This should open a terminal connecting you to your VPS. It will likely request you provide your username and password, which should also have been provided by the VPS provider during setup. Once you log into your VPS via PuTTY you'll now begin building the server.

3. Preparing the VPS

Now once you are logged into you VPS, and per recommendation of Neopixie you'll need to do some preliminary steps to ready your VPS environment to host your swgemu server. Enter the following commands into your PuTTY terminal.

  1. sudo apt-get update
  2. sudo apt-get upgrade
  3. sudo apt install build-essential libmysqlclient-dev liblua5.3-dev libdb5.3-dev libssl-dev cmake git default-jre
When prompted to press Y to continue, do so. This is just confirming the allocation of harddrive space for the dependencies you're installing on the VPS. What these commands are doing are updating your OS environment and installing dependent libraries for your server to function properly.

4. Installing SWGemu or MtG Repo

This next step is where you'll begin building the SWG server of your choosing. At this point decide if you would like to install the MtG Repo or the SWGemu repo.

In the same terminal from step 3. above, enter the following commands.

  1. mkdir -p ~/git
  2. cd ~/git
These commands are making and moving your terminal to the correct directories to install SWG into your VPS. Now for respectively either repository enter the following command following "cd ~/git". DO NOT enter both - chose one or the other, as mentioned depending if you would like to install SWGemu or MtG Repo.

git clone https://github.com/swgemu/Core3
EDITED Thank you to Lasko for the updated information regarding a vanilla Core3.

From Lasko below:
The Review repo is no longer used and might cause some confusion.
Engine and Core are now here: https://github.com/swgemu


OR

git clone https://github.com/ModTheGalaxy/mtgserver

This process takes a little time, so be patient and let it run. Once it's completed running you're now ready to officially build your SWGemu server. Change your directory to the MMOCoreORB by entering the following into the terminal:

cd ~/git/Core3/MMOCoreORB

Then enter the following command to build your sever.

make -j8

Please note, -j8 is referring to the number of Cores allocated on your VPS to installing the server. For my server I knew I only had 4 cores, so instead of entered make -j8, I entered make -j4. Match the number of available cores to your machine to install the server. When I first attempted to make my server at this point I encountered a boost error while running the last code. To fix this I reinstalled boost on my Ubuntu VPS by entering the following command in my Root depository. PLEASE NOTE: This is not a part of the install process, this was just a specific solution to an error I had while making the server.

sudo apt install build-essential libboost-system-dev libboost-thread-dev libboost-program-options-dev libboost-test-dev

After entering make -jX your server will begin to build and may take some time to compile. Once it's completed enter the following command to reboot your server with the SWG installation:

Sudo reboot

5. Installing a GUI for your OS on your VPS

At this point you may be ready to install a GUI on your VPS. Now that the SWG server has been installed your VPS you'll be ready to mod and play with it. To do so there are a few steps using your VPS.

  1. Install a VNC viewer application; for my server connecting from a Windows desktop I installed UltaVNC Viewer. Here enter your VNC Server and Port address provided by your VPS provider and connect. After connection you may be prompted for a password which should already be included with your VPS information.
  2. Following re-open PuTTY after your latest reboot in Step 4, and begin installing the GUI OS to your system. To do so enter the following into the root of your terminal:
    1. sudo apt-get install ubuntu-desktop
    2. sudo apt install gnome-software
    3. sudo apt-get install xrdp htop
    4. sudo rm /usr/share/polkit-1/actions/org.freedesktop.color.policy
    5. sudo adduser remote
      1. Set your password of your choosing. I used "swg" for my password.
    6. sudo usermod -aG sudo,adm remote
    7. sudo reboot
After you following these commands you now should have a GUI installed to your VPS. To connect to your VPS from a Windows desktop, you'll need to launch Remote Desktop Connection now which should be installed on most Window's operating systems. The application should look like this:

878


In the General tab of your Remote Desktop Connection enter your external IP address in the Computer: logon settings and remote into your username, if you kept the same username as the installation commands above and click Connect. Once connected you should be greeted by a screen that looks like this:

879


AND BOOM, you have a VPS server with both a accessible GUI and SWGemu installed. But the installation process isn't over yet...
 

Attachments

Last edited:

Himalayas

Member
Joined
Jan 19, 2016
Messages
106
6. Setting up your Databases.

Now that you've created your GUI and installed your SWG server you now need to setup your databases. To do so first install Mariadb to your VPS by opening the terminal by clicking activities in the top left corner of the OS and opening the terminal application and enter the following code:

sudo apt install mariadb-server

Now to configure the database, following Pixie's guide and enter the following:

sudo mysql_secure_installation

When prompted for password, leave blank and press enter. When requested to set root password enter Y and create you new password. I also chose "swg" as my password for ease of remembering. Then following the next few prompts remarking Y for each one until completed. Following these prompts enter:

sudo mysql

And, you'll be prompted with the following screen (your directory may look different, screenshot is from Pixie's guide):

View attachment 880

Following in the MariaDB command lines enter the following:

  1. CREATE USER 'swgemu'@'localhost' IDENTIFIED BY 'your password entered above';
  2. GRANT ALL PRIVILEGES ON * . * TO 'swgemu'@'localhost';
  3. FLUSH PRIVILEGES;
Then close the terminal.

Now that mariadb has been setup it's now time to also setup mysql. To do so, open your internet browser within your terminal and go to the following site (https://dev.mysql.com/downloads/workbench/). Download the mysql workbench that matches your OS - in this case I used Ubuntu Linux 20.04.

View attachment 881

Once downloaded navigate to your terminal in your OS again and install mysql by entering the following commands:

cd ~/Downloads
sudo dpkg -i mysql-workbench-community_8.0.28-1ubuntu20.04_amd64.deb

If you receive an error during the installation process, I did - type the following command after the failed download in your terminal.

sudo apt-get --fix-broken install

Hopefully that should fix any installation error and you should now be ready to modify your sql database. Navigate from the Activities tab in the top left of your OS and open mySQL application and create a new connection by clicking the little plus icon on the connection boxes within.

View attachment 882
Courtesy of Neopixie's guide.

In the Setup New Connection set your username as swgemu and password to match your mariadb. Also name the connection on the top of the page, I followed Neopixie's guide and named it "swgemu". I doubt they have to match, but for simplicity I kept most passwords as "swg". You may be prompted with a connection warning but continue anyway. If successful you'll have the following prompt:

View attachment 883
Courtesy of Neopixie's guide.

Once you've created your connection you'll need to import the swgemu SQL database from your server folder. To do so open your connection (just by clicking on it) and navigate on the left pane to "Date Import/Restore" and import the swgemu.sql file from your SWG installation directory (swgemu/git/Core3/MMOCoreORB/sql). To find this directory from your initial installation you may be required to go into your file structure and obtain root access. To allow your root access from a remote connection enter the following command in your terminal.

sudo chmod -R 777 /root

Once you've found the swgemu.sql file start your import into your database. If everything's hunky dory you should be prompted by a screen like this:

View attachment 884
Courtesy of Neopixie's guide.

The only item left to complete now is the IP Address configuration in your SQL database. From your swgemu connection navigate to your Schemas by using the arrow icons in the left pane and navigate down to "galaxy". Right click and select rows to open the schema and change the address to your external VPS address. Save changes and close.

7. Home Stretch

Now that your databases are configured there are only a few more steps remaining. The first step is to move over your .TRE files for either your SWGemu or MtG Repo into your environment. There are a couple of options to do this, being not very tech savvy I did the easiest method I could think of. I saved them to my Google Drive and downloaded from my VPS. Be sure as well depending what server you decided to install to either using the MtG TRE files or the SWGemu TRE files, save them to a folder/path of your choosing within the VPS.

Next navigate to your Config.lua located in your Core3/MMOCoreORB/bin/conf directory and open. Change your DB passwords to match the password you selected during step 6 above - for my case it was "swg". Then find the reference titled "TrePath" within the same document and reference the file structure where your TRE files have been saved to your VPS. Save and close your config.lua.

8. Done

You now have a complete and setup server on a VPS. I won't go into more detail on starting your server or client side setup. Please see NeoPixie's guide reference above. Most of this information is from his guide, the only difference was setting up the server on a VPS vs on a VM on your desktop. The process is essentially the same.


I hope this helps some folks setup their servers,
 

Himalayas

Member
Joined
Jan 19, 2016
Messages
106
I'd like to give special thanks to Sytner, Sev, Borrie BoBaka, and Neopixie (for the primary guide) for their help and support answering my questions and being supportive.
 

Aeryna

Moderator
Staff member
Moderator
Joined
Oct 10, 2017
Messages
359
Why do you think no one did this before??
People don't need to be given everything. They must learn on their own. That is a fundamental requirement.

Bad Idea.
 

weti

New Member
Joined
Mar 14, 2019
Messages
14
Why do you think no one did this before??
People don't need to be given everything. They must learn on their own. That is a fundamental requirement.

Bad Idea.
Why do you think it is a bad idea? I think a VPS would be useful for some community members who do not have decent hardware to utilize one of the many VM guides out there.
 

Aeryna

Moderator
Staff member
Moderator
Joined
Oct 10, 2017
Messages
359
Any computer with DDR3 RAM can virtualize. No extraordinary expense is necessary. Even an active SWG can be run with as little as 2GB of dedicated ram to the VM.

It's quite easy to understand.
People don't learn anything using this method.
The goal of this forum is above all to learn for oneself, without leaving questions aside, but to learn.
Exactly the same happens in other forums where I am. People quickly lose their perseverance and ignore learning if you allow these things.
 

Borrie BoBaka

Local Bothan
Staff member
Super Moderator
Joined
Mar 16, 2014
Messages
91
Location
Dark Rebellion RP
I don't see the problem with having guides to cover even the most niche sort of approach to SWG modding and development. There are people who do learn more from following guides in order to get an understanding of the process so that they feel more confident in branching out, experimenting, and trying new things. I myself am one of those people. I do not know how to set up a VM very well, and so guides like this are invaluable to figuring it out so that I can begin to learn.

Not everyone has the patience, knowledge, or know-how to figure these things out. The documentation on this subject is extremely minimal, and guides like these fill in gaps. People quickly lose their perseverance and ignoring learning when they can't find any way to actually learn what they need to, and many more would like to learn more about devving core3 without worrying about how they're going to host their server.

I understand where you're coming from, but every guide, tutorial, or even notes of development help give people the opportunity to learn in the first place. Virtualization, Linux systems, and setting up things like SQL or Cmake is still an extremely advanced topic for some people. We all have to start somewhere.

If the bar for entry into modding is low enough, we will have more modders. Not every modder will do something extraordinary, but for every 5 new modders, at least one could revolutionize some aspect of our community. I like those odds.
 

1sudo

New Member
Joined
Mar 17, 2022
Messages
6
Any computer with DDR3 RAM can virtualize. No extraordinary expense is necessary. Even an active SWG can be run with as little as 2GB of dedicated ram to the VM.

It's quite easy to understand.
People don't learn anything using this method.
The goal of this forum is above all to learn for oneself, without leaving questions aside, but to learn.
Exactly the same happens in other forums where I am. People quickly lose their perseverance and ignore learning if you allow these things.
How dare anyone help newcomers am I right?

It's just a guide, don't blow a gasket. The basics of everything comes in the form of a guide or documentation, whether it be here or elsewhere, I'll venture to bet you've learned a thing or two from posts such as this.
 

Aeryna

Moderator
Staff member
Moderator
Joined
Oct 10, 2017
Messages
359
How dare anyone help newcomers am I right?

It's just a guide, don't blow a gasket. The basics of everything comes in the form of a guide or documentation, whether it be here or elsewhere, I'll venture to bet you've learned a thing or two from posts such as this.
Hey, calm down. It's just my opinion based on other experiences. Time will tell.
 

Lasko

Moderator
Staff member
Moderator
Joined
Feb 13, 2012
Messages
295
Hey, calm down. It's just my opinion based on other experiences. Time will tell.
Are you suggesting we remove all the guides from MtG, or would you like to submit a list for removal?

There is also a premade VM for use here, should I remove that too?
 

Himalayas

Member
Joined
Jan 19, 2016
Messages
106
Thank you everyone for the notes, and thank you Lasko for the update. I should also mention special thanks to you, Lasko, for all the amount of time and incredible work that has gone into the VM environments and modding community.

Most of this guide is already available information published on other forums and sources - I just wished to help bridge the gap for individuals looking to host their dev. environment on a VPS. I personally like both, but if I'm playing with friends and family having a dev environment setup on a VPS is easier for everyone to connect to.
 

1sudo

New Member
Joined
Mar 17, 2022
Messages
6
Hey, calm down. It's just my opinion based on other experiences. Time will tell.
Don't worry, my jimmies have not been rustled, just defending OP for taking time out of his/her day to share with the community.
 

Aeryna

Moderator
Staff member
Moderator
Joined
Oct 10, 2017
Messages
359
Are you suggesting we remove all the guides from MtG, or would you like to submit a list for removal?

There is also a premade VM for use here, should I remove that too?
Please, am i?. Really?.
 

darkmoor

New Member
Joined
Oct 6, 2023
Messages
11
Thank you for writing this guide. I have no experience with this and your guide has been a great help.
 
Top Bottom