[Deprecated][Tutorial] How To Setup A Linux Server (Ubuntu 16.04) From Start To Finish!

Locked at author’s request since CFX Has been deprecated

Hello, I am providing an in-depth and “Noob Friendly” guide on how to install FiveM on a completely fresh Ubuntu installation, mainly because I had such a hard time figuring out a lot of the steps, even with help from several of the awesome members on the Discord server.

I’ll preface this tutorial by saying that it is aimed at Ubuntu 16.04 however, assuming you follow the instructions you should be able to transition this advice over to Debian 8 as well. This is aimed at newer folks so I wont be making too many assumptions about your knowledge on the subject (As long as you return the favor ;)).

I’m going to assume you know how to SSH / FTP into your server for the entirety of this tutorial.

Warning: Due to the nature of how repositories work, their structure could change and this tutorial, in the future, may require you to do a little bit of leg work and search for the correct link to the Repository… Just know that currently, FiveM works best, on Mono 4.8.1.

Requirements:

  • Obtain Root access on your server!

  • Update / Upgrade to ensure you are all up-to-date!

apt-get update && apt-get upgrade
  • Install wget, which allows you to easily download files!
apt-get install wget
  • Install make which lets you easily compile source code without much effort at all!
apt-get install cmake
  • Install g++ which is also a requirement for the compiling part of this tutorial!
apt-get install g++
  • Don’t forget! Be sure to press Enter (or type ‘Y’ and press Enter) when prompted.

Step 1) Downloading, Compiling, and Installing Mono 4.8.1

You’re going to want to navigate to your /home/ directory. You can do this easily by typing:

cd /home/

Afterwards, you are going to want to download the source code for Mono 4.8.1. You can do so, by typing:

wget https://download.mono-project.com/sources/mono/mono-4.8.1.0.tar.bz2

After you wait for that to download, you’ll want to follow that up with:

tar xvjf mono-4.8.1.0.tar.bz2

Move into the correct directory:

cd mono-4.8.1

Type:

./configure

Then follow that up with:

make

The previous step will take some time. Feel free to grab a coffee or something in the meantime. Credits for the latter part of this section goes out to @Scyar_Gameur and a direct link to his contribution will be at the bottom. After the compiling finishes, if you installed g++ you should have had no errors. If any persist, please let me know in the comments.

Next you will want to run:

sudo make install

Congratulations. You now have Mono 4.8.1 installed and running on your Ubuntu 16.04 Server!
You can confirm this by running:

mono --version

Step 2) Setting Up Your FiveM Server!

Afterwards, you are going to want to download FiveM and you can do so here:

You’ll want to unzip your cfx-server.7z and store it in a familiar folder named “/cfx-server/” for the time being. Follow the official setup guides for whichever server version is most current, I personally recommend going in and changing certain settings in:

citmp-server.yml

More importantly your server’s password / name.

At this point, I recommend launching your preferred FTP client and connect to your server using your root / admin account. Afterwards, simply navigate to your /home/ directory using the server browser (in Filezilla, this is the Right side window).

Drag the cfx-server folder into the /home/ directory and you will now have the FiveM server “installed” on to your Ubuntu Server!

At this point you are mostly done, but there is one last step that needs to be done before you will be able to get on your server.

Step 3) Updating your certs!

Luckily this last step is super simple, but very important. If you get a TrustFailure issue when you try to join your server, it’s because you did not follow this step!

You’ll want to type:

sudo cert-sync /etc/ssl/certs/ca-certificates.crt

Followed by,

apt-get update && apt-get upgrade

Step 4) Running Your Server!

You can now start your server by navigating to your cfx-server folder:

cd /home/cfx-server/

and typing:

./run.sh

You can also close it by pressing the command:

CTRL + C

Step 4.5 (Optional)

Alternatively, you can run your server in a… virtual SSH session, which will allow you to drop out of the main session without the server automatically closing. You can do so by typing:

screen

This will prompt you to press your SPACE key a few times, but in general when you get into the new “Screen”, everything will look relatively familiar. The difference is this is a virtual screen.

You can again, in this session, navigate to your server folder and run the server from here. The difference being when you leave it will remain running. To exit this session, you can simply press the command:

CTRL + A + D

And to rejoin the session when you’re back at the main terminal you can press the command:

screen -r

Conclusion

That should be it! You are now the proud owner of a fresh and functioning FiveM server! If you have any questions, concerns, or issues, let me know in the comments and I will eventually get back to you! I’m not super good at this whole server-admin stuff myself, but I figured I’d post an in-depth step-by-step guide / compilation of the information I found so that other users, that struggled like me, can hopefully setup and enjoy this awesome project!

As promised, credits and reference to:

Very Helpful / Informative Thread

And anyone / anything else I may have missed!

Thank you for getting this far :wink:

8 Likes

How would I stop the server?

1 Like

do u have any experience with cronjob? I wanna reboot the server and automatically start it again how would I do that?

1 Like

CTRL + Z and “sudo reboot now”, I’m still new to it myself but I have to reboot my personal server everytime I close it that way.

I had experience with cronjobs when running a webserver but not enough that I can perfectly recall how to set one up. Mine was to auto-renew my SSL certificates when they were within 1 month of expiration… You can google some resources or take a look at this ubuntu thread: https://askubuntu.com/questions/13730/how-can-i-schedule-a-nightly-reboot

Sorry I couldn’t be of more help when it comes to cronjobs.

Rebooting the whole server when you stop your server is totally useless

And you should use screen command (from screen packet) to launch your server.

2 Likes

I don’t disagree. Just updated the main thread with some information I got on the Discord server. Thanks :slight_smile:

It doesn’t setup a cronjob but it shows how to use a screen session!

Thanks you so much, you helped me and all my team :slight_smile:
thanks you, keep helping others :slight_smile:

1 Like

Glad to hear! Never a problem.

I seen your comment as I went to bed last night, all good now?

How would you make the server restart every 6 hours? I tried crontab but no luck

1 Like

I don’t have an example for setting up a cronjob.

Thanks for the helpful post!!!

1 Like

Never a problem! Hope you enjoy!

can you make a tutorial for the new FXServer?

2 Likes

That’s on the way very very soon. I might be just modifying this one completely.

1 Like

Thread should be locked soon since CFX-Server is being deprecated. New tutorial up in a few moments.