Linux Server Setup Fivem

Linux Server Setup Fivem

I don’t think that many Linux nerds are going to read this guide, anyway, let’s see how to setup a fivem server on Linux. Let’s get started!
ZAP-Hosting Gameserver and Webhosting

Requirements

In order to setup a fivem server on a linux based machine you need:

  • Being able to use a linux based machine ✔️.
  • Having git installed ✔️.
  • xz or xz-utils packages ✔️.
  • Make sure your linux machine isn’t running on aarch64, otherwise you’re gonna have some issues while running the binaries.
  • Have the machine updated
    sudo apt update; sudo apt upgrade -y

     

Setup

I’ll go very straightforward on how to setup a fivem server on a linux machine here:

    1. Make a server folder, can be everywhere. Use the coomand
      mkdir
    2. Download the latest stable build for linux from here using (this may be outdated, in case open the linux build, inspect the latest one and copy the link in the button and paste it in the older version):
      sudo wget https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/6183-eab7a55b8f98149ac76af234107e2952c13d4cbb/fx.tar.xz
    3. Extract the file into the server folder using xz or xz-utils
      sudo tar xf fx.tar.xz
    4. Using git clone the cfx-server-data from here
      sudo git clone https://github.com/citizenfx/cfx-server-data.git
    5. Create a server.cfg in the same folder of cfx-server-data
    6. Set the sv_licenseKey licenseKeyGoesHere with you key, which can be found here
    7. While in the cfx-server-data folder run the server using the command
cd ~/server/server-data && bash ~/server/run.sh +exec server.cfg

Opening Ports

In order to make people join your server and play it you have to open those ports:

  • 80, http port to use all NUIs (chat, custom loading screens, etc)
  • 443, https port (not sure but open it just in case)
  • 30120, to make people join your server both udp and tcp

You can open these ports with UFW, which is a basic Firewall for linux machines.

sudo ufw allow 80
sudo ufw allow 443
sudo ufw allow 30120

After adding the rules make sure to enable the firewall with:

sudo ufw enable

Running a server on a linux based machine is the best thing to do, therefore you won’t pay 40 cash more only for the Microsoft server license each month. And one important thing is that you have more ram and CPU available, in fact, I personally recommend doing all the programming stuff on a linux based machine.

That’s all you need to know in order to setup a fivem server on a linux server. In a future guide we’ll see how to make your first resource and how to install a few resources. Remember to join our discord to find more people and who knows maybe play together. See you in the next guide, take care 👋👋.

About rikk228js

Developer - Writer