WebTech #1 Introduction to servers
- Nov 20, 2008
Hello everyone, this post will be a very basic introduction, as a lot of designers are new to the world of servers. In my tutorials, I will use a VPS as my platform, however you can use the same commands for a dedicated server. Also, we assume you know what Linux, Apache, PHP, MySQL, and such names are.
Whats a VPS anyways?
def: A VPS a method of partitioning a physical server computer into multiple servers such that each has the appearance and capabilities of running on its own dedicated machine. (wikipedia)
So basically, a VPS is a ‘division’ of a bigger server, and it fits as a great solution for designers and developers because of the cost involved in such a service. However, a VPS is the next step from entry level-’shared’ hosting and expensive dedicated servers.
Accessing your VPS
Once you have ordered a VPS and your OS is installed, you need to connect to your server. You will have at least 1 IP address for your server, and SSH is enabled by default. SSH is a secure connection system that basically gives you a command line on your server.
Firstly, we need to download PuTTY from their website - Once done, double click on the downloaded putty.exe:
In the Host Name enter the IP address of your VPS, port 22 is the default port, unless you change it for security - we’ll talk about security later.
From Mac or Linux
From Mac you need to open your terminal (also in linux). In mac you can find it under Finder -> Application -> Utilities -> Terminal. Once you’re running it is should look like this:
Then type at the prompt
ssh email@example.com (replace the 10.10.x.x with you IP & use your password on the prompt)
Ok, you're now connected to your VPS. Let’s begin by setting up a few basics. Once you’re logged in, immediately change your root password.
As you may know, for security reasons it’s not recommended to log in to your VPS using the root account. We only logged in with root this one time to do the initial setup. With that in mind, let’s create a user we will be using instead of root from now on. Choose your own name instead of poweruser.
# adduser poweruser
Now we must give the poweruser account some administrative rights. Before we can do that though, it may be necessary to install sudo onto your VPS.
# apt-get install sudo
Sudo stands for super user do and it enables a regular user such as poweruser to run administrative tasks that would typically be available only to root. To enable sudo for the new user, let’s look at the /etc/sudoers file and give our new user super user privileges.
# nano /etc/sudoers
Add to the end of file:
poweruser ALL=(ALL) ALL
You should now be able to log in with your new account and use sudo to perform administrative tasks. When you run a command using sudo, you will be asked for the root password.
Updating the base system
We are now ready to update our VPS. Let’s start by updating the list of packages available to us.
# sudo apt-get update
Updating works by looking at a list of repositories located in /etc/apt/sources.list. If you plan to install 3rd-party or non-standard software, you may wish to edit your sources.list with your favorite editor (I use nano).
# sudo nano /etc/apt/sources.list
To install the latest security updates and bug fixes, type the full upgrade commands:
# sudo apt-get upgrade
# sudo apt-get dist-upgrade
After the first command you may be asked to set your timezone. If you are not you may now set it manually for your home location.
# sudo ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
This creates a symbolic link from /etc/localtime to a file in /usr/share/zoneinfo corresponding with what zone you are in. Have a look in the directories under /usr/share/zoneinfo to see what timezones are available.
Before we finish, we’ll run several system utilities to verify the resources on your VPS. Start by looking at the memory usage.
# free –m
You should see a table reporting your memory usage. Focus your attention on the second line, starting with -/+ buffers/cache. Under the used column, you will see how much memory applications on your VPS use. Above that you might see a higher number, but this is because it reports memory already used for buffers and cached. A more powerful command, top, shows how much processing power and memory is being used and for which running processes.
# top –bn 1
This will run top in batch mode with one iteration, so that you get a nice and clean output of everything running. Keep in mind that running top with the -bn switches is like taking a snapshot, while running it without them would provide you an ongoing look at processor activity in real-time.
Next, let’s take a look at disk usage:
Df simply shows the amount of total and available disk space on a file system.
Well, now your system is up to date, you have a new user account that can perform administrative tasks, and you are aware of the resources in your working environment. Whatever your choose to use it for, you should now be aware of how to take your VPS from a barebones system to something with a little more meat on it.
At this point, we have covered alot of ground for your first server exploration day! Make sure to keep an eye on Abduzeedo, as we will be releasing the next Article on How to Setup Apache (webserver), PHP and MySQL! so you can start serving your websites.