These instructions should be viable for a new Ubuntu server (as of writing, I used 24.04).
Install apache2 and unzip and .net 8.0 runtime and conspy (conspy for tty for service created later)
sudo apt install apache2 unzip dotnet-runtime-8.0 conspy
Download the latest build, unzip to /opt
sudo mkdir -p /opt/mhserver && cd /opt/mhserver
sudo wget <link_to_latest_build>
sudo unzip <filename> -d /opt/mhserver
Obtain the calligraphy.sip and mu_cdata.sip from <marvel_heroes_client_dir>\Data\Game\ and place in the /opt/mhserver/Data/Game/ directory
Add mhserver user and group, lockdown user, assign ownership of files
sudo addgroup mhserver
sudo useradd -g mhserver mhserver
sudo usermod --shell /usr/sbin/nologin mhserver
sudo passwd --lock mhserver
sudo chown -R mhserver:mhserver /opt/mhserver
Get needed files from repo
sudo wget -O /etc/apache2/server.crt https://raw.githubusercontent.com/Crypto137/MHServerEmu/refs/heads/master/assets/ssl/server.crt
sudo wget -O /etc/apache2/server.key https://raw.githubusercontent.com/Crypto137/MHServerEmu/refs/heads/master/assets/ssl/server.key
sudo wget -O /var/www/html/SiteConfig.xml https://raw.githubusercontent.com/Crypto137/MHServerEmu/refs/heads/master/assets/SiteConfig.xml
Enable the necessary apache2 mods
sudo a2enmod rewrite
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod ssl
sudo a2enmod socache_shmcb
sudo a2ensite default-ssl.conf
Edit the /etc/apache2/enabled-sites/default-ssl.conf, place these near the bottom, above <VirtualHost>
ProxyPass /AuthServer http://localhost:8080
ProxyPassReverse /AuthServer http://localhost:8080
Restart apache
sudo systemctl restart apache2
Create a copy of your SiteConfig.xml in Apache24\htdocs and replace the AuthServerAddress value in it with your server’s externally accessible IP address or domain name. For LAN this is something like 192.168.x.x, and for hosting on the Internet it is going to be your server’s IP address or a domain name pointing to it.
Create an override config and place BindIP and PublicAddress in it so it persists after updates.
cp /opt/mhserver/Config.ini /opt/mhserver/ConfigOverride.ini
#Edit the values to:
BindIP=0.0.0.0
PublicAddress=<your_server_name/ip>
Create mhserveremu service
sudo echo "[Unit]
Description=Marvel Heroes server emulator service
After=network.target # Ensures service starts after network is up
[Service]
Type=simple
ExecStart=/opt/mhserver/MHServerEmu
StandardInput=tty
TTYPath=/dev/tty4
StandardOutput=tty
StandardError=tty
User=mhserver
Group=mhserver
WorkingDirectory=/opt/mhserver/
Restart=on-failure[Install]
WantedBy=multi-user.target ">>/etc/systemd/system/mhserveremu.service
Restart the daemon to enable the new service file
sudo systemctl daemon-reload
Enable and start the service
sudo systemctl enable mhserveremu.service
sudo systemctl start mhserveremu.service
Checks/Troubleshooting
Once the server emu is running, you can reach the account management here: https://<your_server_name>/AuthServer/AccountManagement/Create
Check the system logs for the service, watching the file for changes (can ctrl+c to stop following)
sudo journalctl -u mhserveremu -f
Check the status of the service
sudo systemctl status mhserveremu
Restart the service
sudo systemctl restart mhserveremu
Since we installed conspy, and the emulator behaves as an interactive console, we allocated it to /dev/tty4 – we can use conspy to monitor it
sudo conspy 4
To exit conspy hit the esc key 3 times quickly
Update script to pull down the latest daily version
Crontab entry for root to facilitate the update as the mhserver user
0 8 * * * /usr/bin/systemctl stop mhserveremu && /usr/bin/sudo -u mhserver /opt/mhserver/downloads/update_mhserveremu.sh >/var/log/mhserver_daily_update.log 2>&1 && /usr/bin/systemctl start mhservemu