Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Running a Unity Server instance on a LINUX server ??

Discussion in 'Multiplayer' started by joeri_07, Sep 21, 2016.

  1. joeri_07

    joeri_07

    Joined:
    Dec 18, 2015
    Posts:
    45
    Hi everyone !

    I finished a multiplayer game in Unity, and now i want to run one sever instance of that game on my webhost server ( the game is basically one persistent server running, the players won't be able to make their own game-servers, only join this one persistent game-server).

    I got everything set up, but I now realised the OS of my webhost's server is LINUX. I don't see any Linux install build on unity's website, but did come across Ubuntu's Unity 8.. (why is it called 8 and does not equal 5 like on windows or macOS ?)

    My question: Will this work? Can I download and install a Unity linux version remotely (using SSH), and will it correctly run my Unity server instance. Until now I developed on macOS.

    What are your experiences with this? Should i go to another webhost that runs windows on their servers? What are the command-line commands to remotely download, install and run Unity on Linux.

    I know it's a lot of questions but any help much appreciated, because at this point I'm getting really confused.
    Thanx !!!

    - &apos
     
  2. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    Build your server project as Linux (it shouldn't matter what your dev platform is), and ensure to run it with the command line parameters -batchmode -nographics
     
    TheBrizleOne likes this.
  3. joeri_07

    joeri_07

    Joined:
    Dec 18, 2015
    Posts:
    45
    Thnx whippets!

    Ah of course, you can choose the build platform before building the project sweet! (kind of forgot about that, silly me) .... For some reason I thought unity had to be installed to be able to run a unity program, but I understand now that that's not a unity program but a self-contained application. So I guess everything should work. Will get back to you! and like always thanks for the info man :)
     
  4. joeri_07

    joeri_07

    Joined:
    Dec 18, 2015
    Posts:
    45
    Just contacted my webhost-service and they don't allow port-forwarding... guess I have to go to another one. :)
     
    TheBrizleOne likes this.
  5. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    A Windows or Mac editor can produce Linux builds. Just copy it over to your Linux server, set execute permissions, and launch it. As far as actual steps, I generally create a .tar or .tar.gz file out of my build and use scp to copy it to my Linux server. For Windows you'd use pscp to scp it, and 7-zip is a good utility for making tar files and then compressing them into .gz files (or you can just get the real tar and gzip command line utilities).

    To be able to launch your game you'd ssh into your Linux box, and do something like:
    chmod +x ./<name_of_game_executable>

    Then you'll want to launch it most likely as a background task.

    ./<name_of_game_executable> &

    You could also find the Linux "nohup" command useful when launching your server.

    If you click the "headless" checkbox in your build options, you can avoid even this minor hassle :)

    (no need to specify those command line parameters if built as headless already)
     
    Last edited: Jun 19, 2018
  6. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    What does this topic have to do with your Hotmail account?
     
  7. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,227
    Wut...
     
    VNau likes this.
  8. panayiotismilios

    panayiotismilios

    Joined:
    Jun 21, 2018
    Posts:
    8
    For anyone bumping into this,
    Using the ambersand (&) will still kill the process once you close your terminal. Assuming you have a dedicated server that you want to keep running even after you close your terminal you need to use nohup or disown.

    For more info, check this article: https://www.makeuseof.com/run-linux-commands-in-background/
     
    DragonCoder likes this.