Please note, you will need basic Linux experience for this. I’ll try to make this as “beginner” friendly as possible.
Ensure you are logged in as root
You will need to run all of the following commands before we can start.
setenforce 0 yum update -y yum install wget screen nano git -y
Run all of the following commands. We are going prepare the directories for the server.
cd /home/ mkdir FiveM cd FiveM
Go to the artifacts link and find the artifact with the highest number and copy the url for the file “fx.tar.xf”
Now, we are actually downloading and running the server
Run the following commands
wget <url> Replace "<url>" with the link for the "fx.tar.xf" file
Now we have the server downloaded, now we need to extract it
cd /home/FiveM tar xf fx.tar.xz
Once you have it downloaded you will be able to see all of the server files and such. DO NOT RUN THE “run.sh” FILE!
Now we need to setup our “server-data” folder, this is where we will have the resources, and the server.cfg file for the server.
git clone https://github.com/citizenfx/cfx-server-data.git /home/FiveM/server-data cd server-data
Now its time to make our server.cfg
Paste this into the your ssh client (If you are using Putty just right click)
# you probably don't want to change these! # only change them if you're using a server with multiple network interfaces endpoint_add_tcp "0.0.0.0:30120" endpoint_add_udp "0.0.0.0:30120" start mapmanager start chat start spawnmanager start sessionmanager start fivem start hardcap start ■■■■■■■ start scoreboard start playernames sv_scriptHookAllowed 1 # change this #rcon_password yay sv_hostname "My new FXServer!" # nested configs! #exec server_internal.cfg # loading a server icon (96x96 PNG file) #load_server_icon myLogo.png # convars for use from script set temp_convar "hey world!" # disable announcing? clear out the master by uncommenting this #sv_master1 "" # want to only allow players authenticated with a third-party provider like Steam? #sv_authMaxVariance 1 #sv_authMinTrust 5 # 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:110000112345678 group.admin # add the admin to the group # remove the # to hide player endpoints in external log output #sv_endpointprivacy true # server slots limit (must be between 1 and 31) sv_maxclients 30 # license key for server (https://keymaster.fivem.net) sv_licenseKey changeme
Change the config how you want then once you are done press “CTRL + X” then “Y” then “Enter”.
Now we need to finish up a couple little things before we can start the server.
Centos 7 comes default with firewalld so use the following commands to open the ports for the server
firewall-cmd – add-port 30120/tcp firewall-cmd – add-port 30120/tcp – permanent firewall-cmd – add-port 30120/udp firewall-cmd – add-port 30120/udp – permanent firewall-cmd – reload If you get command not found, run these commands, followed by the ones above. yum install firewalld -y systemctl start firewalld systemctl enable firewalld
This will open up the port “30120” for TCP and UDP.
Now we can run our server. Go into your “server-data” folder (by using cd /home/FiveM/server-data)
Then run this:
bash /home/FiveM/run.sh +exec server.cfg
Note this is MariaDB, but will work the exact same as MySql
MariaDB is a fork of MySql (meaning all MySql applications will work the same on MariaDB).
yum install mariadb-server -y systemctl start mariadb systemctl enable mariadb mysql_secure_installation
Recommended settings (during the mysql_secure_installation):
disallow root login remotely
remove test databases, and access to them.
remove test users
reload privilege table
I hope you understood most of this, if you have any questions let me know.