Revision Difference
Creating-a-server#562653
<cat>Play.Hosting</cat>
<title>Creating a server</title>
# Requirements
* System based on Windows, Linux or OSX
* 12 GB free RAM (6k map will use more)
* 15 GB free disc space (SSD/NVMe highly preferred)
To estimate server RAM requirements you can use this [server RAM estimation tool](https://pinehosting.com/tools/rust-ram-calculator) created by Pine Hosting.
These values are not fixed and highly depend on the use case and population of the server.
You do NOT need a Steam account to install and run a Rust server, but you will need a steam account with Rust to join and play.
# Quick install using a zip file
⤶
<note>Disclaimer: This is from 2015, it claims the server will restart and update automatically but it will not, -autoupdate is not a thing anymore. It also runs SteamCMD twice in the startup script unnecessarily. YOU DO NOT NEED THIS. Read this page fully so you understand a few things before using this!</note>⤶
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.⤶
⤶
<note>Disclaimer: This is from 2015, it claims the server will restart and update automatically but it will not, -autoupdate is not a thing anymore. It also runs SteamCMD twice in the startup script unnecessarily. It should be looked at lightly as an example. It is just SteamCMD for windows and a startup script - both explained below.</note>⤶
⤶
# SteamCMD⤶
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 run the `Run_DS.bat` script. The server will check for updates and then validate all files before starting.
⤶
⤶
# SteamCMD⤶
* Rust's server software is installed and updated using the SteamCMD program. The Steam App ID is [258550](https://steamdb.info/app/258550/depots/)).
* Visit [Valve's SteamCMD Wiki](https://developer.valvesoftware.com/wiki/SteamCMD) for the download link, and more information.
* Check out the [Linux server installation](#linuxserverinstallation) for how to download, install, and use the program. Windows is very similar.
## Staging and alternate branches
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 parameters slightly. For example, you can choose ONE of these branches:
```
Steam> app_update 258550 -beta staging
Steam> app_update 258550 -beta aux01
```
⤶
⤶
#OPTIONAL: Installing Oxide for Plugin Support⤶
⤶
#OPTIONAL: Installing Oxide for Plugin Support⤶
* Visit https://umod.org/games/rust and Click the appropriate button. There is a version for Windows and Linux. It will download a `.zip` file which includes all the necessary files to allow support for plugins.
* Extract the .zip file into your server and overwrite any files.
* Any time there is a server update oxide will come out with an update shortly after. You must do this every time the server is updated.
# Starting the Server
Your server needs to know how you want the server to run. There are numerous parameters you can pass at startup. See [Rust Dedicated Server](https://developer.valvesoftware.com/wiki/Rust_Dedicated_Server) on Valve's Wiki, it's kind of dated and a lot repeated here but lists some variables you might want to change. You can use the ``find`` command in your server console to look for something too.⤶
⤶
An example command line to run a Windows server would be:⤶
Your server needs to know how you want the server to run. 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 -logfile rustserverlog.txt
```
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 default. This port is UDP.|
| +server.level "Procedural Map"| Sets the type of map. At this time this is the only one. | |
| +server.seed 1234 | Sets the random seed for how the map is generated | This number can be any value 0-2147483647 |
| +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 omit this. |
| +server.headerimage "http://mysite.com/serverimage.jpg"| Sets the picture for the server | You can omit this. |
| +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. | RCON clients connect to this for admin configuration/control. This port is TCP. Default is equal to server.port|
| +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.|
| -logfile <name> | All console output goes into this file. | using date/time in the filename is suggested.|
You will see a lot of information flying by as the server starts up, maybe even some errors(you can probably ignore). It will take several minutes to fully start, look for ``Server startup complete`` and you should be able to connect.
**Note**: that the Valve Wiki article is marked for deletion and is likely no longer an authoritative list of either command line options nor server commands. An up to date list of all options, marking which are for use on the command line, vs a config file, vs the in game console, vs rcon would be very helpful. It appears that some commands MUST be start up command line options. Others are only for use in the command console. The [web rcon](https://github.com/Facepunch/webrcon) from facepunch doesn't appear to work, and configuring rcon with other clients is also difficult to make work when running the windows based server.
⤶
## server.cfg⤶
⤶
Few things actually need to be passed at startup. A good option is creating a ``server.cfg`` file in your ``rust/server/server.identity/cfg/`` folder and putting changes in that. The server reads this file at startup and takes priority over anything set on the command line. The server does not touch this file, it must be manually edited. You do not include the +/- on variables in this file. An example server.cfg file might look like this:⤶
**Note**: There are numerous parameters you can pass at startup this is not an exhaustive list. Use the the ``find`` command in your server console after start up to help find something ie ``find image``. Most variables can be set as a parameter on the command line but for most things you should use the [server.cfg file](#servercfg). Be aware there are some variables that wont work this way for example the weather _chance variables. Those must be set after the server is running, so either manually or via your RCON client.
⤶
⤶
## server.cfg⤶
⤶
Set only necessities like ports or rcon on the command line. If you want to change a bunch of variables a good option is creating a ``server.cfg`` file in your ``rust/server/server.identity/cfg/`` folder and putting changes in that. The server reads this file at startup and takes priority over anything set on the command line. The server does not touch this file, it must be manually edited. You do not include the +/- on variables in this file. An example server.cfg file might look like this:⤶
```
server.maxplayers 10
server.hostname "Tom Server"
hackablelockedcrate.requiredhackseconds 600
```
⤶
# server.queryport
⤶
As of 2nd February 2023 Rust game servers have a separate queryport along with the existing server.port. This is to support the new multi-threaded networking (performance benefit). This is not related to swnet (Steam networking).
⤶
## server.queryport
⤶
This port is so services can query your server and get information about it. It is needed for your server to appear in the game's server browser list. This was changed in the 2nd February 2023 update to support the new multi-threaded networking (performance benefit). This is not related to swnet (Steam networking).
- If server.queryport is not explicitly set it defaults to 1+ server.port or rcon.port (whichever is greatest)
- server.port and server.queryport both need to be open and accessible, these ports are UDP
- server.port and server.queryport can NOT be the same port
# Automating with a batch file/start up script.
* 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.
See an example file from the 'quick start' zip above. Your batch file can be as simple or robust as you want. 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)
C:\Rust\SteamCMD\SteamCMD.exe +force_install_dir C:\Rust\MyServer\ +login anonymous +app_update 258550 +quit
RustDedicated.exe -batchmode +server.port 28015 +...(and any other parameter/variable you chose)
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. Keep in mind if you run SteamCMD in your startup script this will overwrite an oxide install and put your files back to vanilla.
# Linux server installation:
Linux uses [SteamCMD](https://developer.valvesoftware.com/wiki/SteamCMD) to install and update the server software. It is similar to windows. Here is a simple step by step guide to install
Go to the directory where you want to install the server and create a directory for it. Here we are placing it in the users home directory.
```
cd /home/user_kuper
mkdir rust
```
Create another folder for SteamCMD and open / `cd` to it:
```
mkdir steamcmd
cd steamcmd
```
Download and unpack SteamCMD in this folder, and make SteamCMD executable:
```
wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
tar xvfz steamcmd_linux.tar.gz
chmod +x steamcmd.sh
```
Run steamcmd and download the server software. You can login as anonymous(you do not need a steam account to download the server) but if you don't +login you will get an error: `ERROR! Failed to install app '258550' (No subscription)`.
```
./steamcmd.sh +force_install_dir ../rust +login anonymous +app_update 258550 validate +quit
```
Return to your rust server folder with `cd ../rust`.
Make the `runds.sh` file executable:
```
chmod +x runds.sh
```
By default SteamCMD installs a very basic startup file. You can add any of the options found in the table above. Edit `runds.sh` with your favorite text editor, and save.
Now you can run the script to start the server. The linux console is not interactive like the windows version. You will need a RCON client to send commands to the server. You can put the process in the background, and access the logfile for output.
##Screen
An alternative/easier way to see live console output is run it in a screen session. [ArchLinux Screen Wiki](https://wiki.archlinux.org/title/GNU_Screen)
```
screen -S rust_server ./runds.sh
```
This command creates a screen called "rust_server" and runs your server in it. To detach the screen and return to your terminal, press `CTRL+A` then `D`.
You can list and attach your screens with this command:
```
screen -x <name>
```
If no name is given, you will see a list of sessions, and you should see `rust_server` is listed.
You can reconnect to the screen and see what's happening by running `screen -x rust_server` (-r does the same thing).
⤶
Again you will need a RCON client to manage the server on Linux. Facepunch has an online [remote web console](http://facepunch.github.io/webrcon/#/home) but unfortunately it is not HTTPS! See the table above for RCON configuration.⤶
⤶
<upload src="b3faf/8db354ae74f991e.jpg" size="140364" name="9_1.jpg" />⤶
⤶
<upload src="b3faf/8db354aed6cda27.jpg" size="134269" name="9.jpg" />⤶
# Connecting to the server
## 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 server.port you've used) and hit <key>Enter</key>. Alternatively, you can just use `connect` as it's the equivalent of before-mentioned 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: ⤶
⤶
localhost always points to the machine you use it on it is synonymous with 127.0.0.1 - So if your server and game are on the same computer this is the easiest way to connect. Launch Rust from the Steam library and when you get to the menu hit <key>F1</key> and type `connect localhost:28015` (or whatever server.port you've used) and hit <key>Enter</key>. If you've installed and launched the server correctly you should now connect to the server!
⤶
## Method 2 - Connect via IP:
Here we will determine what IP address that is.
* Hold down the windows key and hit R
* On the server 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⤶
* Look for the line that starts with IPv4 Address and this is the IP address for this machine⤶
* IPs that start with 192. or 172. or 10. are referred to Private network IPs They are not a public IP that anyone can connect to⤶
* If your machine is on a private network like this then you will need to get your public IP from a website like https://www.whatsmyip.org/ and most likely port forward on [your router](#settingupyourrouter)⤶
⤶
### What IP to use?
⤶
By default the rust server will listen on 0.0.0.0 - This means it will work with any IP directed at your machine. People can connect via your public IP. If you want to change this, lets say you don't want people to be able to connect via your public IP you can change the IP the server listens on with the ``server.ip`` parameter. Or your server is on a LAN like in the picture above. Set ``+server.ip 192.168.1.2`` so only people on your LAN can connect.⤶
⤶
⤶
# Adding yourself as administrator⤶
If the server is running and you are connected you can add yourself from the server console, or if your server is Linux you will need to do it via RCON. These are server commands don't confuse this with SteamCMD.
Run the ``users`` command to print out players and get your steamID
```
> users
<slot:userid:"name">
76561198123456789:"TomSmith"
1users
```
Now that you have the steamID run one of these commands to set yourself up as admin or moderator respectively:
```
> ownerid 76561198123456789 "TomSmith"
Added owner TomSmith, steamid 76561198123456789
> moderatorid 76561198123456789 "TomSmith"
Added moderator TomSmith, steamid 76561198123456789
```
You will need to reconnect after adding to get the auth level. When joining the server you should see ` has auth level ` in server console or -logfile. No need to save the changes after doing this, it is done automatically now: https://commits.facepunch.com/464989
An alternative method, only when the server is shut down is to edit the file directly. Goto the ``rust/server/server.identity/cfg/`` folder, and open up users.cfg. create a newline for each admin, it will look like this: ``ownerid 76561198123456789 "TomSmith" ""``
# Setting up your router
If you are just running a server on your local network you don't need this step. But if you are behind networking gear like a router, and you want people outside your network to connect then you most likely will need to set up 'port forwarding'. There are thousands of routers, web panels, etc. It can't all be covered here. You should consult your router's manual.
To put it simply: A game will try to connect to your public IP and a port. That goes to your router. The router is configured so when traffic is trying to connect to a port it sends it to the correct LAN IP on your network.
You should configure your LAN so the server's LAN IP is static and does not use DHCP. Also avoid using 'both' or 'all' if your router has that option for protocol. Server and query ports are UDP protocol, RCON and Rust+ are TCP. You only need server port working to connect, get that working first then add the others if you wish.
To put it simply: A game will try to connect to your public IP and a port. That goes to your router. The router is configured so when traffic is trying to connect to a specific port it sends that traffic to the correct LAN IP on your network.
You should configure your LAN so the server's LAN IP is static and does not use DHCP. Also avoid using 'both' or 'all' if your router has that option for protocol. The Rust Server has 4 ports total; server and query ports are UDP protocol, RCON and Rust+ are TCP. You only need the server port to connect and play, get that working first then add the others if you wish.
⤶
#RCON Clients⤶
⤶
An RCON Client is separate software the connects to your server directly allowing you to monitor and send commands. There are a few software options, and some web based options allowing you to connect any time. Set up your server's RCON settings on the [command line](#startingtheserver). Facepunch has an online [remote web console](http://facepunch.github.io/webrcon/#/home) but unfortunately it is not HTTPS! **Note**: Last edit said this was not working - confirm?⤶
⤶
<upload src="b3faf/8db354ae74f991e.jpg" size="140364" name="9_1.jpg" />⤶
⤶
<upload src="b3faf/8db354aed6cda27.jpg" size="134269" name="9.jpg" />⤶
#Links
Additional server commands are needed for <page>Hosting a custom map</page>
See <page>Creating a hidden whitelisted server</page> If you do not want your server to be public.