CoD4X Server and BigBrotherBot (b3) helpcod4x server setup then cod4xwebadmin setup all on ubuntu

Post Reply
User avatar

Topic author
Gen Stranger
KAB Administrator
Posts: 363
Joined: 19 Jan 2004 18:28
20
Contact:

cod4x server setup then cod4xwebadmin setup all on ubuntu

Post by Gen Stranger »

There are alot of questions on cod4x.me web site about problems setting up COD4X on Ubuntu so I decided to write this post on how I set up my cod4x servers and cod4xwebadmin from Neho
I started by installing ubuntu 18.04 on my server. If you do not have ubuntu 18.04 you can download it here https://ubuntu.com/download/desktop.

now comes step by step instruction on how to install cod4xwebadmin

install ubuntu 18.04 and all upgrades - the setup should load the updates as you install it.
once its installed I needed a way to connect to ubuntu from my home computer
so I installed putty on my windows 10 computer.
putty-32-bit.exe
32 bit putty for windows
(1.05 MiB) Downloaded 410 times
putty-32-bit.exe
32 bit putty for windows
(1.05 MiB) Downloaded 410 times
putty-64-bit.exe
64 bit putty for windows
(1.12 MiB) Downloaded 370 times
putty-64-bit.exe
64 bit putty for windows
(1.12 MiB) Downloaded 370 times
I also use WinSCP as an FTP program to upload the required files
WinSCP-5.17-Setup.exe
Free FTP program
(10.58 MiB) Downloaded 402 times
WinSCP-5.17-Setup.exe
Free FTP program
(10.58 MiB) Downloaded 402 times

I had to enable Enable SSH Server on Ubuntu 18.04 LTS
so from terminal in ubuntu I did the following
sudo apt-get update
then
sudo apt-get install openssh-server

Now to allow SSH root login on Ubuntu 18.04
using terminal do the following
sudo passwd
enter a password
now we have to allow root to login remotely by this command
sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
after that's done restart ssh
sudo service ssh restart

now use putty to login to your ubunntu installation
enter user name root then the password you just made
once your logged in as root you have to make a user for cod4x
I used cod4 as the user
Step 3
sudo 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
Add user cod4 to the sudo Group on Ubuntu 16.04 17.04 18.04 with next command
sudo usermod -aG sudo cod4

you can now logoff the root user and login as cod4
relogin as cod4

<-------------------------------------------------------------------------------------------------------------------->
this is for setting mysql for b3 databases - and phpadmin - if your not using b3 you can skip this step.
install MySQL server on your Ubuntu 18.04 VPS.
sudo apt-get install mysql-server

Secure your MySQL server
MySQl server ships with default settings which are not secure. We need to configure it to make our server less vulnerable to attacks.
Luckily there is a single configuration command that will make things easier for us. Just run the command below:
sudo mysql_secure_installation
you will get the following
ALIDATE PASSWORD PLUGIN can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD plugin?
Press y|Y for Yes, any other key for No: enter Y
There are three levels of password validation policy:
LOW Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
Please set the password for root here.
New password:
Re-enter new password:
Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y
By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y
Success.
Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y
Success.
By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y
Success.

ok now logon into mysql using below command
sudo mysql -u root -p

ok now create a b3 database (I used b30 in case I wanted to add more databases later)
create database b30;

then I created a user for the database called b3 replace below password with a password of your choice
create user 'b3'@'localhost' identified by 'password';

now give b3 access to the database by the command below - use the same password you gave above to the user b3
grant all on b30.* to 'b3' identified by 'password';

type exit to exit mysql

here is where Winscp will really help you ( I use it a lot to edit files like below and .gsc files)
now allow remote access editing /etc/mysql/mysql.conf.d
change
bind-address = 127.0.0.1 to
bind-address = 0.0.0.0

now restart mysql
sudo service mysql stop
sudo service mysql start
to make b3 work you must install python-mysqldb
sudo apt-get install python-mysqldb
Install phpMyAdmin from Ubuntu Packages
sudo apt-get update
sudo apt-get install -y phpmyadmin
any questions on the install of phpmyadmin see https://www.hostingadvice.com/how-to/in ... on-ubuntu/
<---------------------------------------------------------------------------------------------------->

ok now install apache2
sudo apt-get install apache2
Install PHP for web site
Enter the command below to install PHP on your Ubuntu 18.04 server
sudo apt-get install php libapache2-mod-php
restart apache2
sudo systemctl restart apache2
<--------------------------------------------------------------------------------------------------->

Steps to install FTP
Before starting installation, we need to update the repositories.
sudo apt-get update
sudo apt-get install vsftpd

now I made a directory using winscp in home called web
so now I have /home/cod4
and /home/web
and /home/your user name

I uploaded all the cod4webadmin files and the directories to web using winscp again (I love that program)
you can get cod4xwebadmin at https://github.com/byNeHo/CoD4x-WebAdmin

ok once the files are uploaded you have to install the following

sudo apt update
sudo apt install screen
sudo apt install nodejs
sudo apt install npm
sudo apt update
sudo apt install -y mongodb
sudo systemctl start mongodb

now type
mongo --eval 'db.runCommand({ connectionStatus: 1 })'
it will tell you if its running

the following will install the mongodb for the webadmin
mongo
use admin
db.createUser({user:"root",pwd:"password",roles:[{role:"root",db:"admin"}]})

use cod4xwebadmin
db.createUser({user:'cod4',pwd:'password',roles:[{role:'readWrite',db:'cod4xwebadmin'}]})

exit mongo
exit or ctl c

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
after edit
systemctl restart mongodb

ok another file to edit

go to /home/web/app/config
in there you have to edit the config.json file

here is an example of mine with certain information removed
{
"db": {
"username": "cod4",
"password": "blankedout",
"host": "localhost",
"port": "27017",
"name": "cod4xwebadmin"
},
"sessionSecret": "somerandomsecrettext_change_it^{",
"website_name": "CoD4x Webadmin",
"website_url": "www.KAB.iogcod4.com",
"contact_email": "stranger-KAB@KAB.iogcod4.com",
"facebookAuth" : {
"clientID" : "client_id",
"clientSecret" : "clientSecret",
"callbackURL" : "http://localhost:3000/user/auth/facebook/callback",
"profileURL" : "https://graph.facebook.com/v2.5/me?fiel ... name,email"
},
"twitterAuth" : {
"consumerKey" : "consumerKey",
"consumerSecret" : "consumerSecret",
"callbackURL" : "http://localhost:3000/user/auth/twitter/callback"
},
"googleAuth" : {
"clientID" : "clientID",
"clientSecret" : "clientSecret",
"callbackURL" : "http://localhost:3000/user/auth/google/callback"
},
"steamAuth" : {
"returnURL" : "http://iog,mooo.com:3000/user/auth/steam/return",
"realm" : "http://iog.mooo.com:3000",
"apiKey" : "blanked out"
},
"discord_webhook": {
"webhook_url" : "webhook_url",
"webhook_displayname" : "CoD4x Webadmin",
"webhook_avatar" : "http://iog.mooo.com:3000/img/profile-menu.png"
},
"g_recaptcha": {
"SITE_KEY" : "blanked out",
"SECRET_KEY" : "blanked out"
},

"kgb_api": {
"kgb_link" : "http://www.kgb-hosting.com/gpanel/api/s ... rocess.php",
"kgb_id" : "kgb_id",
"kgb_auth" : "kgb_auth"
},
"ssh_access": {
"host" : "my ip",
"user" : "cod4",
"password" : "blanked out"
},
"cod4_server_plugin": {
"download_link" : "http://files.linuxgsm.com/CallOfDuty4/c ... un.tar.bz2",
"servers_root" : "/home/cod4"
},
"cod4x_compile": {
"download_link" : "http://github.com/callofduty4x/CoD4x_Se ... master.zip",
"dir_root" : "/home/cod4/CoD4x_Server-master",
"zip_file_name" : "master.zip",
"save_directory_path" : "/home/web/public"
},

"website_language": "en",
"website_non_http_url": "localhost"

once the file is edited
go to /home/web
run the following

npm install
then go to
cd /home/web/app/seed
run
nodejs dbseed.js
go back to /home/web
start the server with the command below
npm start
web site should be running
//Default user login information's on seed/first install
//username: admin
//email: admin@gmail.com
//password: password

go here only if the web site is running
you must have a way to have the web site running without having putty open all the time and npn start as the means to start the server
pm2 to the rescue

Installing PM2 and starting our application
To install PM2 enter next command
npm install pm2 -g
then run
pm2 start npm --name "cod4xwebadmin" -- start

some pm2 commands
pm2 start npm --name "cod4xwebadmin" -- start
pm2 stop cod4xwebadmin
pm2 stop all
pm2 start all

below will allow pm2 to start with ubuntu if its rebooted for any reason
pm2 startup
you will be prompted to do some stuff
then finally
pm2 save will save the startup config

if all went well it should be running fine -

look at the web site and see what you can do by typing the server ip:3000 in the web broswer
mine is at http://iog.mooo.com:3000/
Gen Stranger
Stranger-KAB
Post Reply