Revision Difference
Creating-a-server#552520
<cat>Play.Hosting</cat>
<title>Creating a server</title>
# Requirements
* System based on Windows, Linux or OSX
* 8 GB free RAM (6k map will use more)
* 8 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.
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
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
* Rust's server software is installed and updated using the SteamCMD program. The Steam App ID is 258550 (which can be found on [SteamDB](https://steamdb.info/app/258550/depots/) or on [Steambase](https://steambase.io/apps/258550)).
* Visit [Valve's SteamCMD Wiki](https://developer.valvesoftware.com/wiki/SteamCMD) for the download link, and more information.
* Check out the step by step guide in the Linux section, 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
* 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:
```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. There are other values like Barren | For now keep Procedural.|
| +server.level "Procedural Map"| Sets the type of map. | |
| +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|
| +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 a few minutes to fully start, look for ``Server startup complete`` and you should be able to connect and play.
## Creating 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)
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.
## 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:
```
server.maxplayers 10
server.hostname "Tom Server"
hackablelockedcrate.requiredhackseconds 600
```
# 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 `cd` into it:
```
mkdir steamcmd
cd steamcmd
```
Download and unpack SteamCMD, 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" />
# 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).
## To keep your server showing in the game's server browser:
- 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
- if server.queryport is not explicitly set in your start file then it will become the server.port+1
- server.queryport and rcon.port can share the same port (but advise against it)
# 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:
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
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
```
Now write the config change with the following command:
```
writecfg
```
You will need to reconnect and you should now be able to do admin/moderator functions, and give yourself things via the F1 menu.
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 on your local network, you don't need this step.
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 ports on your computer. 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. Also server and query ports are UDP protocol, RCON and Rust+ are TCP. Avoid using 'both' if your router has that.
Refer to your router user manual on how to set up forwarding.
#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.