I often see how people are trying to start server using really strange solutions. So I thought "I need to make a good tutorial", let's get it!
You need a Linux server (I use Debian 10) and installed the server.
Usually I put the server in /opt directory, in this tutorial we do it same.
Part One: Installing the server
Let's start to install pure Multi Theft Auto linux server. As a joke from bashorg said: "it only takes three commands to install Gentoo", you have to put only two commands
apt install unzip
wget https://linux.multitheftauto.com/dl/multitheftauto_linux_x64.tar.gz && \
tar xvf multitheftauto_linux_x64.tar.gz && \
rm multitheftauto_linux_x64.tar.gz &&\
cd multitheftauto_linux_x64/mods/deathmatch/ && \
wget https://linux.multitheftauto.com/dl/baseconfig.tar.gz && \
tar xvf baseconfig.tar.gz && \
mv baseconfig/* . && \
rm -rf ./baseconfig/ && \
mkdir resources && cd resources && \
wget https://mirror.multitheftauto.com/mtasa/resources/mtasa-resources-latest.zip && \
unzip mtasa-resources-latest.zip && \
rm mtasa-resources-latest.zip && \
cd ../../../ && chmod +x ./mta-server64
putty_xjovvhDRiG.mp4
What are about these commands?
Downloading and unpacking mta server binaries
Downloading and unpacking default configs
Downloading and unpacking resources
Part 2: Daemonization
Many of tutorials was written when systemd isn't exists. But not today.
Let's make a systemd unit.
Before we're starting to do it, we need to check one thing. Basically MTA Server has ncurses UI, that's can be inconvenient for daemons, so we have to check flags.
Okkay! We take them all!
There are a lot of guides how to make different systemd units, but I've made the config for you. You only need to put the file into /etc/systemd/system/multitheftauto.service
[Unit]
Description=Multi Theft Auto Dedicated server
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=root
WorkingDirectory=/opt/multitheftauto_linux_x64
ExecStart=/opt/multitheftauto_linux_x64/mta-server64 -t -n -u
[Install]
WantedBy=multi-user.target
And make systemd reload the configs
Need video?
putty_QR8ebBKoVy.mp4
Seems like you're done all of my steps. What's next?
There are good commands for management the unit
1. journalctl -u multitheftauto -n -f
2. systemctl enable multitheftauto
3. systemctl stop multitheftauto
4. systemctl restart multitheftauto
5. systemctl start multitheftauto
6. systemctl status multitheftauto
1. Reads logs in the stream
2. Enable the unit (after rebooting the server the unit will start)
3,4,5 Stop/restart/start the unit (the server)
6. Status of the unit (is it running? Stopped? and last lines from the std out)
More info you may read here: https://www.freedesktop.org/software/systemd/man/journalctl.html
and here: https://www.freedesktop.org/software/systemd/man/systemctl.html