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.
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.
- Please login as root. I use PuTTY on MS Windows to manage a server through SSH.
- Let's figure out the Linux version:
cat /etc/issue.netGo forward if it is Ubuntu.
- Update the system:
- 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
- Next create a new system user, for example user1:
useradd -m user1
And add him to administrative group:
Add this line in the opened file:
user1 ALL=(ALL) ALL
- Login as new user user1.
Now you can run any command that requires administrative permissions through sudo.
- 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.
Turn on more safety SSH protocol version:
Protocol 2Restart SSH daemon:
sudo /etc/init.d/ssh restart
- It's time to check your changes at SSH settings. Root access should be disabled on the server. And port 22 must be closed.