Tutorial:Setup Linux Server
Setup alt:V server for Linux
You need to run alt:V server at least on Debian 10 or Ubuntu 18.04.
It is recommended to use altv-serverupdater to have easy downloaded server-files (and in future updated). Remember that you need to have installed dependencies on your linux for that updater (coreutils, wget, >=jq_1.4). However, you can also just download the serverfiles from our website and upload them manually to your server.
Running the alt:V-serverupdater:
apt-get install libc-bin #(debian only) mkdir server && cd server wget -O 'update.sh' 'https://raw.githubusercontent.com/Lhoerion/altv-serverupdater/master/update.sh' chmod +x ./update.sh ./update.sh chmod +x ./altv-server
Creating a config file
Make a new file in server root folder named server.cfg and paste this:
name: 'alt:V Server' host: 0.0.0.0 port: 7788 players: 128 #password: ultra-password announce: false #token: YOUR_TOKEN gamemode: Freeroam website: example.com language: en description: 'alt:V Sample Server' modules: [ js-module ] resources: [ ]
Starting a server
Now you have all server files that you need. Let's try to start server with start.sh
If you get error about libatomic library just install it via your linux package manager.
apt-get update apt-get install libatomic1
Running alt:V server as a systemd.service
It is possible to run the alt:V server as a systemd.service. This gives you the following advantages:
- You can make the server automatically restart when it crashes
- You can easily start/stop it with simple commands, without navigating to the server directory
- You can add the alt:V server to the autostart
Adding the service
Create the file /lib/systemd/system/altv.service with any editor of your choice. In this example we're using nano.
Paste the following snippet inside this file and modify it to your needs. Make sure to change the paths and user/group, otherwise it won't work.
[Unit] Description=alt:V Server After=network.target [Service] WorkingDirectory=/path/to/your/server/ User=altv Group=altv Type=simple ExecStart=/path/to/your/server/altv-server ExecStop=kill -15 $MAINPID PIDFile=/path/to/your/server/altv.pid RestartSec=15 Restart=always [Install] WantedBy=multi-user.target
Now save the file and enable the service with
systemctl enable altv.service
Congratz! The service has been successfully added. alt:V will now automatically boot with your server and restarts, if it crashes. You also now have access to the following commands:
service altv start # start the server service altv stop # stop the server service altv status # get the current status of your server with console output service altv restart # restart the server
Keep in mind to never run applications as root user, as this might be a security risk.