Cara up Linux Server SAMP

  • Step 1: Hello, Linux.

    Quote:
    Presuming you've just rented an unmanaged VPS or Dedicated Server running Linux, they'll usually provide you with SSH login credentials, as well as your IP.
    SSH stands for Secure Shell; think of it as a logging into a PC's cmd.exe remotely.

    To log in to your server through SSH, you'll need an SSH client.
    The most common SSH client for Windows is PuTTy, which you can download from...
    http://www.chiark.greenend.org.uk/~s.../download.html
    Quote:
    Let's fire up PuTTy!


    As you can see, from that lovely image, you'll need to put in your Server's IP in the Hostname field, in addition, make sure the connection type is SSH.
    The default port for SSH is 22.

    Once you're ready, hit 'Open'.
    Quote:
    You'll then be approached by the login prompt.
    Type in 'root', hit enter, and then type in your password.
    Note: The characters will not show when being typed.

    If all goes well, you'll be logged in. Horray!
    Step 2: User Accounts
    Quote:
    Generally speaking, running anything as the root user is a bad idea from a security point of view.
    Because of this, let's create an account for the user.
    Quote:
    Supposing you want to create an account called 'samp', you'll use this command.
    Code:
    adduser -m samp
    If you're running a Debian based system, remove the -m switch in the above command, and it'll also automatically prompt you to make a password.
    If you're running a RedHat based system, like CentOS, you'll then want to give it a password, so you'll need to use this command.
    Code:
    passwd samp
    Follow the onscreen prompts, and hey presto, you've got a user account for SA:MP

    It would've looked a little bit like...
    Step 3: Let's get SA:MP

    Quote:
    Got this far? Great! We're right on track to downloading SA:MP.

    Firstly, you'll need to close the existing login to your root user acount, and log-in to your SA:MP user account.
    So open up PuTTy, enter your server's IP address, log in with the username and password you just created.

    In this section, you'll also learn how to download files, copy/paste in PuTTy, and avoid typing in incredibly long file names.
    Brilliant stuff
    Quote:
    Download the server package.
    To download files on a Linux based system, we'll use 'wget', since it's pretty simple and straight forward.

    Navigate to the SA:MP downloads page, and find the link to the Linux server package.
    Right click the link, click on 'Copy Link Address' and then go back to the PuTTy window.

    Start by typing in wget, hit the space bar, and then right click onto the PuTTy window.
    This pastes the link you've just copied, saving you a load of time from typing it out.
    To execute the command, and download the files, just hit enter.

    Your command should've looked something like this:
    Code:
    wget http://team.sa-mp.com/files/samp03dsvr_R2.tar.gz
    Quote:
    Extracting the files
    So, you've successfully downloaded the file, but what on Earth is that .tar.gz extension?!
    Think of it as a file, within a file. The 'tar' part is basically cello-taping the files together, whilst the 'gz' part compresses the 'tar' file with Gzip compression.

    To extract it, it's pretty darn simple, although the tar commands are horrible to look at.
    But Hey, watch out kids, here's another Linux trick to show your friends. Remember I said I'll show you how to avoid typing out awkwardly long file names? Here we go.

    You'll need to start out by typing 'tar zxf'
    Press space.
    Then type the first couple letters of the server package (sa) then hit tab. As if like magic, the full filename has appeared.
    Now just hit enter, and the package will silently extract itself.

    The command should've looked a bit like
    Code:
    tar zxf samp03dsvr_R2.tar.gz
    To see where the files have gone, use the 'ls' command, and it'll show you the files in the directory you're in.
    Quote:
    Here's a screenshot showing what just happened on my screen.
    Notice at the end, I've used the 'ls' command.
    It's showing the .tar.gz file we downloaded, and the samp03 directory that's been extracted.
    Step 4: First Start-up
    Quote:
    So, you want to get the server started up?
    Fair enough. Let's get to it.

    You'll need to change your directory to the samp03 directory.
    Quite simply, use the following command:
    Code:
    cd samp03
    Quote:
    Editing the server.cfg
    As you're most likely aware, if you use the default server.cfg file when trying to start the server up, it'll complain and refuse to run, because you haven't changed the default password.

    So, let's use a simple editor called 'nano' to edit the server.cfg
    Code:
    nano server.cfg

    A screen looking like that should've popped up.
    You'll be happy to know, that you can browse around the server.cfg by using your arrow keys, and just typing to edit the file. Simple stuff, right?

    Once you've finished editing the file, hit CTRL+X, press 'Y', then Enter.
    Your file is now saved!
    Quote:
    STARTEN THE SERVER!
    Although an interesting command, it won't get your server started.
    At the very least, because you don't have the correct permissions to launch the server.

    That's right, you'll need to let your system know that the SA:MP binaries are allowed to be ran.
    Luckily, it's just this simple command, where '-x' denotes 'executable'

    Code:
    chmod +x samp-npc samp03svr announce
    Now you've got the formalities sorted, you can use the nohup command to run the server in the background.
    This means it'll run without any intervention, and you can close your PuTTy session without the server closing.

    An example command would be
    Code:
    nohup ./samp03svr &
    Yes, the & was intentional

Post a Comment

0 Comments