How to change Garrys Mod Server default port?

I need to have multiple garrysmod servers on the same dedicated hosting so I have a single IP and first server uses default port (27015) and the second server will use another port, but I dont know how to change it.

I searched a lot but ony find port fowarding stuff for people that host server on their own pc.

My dedicated server runs on ubuntu 14.04

Hope that someone knows how to do it.
Thanks

In the startup line put +port portnumber

Wow I didn’t know that was really easy! Im downloading some content now, when it finishes I will try your fantastic answer.
Thanks you!

[editline]21st August 2014[/editline]

Do you know If I can also change the port that in default is 27005 I think this is the query port because gametraker can’t see te second server. whe starting the serveer that query port appears like that:

Network: IP unknown, mode MP, dedicated Yes, ports 27087 SV /** 27005** CL

Underline is the new port I’ve added, bold is the query port that I don’t know how to change.

Hope you know how to do it, than you!

I have two servers and did not change the query port. Gametracker just takes awhile to scan the server and then publish it. If you have a different port the query port should not make a difference.

+clientport 27017

But I don’t think you should be changing it, it shouldn’t matter.

It’s not working, I don’t know why but now I can’t enter the server. Garrys mod needs TC or UPD connection? I’ve opened the ports on TCP only.

That’s the console when I start the server:


+clientport 27082 +maxplayers 12 +map gm_construct
Unknown command "port"
Network: IP unknown, mode MP, dedicated Yes, ports 27087 SV / 27082 CL 
Error loading cfg/trusted_keys_base.txt
Error loading cfg/pure_server_minimal.txt
PREP OK
ConVarRef room_type doesn't point to an existing ConVar
Executing dedicated server config file server.cfg
Map cycle file 'cfg/mapcycle.txt' was not found.
Nav File is wrong or something (4)
Initializing Steam libraries for secure Internet server
[S_API FAIL] SteamAPI_Init() failed; SteamAPI_IsSteamRunning() failed.
dlopen failed trying to load:
/root/.steam/sdk32/libsteam.so
with error:
/root/.steam/sdk32/libsteam.so: cannot open shared object file: No such file or directory
Logging into anonymous gameserver account.
Could not establish connection to Steam servers.
Could not establish connection to Steam servers.
Connection to Steam servers successful.
   Public IP is 31.220.50.29.
Assigned anonymous gameserver Steam ID [SomeNumbersHere].
VAC secure mode is activated.

[editline]23rd August 2014[/editline]

I can close the thread now, I just purchased another server so all problems are gone.
Thanks to everyone who replied to this thread!