SimonOmega

Member
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:
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.​
 
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.
 
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
 
Im getting an 'error CS2001: Source file 'Ultima/*.cs' could not be found' while building the Ultima.dll any one know why?
 
Im getting an 'error CS2001: Source file 'Ultima/*.cs' could not be found' while building the Ultima.dll any one know why?
Sperg — Today at 2:49 AM
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
error CS2001: Source file `Ultima/.cs' could not be found

Sperg — Today at 3:05 AM
This is an issue also left unanswered on the forums from Nov 9th

Voxpire — Today at 3:10 AM
Ultima isn't a part of the distribution any more, it was all replaced with native file readers that don't rely on GDI+ lack of support for 16-bit pixel formats when running under mono

Sperg — Today at 3:11 AM
So is there any type of workaround?

Voxpire — Today at 3:12 AM
Remove the -recurse:Ultima/*cs argument from the compile command
NEW
[3:12 AM]
Or use the new Makefile ServUO/Makefile at master · ServUO/ServUO
 
I'm stuck on Compile ServUO steps #2 and #3 (build Ultima online .dll).

This is the command I'm inputting (same as the guide above):

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


Here is the error I'm getting:
error CS2008: No files to compile were specified
Compilation failed: 1 error(s), 0 warnings

Any idea of how to solve this? Thanks!
 
@Mikely, @Sperg and @rafael.assis

Do make -j $(nproc) in ServUO folder, or just make. The first one will use more CPU threads to compile faster. Both Ultima.dll and ServUO.exe will be generated. Then mono ServUO.exe.

But i am stuck on compiling scripts:

C#:
Scripts: Compiling C# scripts...Error:
System.Exception: Compiler failed to produce the assembly. Output: ''
  at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch (System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames) [0x0035e] in <a85c1a570f9a4f9f9c3d2cfa5504e34f>:0
  at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromFileBatch (System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames) [0x00047] in <a85c1a570f9a4f9f9c3d2cfa5504e34f>:0
  at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromFile (System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames) [0x00006] in <a85c1a570f9a4f9f9c3d2cfa5504e34f>:0
  at Server.ScriptCompiler.CompileCSScripts (System.Boolean debug, System.Boolean cache, System.Reflection.Assembly& assembly) [0x001d9] in <b190f83f93f645acb1b45c09d162e748>:0
  at Server.ScriptCompiler.Compile (System.Boolean debug, System.Boolean cache) [0x00034] in <b190f83f93f645acb1b45c09d162e748>:0
  at Server.Core.Main (System.String[] args) [0x00624] in <b190f83f93f645acb1b45c09d162e748>:0
This exception is fatal, press return to exit

My system:
  • Linux Mint 21.3
  • ServUO pub 57.3
  • Mono 6.8.0.105 (Debian 6.8.0.105+dfsg-3.2)

But why MCS commands in this tutorial doesn't works?​

This is just an explanation on why error CS2001: Source file `Ultima/.cs' could not be found happens. Please, use make instead!

Both commands in this tutorial:

Build Ultima.dll First
  • 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
Build ServUO.exe Second
  • 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
MUST be execute in BASH no any other shell.

So, before execution, first enter in BASH. For example, i use ZSH. If you don't know, just echo $SHELL. If you are not in BASH, like me, just write bash in your shell and you will move tho BASH. Then execute commands above.

ServUO pub 57.2 compiles successfully, but...​

After login server, world building etc, then SAVE and RESTART, an infinite looping of this:

Code:
Error:
02:40:45 System.IO.IOException: Invalid handle to path ".../ServUO-57.2/[Unknown]"
  at System.IO.FileStream.ReadData (System.Runtime.InteropServices.SafeHandle safeHandle, System.Byte[] buf, System.Int32 offset, System.Int32 count) [0x00036] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
  at System.IO.FileStream.ReadInternal (System.Byte[] dest, System.Int32 offset, System.Int32 count) [0x0002c] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
  at System.IO.FileStream.Read (System.Byte[] array, System.Int32 offset, System.Int32 count) [0x000b9] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
  at System.IO.StreamReader.ReadBuffer () [0x000bf] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
  at System.IO.StreamReader.Read () [0x0002e] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
  at System.TermInfoDriver.GetCursorPosition () [0x00051] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
  at System.TermInfoDriver.ReadUntilConditionInternal (System.Boolean haltOnNewLine) [0x00011] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
  at System.TermInfoDriver.ReadLine () [0x00000] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
  at System.ConsoleDriver.ReadLine () [0x00000] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
  at System.Console.ReadLine () [0x00019] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
  at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_delegate_end_invoke(object,intptr)
  at (wrapper delegate-end-invoke) System.Func`1[System.String].end_invoke_TResult__this___IAsyncResult(System.IAsyncResult)
  at Server.Misc.ServerConsole.<PollCommands>m__2 (System.IAsyncResult r) [0x00000] in <1ce648fb8fe045968b9718600f627556>:0
  at (wrapper managed-to-native) System.Runtime.Remoting.Messaging.AsyncResult.Invoke(System.Runtime.Remoting.Messaging.AsyncResult)
  at System.Runtime.Remoting.Messaging.AsyncResult.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00000] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
  at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00096] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <12b418a7818c4ca0893feeaaf67f1e7f>:0
02:40:45 Crash: Generating report...done
02:40:45 Crash: Backing up...done
02:40:45 Crash: Restarting...done
 
Last edited:

Active Shards

Donations

Total amount
$110.00
Goal
$1,000.00
Back