-
Install CoD4x Webadmin on Ubuntu 16.04 17.04 18.04 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(putty) 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 Ubuntu 16.04 17.04 18.04 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
Refresh your local package index by typing
sudo apt update
Install Node.js from the repositories:
sudo apt install nodejs
If the package in the repositories suits your needs, this is all you need to do to get set up with Node.js. In most cases, you'll also want to also install npm, the Node.js package manager. You can do this by typing:
sudo apt install npm
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:
sudo apt update
When the server is finishing updating, it’s time to install MongoDB:
sudo apt install -y mongodb
Once MongoDB is installed, you will need to start and stop MongoDB, verifying that it functions correctly:
sudo systemctl start mongodb sudo systemctl stop mongodb
This will output the current database version, the server address and port, and the output of the status command:
mongo --eval 'db.runCommand({ connectionStatus: 1 })'
Its time to add our user for database called "cod4xwebadmin", in order to do that we need to open the mongodb shell in terminal(putty)
mongo
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)
db.createUser({user:"admin",pwd:"admin",roles:[{role:"root",db:"admin"}]})
Lets create the user for our cod4xwebadmin database with next command (change user and pwd to yours)
use cod4xwebadmin db.createUser({user:'database_user',pwd:'newdatabasepass',roles:[{role:'readWrite',db:'cod4xwebadmin'}]})
Lets start the mongoDB with authentication turned ON (if u keep the default port behind firewall that's 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) (https://robomongo.org/) change also
bind_ip = 127.0.0.1
to
bind_ip = 0.0.0.0
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. Clone the latest CoD4x application from github page, with command git https://github.com/byNeHo/CoD4x-WebAdmin
Examples for git installation if you don't have it already
Ubuntu:
sudo apt update sudo apt install git
Debian 9:
sudo apt update sudo apt install git
Debian 8:
sudo apt update sudo apt-get install git-core
Centos 7:
sudo yum install git
I will use in this example next path "/var/www/"
git clone https://github.com/byNeHo/CoD4x-WebAdmin.git html
After you have cloned the CoD4x Webadmin files it is time to change the config.json file so that we can start our application
Navigate to
/app/config/config.json
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 running with an npm package called PM2)
"website_url": "http://your_server_IP:3000",
In order to be able to sign up after we start the application we have to get a google recaptcha secret key and site key (https://www.google.com/recaptcha/admin#list)
"g_recaptcha": { "SITE_KEY" : "SITE_KEY", "SECRET_KEY" : "SECRET_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 beginning 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" : "http://files.linuxgsm.com/CallOfDuty4/cod4x18_dedrun.tar.bz2", "servers_root" : "/home/cod4" }
The other config json fields are used for some plugins, i will explain that part separated, we don't need it for now
- Install the required NPM packages
Navigate to the website root
cd /var/www/html/
Install
npm install
6. Seed/populate the MongoDB with some default data
Navigate in terminal(putty) 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 don't forget to enable the port 3000
Open the browser and navigate to your application
http://my_server_IP:3000
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 information's on seed/first install //username: admin //email: admin@gmail.com //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 installation for CoD4x Webadmin on Ubuntu 16.04 17.04 18.04
-
how to fix that...
npm install audited 14143 packages in 12.874s found 1 low severity vulnerability run `npm audit fix` to fix them, or `npm audit` for details
-
@DA3K-DRAGON ignore that for now, its a low issue, and please post in support when you have questions
-