Install CoD4x Webadmin on Debian 9 from scratch

  • Administrators

    Install CoD4x Webadmin on Debian 9 from scratch

    1. Create a user for our Game Servers (if you already have a user and run some cod4 servers you dont need this part)

    Open the terminal and type

    adduser cod4

    You will be asked some additional questions.
    First, you will need to enter and confirm a password for this user.
    Then you will be asked for some additional information about the user, such as full name, room number, work phone, home phone and other. This information is optional and you can just press ENTER on each question to skip it.
    In the end, you will be asked for confirmation of all the information you have entered so far. If everything is correct just press Y and then Enter.

    This is the output that you should get, for our new user called “cod4”:

    Adding user `cod4' ...
    Adding new group `cod4' (1000) ...
    Adding new user `cod4' (1000) with group `cod4' ...
    Creating home directory `/home/cod4' ...
    Copying files from `/etc/skel' ...
    Enter new UNIX password:
    Retype new UNIX password:
    passwd: password updated successfully
    Changing the user information for cod4
    Enter the new value, or press ENTER for the default
    Full Name []:
    Room Number []:
    Work Phone []:
    Home Phone []:
    Other []:
    Is the information correct? [Y/n] Y

    With this, a new user and group named “cod4” have been successfully created. Its home directory has also been created at the following location on your server: /home/cod4

    You can now log in as the “cod4” user to your server using the password you have set up.

    Add User to the sudo Group on Debian 9 with next command

    usermod -aG sudo cod4

    You can also verify if our user is now a member of the sudo group , with the groups commands:

    groups cod4

    You should get the following output, showing that “cod4” is a member of both cod4 and the sudo group:

    cod4 : cod4 sudo

    2 Install Node js and NPM

    To install install Node.js and npm, you first need to install curl

    sudo apt-get install curl software-properties-common

    Then use this command to add the required repository to your system.
    The command will also update the package database afterwards

    curl -sL | sudo bash -

    Use this command to install Node.js and npm

    sudo apt-get install nodejs

    Finally, verify that Node.js is installed

    indicates output

    node -v
    > v10.9.0

    Also, check the version of NPM.

    npm -v
    > 6.2.0

    3 Install MongoDB and setup a user for our database

    First, it’s essential to update the server before attempting to install MongoDB:

    apt-get update && apt-get upgrade -y

    When the server is finishing updating, it’s time to install MongoDB:

    apt-get install mongodb

    Once MongoDB is installed, you will need to start and stop MongoDB, verifying that it functions correctly:

    systemctl start mongodb
    systemctl stop mongodb

    Now you can check your MongoDB version, making sure it’s the proper version or the version you were expecting:

    mongod --version

    Its time to add our user for database called "cod4xwebadmin", in order to do that we need to open the mongodb shell in terminal


    Lets first create our admin user, we switch to database admin with next command

    use admin

    Then we create the admin user with next command (change user and pwd to yours)


    Lets create the user for our cod4xwebadmin database with next command (change user and pwd to yours)

    use cod4xwebadmin

    Lets start the mongoDB with authentication turned ON (if u keep the default port behind firewall thats a plus security, so if you would like to use mongoDB only locally there is no need to allow access to port 27017 - default mongoDB port)

    Locate the Config file and edit it /etc/mongodb.conf, uncoment auth

    # Turn on/off security.  Off is currently the default
    #noauth = true
    auth = true

    If you would like to use Robo 3T (formerly Robomongo) ( change also

    bind_ip =


    bind_ip =

    Robo 3T is something similar to phpmyAdmin so you can see your database Collections

    We need to restart our mongoDB after this changes

    systemctl restart mongodb

    4. Download the latest CoD4x application fron github page and upload it to your new website directory

    I will use in this example next path "/var/www/html"

    After you have downloaded and unziped the CoD4x Webadmin files it is time to change the config.json file so that we can start our application

    Navigate to


    We need to change here multiple lines, first we have to change the mongoDB users username and password

    "db": {
    	"username": "db_username",
    	"password": "db_password",
    	"host": "localhost",
    	"port": "27017",
    	"name": "cod4xwebadmin"

    Next change the session secret to some random text

    "sessionSecret": "somerandomsecrettext_change_it^{",

    Change the website name to yours

    "website_name": "CoD4x Webadmin",

    Change the website URL (i will create a separated tutorial how to setup the nginx file and how to keep the application runing with an npm package called PM2)

    "website_url": "http://your_server_IP:3000",

    In order to be abble to sign up after we start the application we have to get a google recaptcha secret key and site key (

    "g_recaptcha": {
    	"SITE_KEY" : "SITE_KEY",

    Change ssh access, we need this part to manage our Local CoD4 servers later. Since i have created a user called cod4 on the begining i will use that username and password here

    "ssh_access": {
    	"host" : "your-server-ip",
    	"user" : "cod4",
    	"password" : "cod4_users_password"

    Change cod4 server plugin to use the cod4 users root directory

    "cod4_server_plugin": {
    	"download_link" : "",
    	"servers_root" : "/home/cod4"

    The other config json fields are used for some plugins, i will explain that part separated, we dont need it for now

    1. Install the required NPM packages

    Navigate to the website root

    cd /var/www/html/


    npm install

    6. Seed/populate the MongoDB with some default data

    Navigate in terminal to the applications seed folder

    cd /var/www/html/app/seed

    Seed/Populate the MongoDB

    nodejs dbseed.js

    Our application is ready to be started

    Navigate to the website root

    cd /var/www/html/

    Start the application

    npm start

    If you are using firewall dont forget to enable the port 3000

    Open the browser and navigate to your application


    Sign up with your Username, email and password

    After you have signed up you will be redirected to the profile page, ignore that you can change the avatar later, sign out

    Now login with the default Admin (100 power) user what we have added when we have populated the MongoDB in previous step

    //Default user login informations on seed/first install
    //username: admin
    //password: password

    After you have logged in go to Admin, under profile menu. Locate Users link click on your profile what you have just created and set yourself as admin with 100 power. If you have changed your power to 100 relogin with your account, go again back to Admin/users and delete the default admin user (for security reason since this admin is public it would be not nice if others would use this email and password and manage your servers bans users etc...)

    This is the complete instalation for CoD4x Webadmin on Debian 9

Powered & Designed by NeHo