Step Six • Get ready for remote control

10. Login as user and superuser

  1. Reboot
  2. Login
  3. Superuser

11. Instal SSH and vi

  1. Install SSH
  2. Install vim-nox

12. Make the server's own IP address static using vi

  1. IP address
  2. Editing in vi
  3. Make the IP address static
  4. Restart the network
10. Login as user and superuser

10a. Reboot

This was the last screen of the previous page:

Continue

Remove the CD from the tray and hit <Continue>. You'll see a white on black message stating the system is going down.:

System goes down

The newly installed system will then boot. First you'll see this screen:

Debian

10b. Login

You don't have to do anything. Debian will be booted automatically. When the system is running, you'll see:

Login

Type your username, for example newuser, or whatever username you chose during the installation:

Username

You'll be prompted for the user password you chose during installation.

Password

Type your user password. You won't see it appear when you type. When you're ready typing, hit Enter.

This is how the system welcomes you:

Welcome

As you see on the last line, the user newuser is logged in on host server01. If you chose another user and host during installation, you will see the names of your choice instead.

For newuser the command line will always start with newuser@server01:~$. Compare this to what your own screen shows.

10c. Superuser

Next we are going to do some things for which you need the permissions of the root user, also called superuser. On the command line, type su.

Su

You'll be prompted for the root user password, which you chose yourself during installation.

Password

Type your root password. You won't see it appear when you type. When you're ready typing, hit Enter.

Watch the command line, where newuser@server01:~$ has been replaced by server01:/home/newuser#. This means that from now on you'll be issuing superuser commands.

Root

Take another look at the last line: server01:/home/newuser#. It means that the superuser (root) is now logged in on host server01 and that the current location is directory newuser inside the directory home. If during installation you chose your own host name and username, you will see those instead.

TIP For the install commands below it doesn't matter what the command line starts with, as long as it ends with a hash #.

11. Install SSH and vi

11a. Install SSH

We want to be able to approach the webserver from another computer. Therefore, we need to install ssh.

Following the hash #, type: apt-get install ssh openssh-server. Then hit Enter.

ssh

You'll be asked whether to continue or not. Yes, so type y and hit Enter.

Yes

You'll see processes taking place on your screen. Take a back seat. After ssh has been installed, the last line will again be something like:

Ready

11b. Install vim-nox

You will need to be able to edit system files. You'll need an editor that works from the command line. We'll install the vi editor vim-nox. Type apt-get install vim-nox and hit Enter.

Vi

Continue or not? Type y ...

Continue

... and hit Enter.

With the installation completed, you will start using the vi editor to change files from the command line. Instructions for editing you'll find below.

12. Make the server's own IP address static using vi

12a. IP address

Using the vi editor you’re going to give the webserver a static IP address. First, you need to know the internal IP address of your router. If you don't know its IP address, type route -n on the command line and hit Enter.

In this case the router or gateway ip address is: 192.168.178.1 for a Fritz!Box:

Gateway

IP addresses for routers look like this: 192.168.x.x. The first 6 figures are the same for all routers. Here we'll use the IP address for a Fritz!Box, being 192.168.178.x. In the file below, replace it by the IP address of your own router (consult your router's manual, if necessary).

Once you know your router's IP address, type vi /etc/network/interfaces on the command line ...

Network

... and hit Enter.

The editor vi has now opened a file called interfaces, which is located in the directory network, which on its turn is located in the directory etc. You cannot use the mouse while editing, you must use the keyboard.

Edit interfaces

Watch the last line. You see: "/etc/network/interfaces".

12b. Editing in vi

Now, hit the I (the character i) on your keyboard.

Insert

Take a look at that last line again: -- INSERT --. You may now edit and insert or delete text.

This is what you need to know for editing in vi:

<= keyboard hits => action
  i   insert (start editing)
  arrows   move around
  backspace   delete to the left
  delete   delete to the right
  esc   stop editing
esc :w enter stop editing, save changes and keep vi open
esc :wq enter stop editing, save changes and exit vi
esc :q enter stop editing, exit vi without saving

Click the vi & shell help panel for instructions. You open the panel at the top right of many pages.

12c. Make the IP address static

Using the arrow keys move the cursor down to the line containing allow-hotplug eth0.

Move down

Make sure you're in the insert mode. If you did indeed hit the i on your keyboard, you're now ready to edit the code.

We'll turn the line into a comment by typing a hash # there.

Type hash

Comments start with a hash # and are not executed by the system. Programmers use the term comment out placing a hash # whenever they want to exclude a command from being executed.

The reason for commenting out this particular line is that we want to be able to restart the network without having to restart the entire system. Therefore, we'll replace this line by auto eth0 in a minute.

First, comment out the line iface eth0 inet dhcp the same way.

Comment out

The reason for commenting out this line is that we don't want DHCP to assign a dynamic IP address to your Linux system. For our webserver we need a static IP address, static meaning: always the same.

Move the cursor to the end of the line #iface eth0 inet dhcp and hit Enter to create a new line. Add these lines:

auto eth0 (the last character is a zero)
iface eth0 inet static

Now we've got this:

Static

Now you need that internal IP address of your router, as we mentioned above in 12a. In this example we'll use 192.168.178.1 for Fritz!Box. You'll have to modify the scheme below according to your own router's specifics.

The address on the first line you will add now is going to be the internal IP address of your webserver. You will base it on your router's address, choosing a new figure for the last one (1). Avoid choosing the exact address of your router (1) or another computer already on your local area network (LAN). So if your router has address 192.168.0.1, replace the last figure by a free spot, for example 99, making it: 192.168.0.99. You can pick any free spot instead of 99.

The Fritz!Box router has address 192.168.178.1, so again, we could pick 192.168.178.99 for the webserver, which is what we'll do. Hit Enter to go to the next line, hit Tab and type your router

address 192.168.178.99 to make it look like:

Address

Remember that everytime you see those first 9 figures 192.168.178 you’re looking at the Fritz!Box’s address, which you must replace by the address of your own gateway. Gateway is another word for router.

Now add the following lines, replacing the bold figures (178) by your own router's specific data:

netmask 255.255.255.0
network 192.168.178.0
broadcast 192.168.178.255
gateway 192.168.178.1

This will make the file look like:

Static

In order to save the file, do this:

hit the Esc key (when you do this the term -- INSERT -- will disappear from the bottom line)
type :wq (the colon : is part of the command; you'll see :wq appearing in the bottom line)
hit Enter

The screen will issue a confirmation: written.

Confirmation

The vi editor is closed now and you're back on the command line.

12d. Restart the network

Because of the IP address modifications you must restart the network.

Type /etc/init.d/networking restart

Restart network

... and then hit Enter.

You'll get a confirmation when it's done:

Done

Since ssh has been installed and we’ve established a static IP address, we may start using the webserver from another computer now.

We'll do that on the next page.

Drag this box to where you want it
vi | shell
command action command action
su become superuser rm foo delete file foo
ls show files & directories rmdir foo delete directory foo
ls -a show invisible items too rm -rf foo delete dir foo + content
ls -l show long names chmod change permissions
ls -la show long and invisible chmod 755 foo set 755 for foo
cd change directories vi /etc/foo open file foo in vi
cd / go to root directory apt-get install get and install application
cd /etc go to etc via root tar -xzvf extract zip file
cd /tmp go to temp via root exit finish terminal session
/etc/init.d/restart apache2 restart the Apache server
/etc/init.d/status apache2 show if the Apache server is running
shutdown -h now shutdown the system immediately
shutdown -r shutdown and reboot the system
vi | shell
<= keyboard hits => action
  i   insert (start editing)
  arrows   move around
  backspace   delete to the left
  delete   delete to the right
  esc   stop editing
esc :w enter stop editing, save changes and keep vi open
esc :wq enter stop editing, save changes and exit vi
esc :q enter stop editing, exit vi without saving

Assistance

vi & shell

Contact

Arrow