Revision Difference
Creating-a-server#550629
<cat>Play.Hosting</cat>
<title>Creating a server</title>
# Requirements
* System based on Windows, Linux or OSX
* 4 GB free RAM
* 4.5 GB free disc space (SSD/NVMe highly preferred)
These values are not fixed and highly depend on the use case and population of the server.
Note that you do NOT need a Steam account to have a Rust server running.
If you want to PLAY on that server or give yourself admin/mod rights, you DO need a Steam account.
# Quick install using a zip file
Disclaimer: This prevents the use of oxide/umod as it overwrites the files at startup
Facepunch has provided this `Rust_server.zip` file for a quick installation of a local server that you can find [here](https://files.facepunch.com/garry/1b1011b1/Rust_Server.zip)
Simply extract the contents of the zip file to the file location you want it on your PC and then edit the `Run_DS.bat` as you wish to edit the server's name/description/seed/size and any startup configurations.
To start the server simply run the `Run_DS.bat`. The server will check for updates and then validate all files before starting.
# Installing and updating SteamCMD
* Rust has the Steam App ID 258550
* Please visit https://developer.valvesoftware.com/wiki/SteamCMD for more information on that topic.
#OPTIONAL: Installing uMod/Oxide for Plugin Support
* To install uMod/Oxide onto your server:
* Visit https://umod.org/games/rust and Click the top Download Button, This downloads a `.zip` file which includes all the necessary files to allow support for plugins.
* Extract the .zip file which includes a folder `RustDedicated_Data` and copy this over to your server directory which includes the `RustDedicated.exe` file, if it asks to override some files, Select the option that does override the files.
# Setting up a batch file to run your server
Your server needs to know how you want the server to run.
There are numerous switches and configuration settings you can tell your server at startup.
An example command line to run a Windows server would be:
```markdown
RustDedicated.exe -batchmode +server.port 28015 +server.level "Procedural Map" +server.seed 1234 +server.worldsize 4000 +server.maxplayers 10 +server.hostname "Name of Server as Shown on the Client Server List" +server.description "Description shown on server connection window." +server.url "http://yourwebsite.com" +server.headerimage "http://yourwebsite.com/serverimage.jpg" +server.identity "server1" +rcon.port 28016 +rcon.password letmein +rcon.web 1
```
That looks like a lot, but lets break down each item one by one:
| Setting | Function | Notes |
| --------------------- | ----------------------------------------------------------- | ----------------------------------------- |
| -batchmode | Tells the server to run without a GUI ||
| +server.port 28015 | Sets the port people will use to connect to the game | 28015 is typical|
| +server.level "Procedural Map"| Sets the type of map. There are other values for Barren | For now keep Procedural.|
| +server.seed 1234 | Sets the random seed for how the map is generated | Change this value to any number up to 8 digits long |
| +server.worldsize 4000 | Sets the world size. | The larger the map, the more disk space and memory you need. Use 1000 to 6000|
| +server.maxplayers 10 | Sets the max number of players connecting at one time | The more players, the faster your computer CPU needs to be|
| +server.hostname "Tom Server" | Sets a server name| Name of server as shown on the client server list|
| +server.description "Awesome!"| Sets a description for your server | Description shown on server connection window, for example you could show the size or intent of the server.|
| +server.url "http://mysite.com"| If you have your own website, you can set it here. | You can also omit this. For this example we will leave a generic non-working name|
| +server.headerimage "http://mysite.com/serverimage.jpg"| Sets the picture for the server | Not required|
| +server.identity "server1" | This is the internal name of the server. | This example name will be used to create a "C:\Rust\MyServer\server1" directory for all of your server files.|
| +rcon.port 28016 | Set the remote connect port. | Use this port to remote connect to the server for admin configuration/control.|
| +rcon.password letmein | Sets the remote connect password for remote administration. | Change this value!!!
| +rcon.web 1 | Sets the type of remote connect method. | rcon.web 1 is suggested.|
Steps to create the batch file.
* Change file explorer to show known file extensions
* Navigate to "C:\Rust\MyServer\"
* Right click and select "New | Text Document"
* Change the name to "RunServer.BAT" and hit enter
* Confirm file extension is fine
* Right click on file name and select edit
* Copy the example command line above and paste into notepad
* Change the settings to what your server should be (seed, password, worldsize, maxplayers)
* Save
(TODO add notepad screenshots)
* Run this batch file.
After a few minutes the server will have created all of the files it needs to run.
Congratulations! You have just created a whole new world! You are a GOD!
(TODO add screenshot)
# Linux server installation (ubuntu 22.04) 2023:
This guide assumes you know how to connect to you server remotely and issue commands using a terminal.
Go to the folder that will contain your server. Here, we are placing it in the `home` directory of our user.
```
cd /home/user_kuper
```
Create a folder for your server and `cd` into it:
```
mkdir rust
cd rust
```
Create a folder called `steamcmd` and `cd` into it:
```
mkdir steamcmd
cd steamcmd
```
Download and unpack steamcmd:
```
wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
tar xvfz steamcmd_linux.tar.gz
```
Download the server software. *Remember to change the directory in this command to the same one as your Rust server!* You need to download under the login `anonymous`, otherwise you will get an error: `ERROR! Failed to install app '258550' (No subscription)`.
```
./steamcmd.sh +login anonymous +force_install_dir /home/user_kuper/rust +app_update 258550 validate +quit
```
Return to the Rust server folder with `cd ..`.
Make the `runds.sh` file executable and give it permissions with:
```
chmod u+x runds.sh
```
By default, steamcmd installs the software with this startup file being blank. You can add any of the options found in the table above. Edit the file:
```
nano runds.sh
```
Save the file with key combinations. (Nano defaults to `CTRL+X` to quit, `CTRL+Y` to save the new buffer, and then `ENTER` to write the file.)
⤶
Start the server:⤶
⤶
If you were to go ahead and start the server, it would be terminated upon the disconnect of your terminal session. To prevent the server being terminated when you disconnect, we need to utilize screens. Run the following command:⤶
```
./runds.sh
screen -S rust_server ./runds.sh
```
⤶
in order for the server to continue working after closing the window, it must be launched in `screen` mode⤶
it is desirable that the connection via Putti is already in screen mode⤶
otherwise, you need to run the screen yourself⤶
⤶
```⤶
screen⤶
This command creates a screen called "rust_server" and immediately puts it to work running `runds.sh`. This way, the server continues running even after you disconnect.⤶
⤶
Right now, you are seeing the output of the screen (there is no output because the Linux server does not produce output. See ). To detach the screen and return to your terminal, press `CTRL+A` then `CTRL+D`.⤶
⤶
Now, you can see the running screens with the following command:⤶
```
⤶
<upload src="b3faf/8db34135a2058b7.jpg" size="171938" name="screen.jpg" />⤶
⤶
after each new launch of the screen, you must go to the server folder !!!⤶
⤶
```⤶
cd /home/user_kuper/rust⤶
./runds.sh⤶
```⤶
⤶
after closing the window and a new connection, you can see the running terminals in screen mode⤶
⤶
```⤶
screen -ls
```
⤶
<upload src="b3faf/8db341366403447.jpg" size="25241" name="screen2.jpg" />⤶
⤶
to connect to your terminal screen⤶
⤶
```⤶
screen S-kuper⤶
```⤶
⤶
use the keys to stop the server ctrl + c⤶
to complete the screen ctrl + a + k this will kill the screen process and the server if it is running⤶
⤶
Have you already tried making yourself an administrator?⤶
Did you not succeed?⤶
⤶
To manage the server on Linux, you will have to use the remote web console via rcon⤶
⤶
Something like https://github.com/Facepunch/webrcon only works in unprotected mode - no https⤶
⤶
Don't forget to save your settings⤶
Observe that `rust_server` is listed as a running screen.⤶
⤶
You can reconnect to the screen and see what's happening (even though nothing will be there) by running `screen -r rust_server` (the -r is for reattach).⤶
⤶
Once there, you can press `CTRL+C` to stop your server then again press `CTRL+A` `CTRL+D` to detach.⤶
⤶
If you wish to terminate the screen AND the server at the same time, you may press `CTRL+A` `CTRL+K`.⤶
⤶
To manage the server on Linux, you will have to use the remote web console via rcon. Something like https://github.com/Facepunch/webrcon only works in unprotected mode - no https.⤶
⤶
Don't forget to save your settings!⤶
<upload src="b3faf/8db354ae74f991e.jpg" size="140364" name="9_1.jpg" />
<upload src="b3faf/8db354aed6cda27.jpg" size="134269" name="9.jpg" />
# Important information regarding the server.queryport starting from 2nd February 2023 :
From February 2nd 2023 all Rust game servers will need to set a queryport alongside the existing gameport to support our new Multithreaded networking (performance benefit)
## What do I need to do to keep my server showing in the in-game Rust server browser?
- server.port and server.queryport both need to be set from your server's start file
- server.port and server.queryport can NOT share the same port
- if server.queryport is not explicitly set in your start file then it will become the server.port+1
## Example of a good config :
```
server.port 28015
server.queryport 28016```
**OR**
```
server.port 28016
server.queryport 28015```
## Example of a bad config :
```
server.port 28015
server.queryport 28015```
## Other important information :
- server.queryport and rcon.port can share the same port
- This is related to the upcoming network multithreading and not swnet (Steam networking)
- For Firewall whitelisting purposes, the queryport is using a UDP protocol connection
# Additional and optional considerations in setup
Beta versions
Rust has beta branches available for your server if you are wanting to test new features not released to the public. To set up a server with one of these beta branches, you need to change your SteamCMD above to download the "beta prerelease" or "beta staging" branches of Rust development. For example, you can choose ONE of these branches:
```
Steam> app_update 258550 -beta staging
Steam> app_update 258550 -beta aux01
```
Better batch file
You may wish for your batch file to be more robust. An example of some things you may want to do would make your batch file look like this:
```
:start
C:\Rust\SteamCMD\SteamCMD.exe +login anonymous +force_install_dir C:\Rust\MyServer\ +app_update 258550 +quit
RustDedicated.exe -batchmode +server.port 28015 +...(and all of your other configuration you chose before)
goto start
```
* The ":start" line sets up a place for the "goto start" to jump to.
* The SteamCMD line does all of the steps to update your server just as you did manually above.
* The RustDedicated line is the line to start your server
* The "goto start" line is run when the server is shut down via failure or command "restart" in the server.
There are many other things you could put in this, such as logging the restart or starting other background services that you use for your server. All of this is optional.
# Connecting to the server
Your server will have been assigned an IP address by your router.
## Method 1 - Connect using localhost:
Launch Rust from the Steam library and when you get to the menu hit <key>F1</key> and type `connect localhost:28015` (or whatever port you've used) and hit <key>Enter</key>. Alternatively, you can just use `connect` as it's the equivalent of beforementioned command with full IP and port.
If you've installed and launched the server correctly you should now connect to the server!
## Method 2 - Connect using your IP:
Here we will determine what IP address that is.
* Hold down the windows key and hit R
* In the Run Box that pops up, type `CMD` and hit enter
* In the Command Box that runs, type `ipconfig` and hit enter.
Your screen will have a section that looks similar to this
```
Ethernet adapter Ethernet:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::1de5:48b8:737d:342a%8
IPv4 Address. . . . . . . . . . . : 192.168.1.2
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
```
* Look for the line that starts with IPv4 Address and record this number
This is the IP address for your Rust Server that you will use to connect to it.
### Test local connection on your network
You can run the server using the IP address set by your local router.
In Step 7 above, we found the IP address to be 192.168.1.2
In step 5 above, we set the server port to be 28015
To test this, we are going to start a Rust client and check to see if we can connect locally.
Launch Rust from the Steam library and when you get to the menu hit <key>F1</key> and type `connect 192.168.1.2:28015` (or whatever your information is) and hit <key>Enter</key>
If you've inputted the correct information and have installed and launched the server correctly you should now connect to the server!
# Adding yourself as administrator
Once you are playing locally, switch to the black command box that is the server and type "users". Don't confuse this command with a SteamCMD. This is to be done in the text window that is your server. You should receive back that 1 user is connected. It will give you data similar to the following but with your Steam information:
```
> users
<slot:userid:"name">
12345678901234567:"TomSmith"
1users
```
While still in the server command box, to set yourself up as admin or moderator respectively, type one the following:
```
> ownerid 12345678901234567 "TomSmith"
Added owner TomSmith, steamid 12345678901234567
> moderatorid 12345678901234567 "TomSmith"
Added moderator TomSmith, steamid 12345678901234567
```
Note that the if you know how to copy/paste, the colon ":" in the output needs to be replaced with a space. Now write the config change with the following command:
```
writecfg
```
You are now able to do admin/moderator functions while playing Rust with your client.
# Setting up your router
You want your server to always be the same local IP. To do this, you need to set up your router to always assign the same IP address to the computer running your server
Refer to your router user manual for how to set up a static IP for your Rust server computer.
If you want people outside your network to be able to connect, you need to have your router forward traffic coming from the internet to the port on your computer. If you are just running on your local network, you don't need this step.
Refer to your router user manual on how to port forward internet traffic to a specific computer and UDP port.
#Links
Additional server commands are needed for <page>Hosting Custom Maps</page>