How to create a server (Linux Guide)

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

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 open the Rar with Ark (or your distros respective tool for extracting) and drag the loose files (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

Step 4. Open Main Folder, and make a text file named “servercfg.txt”, now go to this template 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 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” 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 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
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/ 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.

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

[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:

sudo systemctl daemon-reload
sudo systemctl enable cod4x.service

NOTE: that this creates a symlink

start the service:

sudo systemctl start cod4x.service

check if service is running:

sudo systemctl status cod4x.service
1 Like

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

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

1 Like