How to Set Up an MTA:SA Server From Scratch on Ubuntu Linux

Step-by-step technical tutorial to deploy an MTA:SA server on Ubuntu Linux VPS: installation, configuration, firewall, gamemode and tuning.

Setting up an MTA:SA (Multi Theft Auto: San Andreas) server on Linux is simpler than the legacy ecosystem suggests — the official binaries ship ready for modern distributions and the server doesn’t require a graphical interface. The friction usually comes from firewall configuration (UDP, not TCP) and understanding that MTA is a multiplayer game server separate from the original GTA:SA — the client connects directly to your VPS’s IP.

This tutorial covers a from-scratch install on Ubuntu 24.04 LTS, mtaserver.conf configuration, deployment of a basic gamemode, isolation via a dedicated user, supervision through systemd and a UFW firewall. Estimated execution time: 25-35 minutes. You’ll finish with an MTA:SA server online, registered in the public master list and restarting automatically after a reboot.

The target persona is a new MTA:SA community owner configuring mtaserver for the first time. Prior Linux experience isn’t required — every command is explained.

Prerequisites

What you need before starting

A VPS running Ubuntu 24.04 LTS (Server, not Desktop), SSH access as a sudo user, at least 1 GB of RAM and 5 GB of free disk space. A stable connection to download the ~30 MB MTA package. An x86_64 CPU is mandatory (ARM64 will not work).

Confirm you have what you need before proceeding:

System Ubuntu 24.04 LTS x86_64
Minimum RAM 1 GB (2 GB recommended)
Game port 22003/UDP
HTTP port 22005/TCP
ASE port 22126/UDP

Port 22003/UDP is the game port where MTA clients connect. 22005/TCP is used by the internal HTTP resource (resources, downloads). 22126/UDP is ASE (All-Seeing Eye) — the protocol that lets the server show up in the public list. All three need to be open on the firewall.

Installing the MTA:SA Server

This section covers everything from creating the dedicated user to running the binary for the first time. Running game services with their own user (not root) limits the blast radius of any exploit in third-party Lua scripts.

01

Update the package index and install the basic dependencies:

sudo apt update && sudo apt upgrade -y
sudo apt install -y wget tar libncurses6 libreadline8 ca-certificates

The MTA:SA Server needs libncurses6 and libreadline8 for the interactive console. On Ubuntu 24.04 these packages live in the default repository.

02

Create a dedicated mtasa user with no login privileges:

sudo useradd -r -m -d /opt/mtasa -s /bin/bash mtasa
sudo su - mtasa

The -r flag creates a system user and -m creates a home directory at /opt/mtasa. You are now operating as mtasa — every subsequent command runs in this context, except where explicitly marked with sudo.

03

Download the official Linux MTA:SA Server package:

cd /opt/mtasa
wget https://linux.multitheftauto.com/dl/multitheftauto_linux_x64.tar.gz
tar -xzf multitheftauto_linux_x64.tar.gz
mv multitheftauto_linux_x64 server
cd server

The URL linux.multitheftauto.com/dl/ is the official endpoint maintained by the MTA team. Verify the file downloaded completely with ls -lh multitheftauto_linux_x64.tar.gz — it should be around 30 MB.

04

Download the default resources — without them the server starts but has no gamemode:

cd /opt/mtasa/server/mods/deathmatch
wget https://mirror.multitheftauto.com/mtasa/resources/mtasa-resources-latest.zip
unzip mtasa-resources-latest.zip -d resources/
rm mtasa-resources-latest.zip

If unzip isn’t available, install it with sudo apt install -y unzip (back as the sudo user) and retry the step.

Configuring mtaserver.conf

The mtaserver.conf file controls every aspect of the server: name, password, slots, initial gamemode, ASE, public IP. It lives at /opt/mtasa/server/mods/deathmatch/mtaserver.conf and uses XML format.

05

Open the configuration file:

nano /opt/mtasa/server/mods/deathmatch/mtaserver.conf

Locate and adjust the critical fields:

<servername>My MTA Server</servername>
<serverip>auto</serverip>
<serverport>22003</serverport>
<maxplayers>32</maxplayers>
<httpport>22005</httpport>
<password></password>
<ase>1</ase>
<donotbroadcastlan>0</donotbroadcastlan>

With <ase>1</ase> the server registers itself in the public master list. If you want a private server for friends, leave it as 0. Direct IP connection works in both cases.

06

Set the admin password for remote console access. Locate the <resource src="admin" /> block and open acl.xml:

nano /opt/mtasa/server/mods/deathmatch/acl.xml

Edit the Admin group and adjust the <object name="user.admin" /> entry. The actual password is set when you add the user for the first time via the server console with the command addaccount admin YOUR_STRONG_PASSWORD.

Do not use a weak password

The admin account has full control — including executing arbitrary Lua on the server. Use a password with at least 16 random characters. Leaked password = compromised server.

07

Define the initial gamemode. Edit mtaserver.conf again and locate the <resource> section. Add or adjust:

<resource src="freeroam" startup="1" protected="0" />
<resource src="play" startup="1" protected="0" />

freeroam is the simplest default gamemode — players spawn free and can use commands to spawn vehicles. To test the server for the first time, this is enough.

First run and test

Before configuring systemd, run the server manually to confirm everything works. This makes it easier to spot configuration errors in real time.

08

Start the server in the foreground:

cd /opt/mtasa/server
./mta-server64

The console shows the initialization: module loading, reading of mtaserver.conf, registration of resources and finally the message Server started and is ready to accept connections!. If a library-missing error appears, install libstdc++6 and lib32stdc++6.

09

Create the admin account through the interactive console (without closing the server):

addaccount admin YOUR_PASSWORD_HERE
aclrequest allow admin all

Then stop the server with Ctrl+C — we’ll move it under systemd next.

Firewall and systemd

Running the server manually works for testing, but in production you need a supervisor (to restart on crash) and a firewall (to block anything that isn’t the game).

10

Open the required ports in UFW (as the sudo user, outside the mtasa context):

sudo ufw allow 22003/udp comment 'MTA:SA game port'
sudo ufw allow 22005/tcp comment 'MTA:SA HTTP'
sudo ufw allow 22126/udp comment 'MTA:SA ASE'
sudo ufw allow 22/tcp comment 'SSH'
sudo ufw enable
sudo ufw status verbose
Watch out for SSH

Before running ufw enable, confirm the 22/tcp rule is in place. Enabling UFW without it locks you out of the VPS. If you’re using a custom SSH port, allow it explicitly.

11

Create the systemd unit file at /etc/systemd/system/mtasa.service:

sudo nano /etc/systemd/system/mtasa.service

Contents:

[Unit]
Description=MTA:SA Server
After=network.target

[Service]
Type=simple
User=mtasa
Group=mtasa
WorkingDirectory=/opt/mtasa/server
ExecStart=/opt/mtasa/server/mta-server64
Restart=on-failure
RestartSec=10
StandardOutput=append:/var/log/mtasa/server.log
StandardError=append:/var/log/mtasa/server.log

[Install]
WantedBy=multi-user.target

Create the log directory and enable the service:

sudo mkdir -p /var/log/mtasa
sudo chown mtasa:mtasa /var/log/mtasa
sudo systemctl daemon-reload
sudo systemctl enable --now mtasa

Verification

Confirm the server is running as a supervised service and responding on the network.

sudo systemctl status mtasa
sudo ss -ulnp | grep 22003
tail -f /var/log/mtasa/server.log

systemctl status should show active (running). ss -ulnp should list the mta-server64 process listening on port 22003/UDP. The log should contain Server started and is ready to accept connections!.

For a real connection test, open the MTA:SA client on Windows, go to “Quick connect” and connect to YOUR_VPS_IP:22003. If you want it to appear in the master list, it takes 2-5 minutes to propagate — before that, direct IP connection already works.

Troubleshooting

”address already in use” on startup

Another instance is still running. Stop it with sudo systemctl stop mtasa and pkill -u mtasa mta-server64. Wait 30 seconds before restarting — the UDP socket can take a moment to release.

Server doesn’t show up in the master list

Confirm <ase>1</ase> in mtaserver.conf and that UDP port 22126 is open in the firewall. On some VPS providers behind NAT, change <serverip>auto</serverip> to the explicit public IP. Propagation to the master takes up to 5 minutes after the first startup.

Players connect but drop after login

Almost always the HTTP port 22005/TCP is blocked. Clients need to download resources over HTTP — without it, timeout and disconnect. Confirm with sudo ufw status that 22005/tcp is ALLOW.

Latency optimization

For servers with a regional player base, VPS latency matters more than raw CPU. Datacenters geographically close to your players typically deliver 5-15 ms, against 120-180 ms when traffic crosses continents.

Next steps

With the base server online, the natural follow-ups are:

  • Configure custom resources in /opt/mtasa/server/mods/deathmatch/resources/
  • Set up automatic backup of the resources/ directory and the internal.db file (the server’s SQLite database)
  • Add a second server for a different gamemode on another UDP port
  • Implement online-player monitoring via the HTTP API exposed by MTA
  • Configure SSL/TLS on the httpserver if you serve resources via a CDN

If you’re running this in production and want low latency for players in Brazil, a Hostini VPS in São Paulo typically delivers 5-15 ms across most of the country, with edge DDoS protection and a network sized for UDP spikes — exactly the profile game servers require.

Frequently asked questions

What's the difference between MTA:SA and SA-MP for hosting on Linux?

MTA:SA has an official Linux server maintained by the Multi Theft Auto team with up-to-date binaries for modern glibc. SA-MP is a separate project with an older Linux package and 32-bit library dependencies. For Ubuntu 24.04 LTS, MTA is simpler to deploy today.

How much RAM and CPU do I need for a 50-player server?

A typical MTA:SA server with a roleplay or DM gamemode consumes 200-500 MB of RAM and usually a single core. With 50 active players and complex Lua scripts, 2 vCPUs and 2 GB of RAM provide comfortable headroom. The bottleneck is usually network latency, not CPU.

Can I run the MTA:SA Server in a Docker container?

Yes, it works, but it adds a NAT layer that can complicate public IP detection and UDP port forwarding. For production, running directly on the host with systemd is more predictable. Containers make sense for isolated test environments.

How do I get the server to appear in the public master list?

In mtaserver.conf, set <serverip>auto</serverip> and <ase>1</ase>. The server queries its own public IP and registers itself in the master list on startup. If you're behind NAT (some VPS providers), force the public IP manually in the serverip field.

Does MTA:SA run on ARM64 (Ampere, Graviton)?

No. The official Linux binary is compiled for x86_64 and depends on 32-bit libraries. Use a VPS with an Intel or AMD x86_64 CPU — any standard plan works. ARM64 is incompatible, and trying to run it via emulation degrades performance to an unusable level.

Topics:
Next steps VPS, dedicated or managed panel for FiveM, SAMP, MTA, Tibia and more.Host your game server with Hostini →
Was this tutorial helpful?
Chat on WhatsApp