+ All Categories
Home > Documents > 2015-in1-hands-on-1 - NAIST · 2017. 3. 14. · Marius Georgescu (IPLab) IN1H1 2015.04.17 9 / 13...

2015-in1-hands-on-1 - NAIST · 2017. 3. 14. · Marius Georgescu (IPLab) IN1H1 2015.04.17 9 / 13...

Date post: 24-Jan-2021
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
7
Build your own Lightweight Webserver - Hands-on I - Information Network I Marius Georgescu Internet Engineering Laboratory 17 Apr. 2015 iplab Prerequisites Prerequisites Download and Install VirtualBox Windows [download link] OS X [download link] Linux [download link] Download the ready-made CentOS VM image (User: in1 Pass: info2015) [local download link] *Windows users only: Download and install Cygwin For the Download site choose one of the JP mirrors e.g. ftp://ftp.iij.ad.jp Make sure the libssh2, openssh packages are installed Marius Georgescu (IPLab) IN1H1 2015.04.17 2 / 13
Transcript
Page 1: 2015-in1-hands-on-1 - NAIST · 2017. 3. 14. · Marius Georgescu (IPLab) IN1H1 2015.04.17 9 / 13 Remote connectivity Test Secure SHell (SSH) Connection Test SSH from MAC / Linux hosts:

Build your own Lightweight Webserver- Hands-on I -

Information Network I

Marius Georgescu

Internet Engineering Laboratory

17 Apr. 2015

iplab

Prerequisites

Prerequisites

Download and Install VirtualBoxWindows [download link]OS X [download link]Linux [download link]

Download the ready-made CentOS VM image(User: in1 Pass: info2015) [local download link]*Windows users only: Download and install Cygwin

For the Download site choose one of the JP mirrors e.g.ftp://ftp.iij.ad.jp

Make sure the libssh2, openssh packages are installed

Marius Georgescu (IPLab) IN1H1 2015.04.17 2 / 13

Page 2: 2015-in1-hands-on-1 - NAIST · 2017. 3. 14. · Marius Georgescu (IPLab) IN1H1 2015.04.17 9 / 13 Remote connectivity Test Secure SHell (SSH) Connection Test SSH from MAC / Linux hosts:

Import VM

Import VM

Start the Import appliance on VirtualBox Choose the [previously] downloaded VM image

Marius Georgescu (IPLab) IN1H1 2015.04.17 3 / 13

Apache Server

Install Apache Server

Start the terminal application Run the command to install the Apache daemon:$ sudo yum -y install httpd

Marius Georgescu (IPLab) IN1H1 2015.04.17 4 / 13

Page 3: 2015-in1-hands-on-1 - NAIST · 2017. 3. 14. · Marius Georgescu (IPLab) IN1H1 2015.04.17 9 / 13 Remote connectivity Test Secure SHell (SSH) Connection Test SSH from MAC / Linux hosts:

Apache Server

Configure Apache Server

Start the terminal application and edit the following file with the vitext editor (gedit is an alternative) as shown in the screenshot:$ sudo vi /etc/httpd/conf/httpd.conf

$ sudo gedit /etc/httpd/conf/httpd.conf

Run the following commands:

to add the httpd to the startup:$ sudo systemctl enable httpd

to start the http daemon:$ sudo systemctl start httpd

to check if http is running:$ sudo systemctl status httpd

Marius Georgescu (IPLab) IN1H1 2015.04.17 5 / 13

QnA1

QnA1

Marius Georgescu (IPLab) IN1H1 2015.04.17 6 / 13

Page 4: 2015-in1-hands-on-1 - NAIST · 2017. 3. 14. · Marius Georgescu (IPLab) IN1H1 2015.04.17 9 / 13 Remote connectivity Test Secure SHell (SSH) Connection Test SSH from MAC / Linux hosts:

Check the client-server functionality

Change the NIC settings*Mac users:

After shutting down the VM, in the main VirtualBoxwindow choose the Preferences Menu

In the Network Tab add new Host-only network

Set it up to act as DHCP server

Everyone:

Shut down the VM and go to the VM Settings menu

In the Network tab choose Host-only Adapter

Marius Georgescu (IPLab) IN1H1 2015.04.17 7 / 13

Check the client-server functionality

Test client-server connectionCheck the reachability of the Webserver:

Confirm the IP address of the server with the ifconfigcommand:

Use ping to check reachability Check that the Apache server is running using the Browser onyour host (Windows / Mac / Linux ) machine.

Marius Georgescu (IPLab) IN1H1 2015.04.17 8 / 13

Page 5: 2015-in1-hands-on-1 - NAIST · 2017. 3. 14. · Marius Georgescu (IPLab) IN1H1 2015.04.17 9 / 13 Remote connectivity Test Secure SHell (SSH) Connection Test SSH from MAC / Linux hosts:

QnA2

QnA2

Marius Georgescu (IPLab) IN1H1 2015.04.17 9 / 13

Remote connectivity

Test Secure SHell (SSH) Connection

Test SSH from MAC / Linux hosts:$ ssh [email protected]

Test SSH from Windows Hosts using the Cygwin console:$ ssh [email protected]

Marius Georgescu (IPLab) IN1H1 2015.04.17 10 / 13

Page 6: 2015-in1-hands-on-1 - NAIST · 2017. 3. 14. · Marius Georgescu (IPLab) IN1H1 2015.04.17 9 / 13 Remote connectivity Test Secure SHell (SSH) Connection Test SSH from MAC / Linux hosts:

Remote connectivity

Securing OpenSSHUse SSH Public Key Authentication:

Using the terminal / Cygwin console create apublic/private key pair with the command:$ ssh-keygen -t rsa

Copy the public rss key to the remote server with thecommand:$ scp

˜

/.ssh/id_rsa.pub

[email protected]:

˜

/.ssh/authorized_keys

Other recommended security measures can be found in theCentOS official documentation [link]

Disable the SSH password authentication by editing thesshd_config file as shown in the screenshot:$ sudo vi /etc/ssh/sshd_config

Restart the ssh daemon using: $ systemctl restart ssh

Marius Georgescu (IPLab) IN1H1 2015.04.17 11 / 13

Hello World !!!

Hello World !!!

Using an SSH connection from the host machine add anindex.html file as shown in the screenshot$ sudo vi /var/www/html/index.html

Connect to the Webserver using the host machine browser. Youshould see:

Marius Georgescu (IPLab) IN1H1 2015.04.17 12 / 13

Page 7: 2015-in1-hands-on-1 - NAIST · 2017. 3. 14. · Marius Georgescu (IPLab) IN1H1 2015.04.17 9 / 13 Remote connectivity Test Secure SHell (SSH) Connection Test SSH from MAC / Linux hosts:

QnA3

QnA3

Marius Georgescu (IPLab) IN1H1 2015.04.17 13 / 13


Recommended