Atlantic.Net Blog

How to Install FiveM Game Server on Ubuntu 20.0

Hitesh Jethva
by Atlantic.Net (273 posts) under VPS Hosting
0 Comments

FiveM is a multiplayer game server that allows you to play multiplayer on customized dedicated servers. It was specifically designed for creativity. You can create your own server and make your dreams come true. It provides a set of tools to personalize the gameplay experience of your server. With FiveM, you can make anything including roleplay, drifting, racing, deathmatch, or something completely original.

 

In this tutorial, we will show you how to install FiveM on Ubuntu 20.04.

Prerequisites

  • A fresh Ubuntu 20.04 VPS on the Atlantic.Net Cloud Platform
  • A valid domain name pointed to your server IP
  • A root password configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Ubuntu 20.04 as the operating system, with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in to your Ubuntu 20.04 server, run the following command to update your base system with the latest available packages.

apt-get update -y

Step 2 – Install Required Dependencies

Before starting, you will need to install some dependencies in your server. You can install all of them with the following command:

apt-get install screen wget git -y

Once all the packages are installed, you can proceed to the next step.

Step 3 – Install and Configure FiveM

First, create a directory for FiveM and download the latest version of FiveM inside the directory:

mkdir ~/fivem_server
cd ~/fivem_server
wget https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/3074-
0c5d71ad77873c159d7542a7e8314d9696c1b55b/fx.tar.xz

Once the download is completed, extract the downloaded file with the following command:

tar -xvf fx.tar.xz

Next, you will need to download the CFX server data to your system. You can download it with the following command:

git clone https://github.com/citizenfx/cfx-server-data ~/fivem_resources

Next, you will need to create a FiveM configuration file.

You can create it with the following command:

nano ~/fivem_resources/server.cfg

Add the following lines including your FiveM Licence:

# Only change the IP if you’re using a server with multiple network interfaces, otherwise 
change the port only.
endpoint_add_tcp "0.0.0.0:30120”
endpoint_add_udp "0.0.0.0:30120”

# These resources will start by default.
ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
ensure fivem
ensure hardcap
ensure rconlog
ensure scoreboard

# This allows players to use scripthook-based plugins such as the legacy Lambda Menu.
# Set this to 1 to allow scripthook. Do note that this does _not_ guarantee players won’t be 
able to use external plugins.
sv_scriptHookAllowed 0

# Uncomment this and set a password to enable RCON. Make sure to change the password - it 
should look like rcon_password "YOURPASSWORD”
#rcon_password "”

# A comma-separated list of tags for your server.
# For example:
# - sets tags "drifting, cars, racing”
# Or:
# - sets tags "roleplay, military, tanks”
sets tags "default”

# Set an optional server info and connecting banner image url.
# Size doesn’t matter, any banner sized image will be fine.
#sets banner_detail "https://url.to/image.png”
#sets banner_connecting "https://url.to/image.png”

# Set your server’s hostname
sv_hostname "FXServer, but unconfigured”

# Nested configs!
#exec server_internal.cfg

# Loading a server icon (96×96 PNG file)
#load_server_icon myLogo.png

# convars which can be used in scripts
set temp_convar "hey world!”

# Uncomment this line if you do not want your server to be listed in the server browser.
# Do not edit it if you *do* want your server listed.
#sv_master1 "”

# Add system admins
add_ace group.admin command allow # allow all commands
add_ace group.admin command.quit deny # but don’t allow quit
add_principal identifier.steam:110000100000000 group.admin # add the admin to the group

# Hide player endpoints in external log output.
sv_endpointprivacy true

# Server player slot limit (must be between 1 and 32, unless using OneSync)
sv_maxclients 32

# License key for your server (https://keymaster.fivem.net)
sv_licenseKey i1mqzvi2eukui85p8cb0uddanqsru2lk

Save and close the file when you are finished.

Next, you can start the FiveM server with the following command:

cd ~/fivem_resources && bash ~/fivem_server/run.sh +exec server.cfg

Once the server has started successfully, you should get the following output:

Note: This process will take several minutes to start

[------------------------------------------------------------------------------------------------------
--------------------------------] 0/315Server license key authentication succeeded. Welcome!
Authenticating with Nucleus...
[#####-------------------------------------------------------------------------------------------------
-------------------------------] 11/315 fff
cccc ff xx xx rr rr eee
cc ffff xx rrr r ee e
cc ff xx ... rr eeeee
ccccc ff xx xx ... rr eeeee

Authenticated with cfx.re Nucleus: https://hitj-e8q3pd.users.cfx.re/
[###############################-----------------------------------------------------------------------------
-------------------------] 74/315-- [server notice: tebex_not_set]
================
Monetize your server using Tebex! Visit https://tebex.io/fivem for more info.
================

Press CTRL + C to stop the server.

Step 4 – Create a Systemd Service File for FiveM

It is a good idea to create a systemd service file to manage the FiveM service. You can create it with the following command:

nano /lib/systemd/system/fivem.service

Add the following lines:

[Unit]
Description=FiveM server

[Service]
Type=forking
User=root
ExecStart=/usr/bin/fivem_start.sh

[Install]
WantedBy=multi-user.target

Save and close the file, then create a FiveM start script:

nano /usr/bin/fivem_start.sh
Add the following lines:


#!/bin/bash
screen -dm bash -c 'cd /root/fivem_resources && bash /root/fivem_server/run.sh +exec 
server.cfg'

Save and close the file then set proper permission:

chmod +x /usr/bin/fivem_start.sh

Next, reload the systemd daemon with the following command:

systemctl daemon-reload

Next, start FiveM and enable it to start at system reboot:

systemctl start fivem
systemctl enable fivem

You can verify the status of FiveM with the following command:

systemctl status fivem

You should get the following output:

  • fivem.service - FiveM server
Loaded: loaded (/lib/systemd/system/fivem.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2021-01-13 15:09:13 UTC; 6s ago
Process: 24132 ExecStart=/usr/bin/fivem_start.sh (code=exited, status=0/SUCCESS)
Main PID: 24136 (screen)
Tasks: 67 (limit: 4691)
Memory: 48.1M
CGroup: /system.slice/fivem.service
├─24136 SCREEN -dm bash -c cd /root/fivem_resources && bash /root/fivem_server/run.sh +exec server.cfg
├─24148 /root/fivem_server/alpine/opt/cfx-server/ld-musl-x86_64.so.1 --
library-path /root/fivem_server/alpine/usr/lib/v8/:/root/f>
└─24151 /root/fivem_server/alpine/opt/cfx-server/ld-musl-x86_64.so.1 --
library-path /root/fivem_server/alpine/usr/lib/v8/:/root/f>

Jan 13 15:09:13 ubuntu2004 systemd[1]: Starting FiveM server...
Jan 13 15:09:13 ubuntu2004 systemd[1]: Started FiveM server.

By default, FiveM listens on port 30120. You can check it with the following command:

ss -antpl | grep 30120

You should get the following output:

LISTEN 0 128 0.0.0.0:30120 0.0.0.0:* users:(("ld-musl-x86_64.",pid=24148,fd=57))

Conclusion

Congratulations! You have successfully installed and configured a FiveM game server on Ubuntu 20.04. You can now download the FiveM client on your desktop system and start playing using FiveM on your virtual private server from Atlantic.Net!

Get A Free To Use Cloud VPS

Free Tier Includes:
G3.2GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

Major SMS Company Hacked
How to Install WordPress with SlickStack on Ubuntu 20.04
Top 10 Linux Distributions
How To Create a New User and Grant Permissions in MySQL8 on CentOS8
Top 10 Remote Management Tools

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2323 Bryan Street,

Dallas, Texas 75201

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources