ServUO Installation on Debian 10

  • Views Views: 875
  • Last updated Last updated:
  • ServUO Debian 10 Tutorial

    This guide intended to cover the installation and setup of ServUO and its dependencies as well as some optional tools to make administration easier on Debian 10 as well as register it as a system service.

    Debian is a popular distribution in it’s own right, but it is also serves as the base from which many other popular distributions are built from, including Ubuntu. Ergo, these instructions should, for the most part also apply to them, although some modifications may be necessary and no guarantees are given.

    This guide assumes the following:
    • You have root (or sudo) terminal access of a Linux host running Debian 10 with internet access
    • You have the required UO client-side files for ServUO to operate and/or possess a means to transfer those files to/from the host if the host is remote. (SFTP/SCP/Samba etc)
    • You have already configured your network adapters with the necessary IP Address(es), gateways and DNS Servers
    • Any intermediate network devices such as routers or firewalls between your server and the desired networks (ie Internet) are already configured to allow connections on TCP Port 2593
    As written, the instructions assume full root access. Prefix them with sudo if needed/desired for your setup. A dedicated "servuo" user for the process to run under may also be created/desired as a best practice. Also, for failsafe reasons, all paths given in instructions will be absolute paths, not relative. All testing was done on a KVM based VM with 2GB of memory.

    Step 1 - Installing Mono

    These directions are taken directly from the mono project website:
    Code:
    apt install apt-transport-https dirmngr gnupg ca-certificates
    apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
    echo "deb https://download.mono-project.com/repo/debian stable-buster main" | tee /etc/apt/sources.list.d/mono-official-stable.list
    apt update
    apt install mono-complete
    Step 2 - Installing other dependencies

    Note that some of these may already be installed:

    Code:
    apt-get install build-essential git zlib1g zlib1g-dev screen unzip
    Step 3 - Deciding where to store ServUO Files

    Choose a parent directory for the "ServUO" Folder to reside. The “ServUO” directory itself will be automatically created during the next Steps. The directory chosen is somewhat user preference, although you should be wary of storing it in certain directories. For more info on reserved directories or the original intended functions of them, you can consult the Unix Filesystem Hierarchy Standard. Also note that some applications do not like spaces in path names. Avoid if possible.

    Common valid choices could be /srv/, /var/ or /opt/. You can also store it inside a user’s home directory, but this may complicate permissions if you have multiple users needing access to it. We will use /srv/ for our example. Use “cd” to change your working directory

    Code:
    cd /srv/
    Step 4A - Retrieve the ServUO Files (Git)

    For the current git revision, you would simply:
    Code:
    git clone https://github.com/ServUO/ServUO.git
    This method should create a new directory called 'ServUO' inside of the current working directory, , ie "/srv/ServUO" (should be the one chosen in step 3) and then download the latest files from the ServUO github.

    Step 4B - Retrieve the ServUO Files (Numbered Release)

    For a numbered release zip file, you could use either wget or cURL on the source code link in github:
    Code:
    wget https://github.com/ServUO/ServUO/archive/56.1.zip
    OR
    Code:
    curl -LJO https://github.com/ServUO/ServUO/archive/56.1.zip
    For a release, you also need to extract the files from the zip.
    Code:
    unzip 56.1.zip
    This method should make a ServUO.XX folder where XX is the release version inside of the current working directory, , ie "/srv/ServUO-56.1" (should be the one chosen in step 3)

    Step 5 - Acquire the necessary UO client files and point ServUO at them

    Go ahead and create a subfolder for your client files inside your ServUO folder.

    Code:
    mkdir /srv/ServUO/Muls
    You don’t need the entire client, a full list of which files are required is in the comments of /srv/ServUO/Scripts/DataPath.cs. If you have local access to the server you can get these off the UO CD or copy them using a flash drive using the mount command.

    If the server is remote, you will need to transfer them somehow, if transferring from a Windows Desktop, WinSCP is an easy, free and secure way to move them with an intuitive graphical interface. Regardless of how, place the required files as mentioned into the newly created /srv/ServUO/Muls/ Directory.

    Now, we need to edit datapath.cfg to point ServUO at these files. nano is an easy to use text editor and should already be included in most distributions. vi and emacs are common alternatives with steeper learning curves.

    Code:
    nano /srv/ServUO/Config/DataPath.cfg
    You should see:

    Code:
    # Uncomment this line and set it to the path of the client files to set a
    # custom data path. Otherwise ServUO will look for the client in the default
    # Windows installation directories. Note that this is *required* when running
    # on non-Windows systems.
    # CustomPath=C:\Program Files (x86)\Electronic Arts\Ultima Online Classic
    Note that you can put either an absolute or relative path here. If using a relative path, it is relative from the perspective of the ServUO.sh we will create later, not the Config folder. A relative path may be preferred for portability reasons if you foresee moving to another system where the paths may change.

    Absolute Path example: CustomPath=/srv/ServUO/Muls

    Relative Path example: CustomPath=./Muls

    Once you have made the changes, CTRL+O will save the file (will prompt for verification) and CTRL+X will quit. These commands and shortcuts are also shown on the bottom bar of the nano text editor.

    Step 6 - Compile the ServUO Core and (hopefully) first successful run.

    Go back to the ServUO directory and type in make. make is a linux utility that will automatically build software according to predefined instructions in a MakeFile. (ServUO distro includes one).

    Code:
    cd /srv/ServUO
    make
    It should build both Ultima.dll and ServUO itself, and if successful, will attempt to run the program for the first time. If any part of this process fails, you can try starting over from scratch by:

    Code:
    make clean
    make
    If, however, ServUO loads fine and begins listening, you should be able to test client connections now. Can also test console commands from the terminal. For now, go ahead and shutdown the server.

    To run the software again in the future, you don’t need to rebuild the core with make each time. Part of the make process also created a shell script called ServUO.sh that loads the ServUO executable via mono for you.

    To run it, simply enter:

    Code:
    /srv/ServUO/ServUO.sh
    Step 7 – (Optional) Using screen to manage the ServUO “window”

    You may have noticed that if you logout the vty session, the ServUO process ends. This can be a bit of a pain if you need to do other tasks, or maybe you just don't want to always have keep the ServUO window open. The Unix screen utility allows you to attach/detach from certain terminal sessions without closing the programs.

    There are many features to screen, that are outside the scope of this guide, so we will just cover creating a screen session, starting servuo from it, detaching from it, and then reattaching to it to resume console.

    Simplest method:

    Code:
    screen
    /srv/ServUO/ServUO/ServUO.sh
    Now, if you need to do something else, instead of having to open another vty session, you can just simply detach the current screen with CTRL+A, followed by CTRL+D. to resume this screen at any time simply type in

    Code:
    screen -r
    if you work with multiple screens, you can name them as follows:

    Code:

    screen -S servuo
    /srv/ServUO/ServUO/ServUO.sh
    and then resume after detaching with

    Code:
    screen -r servuo

    Step 8 (Optional) - Running as a Service

    You may want to go even a step further, and register ServUO as a system process with systemd, so that it starts automatically on a Server reboot

    first you need to create the file with instructions and parameters for systemd to read:

    Code:
    nano /etc/systemd/system/servuo.service
    and populate it with the following info (change things like paths and user specific text as desired):

    Code:
    Description=servuo.service
    After=network.target

    [Timer]
    OnStartupSec=60

    [Service]
    User=root
    Type=simple
    ExecStart=/bin/sh -c '/usr/bin/screen -DmS servuo /srv/ServUO/ServUO.sh'
    ExecStop=/usr/bin/screen -p 0 -S servuo -X eval 'stuff "bc Server Shutdown Imminent"\\015'
    ExecStop=/bin/sleep 10
    ExecStop=/usr/bin/screen -p 0 -S servuo -X eval 'stuff "shutdown"\\015'
    ExecStop=/bin/sleep 5
    ExecStop=/usr/bin/wall "ServUO Process Ended via systemd"

    [Install]
    WantedBy=multi-user.target
    Then save and exit. To register the service with systemd from the file you just created, use the following:

    Code:
    systemctl enable servuo.service
    You can now start/stop/check status the service with

    Code:
    service servuo start
    service servuo stop
    service servuo status
    When stopping, the above example will:
    1) broadcast a final warning to players ingame
    2) wait 10s
    3) save and shutdown
    4) wait 5s
    5) send a wall command to all active tty sessions that the process has ended

    You can also still bring the console back with
    Code:
    screen -r servuo
    as outlined in Step 7.