How to Set Up a SA-MP Server from Scratch on Ubuntu Linux
Technical guide to set up a SA-MP server from scratch on Ubuntu Linux: install samp03svr, configure server.cfg, open firewall ports and run it as a systemd service.
San Andreas Multiplayer (SA-MP) is still active despite the official master server going unstable in recent years — international roleplay, freeroam, and DM communities keep thousands of daily players online. Hosting your own SA-MP server on Ubuntu Linux gives you full control over plugins, gamemodes, and performance, and removes the recurring cost of third-party panels.
This tutorial covers a complete install of samp03svr (version 0.3.7-R2) on Ubuntu 24.04 LTS, from the required i386 libraries to a systemd service with automatic restart. The target is a new owner deploying to production on a Linux VPS without a control panel. Estimated time: 25 to 35 minutes.
By the end you’ll have a server listening on UDP 7777, running under a dedicated user, with persistent logs via journalctl, and able to survive machine reboots.
Prerequisites
Before you start, confirm your VPS meets the minimum requirements. samp03svr is light on CPU, but usage scales with plugins, gamemode complexity, and concurrent player count.
Ubuntu 24.04 LTS (also works on 22.04) with at least 1 GB RAM, 2 GB recommended for gamemodes with many filterscripts. Root or sudo access, ~200 MB free disk space, and a free UDP port (default 7777). Active SSH connection.
Ubuntu 24.04 LTS 7777/UDP samp /opt/samp Preparing the system and i386 libraries
The official SA-MP server binary is 32-bit. On modern 64-bit Ubuntu you must explicitly enable the i386 architecture before installing the dependencies, otherwise apt cannot find the lib32* packages.
Update the package index and install basic utilities:
sudo apt update
sudo apt install -y wget tar curl ufwwget and tar are used to download and extract the server. ufw will be the edge firewall.
Enable the i386 architecture and install the 32-bit libs:
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y lib32gcc-s1 lib32stdc++6The dpkg --add-architecture command tells the system to accept packages from another architecture — without it, apt install lib32gcc-s1 returns Unable to locate package.
Create a dedicated user for the SA-MP server:
sudo useradd --system --create-home --home-dir /opt/samp --shell /usr/sbin/nologin samp--system creates an account without password expiration. --shell /usr/sbin/nologin blocks interactive login — the user exists only to isolate the server process.
Downloading and extracting samp03svr
The official binary is distributed as a tarball on files.sa-mp.com. The current stable version is 0.3.7-R2-2-1, compatible with most gamemodes in circulation.
Switch to the samp user’s home directory and download the server:
cd /opt/samp
sudo -u samp wget https://files.sa-mp.com/samp037svr_R2-2-1.tar.gzRunning wget as sudo -u samp ensures the file is created with the correct ownership, avoiding a manual chown later.
Extract the archive and remove the tarball:
sudo -u samp tar -xzf samp037svr_R2-2-1.tar.gz --strip-components=1
sudo -u samp rm samp037svr_R2-2-1.tar.gzThe --strip-components=1 flag avoids the extra samp03/ subdirectory — the files land directly in /opt/samp/.
The SA-MP Team does not publish official checksums, but check the file size (~1.6 MB) and confirm the samp03svr binary runs without a segmentation fault. If you download from unofficial mirrors, prefer sources audited by the open.mp community.
Configuring server.cfg
server.cfg is the heart of the configuration — it defines the public name, rcon password, initial gamemode, loaded plugins, and player limits. Edit it carefully: syntax errors make the server fail to start with no clear message.
Open the config file:
sudo -u samp nano /opt/samp/server.cfgReplace the contents with a minimal working configuration:
echo Executing Server Config...
lanmode 0
rcon_password CHANGE_THIS_LONG_PASSWORD
maxplayers 50
port 7777
hostname Hostini SA-MP Server
gamemode0 grandlarc 1
filterscripts gl_actions
announce 1
query 1
chatlogging 0
weburl www.sa-mp.com
onfoot_rate 40
incar_rate 40
weapon_rate 40
stream_distance 300.0
stream_rate 1000
maxnpc 0
logtimeformat [%H:%M:%S]
language Englishgrandlarc is the default gamemode shipped in the tarball. When you install your own gamemode, replace the name in gamemode0. You must change rcon_password before bringing the server online.
Passwords like changeme, admin, or short strings are immediate targets for bots that scan the internet looking for SA-MP servers. Use 20+ random characters. Command to generate one: openssl rand -base64 24.
Opening the firewall port
Ubuntu 24.04 ships with ufw installed but inactive by default. Before enabling it, make sure SSH stays reachable — otherwise you lock yourself out of the machine.
Allow SSH and the SA-MP UDP port:
sudo ufw allow 22/tcp
sudo ufw allow 7777/udp
sudo ufw enableWhen ufw warns about disconnection, answer y. The SSH rule was added before enable, so the current connection stays alive.
Confirm the active rules:
sudo ufw status numberedYou should see both rules listed with status ALLOW IN. If your provider has a separate edge firewall (security group, cloud panel), allow 7777/UDP there as well.
Running it as a systemd service
Running ./samp03svr directly in the terminal works for tests, but the process dies when you disconnect SSH. A systemd service unit solves this with automatic restart and centralized logs.
Create the service file:
sudo nano /etc/systemd/system/samp.servicePaste the content below:
[Unit]
Description=SA-MP Server
After=network.target
[Service]
Type=simple
User=samp
Group=samp
WorkingDirectory=/opt/samp
ExecStart=/opt/samp/samp03svr
Restart=on-failure
RestartSec=10
StandardOutput=journal
StandardError=journal
LimitNOFILE=4096
[Install]
WantedBy=multi-user.targetRestart=on-failure restarts the process if it exits with a non-zero status — useful for plugin crashes. WorkingDirectory=/opt/samp ensures the binary finds server.cfg, gamemodes/, and plugins/.
Enable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable samp.service
sudo systemctl start samp.serviceenable configures automatic start at boot. start brings the server up immediately.
Verification
With the service running, confirm three things: the process is alive, it’s listening on the correct port, and it answers external queries.
Check the service status:
sudo systemctl status samp.serviceYou should see Active: active (running) and the last lines of the server log showing Server Plugins, Filterscripts, and Number of vehicle models.
Confirm UDP port 7777 is open:
sudo ss -ulnp | grep 7777The output should include a line like UNCONN 0 0 *:7777 *:* users:(("samp03svr",pid=...)). If nothing appears, the server did not bind the port — inspect the log with journalctl -u samp.service -n 50.
Test from the SA-MP client on another computer: add your VPS IP to the favorites list (port 7777) and try to connect. If you reach the spawn screen, the server is fully functional.
Troubleshooting
Server does not start, journalctl shows “samp03svr: command not found”
The binary exists but is missing execute permission, or the 32-bit libs were not installed. Confirm with:
ls -la /opt/samp/samp03svr
ldd /opt/samp/samp03svr
If ldd returns not a dynamic executable or errors about libgcc_s.so.1, reinstall the i386 libs: sudo apt install --reinstall lib32gcc-s1 lib32stdc++6.
Server starts but no one can connect
It is almost always a firewall issue — check both the local ufw and the provider’s firewall. Test the external port with nmap -sU -p 7777 YOUR_PUBLIC_IP from another machine. If the port appears as open|filtered, some layer is blocking UDP.
Intermittent crashes every few hours
Usually it’s a gamemode or plugin with a memory leak. Monitor with top -u samp and correlate with journalctl -u samp.service. Remove plugins one by one from server.cfg until you identify the culprit.
Next steps
With the base server online, consider the next refinements:
- Install a custom gamemode (replace
grandlarcingamemode0with your Pawn-compiled file ingamemodes/) - Add essential plugins like
sscanf2andmysqlin/opt/samp/plugins/ - Configure automatic backups of
scriptfiles/via cron - Implement log rotation to prevent
server_log.txtfrom growing indefinitely - Set up a simple monitoring panel reading the SA-MP query via SACNL or similar
If you’re deploying a SA-MP server to production, a Hostini VPS already ships with edge DDoS protection — relevant because game servers are frequent targets of UDP saturation attacks, the same protocol SA-MP uses for gameplay.
Frequently asked questions
Why do I need to install i386 libraries on 64-bit Ubuntu?
The official samp03svr binary is compiled for 32-bit (i386) and there is no native 64-bit build. To run it on a 64-bit Ubuntu you must enable the i386 architecture with dpkg --add-architecture and install lib32gcc-s1. Without those libs the binary fails silently or returns a loader error.
What is the difference between UDP 7777 and TCP 7777?
SA-MP uses UDP exclusively for client-server communication. TCP port 7777 is only needed if you enable query info for listing sites. For pure gameplay, only allow UDP 7777 on the firewall — opening TCP unnecessarily increases the attack surface with no benefit.
Can I run samp03svr directly as root?
Technically yes, but it is bad practice. The server does not need elevated privileges to listen on port 7777 (above 1024). Creating a dedicated samp user limits the impact of any exploit in plugins or filterscripts. The systemd service in this tutorial already runs with User=samp.
How do I protect my rcon_password against brute force attacks?
Use a 20+ character random password, set maxplayers close to the actual count to reduce empty slots, and configure rcon 1 only when you need to administer remotely. Combine it with fail2ban filtering the server log to ban IPs after failed attempts — SA-MP logs RCON authentication failed in server_log.txt.
Why does my server not show up in the SA-MP client's internal listing?
The master listing uses announce 1 in server.cfg and depends on DNS resolution for servers.sa-mp.com. Check that announce is enabled, that UDP port 7777 is reachable from the public internet (not just localhost), and test with telnet or nmap from an external network. It can take up to 15 minutes to appear after the first registration.
What happens if I close the SSH terminal while samp03svr is running manually?
The process receives SIGHUP and terminates with the SSH session. That's why this tutorial uses systemd: it decouples the process from the session, provides automatic restart on crash, and centralizes logs in journalctl. Alternatives like screen or tmux work for testing, but not for production.