# How to create a server (Linux Guide)

**URL:** <https://cod4x.ovh/t/how-to-create-a-server-linux-guide/3116>\
**Category:** CoD4x | Server Support\
**Tags:** server\
**Created:** [December 10, 2023, 10:47am UTC](https://cod4x.ovh/t/how-to-create-a-server-linux-guide/3116 "2023-12-10T10:47:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![KutaG59](https://cod4x.ovh/user_avatar/cod4x.ovh/kutag59/32/1326_2.png) [@KutaG59](https://cod4x.ovh/u/KutaG59)\
**Post date:** [December 10, 2023, 10:47am UTC](https://cod4x.ovh/t/how-to-create-a-server-linux-guide/3116/1 "2023-12-10T10:47:51Z")

</div>

6 days ago I made a guide for Windows, I am now back with Linux. luckily its more straight forward, but can be confusing for very new users. Once again thanks to -MAD\_DAD- for his Windows guide, as its what started me wanting to setup my own guides.  
Any blue links are downloads / visual images to help further speed up / understand the setup. If you personally don’t trust downloading after clicking a link, it is perfectly fine to go to the website yourself and find the download yourself.

This is all done on Fedora 39, any prerequisites names may differentiate, please find them yourself, and do not ask me. As I have no idea, and would rather not spend my time doing this for you.

This is also done assuming you have your system setup correctly (Read/Write privileges, Wine, Proton, dxvk etc) If it is not, please figure this out on your own.

First download any prerequisites. For Fedora and Fedora based distros (like nobara) its

> sudo dnf install glibc-devel glibc-devel.i686 libgcc.i686 libstdc+±devel.i686 nasm

Any other distro please refer to [this](https://github.com/callofduty4x/CoD4x_Server#compiling-on-linux)

Step 1. Make a folder anywhere for your server, we will name it “Cod4x Server” in that folder, make another called “Main”. Once this is done, copy all IWD files from your “Main” folder in your Cod4x folder, into your Servers “Main” Folder. Then Copy the entire “Zone” folder from Cod4x, and paste it into “Cod4x Server”. You should now have “Main” and “Zone” as folders.

Step 2. Install [Linux Server](https://cod4x.ovh/t/releases/24) open the Rar with Ark (or your distros respective tool for extracting) and [drag the loose files](https://imgur.com/a/MYoSPIw) (not the folders above main labeled cod4x18\_server-linux) into your “Cod4x Server” folder.

Step 2.5. Open your console in the folder (right click an empty space / below cod4x\_dedrun) and type paste this —\>" chmod +x cod4x\_dedrun " then run the command.

Step 3. Run the server just once to make sure it runs (double click cod4x.dedrun or right click an empty space in the folder, open terminal and run ./cod4x18\_dedrun +map mp\_killhouse ). After that your folder structure should look something like [this](https://imgur.com/a/Fv9bqUF)

Step 4. Open Main Folder, and make a text file named “servercfg.txt”, now go to this [template](https://github.com/KutaG59/Cod4x-server-setup/blob/main/server.cfg) copy and paste it into the new text file. Keep open for Step 5.

Step 5. **Line 15** , add a authtoken by going to [Cod4x Masterserver List](https://cod4master.cod4x.ovh/) and signing in with your steam account (for security reasons on their end)  
**Line 44** sets the server name (what people see it as) **DO NOT TOUCH RCON\_PASSWORD LEAVE IT BLANK**  
**Line 48** sets a password if you want the match to be private to yourself/friends.  
**Line 66/67** this will need to be changed, this will be explained in step 6 **PLEASE KEEP MENTAL NOTE ON THIS**  
**Line 208** to change gamemode, if done **Line 241** Must be edited as well.  
Once your done editing your cfg, save it in the top left, then close it and **rename** it to “server.cfg”

Step 6. Port Forwarding and ipv4. Open your console and type ifconfig then hit enter.  
The top/first set of information should be your connection. look for “[inet](https://imgur.com/a/7lsEFgG)” this will be the ipv4/ip you need. If this is too troublesome, find another method of this (like `ip addr`). After this we need to setup a port, this is where things can fall off for some people

Easiest Way: Find your internet providers phone app, and go through that.

Next Best way: Login through your providers website

Last Option (always works if router supports): Open console, type “ip route” and the very first option “default via 000.000.000.000” copy and paste the ip into your browsers search (at the top) and look up your admin login for your router (or look for a sticker with login info on the bottom/side of your router)

Once your at the page to port forward, setup any port between the numbers of 0 and 65535 (ex 38091. If you want multiple do “set ranges” and set between a number like 38091-38097) and make the protocol TCP/UDP.

Step 7. Now that this is all done, we are on our last step. Go into your “Cod4x Server” folder, make a copy of “Cod4x18\_dedrun” and rename it to “Cod4x18\_dedrunServer” open Lutris ([download](https://lutris.net/) if its not installed) Add a locally installed game, select Wine as the runner, choose the executable as the copy we made, and in the arguments section we will paste

> +set dedicated 2 +set net\_ip 000.000.000.000 +set net\_port 28700 +set modstats 0 +set rcon\_password “Password” +set sv\_maxclients 32 +exec server.cfg

replace net\_ip and net\_port with the ipv4/port in the cfg file we made.  
Next make a wine prefix folder in your Home. Name it “wine prefix” then make another called “Cod4x” and select that folder, it should now look like [this](https://imgur.com/a/OLAdNQB)  
Hit save, and then hit play. Right Click it and select “Show logs” to make sure  
A. server has started and is logging  
B. is using IP/Port (scroll to the very top of the logs)  
C. Has connected to the master server.

To check the server, open Cod4x. Join game, change the source at the top to Local (hit refresh if server isnt showing, might’ve not refreshed when you opened the list) and you should see “Cod4Host” boom! theres your server!  
if you want to make sure the Masterserver list can see it, visit [https://cod4master.cod4x.ovh/](https://cod4master.cod4x.ovh/) and search your server name you set in Step 5. It should pop up.

If you have any MAJOR issues (I.E Lutris wont open the server, the logs are filled with junk, you cant get Cod4x to work on Linux in general, Server isn’t joinable/See-able to friends) Then feel free to DM me on discord @ kutag59. but if its something like the prerequisites not downloading, please try to troubleshoot this yourself, You need to learn your own machine and you cant do that if answers are handed to you on a platter.

---

<div class="post-metadata">

**Author:** ![ETfraXoR](https://cod4x.ovh/letter_avatar_proxy/v4/letter/e/b487fb/32.png) [@ETfraXoR](https://cod4x.ovh/u/ETfraXoR)\
**Post date:** [December 13, 2023, 5:00pm UTC](https://cod4x.ovh/t/how-to-create-a-server-linux-guide/3116/2 "2023-12-13T17:00:07Z")

</div>

On linux you can also create a service, you do not need wine to run the server. If you are using a systemd os like ubuntu just create a `cod4x.service` under `/etc/systemd/system/cod4x.service` with the following content

```auto
[Unit]
Description=Service that keeps running the cod4x server on startup.
After=network.target

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
ExecStart=/home/cod/cod4/cod4x18_dedrun +set dedicated 2 +set net_port "28960" +set rcon_password "password" +set sv_cheats 1 +set sv_maxclients 32 +set ui_maxclients 40 +exec server.cfg +map_rotate
WorkingDirectory=/home/cod/cod4
Restart=always
RestartSec=5
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=%n

```

Change your home directory and where the file are sotred accordingly.  
`/home/<username>/<cod-server-directory>`

Then enable the service like so:

```bash
sudo systemctl daemon-reload
sudo systemctl enable cod4x.service

```

NOTE: that this creates a symlink

start the service:

```bash
sudo systemctl start cod4x.service

```

check if service is running:

```auto
sudo systemctl status cod4x.service

```

---

<div class="post-metadata">

**Author:** ![KutaG59](https://cod4x.ovh/user_avatar/cod4x.ovh/kutag59/32/1326_2.png) [@KutaG59](https://cod4x.ovh/u/KutaG59)\
**Post date:** [December 13, 2023, 6:11pm UTC](https://cod4x.ovh/t/how-to-create-a-server-linux-guide/3116/3 "2023-12-13T18:11:44Z")

</div>

Ill be using this once my optiplex comes in, Thank you 🙏

---

<div class="post-metadata">

**Author:** ![ETfraXoR](https://cod4x.ovh/letter_avatar_proxy/v4/letter/e/b487fb/32.png) [@ETfraXoR](https://cod4x.ovh/u/ETfraXoR)\
**Post date:** [December 13, 2023, 6:27pm UTC](https://cod4x.ovh/t/how-to-create-a-server-linux-guide/3116/4 "2023-12-13T18:27:17Z")

</div>

You are welcome! Any doubts on Linux hit me up. If you don’t care about which os, then pick debian or ubuntu 🙂  
Peace
