HowTo: Compile and Run ServUO using Mono in Linux

SimonOmega

Citizen
Hello alll,
This guide will explain how to compile and execute ServUO under Linux using Mono.
I am using these specific versions:

Instructions

First, Setting up the Ultima Online Client

This step assumes you do not have access to a Windows System and that you are running a distrobution with a GUI installed. Once ServUO is setup and running you can scp the files to a GUI-less server if you wish. If you run the Ultima Online Client from Windows you can copy your *.mul data files to the Linux system running ServUO.
  1. Install wine and wine32 for your distrobution.
    • Debian | Ubuntu | Kali: sudo apt-get install wine wine32
  2. I prefer to create a directory specific to the UO Client that wine is sandboxed into. If you wish you can use the plain wine command which will use your generic wine configuration assigned to your user profile.
  3. sudo mkdir /opt/UO/ && sudo chown `whoami`:`whoami' /opt/UO/
  4. cd /opt/UO/
  5. wget http://web.cdn.eamythic.com/us/uo/installers/20120309/UOClassicSetup_7_0_24_0.exe
  6. WINEPREFIX="/opt/UO/" WINEARCH=win32 wine UOClassicSetup_7_0_24_0.exe /desktop=shell,1244x700
  7. wget http://uos-update.github.io/UOS_Latest.exe
  8. WINEPREFIX="/opt/UO/" WINEARCH=win32 wine UOS_Latest.exe /desktop=shell,1244x700
  9. I run wine as a virtualized desktop session then execute UOS to run the Ulitima Online Client.
    • WINEPREFIX="/opt/UO/" WINEARCH=win32 wine explorer /desktop=shell,1244x700
  10. You can use [Start], run, and Browse to execute UOS.
Second, Install Mono

Follow the instructions on on the Mono Project link above to install Mono for you Distrobution.
Debian | Ubuntu | Kali: sudo apt-get install mono-devel

Third, Download ServUO

NO Git

Download the current ServUO. If you do not know how to use Git and are using a distrobution with: a GUI and Web Browser - follow the steps below.
  1. Make a directory to hold all the code and content for ServUO.
  2. sudo mkdir /opt/ServUO/ && sudo chown `whoami`:`whoami' /opt/ServUO/
  3. Open the ServUO link above in your Browser.
  4. Click Code
  5. Click Download Zip
  6. ServUOGitHub.png
  7. Download the Zip to /opt/ServUO/
  8. Extract the files from the Zip (Using 7-Zip and Pub57 for this example) 7z e /opt/ServUO/ServUO-ServUO_Pub57.zip -o"/opt/ServUO/"
Git
If you prefer Git perform the following steps.
  1. Install Git for your distrobution.
    • Debian | Ubuntu | Kali: sudo apt-get install git
  2. Make a directory to hold all the code and content for ServUO.
  3. sudo mkdir /opt/ServUO/ && sudo chown `whoami`:`whoami' /opt/ServUO/
  4. cd /opt/ServUO
  5. git clone https://github.com/ServUO/ServUO.git
Compile ServUO
Now to compile ServUO.
  1. cd /opt/ServUO/
  2. Build Ultima.dll First
  3. mcs -sdk:4.5 -out:Ultima.dll -optimize+ -unsafe -target:library -r:System,System.Configuration.Install,System.Data,System.Drawing,System.EnterpriseServices,System.Management,System.Security,System.ServiceProcess,System.Web,System.Web.Services,System.Windows.Forms,System.Xml -nowarn:219,414,618 -recurse:Ultima/*.cs
  4. Build ServUO.exe Second
  5. cs -sdk:4.5 -out:ServUO.exe -d:MONO -d:Framework_4_0 -d:ServUO -optimize+ -unsafe -r:System,System.Configuration.Install,System.Data,System.Drawing,System.EnterpriseServices,System.Management,System.Security,System.ServiceProcess,System.Web,System.Web.Services,System.Windows.Forms,System.Xml,Ultima.dll -nowarn:219 -recurse:Server/*.cs
  6. OPTIONALLY: I like to copy the *.mul data to the ServUO folder.
  7. Assuming you installed the Client using the Instructions above.
  8. mkdir /opt/ServUO/UO_DATA/
  9. cp "/opt/UO/drive_c/Program\ Files/Ultima\ Online\ Classic/*.mul" /opt/ServUO/UO_DATA/
First Execution of ServUO
  1. cd /opt/ServUO/
  2. mono ServUO.exe
  3. When asked provide the path to your *.mul files. If you followed the optional instructions above: /opt/UO/UO_DATA/
  4. Follow the prompts to setup your Owner Account.
  5. Once the server is running and listening on the host IP addresses issue the following comands.
  6. save
  7. shutdown
At this point you and scp the /opt/ServUO directory to a GUI-less Linux Server if you wish. the destination host must be running the same version of Mono.

Running the ServUO Server
  1. cd /opt/ServUO/
  2. mono ServUO.exe

Frequently Asked Question (FAQ)
This section will be updates as questions arise and ServUO matures.
  • I have not been able to set the directory in Config/DataPath.cfg and have it load the *.mul files properly. Need to look into this.
  • Compiling leads to error CS0006
    • error CS0006: Metadata file `OpenUO.Core.dll' could not be found
      error CS0006: Metadata file `OpenUO.Ultima.dll' could not be found
      error CS0006: Metadata file `OpenUO.Ultima.Windows.Forms.dll' could not be found
      error CS0006: Metadata file `SevenZipSharp.dll' could not be found
    • This happens if you do not compile Ultima.dll first, or you forget to compile it as -target:library
    • Do not compile ServUO.exe with -target
    • Ultima.dll compiles from the Ultima directory. ServUO.exe compiles from the Server directory.
  • Can't connect to your ServUO Server, check your iptables and nftables. This is outside the scope of this post.


@Sareus Helped.
 
Last edited:

SimonOmega

Citizen
FAQ

  • I am falling trhough the map! Welcome to using Broadsword.
    • Easy fix: Run ServUO with *.mul files from an older version. My favorite is 7.0.20.0.​
    • But I can't find these *.mul files.
      • Seek and you shall find.​
 

Nerun

Citizen
Hi,

Good tutorial. A few notes:

FIRST:

Under Compile ServUO, step 5, you wrote "cs..." should be "mcs..."
C#:
cs -sdk:4.5 -out:ServUO.exe -d:MONO -d:Framework_4_0 -d:ServUO -optimize+ -unsafe -r:System,System.Configuration.Install,System.Data,System.Drawing,System.EnterpriseServices,System.Management,System.Security,System.ServiceProcess,System.Web,System.Web.Services,System.Windows.Forms,System.Xml,Ultima.dll -nowarn:219 -recurse:Server/*.cs

Should be:
C#:
mcs -sdk:4.5 -out:ServUO.exe -d:MONO -d:Framework_4_0 -d:ServUO -optimize+ -unsafe -r:System,System.Configuration.Install,System.Data,System.Drawing,System.EnterpriseServices,System.Management,System.Security,System.ServiceProcess,System.Web,System.Web.Services,System.Windows.Forms,System.Xml,Ultima.dll -nowarn:219 -recurse:Server/*.cs

SECOND:

In /ServUO-57/Scripts/Misc/DataPath.cs, you can change line 20 to add UO mul files automatically, so you don't need to write it every time you restart the server.

Find:
C#:
private static readonly string CustomPath = Config.Get(@"DataPath.CustomPath", default(string));

Change to:
C#:
private static readonly string CustomPath = @"/opt/ServUO/UO_DATA/";

/opt/ServUO/UO_DATA/ is your example, of course.
 

PyrO

Moderator
on linux you just need to do use the make command, after seting the datapath in the datapath.cfg, there is no need to edit the cs files