1. "Native" Linux support for Rust is back since February 2016! Garry Newman on Twitter

    That allowed us to add a Rust Server Script into LGSM.

    Modded server with Oxide
    In this guide, we're going to go through the Rust install process, correcting your system to handle multiple Rust servers, installing Oxide and keeping it updated easily.

    UPDATE 2017-01-29: LGSM now supports downloading, updating, or removing Oxide with the "mods-install", "mods-update" and "mods-remove" commands! It also adds a new "wipe" command. Run "update-functions" command to get the new features!

    System requirements
    RAM
    A Rust game server uses from 6 to 12GB RAM, depending on your map size.
    For that matter, LGSM warns you if you have less than 4GB available.

    CPU
    It will use constantly around 50% of one core from a Xeon E5-1650V3 (6 cores 12 threads, 3.8Ghz), or around 30% of one core from an I7 4870K, regardless of the amount of people connected and with very few constructions on it. As most game servers, it seems like it's mainly monothreaded, so you'd better have some good monothread performance.

    Bandwidth
    Bandwidth shouldn't be an issue, aim for a 10mb/s+ upload speed minimum

    Other notes
    The server autosave can cause lags, depending on your CPU and disk speed. An SSD server with a very good CPU can help.
    It is highly recommended a dedicated server is used with Rust because of its high system requirements.

    Conclusion
    Don't take an inappropriate server with 150 cores @1,2Ghz, prefer a quad/hexa core @+3,3Ghz, check benchmarks before choosing your server. CPU: good monothread performance ;RAM: 12-16GB and more; avoid VPS.

    Linux Distribution
    You will need Glibc greater or equal to v2.15 (more info glibc · GameServerManagers/LinuxGSM Wiki · GitHub )

    So you need:
    • Debian 8 or greater (advised)
    • Ubuntu 12.04 LTS or greater
    • CentOS 7 or greater
    Useful Links
    Manual Installation and general information
    LGSM Installation
    Oxide Support
    Setting up a Rust server with Linux and LGSM | Oxide

    LGSM Support
    Oxide for Linux
    Rusty
    Rust Server with LGSM Video tutorial
    Here is a quick tour of Rust special features, and install guide for Rust and Oxide.



    If you need more help, here is a video that shows a bit more into depth how to use LGSM, how the directory structure works, it also explains the basics of a Rust Server and other stuff, that's why it's 20 minutes long, otherwise, if you're experienced, you can get your server up and running in around 5 minutes without any mods.



    LGSM Tutorial
    0) Make sure you have all the dependencies
    And make sure you match the distro requirement by carefully reading instructions at: rustserver: Rust |

    1) Make a new user and login to it
    As root, do:

    adduser rust
    [...]
    su - rust

    2) Get LGSM and make it executable
    wget https://gameservermanagers.com/dl/rustserver
    chmod +x rustserver
    3) Run the installer and follow the instructions
    ./rustserver install
    4) Edit rustserver to fit your needs
    You'd better use nano or vim, but you could also use a text editor like notepad++, which is way less convenient. If you need help about what to configure, watch the video.

    nano rustserver
    5) Edit server.cfg
    nano serverfiles/server/rust-server/cfg/server.cfg
    6) Make sure everything is alright
    Start your server

    cd ~
    ./rustserver start
    Then check your logs

    cat serverfiles/game*.log
    Since Rust have no console, you can use this workaround to display the log in real time:

    tail -f serverfiles/game*.log`
    Since Rust don't allow setting a custom log location, the log file will be called game-{FULL-CURRENT-DATE}.log to not be erased on every restart and will be moved to log/server upon any server start/restart and a new one will be created.

    Note: The Rust console is empty under Linux. You'll have to use an RCON tool and/or watch your logs.

    7) Install Oxide
    As a reminder, Oxide is an API allowing you to run mods for you Rust server.

    LGSM now handles Oxide for Rust natively, with mods-install and mods-update commands.

    ./rustserver mods-install
    rustoxide
    Then you'd better check your logs again after restarting the server to check that Oxide is loading properly.

    If a Rust update has been released, then an Oxide update will soon follow. To update Oxide, you can then run:

    ./rustserver mods-update
    8) Install Oxide addons
    Just put them into serverfiles/server/rust-server/oxide/plugins They will load automatically.
    If you need to edit their configs, it will be located in : serverfiles/server/rust-server/oxide/config
    If you updated an addon and wish to reload it without restarting the server, you'll need to input it in an RCON tool. Once you've got it, run :

    oxide.reload PluginName

    9) Send RCON commands:
    You will need a tool to send RCON. Here are 3 of them:

    To use an external software like Rusty or Rustadmin, you need to alter rustserver script with rconweb="0". To use Facepunch tool, leave it at default rconweb="1"

    Note: Facepunch web tool currently don't accept domain names, you need to enter server IP.

    If you can't remember the RCON port you set or password (that you MUST change), just use:

    ./rustserver details
    Essential commands:

    save ; will save the server state (useful before a stop or restart)
    oxide.reload PluginName ; will reload a plugin after updating it
    server.writecfg ; to save config commands you ordered into Rusty, including new admins
    ownerid STEAMID64 "Nickname" "Reason" ; to add an owner
    moderatorid STEAMID64 "Nickname "Reason" ; to add a moderator

    10) Avoid a security breach and allow you to run multiple servers
    By default, a user can see all started processes from other users, which is bad, but also their start parameters, which is pretty dangerous. Those start parameters can contain sensitive information, such as RCON password, Steam API keys, GSLTokens... Upon start, a Rust dedicated server is checking if the process name started by any user, and will prevent you from running it again if it finds it, displaying "Player is already running".

    To avoid that, run:

    mount -o remount,rw,hidepid=2 /proc
    And to keep the changes upon machine reboot:

    nano /etc/fstab
    # Here are the modification to apply to the "proc" line
    proc /proc proc defaults,hidepid=2 0 0
    Of course, you still need to make one user per server, change ports, and repeat the install process. (See Multiple Servers · GameServerManagers/LinuxGSM Wiki · GitHub for more info)

    11) Setup automated tasks (reboot, update...)
    You will need to use Linux Cronjobs. For more information, see Cronjobs · GameServerManagers/LinuxGSM Wiki · GitHub

    Basically, I advise you to setup root cronjobs. The syntax for root cronjobs is (replace things between <> by the actual value)

    * * * * * su - <username> -c '/home/<username>/rustserver <command>' > /dev/null 2>&1
    Example for a restart every day at 5: Login to Root (su command), then do:

    crontab -e
    0 5 * * * su - rust -c '/home/rust/rustserver restart' > /dev/null 2>&1

    # save and exit (ctrl +x, y, enter if using nano)
    You can run a monitor cronjob every few minutes to make sure your server is up and runing.

    */3 * * * * su - rust -c '/home/rust/rustserver monitor' > /dev/null 2>&1
    12) Updating Rust
    Just run

    ./rustserver update
    If needed, run

    ./rustserver validate
    To wipe the server run

    ./rustserver wipe
    To update Oxide, that your previously installed with LGSM, run

    ./rustserver mods-update
    Special Thanks :
    • UltimateByte for Rust support into LGSM and documentation
    • Wulf and Oxide team for enlightening about Rust and Oxide
    • Daniel Gibbs, Founder of LGSM, for his help making this work
    • CedarLUG, LGSM Support, for his help dealing with Rust's weirdness
     
    Last edited by a moderator: Jan 31, 2017
  2. Thanks!!!
    Can this be a sticky post?
     
  3. Will probably jump to linux soon since I use Debian most of my time in work :) Great job on this tutorial! Thumbs up for sticky post
     
  4. Well, seems like it's been granted ! ^^
    Hopefully "Wine for Linux setup for Rust" will one day no longer be required for anyone as there is now a good native support !

    Wise choice bro ! As long as you're comfortable with Linux, this is certainly the fastest and most powerful way to manage a server !


    Here are some piece of advice for the beginners, those who know nothing about Linux.

    I started Linux by hosting a forum (it required SSH and domain names knowledge, and FTP/PHP/Apache2 server deployments) and a TeamSpeak server, then a Garry's Mod server (needed SteamCMD knowledge). It took me one or two sleepovers to be happy with my machine which i firstly reinstalled a few times before even considering it stable enough to host a website and a TS. But I didn't start with the easiest system, I was using ESXI which is very powerful but a pain to set up for the first time. It allowed me to run several Debian Linux virtual machines under the same server, and allowed me to save snapshots of my system to be able to rollback after critical mistakes. That way i could test risky commands that i would have never tried otherwise. I'd advise not to do that but to prefer buying a cheap VPS or making a Linux VM (with no interface) to run all tests you want, just to get comfy with Linux First.

    Then, I discovered LGSM, which changed my life and the way i was managing my game servers quite a bit by simplifying deployment and maintenance, and started making more and more servers.

    If you're jumping into Linux for the first time, get ready to Google a lot, (documentation for Linux is very abundant) to first learn the basics of SSH. That will also help you understanding the basics of Shell (scripts). Don't bother with a remote interface, it will be useless because you'll end up using only a command prompt for a server anyways. And you'd better spend a few hours or even a few days to learn the basics of Linux (Installing packages, updating your server, monitor and manage your server -munin / webmin - setup a proper FTP server, configure some stuff for safety...), then you'll probably continue to learn stuff about Linux every day for quite a while... :)
    For the distribution, i can only advise Debian or Ubuntu, which are very stable, very updated, and very well documented with a great community.

    Welcome and good luck to all Linux beginners !
     
    Last edited by a moderator: Mar 14, 2016
  5. Hello,
    I try to follow your tutorial. Aside step 3 does its work. I put the logs.

    Code:
     rustoxide@debian:~$ ./rustserver install
        fetching functions/core_functions.sh...FAIL
    savez de quoi sa peut venir, merci ?
    [DOUBLEPOST=1457714026][/DOUBLEPOST]We successfully executed in the beginning of step 3, but now I'm missing file "libstdc ++ 6: i386". I try to download but its not working. I put the logs.


    Code:
    root @ debianhome # apt-get install libstdc ++ 6: i386
    Reading package lists ... Done
    Shaft Construction dependencies
    Reading state information ... Done
    E: Could not find the libstdc ++ 6
    E: Could not find package matching the regular expression "libstdc ++ 6"
     
  6. You missed step 0). So you should go back to step 0, install required dependencies, and come back to tell us it's working ;)

    And don't forget before anything else :
    Code:
    dpkg --add-architecture i386
    apt-get update
     
  7. @UltimateByte How can I make that typing restart in the console is restarting the server?
     
  8. Rust doesn't provide a console. What you see when running ./rustserver console , it's useless until facepunch eventually decides to provide a server console.
    If you wish to restart, use ./rustserver restart
    You can setup an auto restart using cronjobs (see Automation · dgibbs64/linuxgsm Wiki · GitHub )

    I've got one restart per day at 6:30, and it's enough, at least on my machine, no lag whatsoever. I used the "notifier" addon to tell people "daily restart at 6:30" and before the reboot "reboot in 30/5/1 minutes". Of course, it doesn't run a "save" command, it just closes then re-open the server, but if you got the default savetime of 300s (5 minutes), it shouldn't be a problem.
     
  9. I know and I have the same setup at the moment. I use a save intervall of 120second since its a build server. But I am at the point I need a head-admin and I want that the person can restart the server without getting in the ssh of the server. Thats why I have this question. Since the restart command has a timer but only do a exit on the server.
     
  10. I know, it's hard to trust someone for SSH... If you know a bit of PHP you could make a password protected page with a button that would trigger the restart command. You could also do several programmed reboots every day at fixed hours.
    Still, the only way to manually save is to use RCON... So good luck to integrate that in a PHP page (it's possible, some frameworks exists, but does it worth the effort ?!).
     
  11. Well I have made more automatic restarts.
     
    Last edited by a moderator: Mar 14, 2016
  12. The proper way to run multiple servers :
    It's the most simple, clean, and efficient way to do it !

    - Apply the fix mentioned in "10)" part of this tutorial
    - Make a new user
    - Install the new server on that new user, and make sure you set up different ports.

    The stupid way to do it :
    If you wish to run 2 servers under the same user (which is most likely a bad idea), you'll have to do some more shitty stuff.
    I consider it the bad way to do this, i can't advise this shit, especially because you're gonna have issues on any Rust update... but still, if you wanna do that, the process is documented here : Multiple Servers · dgibbs64/linuxgsm Wiki · GitHub
    But for Rust, it will require some other tweaks due to its stupid process name checking. So you'll have to change the name of the executable and Data dir.
    So here is the full process :

    Of course, Make 2 separate folders, one per server.
    On the second installation :
    1) In LGSM script (rustserver), change the "executable" variable to : executable="./RustDedicated2"
    2) In LGSM script (rustserver), change the "servicename" to a whole different name like : servicename ="second-rust". (You need a very different name because you might have issues with Tmux mixing up names suchs as "rust-server" and "rust-server2"
    3) Rename serverfiles/RustDedicated to serverfiles/RustDedicated2
    4) Rename serverfiles/RustDedicated_Data to serverfiles/RustDedicated2_Data

    The even more stupid way to do it, but useful if you have a very limited disk space :
    If you wish to have 2 servers in the same folder (i wouldn't advise that neither, but who knows, maybe your server HDD is 20GB and still one will wanna host several servers on this shit...), i didn't try it for Rust, but it should work :

    1) Copy rustserver to rustserver2
    2) In rustserver2 (LGSM script), change the "servicename" to a whole different name like : servicename ="second-rust". (You need a very different name because you might have issues with Tmux mixing up names suchs as "rust-server" and "rust-server2")
    3) In rustserver2 (LGSM script), change the "executable" variable to : executable="./RustDedicated2"
    4) Copy serverfiles/RustDedicated to serverfiles/RustDedicated2
    5) Copy serverfiles/RustDedicated_Data to serverfiles/RustDedicated2_Data
     
    Last edited by a moderator: Mar 14, 2016
  13. You are to fast, I alrady removed the question since I found the error I made, haha.
    I did replace a server backup that rollback my changes to the userhide.

    But thanks anyway, it will provide other help aswell! :)
     
  14. Hello, I did encounter a problem while installing my server, i did install the server without any problems, but then when i try to start it just fails. I have linux server using LGSM. No message just FAIL on service name and my rust server name, nothing in debug also. Any help?
     
  15. Are you sure, that tmux and Glibc are established?
     
  16. Hello, i install server 1 day ago, and today i have many errors in gamelog
    Code:
    Unhandled Exception: System.Net.Sockets.SocketException: Too many open files
      at System.Net.Sockets.Socket.Accept (System.Net.Sockets.Socket acceptSocket) [0x00000] in <filename unknown>:0
      at System.Net.Sockets.SocketAsyncEventArgs.AcceptCallback () [0x00000] in <filename unknown>:0ERROR building certificate chain: System.IO.IOException: Too many open files
      at System.IO.Directory.GetFileSystemEntries (System.String path, System.String searchPattern, FileAttributes mask, $
      at System.IO.Directory.GetFiles (System.String path, System.String searchPattern) [0x00000] in <filename unknown>:0
      at Mono.Security.X509.X509Store.BuildCertificatesCollection (System.String storeName) [0x00000] in <filename unknow$
      at Mono.Security.X509.X509Store.get_Certificates () [0x00000] in <filename unknown>:0
      at System.Security.Cryptography.X509Certificates.X509Store.Open (OpenFlags flags) [0x00000] in <filename unknown>:0
      at System.Security.Cryptography.X509Certificates.X509Chain.get_Roots () [0x00000] in <filename unknown>:0
      at System.Security.Cryptography.X509Certificates.X509Chain.get_CertificateCollection () [0x00000] in <filename unkn$
      at System.Security.Cryptography.X509Certificates.X509Chain.FindParent (System.Security.Cryptography.X509Certificate$
      at System.Security.Cryptography.X509Certificates.X509Chain.BuildChainFrom (System.Security.Cryptography.X509Certifi$
      at System.Security.Cryptography.X509Certificates.X509Chain.Build (System.Security.Cryptography.X509Certificates.X50$
      at System.Net.ServicePointManager+ChainValidationHelper.ValidateChain (Mono.Security.X509.X509CertificateCollection$
    Please, report this problem to the Mono team
    [Oxide] 12:36 [Error] Failed to call hook 'IOnBasePlayerAttacked' on plugin 'rustcore v1.0.0' (Exception: sql error: unable to open database file)
    [Oxide] 12:36 [Debug]   at RustNative.SQLite.Insert (System.String query, System.Object[] keys) [0x00000] in <filename unknown>:0 
      at UserPersistance.AddLifeStory (UInt64 playerID, ProtoBuf.PlayerLifeStory lifeStory) [0x00000] in <filename unknown>:0 
      at BasePlayer.LifeStoryEnd () [0x00000] in <filename unknown>:0 
      at BasePlayer.OnKilled (.HitInfo info) [0x00000] in <filename unknown>:0 
      at BaseCombatEntity.Die (.HitInfo info) [0x00000] in <filename unknown>:0 
      at BasePlayer.Die (.HitInfo info) [0x00000] in <filename unknown>:0 
      at BaseCombatEntity.Hurt (.HitInfo info, Boolean useProtection) [0x00000] in <filename unknown>:0 
      at BasePlayer.Hurt (.HitInfo info, Boolean useProtection) [0x00000] in <filename unknown>:0 
      at BaseCombatEntity.OnAttacked (.HitInfo info) [0x00000] in <filename unknown>:0 
      at BasePlayer.OnAttacked (.HitInfo info) [0x00000] in <filename unknown>:0 
      at Oxide.Game.Rust.RustCore.IOnBasePlayerAttacked (.BasePlayer player, .HitInfo info) [0x00000] in <filename unknown>:0 
      at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
      at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
    [Oxide] 12:36 [Error] Failed to save protobuf data to oxide.covalence.playerdata.data (IOException: Too many open files)
    [Oxide] 12:36 [Debug]   at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0 
      at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) [0x00000] in <filename unknown>:0 
      at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
      at System.IO.File.Open (System.String path, FileMode mode) [0x00000] in <filename unknown>:0 
      at Oxide.Core.ProtoStorage.Save[IDictionary`2] (IDictionary`2 data, System.String[] sub_paths) [0x00000] in <filename unknown>:0 
    RustIO map dont work (cant enter on my site map)

    I go try this:
    Code:
     Ubuntu Linux
    Find the current maximum number of open files per user in a single session:
    ulimit -n
    By default the number is 1024 which is too small.
    Edit the limits.conf file:
    sudo gedit /etc/security/limits.conf
    Add the following lines to the file:
    * soft nofile 10000
    * hard nofile 50000
    This sets for all users a soft limit of 10000 open files and a hard limit of 50000. These are just example numbers. Set them according to your system needs. Note that the wildcard option applies only to regular users, not to superuser. If you run Magnolia as superuser replace the asterisk with root.
    Save the file.
    Edit the configuration file for session-related modules:
    sudo gedit /etc/pam.d/common-session
    Add the following line to the file:
    session required pam_limits.so
    Save the file.
    Restart Ubuntu.
    Verify the new maximum number of open files:
    ulimit -n
    The command should now return 10000.
    Restart Rust Server fix all problem, but i think it back later if ulimit dont help.
     
    Last edited by a moderator: Mar 20, 2016
  17. What does the logs say ?

    Interesting, what version of ubuntu do you have ? Interface installed or not? What kind of issues did you get ?
    @DikkatDeli may find this interesting :)
     
  18. I have 26~14.04.1-Ubuntu SMP
    Server dont have interface, dont have display or keyboard work only Terminal (i connect from Pytty).
    I google for "Unhandled Exception: System.Net.Sockets.SocketException: Too many open files" and google say me try ulimit.
     
  19. Thanks about that. Never had such an issue with Debian but may help others. At least you had an error to help. To end up with this, i'm curious : Where did you see that error ? (in what log)
     
  20. I have spam in my RUSTY and i open log: /rustserver/serverfiles/gamelog-2016-03-20-12-42-16.log
    Log in oxide folder clear, no error found.