Basic setup of a VPS on Ubuntu

Often web-developers (and not only they) have to administer a server. I’ve decided to share my modest experience with you. We’ll try to configure Ubuntu VPS from scratch.

Virtual private server (VPS) is a term used by Internet hosting services to refer to a virtual machine. The term is used for emphasizing that the virtual machine, although running in software on the same physical computer as other customers' virtual machines, is functionally equivalent to a separate physical computer, is dedicated to the individual customer's needs, has the privacy of a separate physical computer, and can be configured to run as a server computer (i.e. to run server software). The term Virtual Dedicated Server or VDS is used less often for the same concept, however it may indicate that the server does not use burst/shared ram through multiple machines, as well as individual CPU cores.
http://en.wikipedia.org/wiki/Virtual_private_server

Choose VPS hosting for the experiments.

I use hosting on Ubuntu 64 10.10.

Follow the step-by-step instructions below in order to configure your VPS.

  1. Please login as root. I use PuTTY on MS Windows to manage a server through SSH.
  2. Let's figure out the Linux version:cat /etc/issue.net
    # or
    lsb_release –a
    Go forward if it is Ubuntu.
  3. Update the system:apt-get update
    apt-get upgrade
  4. It is optional step for persons who don’t like vim text editor.
    Install nano editor. I think nano is a little bit easier than vim.apt-get install nano
  5. Next create a new system user, for example user1:useradd -m user1
    passwd user1

    And add him to administrative group:

    visudo

    Add this line in the opened file:

    user1 ALL=(ALL) ALL

  6. Login as new user user1.
    Now you can run any command that requires administrative permissions through sudo.
  7. Let’s improve the server security.sudo nano /etc/ssh/sshd_configSet PermitRootLogin parameter to no (if it does not exist please add):PermitRootLogin noChange default SSH port from 22 to value between 1024 and 49151.Port 2200

    Turn on more safety SSH protocol version:

    Protocol 2Restart SSH daemon:sudo /etc/init.d/ssh restart

  8. It's time to check your changes at SSH settings. Root access should be disabled on the server. And port 22 must be closed.