PDA

View Full Version : [CoD2] Install CoD2 on your VDS much faster!



Lonsofore
23rd April 2017, 08:29
Attention!
I don't support this repo and torrent anymore because of
my Docker version (https://killtube.org/showthread.php?3167-CoD2-Setup-CoD2-with-Docker)
so I highly recommend to use it instead.


Hello, Killtube!
I think, everyone know this thread (https://killtube.org/showthread.php?2454-Work-in-progress-Setup-CoD2-on-your-ubuntu-14-04-server) from IzNoGoD. It's a great tutorial and whole Killtube can agree with me, I think (because everyone give link on this thread to beginners). I like it, but... few days ago I changed my hosting and not only once (thank you, good russian hosters). And after another installation I already had a file with commands from that thread (and some else). So, it was a story, now I wanna show you the main subject of this thread :)


About:
I created .sh file, which can install ALL what you need for CoD2 (if it's not all - let's modify it together).
I measured the time from VDS purchase to full CoD2 installation with this .sh and it's less than 10 minutes (with uploading all cod2 files!).
So, any beginner, even he doesn't know anything about Linux can install CoD2 server on Linux now!


So, what does this do:
All what you need to start cod2 server(s):

Updating and upgrading packets
Install all libs for cod2
Install some tools, which you will need (git ssh scp nano make screen zip unzip perl aria2 geoip-bin man-db sqlite sshpass)
Ask you to install no-ip client (for dynamic dns. you will need this for gametracker.com)
Ask you to install web-server (lighttpd or apache2 - on your own)
Ask you to install phpmyadmin (only if you installed web-server)
Creates new user for cod2 (will ask you about name)
Creates all cod2 folders for all versions (it will use links, so you don't have to have main files for all versions)
Ask you to upload main files by yourself or download it from my link or download it from torrent!
Install the latest version of libcod (from VoroN's repo)
Install cod2_lnxded for all versions
Install YOUR servers for each version (ask you about your sh name, fs_game, config name, cracked and port)
Make .sh files to launch your servers (for all CoD2 versions, what you need)



cod2_lnxded versions:
This is the latest patched versions of CoD2 servers (from this thread (https://killtube.org/showthread.php?1719-CoD2-Latest-cod2-linux-binaries-(1-0-1-2-1-3))):

1.0: cod2_lnxded_1_0a
1.2: cod2_lnxded_1_2c_patch_va_loc
1.3: cod2_lnxded_1_3_patch_va_loc



And what do you need to start it:
0. Get VDS with Ubuntu 14.04 or 16.04 and log in as root there.
1. On command line, type in the following commands:

apt-get update
apt-get install git -y
git clone https://github.com/lonsofore/cod2install
cd cod2install
./start.sh
2. Enter your info, when it will ask!


Few tips:

All server files you should upload in ~/cod2/servers/
All your maps you should upload in ~/cod2/Library/fs_game/ (fs_game of your server)
To start your servers open a folder cod2_1_0 or cod2_1_2 or cod2_1_3 and launch it with ./name.sh (there name is the name of your server sh file)
You can update libcod very fast - just launch parts/libcod.sh (from cod2install folder)
You also can manage your servers faster. To add a new server - use parts/servers.sh (from cod2install folder also)



Some screenshots:
1342
1343


Github link (https://github.com/lonsofore/cod2install)
Let me know about mistakes and tell me please if download link is broken.

YuriJurek
23rd April 2017, 16:13
Love this idea, will have to check it out later, but it's a great asset for people that are just starting with cod2.

IzNoGoD
23rd April 2017, 18:12
Please add an apt-get update to your list of commands. Most templated vps installs come with such outdated crappy stuff that even the apt list is outdated, which makes the apt-get install git fail.

Lonsofore
23rd April 2017, 18:41
Please add an apt-get update to your list of commands. Most templated vps installs come with such outdated crappy stuff that even the apt list is outdated, which makes the apt-get install git fail.
You're right. Done, thank you :)

And I have a question to Killtube. I need a file hosting with direct download (to place main files there). Any ideas?
Or maybe somebody can place a miror on his server? Already did it on my server, but one link isn't good enough, I think.

kung foo man
24th April 2017, 00:09
I just wonder if there are legal troubles to distribute the .iwd's

What I would like is a torrent system, that every VPS admin can leech them and - via question - decide to seed it aswell. That would more or less distribute the load evenly

For the end user, that would be an option less to choose from ("Which server you wanna download from?") and faster (multiple downloads same time). And since all package managers got some torrent clients, it wouldn't even be so hard to set up probably via .sh script... just the legal question tho

Ni3ls
24th April 2017, 00:37
http://sv02.bitlimit.com/cod2/main/

Here are all the iwds located

Lonsofore
24th April 2017, 03:34
I just wonder if there are legal troubles to distribute the .iwd's

What I would like is a torrent system, that every VPS admin can leech them and - via question - decide to seed it aswell. That would more or less distribute the load evenly

For the end user, that would be an option less to choose from ("Which server you wanna download from?") and faster (multiple downloads same time). And since all package managers got some torrent clients, it wouldn't even be so hard to set up probably via .sh script... just the legal question tho
I very like this idea. I'll try to do it soon :)



http://sv02.bitlimit.com/cod2/main/

Here are all the iwds located
There is a problem with iw_15. It's different in 1.2 and 1.3, as I know.

Maybe I should ask about CoD2 versions before install...

IzNoGoD
2nd May 2017, 08:28
Time to pick apart a git repo. Note that I like the idea of this stuff, but there's a lot of stuff that could be done better script-wise:


First off, I wouldn't chmod files to 777 unless they need to be executeable by everyone. Chmod 500 works fine for almost all intents and purposes.

You seem to not apt-get update after adding the i386 architecture. This will (probably) cause subsequent apt-gets to fail.

The gcc-multilib is no longer required by voron's libcod if I recall correctly

What are you using zram-config for?

You're using a hard-coded path for the noip folder. If they update (and increase the version number) your script will no longer work. Try cd noip*

You're not cleaning up the downloaded .tar file for the noip install

Why do you need mysql-server and php5-cgi just for installing a web server, which is most likely going to be used for redirect stuff?

You don't seem to be setting the owner or file permissions on the php.ini file when overwriting the old one

The linking of the phpmyadmin can fail in case such a directory and/or link already exists. Use -f for ln to force the link to be created regardless (might cause dataloss if there's a phpmyadmin folder with files in it already though)

You're completely removing the apache2 program during the installation, without informing the user about it. Worse, you remove it and its config files, which are most likely custom (apt-get purge)

Why is the new cod2 user granted sudo privileges? I'd put my cod2-specific accounts without sudo privileges for obvious reasons

There's probably no need to specify the base dir (-b /home) in your useradd command

If all you want to do is add a user with a password, use adduser instead of useradd. It will prompt the user to input a password as well, so you don't have to manually call passwd afterwards

You're assuming that the user has the cod2install folder in his home dir (like /root/cod2install). This will not always be the case. Better to just copy all contents of current dir to the new folder

No need to chmod those files to 777 again. 500 would suffice for read+execute privileges. (when cloning git repos the correct chmod settings are already applied. These are determined at git-commit time, so whatever permissions you upload get downloaded anyway)

You're trying to execute the cod2_servers.sh from the original location. This might fail if this original user is root, and the user has no read-rights on the root dir (default situation). Better to use the /home/$user/ stuff for that. (I am not 100% sure this will happen, but better safe than sorry)

Your description for last localized file only seems off for 1.2. I recall 1.2 missing the last localized file, causing the server to message PC_PATCH_CLIENTDOWNLOADDISCONNECTED on a few occasions. 1.2 should only differ in iw_15.iwd compared to 1.0

The link included in the git project seems already dead. Reporting it per comments.

For linking all contents of a directory, you can more easily just do ln -s /source/*.iwd /dest/ No need to use a for loop there.

Please keep in mind that copying the pb folder will automatically enable your punkbuster. The sv_pb cvar does not influence this for some strange reason. You might want to add a separate question for it.

You're limiting users to one server per fs_game. Users cannot run multiple servers from the same (named) fs_game folder due to the .sh file being named after the fs_game.

There's no input checking on port or cracked cvars

There's no need to set sv_version afaik

You might want to add a wait/sleep in the while loop that's restarting the server. Otherwise, a bug in the mod might completely trash all server resources

You probably want to chmod the resulting fs_game.sh files to 500 so they can actually be executed.

IzNoGoD
2nd May 2017, 08:32
Thread sticky-d.

Lonsofore
3rd May 2017, 07:05
Thank you, IzNoGoD :)
I'm a bit confused now, so much bugs here. But I expected it.
I'll try to fix the most of them soon in few next commits.
In next update I wanna add a menu, where you can check, what do you want to install.



What are you using zram-config for?
So, I'll make a question about it there.



Why do you need mysql-server and php5-cgi just for installing a web server, which is most likely going to be used for redirect stuff?
Already made a question about mysql and phpmyadmin (what required php5-cgi)



You don't seem to be setting the owner or file permissions on the php.ini file when overwriting the old one
Well... it's root's file, so do we need to change it? Or do you mean, that after sed file permissions can change?



The linking of the phpmyadmin can fail in case such a directory and/or link already exists. Use -f for ln to force the link to be created regardless (might cause dataloss if there's a phpmyadmin folder with files in it already though)
In this case, I think, better to fail with link then lose data.



You're completely removing the apache2 program during the installation, without informing the user about it. Worse, you remove it and its config files, which are most likely custom (apt-get purge)
Will fix it in update - there are no this shit. And I ask about prefer web server.



You're trying to execute the cod2_servers.sh from the original location. This might fail if this original user is root, and the user has no read-rights on the root dir (default situation). Better to use the /home/$user/ stuff for that. (I am not 100% sure this will happen, but better safe than sorry)
Can you tell more about it, please? I'm not sure that I understood it correct.



Your description for last localized file only seems off for 1.2. I recall 1.2 missing the last localized file, causing the server to message PC_PATCH_CLIENTDOWNLOADDISCONNECTED on a few occasions. 1.2 should only differ in iw_15.iwd compared to 1.0
So, iw_15 only for 1.2 and iw_15 and localized files for 1.3, right?



The link included in the git project seems already dead. Reporting it per comments.
That's why I wanna add torrent there (already did, in fact, but didn't upload it yet).



Please keep in mind that copying the pb folder will automatically enable your punkbuster. The sv_pb cvar does not influence this for some strange reason. You might want to add a separate question for it.
Didn't know about that...



You're limiting users to one server per fs_game. Users cannot run multiple servers from the same (named) fs_game folder due to the .sh file being named after the fs_game.
Didn't think about that, you're right.



There's no input checking on port or cracked cvars
Will ask :)



There's no need to set sv_version afaik
Well, can we identify server version somehow?
found getCvarFloat("shortversion")


P.S. I missed some remarks, where I can answer only "You're right, IzNoGoD"

Ni3ls
3rd May 2017, 10:21
Well, can we identify server version somehow? (yea, 1.3 we can identify by gamestate, but what about 1.2?)


The server version depends on the iwd's you upload + binary

Lonsofore
3rd May 2017, 10:31
The server version depends on the iwd's you upload + binary
I use my fs_game for 1.0 and 1.3. If I will use it for 1.2 too - how can I detect current game version?

Ni3ls
3rd May 2017, 10:51
I don't get you.
1.0 is the basic version
1.2 adds iw_15
1.3 adds a different iw_15 + localized file

So you can't use the same dir for 1.2 and 1.3

Lonsofore
3rd May 2017, 11:13
That's what I actually do. One directory - 2 (or more) servers.
You can read more here: https://en.wikipedia.org/wiki/Ln_(Unix)

Ni3ls
3rd May 2017, 12:49
So you are saying that in the folder "main" you have all iwd's + all localized files from 1.3?
And then in the fs_game you have the same mod for all 3 versions?

If you also use that "main" both for 1.2 and 1.3 servers, the players from 1.2 have to download a big-ass iw_15.iwd because it's not the same on the client

Lonsofore
3rd May 2017, 14:40
So you are saying that in the folder "main" you have all iwd's + all localized files from 1.3?
And then in the fs_game you have the same mod for all 3 versions?

If you also use that "main" both for 1.2 and 1.3 servers, the players from 1.2 have to download a big-ass iw_15.iwd because it's not the same on the client

Let me show you my directories:
cod2/main/1.0/ - all files from 1.0
cod2/main/1.2/ - iw_15 from 1.2 and localized (I'm not sure about localized - IzNoGoD said something about it here)
cod2/main/1.3/ - iw_15 from 1.3 (yea, it's different with 1.2) and localized
cod2_1_0/main/ - here I linked cod2/main/1.0/
cod2_1_2/main/ - here I linked cod2/main/1.0/ and cod2/main/1.2/
cod2_1_3/main/ - here I linked cod2/main/1.0/ and cod2/main/1.3/

So, now about fs_game. Let's imagine, that I have a server with fs_game = "killtube". So, what I have here:
cod2/killtube/ - original fs_game with all files
cod2_1_0/killtube - link to the first one
cod2_1_2/killtube - link to the first one
cod2_1_3/killtube - link to the first one
So, if I wanna change all my servers, I just replace files once.

And here I found getCvarFloat("shortversion"). Just forgot about it. So, IzNoGoD is right again and I'll delete my own cvar in next commit.


And question to Killtube now: as I know, we use this (https://killtube.org/showthread.php?1719-CoD2-Latest-cod2-linux-binaries-(1-0-1-2-1-3)) to make our servers cracked. So, the question is: can we just turn it off with sv_cracked=0?

Ni3ls
3rd May 2017, 15:53
Let me show you my directories:
cod2/main/1.0/ - all files from 1.0
cod2/main/1.2/ - iw_15 from 1.2 and localized (I'm not sure about localized - IzNoGoD said something about it here)
cod2/main/1.3/ - iw_15 from 1.3 (yea, it's different with 1.2) and localized
cod2_1_0/main/ - here I linked cod2/main/1.0/
cod2_1_2/main/ - here I linked cod2/main/1.0/ and cod2/main/1.2/
cod2_1_3/main/ - here I linked cod2/main/1.0/ and cod2/main/1.3/

So, now about fs_game. Let's imagine, that I have a server with fs_game = "killtube". So, what I have here:
cod2/killtube/ - original fs_game with all files
cod2_1_0/killtube - link to the first one
cod2_1_2/killtube - link to the first one
cod2_1_3/killtube - link to the first one
So, if I wanna change all my servers, I just replace files once.

And here I found getCvarFloat("shortversion"). Just forgot about it. So, IzNoGoD is right again and I'll delete my own cvar in next commit.


And question to Killtube now: as I know, we use this (https://killtube.org/showthread.php?1719-CoD2-Latest-cod2-linux-binaries-(1-0-1-2-1-3)) to make our servers cracked. So, the question is: can we just turn it off with sv_cracked=0?

Ah see I knew it wasn't just 1 folder. But as Izno said, no need for version checker. The binary will decide since it loads specific files.

sv_cracked = 0 will turn it into a normal cracked server

Lonsofore
6th May 2017, 22:15
Update! :)

Fixed almost all from this message (https://killtube.org/showthread.php?2873-CoD2-Install-CoD2-on-your-VDS-much-faster!&p=16240&viewfull=1#post16240).
And also:
+ added dialog boxes
+ setup menu
+ now you can choose between lighttpd and apache2, when installing web server
+ torrent (now we can share main files each other! support it, please)
+ updated cod2_lnxded (https://killtube.org/showthread.php?1719-CoD2-Latest-cod2-linux-binaries-(1-0-1-2-1-3)) (thank you, Mitch)

cod2_lnxded now:
1.0: cod2_lnxded_1_0a
1.2: cod2_lnxded_1_2c_patch_va_loc
1.3: cod2_lnxded_1_3_patch_va_loc

And some screenshots:
1341
1340

IzNoGoD
6th May 2017, 23:33
Save over 1.5gig of disk space by replacing the localized_english 0-10 with this one file:1344

You still gotto keep localized 11 though, but that's originally not part of 1.2 afaik. Doesn't hurt to include it though, fixes a tiny issue with the downloading message.

Lonsofore
7th May 2017, 01:43
Save over 1.5gig of disk space by replacing the localized_english 0-10 with this one file:1344

You still gotto keep localized 11 though, but that's originally not part of 1.2 afaik. Doesn't hurt to include it though, fixes a tiny issue with the downloading message.

Wow, that's cool! Updated torrent and link with this file, thank you :)

IzNoGoD
7th May 2017, 15:50
Wow, that's cool! Updated torrent and link with this file, thank you :)


Due to legal issues I will tell you that I might "know a guy" who "might" be seeding that torrent from 4 seedboxes.

Lonsofore
7th May 2017, 23:27
Hmm... I just thought about file structure. If you want to start 2 identical servers on the same versions, with custom maps, you will have a problem - fs_homepath (.callofduty2 folder). With the same fs_game and the same fs_homepath you will have problems with Library (2 maps in server folder - users will download both, even they don't need one of them).

So, let's think about it - how to avoid it, any opinions?

Yes, we can create new fs_homepath for each server, but it isn't correct, I think... We can also ask about count of servers with the same fs_game... yeah, maybe it's the best way here, but I also want to hear some killtube opinions.

IzNoGoD
7th May 2017, 23:39
Create homepath with net_port in it, will avoid any collision ever.

Just soft-link it, doesn't take up more space.

Lonsofore
19th May 2017, 20:40
Update! What's new:
- Updated paths for fs_homepath - now each server has it's own
- Added startup.sh file, where you can add something, what you wanna start with the system (using cron). And there you can automatically add torrent seeding and cod2 servers (after question, of course).

Lonsofore
30th June 2017, 18:04
Little fix. Change your sh servers files in cod2_1_0, cod2_1_2, cod2_1_3. Replace there this line:

"./cod2_lnxded" "$PARAMS"
to this (use your version here instead cod2_1_0):

"$HOME/cod2_1_0/cod2_lnxded" "$PARAMS"

You have to change it if you want to start this sh from another folder (not from cod2_1_0 or your version) or if you use autostart script.

Added few tips to the head message also.

sezing
16th October 2017, 22:47
PARAMS="+set fs_homepath $HOME/.callofduty2_$ver Created but -bash: cd: /home/userme/.callofduty2_1_2: No such file or directory

+set fs_game $srv_fs

my $srv_fs : fs_game_dosya2 -> /home/userme/cod2/servers/fs_game_dosya2

-bash: cd: /home/userme/cod2/servers/fs_game_dosya2: No such file or directory


what is for fs_homepath and +set fs_game ?

Lonsofore
17th October 2017, 19:09
PARAMS="+set fs_homepath $HOME/.callofduty2_$ver Created but -bash: cd: /home/userme/.callofduty2_1_2: No such file or directory

+set fs_game $srv_fs

my $srv_fs : fs_game_dosya2 -> /home/userme/cod2/servers/fs_game_dosya2

-bash: cd: /home/userme/cod2/servers/fs_game_dosya2: No such file or directory


what is for fs_homepath and +set fs_game ?

Well... fs_homepath is a home path of your server. You can find there console log and you can create there some files. Useless place, if you're beginner (or just don't use files lol).
fs_game is a path of your mod, where you should have your server cfg and your mod folders (like maps/mp/gametypes).

In this case you had to upload your mod to the server, and as I see, you did it. So, this path (/home/userme/cod2/servers/fs_game_dosya2) should be in your .sh file (instead $srv_fs).

sezing
19th October 2017, 15:19
Well... fs_homepath is a home path of your server. You can find there console log and you can create there some files. Useless place, if you're beginner (or just don't use files lol).
fs_game is a path of your mod, where you should have your server cfg and your mod folders (like maps/mp/gametypes).

In this case you had to upload your mod to the server, and as I see, you did it. So, this path (/home/userme/cod2/servers/fs_game_dosya2) should be in your .sh file (instead $srv_fs).

is this script for only ubuntu 14.04 ?

i tried on 14.04 everything is working. However on my 16.06 server is not working. i had to download Latest cod2 linux binaries from Mitch then it worked.

i liked the idea enable cracked 1-0.

can original user join my server if i use Mitch cod2 linux binaries?

voron00
19th October 2017, 15:25
You don't need to use any custom binaries, just use libcod +sv_cracked 1 or sv_noauthorize 1.

sezing
19th October 2017, 20:17
You don't need to use any custom binaries, just use libcod +sv_cracked 1 or sv_noauthorize 1.

i was using libcod +sv_cracked 1 but couldnt join the server.

voron00
20th October 2017, 09:14
Old versions of libocd does not registering custom cvars, use my version or use +set sv_cracked 1.

Lonsofore
20th October 2017, 10:42
is this script for only ubuntu 14.04 ?

i tried on 14.04 everything is working. However on my 16.06 server is not working. i had to download Latest cod2 linux binaries from Mitch then it worked.


I haven't tried it with other versions, so I wrote 14.04 only. I wanna try it on 16.04 soon, so I'll write about it after.

Lonsofore
26th February 2018, 05:09
A big update.

- Now you can use Ubuntu 16.04 aswell
- Edited .torrent file - removed iw_01, iw_02 (it's just for SP). Now it's just 1.8G for all versions.
- Now you can migrate from your old host (you can move your all fs_game, maps from Library, mysql, libcod files). Only if your last server was also installed with this cod2install!
- chmod +x is now default for start.sh, so you don't have to write it after clone
- A lot of small fixes

One time I should make a tutorial - how to use it. Because as I think, a lot of users don't even know, what is fs_game, Libruary, etc.

CaptainSlow
21st April 2018, 21:01
Great stuff! Keep up the good work

teufel
17th March 2019, 18:20
Lonsofore*

You removed iw_01.iwd & iw_02.iwd.

Remove localized files too and the servers will still start. :cool:

Lonsofore
17th March 2019, 19:25
Lonsofore*

You removed iw_01.iwd & iw_02.iwd.

Remove localized files too and the servers will still start. :cool:

Too late answer. I don't support this torrent and repo anymore because of my Docker version (https://killtube.org/showthread.php?3167-CoD2-Setup-CoD2-with-Docker), so I highly recommend to use it instead.

P.S. And we talked about localized two years ago here (https://killtube.org/showthread.php?2873-CoD2-Install-CoD2-on-your-VDS-much-faster!&p=16261&viewfull=1#post16261).