7 Create a Linux Server

Jacob Christensen and Mathew J. Heath Van Horn, PhD

The Linux operating system has been increasing in popularity for many reasons. Most Linux platforms are free and open-source with very active development communities. Linux is also very reliable in that it often does not require reboots when something goes wrong. Furthermore, Linux is very customizable so only the features that are required are installed. A bare-bones Linux distribution can run on as little as 58MB of RAM! Finally, most applications on Linux are free and open-source.

Used with permission by the artist – Romana A. Heath Van Horn

Many people are reluctant to use Linux because it generally uses a command line interface (CLI) instead of a graphical user interface (GUI) like Windows or Apple. However, all those easy-to-use images require a lot of RAM and CPU power, so using CLI allows the operating system to focus on the essentials. We use Linux in the GNS3 environment because it requires very little in the way of hardware resources. This allows us to build complex enterprise networks without overloading our hosting machine. This lab will help you download, install, and configure a Ubuntu Linux Server for use in a GNS3 environment.

Learning Objectives

  • Successfully download, install, and run Ubuntu Server in a GNS3 environment
  • Optional installs for later labs
      • Phase II – DHCP Server – KIA
      • Phase III – DHCP Server – isc-dhcp-server
      • Phase IV – DNS Server – BIND9
      • Phase V – Text-Based Web Browser – w3m
      • Phase VI – GUI – Ubuntu Desktop
      • Phase VII – Web Hosting Service – Apache2

Prerequisites

Deliverables

  • None – this is a preparatory lab that supports other labs in this book

Resources

Contributors and Testers

  • Quinton D. Heath Van Horn, 7th Grade
  • David Reese, Mathematics Student, SUNY Brockport
  • Cody Shinkyu Park, Honeywell Software Engineer, ERAU-Prescott Alumni
  • Evan Paddock, Cybersecurity Student, ERAU-Prescott
  • Dante Rocca, Cybersecurity Student, ERAU-Prescott
  • Sawyer Hansen, Cybersecurity Student, ERAU-Prescott

Phase I – Download and Installation

Installing Linux Server is pretty straightforward. We will use the Ubuntu distribution of Linux due to its expansive documentation and support structure. However, learners will find that other Linux distributions follow similar processes prescribed here.

Furthermore, various tools on the Ubuntu server will be used in part 2 of this book. It is highly recommended that you install all of the optional tools in case you need them later.

  1. Download Ubuntu Server from https://ubuntu.com/download/server
  2. Start Oracle Virtual Box Manager
  3. Click on New (Figure 1)
    1. Pick a name, for this example, we use something clever like “Ubuntu Server”
    2. Use the dropdown menu to select the Ubuntu Server ISO that you downloaded
    3. Click Skip Unattended Installation IMPORTANT!
    4. Click Next
    5. You can leave the hardware on its defaults –> click next (Figure 2)

      NOTE: If you are planning on installing the GUI interface you will need at least 50GB of hard disk storage in the next step.

    6. Leave the default Virtual Hard Disk settings –> click next (Figure 3)
    7. Review the summary and click on Finish
  4. Start the Ubuntu Server VM
  5. Use the arrow keys to Install Ubuntu Server (Figure 4)
  6. Use the arrow keys to select your language (Figure 5) and your keyboard
  7. Use the arrow keys to select Ubuntu Server and press done (Figure 6)
  8. Accept the default network connections and select Done (Figure 7)
  9. Enter a proxy address if you need one select Done (Figure 8)
  10. Enter an alternative Mirror if you know you have one, otherwise, just select Done (Figure 9)
  11. Use the default storage configurations and select Done for both screens (Figure 10)
  12. Confirm the action and select Continue (Figure 11)
    1. For the profile information, the following is recommended (Figure 12)
      Your Name: student
      Your Servers Name: ubuntu_server
      Pick a username: student
      Chose a password: Security1
  13. There is no need to update to Ubuntu Pro, so skip it for now (Figure 13) and continue
  14. Select Install OpenSSH Server and continue (Figure 14)
  15. No snaps are needed – select done (Figure 15)
  16. Allow the installation and update to complete, then select Reboot Now (Figure 16)
  17. You might have to hit enter a couple of times depending on the way your VirtualBox is configured
  18. Login using the credentials you created earlier

    NOTE: If you are new to Linux, you should know that the password cursor does not move. This is a security feature to mask how many characters the password is. Anyone shoulder surfing can accelerate their password brute force efforts by knowing the length of the password.

Phase II – Install DHCP Server – Kea (Optional)

These are the instructions to install Kea as the DHCP server because it is replacing isc-dhcp which is no longer supported. We found documentation limited, so for new learners, we recommend installing the isc-dhcp-server which has expansive examples on the web that new learners can refer to as needed.

  1. At the terminal prompt, type

    sudo apt install kea

  2. Kea can be configured by typing

    sudo vi /etc/kea/kea-dhcp4.conf

  3. The instructions to configure Kea are included in the file
  4. You can also use this guide to configure Kea
  5. Use this guide to add the Ubuntu Server to the GNS3 Working Environment

Phase III – Install DHCP Server – isc-dhcp-server

The isc-dhcp-server is no longer supported as of October 2022. However, it was in use for a long time and there are many writeups on the web on different configurations. We felt it best to continue to have this option for learners at this time.

  1. To install type

    sudo apt install isc-dhcp-server

  2. Some shortcut commands for future reference include:
    1. To bind the DHCP server to an interface type

      vi /etc/default/isc-dhcp-server

    2. To configure type

      sudo vi /etc/dhcp/dhcpd.conf

    3. To test the configuration file type

      dhcpd -t

    4. To start the DHCP server type

      sudo systemctl start isc-dhcp-server.service

    5. To enable the DHCP service to start on boot type

      sudo systemctl enable isc-dhcp-server.service

    6. To restart the DHCP server type

      sudo systemctl restart isc-dhcp-server.service

    7. To check the status of the DHCP server type

      sudo systemctl status isc-dhcp-server.service

Phase IV – Install DNS Server – BIND9

Berkley Internet Name Domain (BIND) is the most popular software suite for DNS implementation on Linux systems.
  1. Install software and additional utilities

    sudo apt install -y bind9 dnsutils bind9-utils

  2. Modify configurations file

    sudo nano /etc/bind/named.conf.options

  3. Configure master zone declarations

    sudo nano /etc/bind/named.conf.local

  4. Start DNS daemon

    sudo systemctl start named

  5. To restart

    sudo systemctl restart named

  6. To check status
    sudo systemctl status named

 

Phase V – Install a Text-Based Web Browser (Optional)

Occasionally you may want to visit the web from the Ubuntu Server that does not have a GUI. This is how you install w3m.

  1.  Install by typing

    sudo apt install w3m

  2. Run by typing

    w3m -v http://www.google.com

  3. Exit the browser by pressing Ctrl-z

 

Phase VI – Install a GUI (Optional)

There could be times when you want a graphical user interface (GUI). Make sure your Linux VM has at least 50GB available on the hard drive. Use the default settings whenever prompted.

  1. To install the GUI type

    sudo apt install ubuntu-desktop

  2. Install the display manager by typing

    sudo apt install lightdm

  3. Enable the LightDM service by typing

    sudo systemctl start lightdm.service

  4. To make sure it starts on boot type

    sudo service lightdm start

  5. You may have to restart the Ubuntu VM

    sudo shutdown now -r

 

Phase VII – Install a web hosting service

Creating a web hosting service isn’t that complicated, but there are a lot of steps. A web server requires a platform, a database, and an interface. Follow these steps to create a local web hosting service and create a test website that can be accessed.

  1. Install a GUI on the Ubuntu Server by following the steps in Phase 6
  2. Install Apache HTTP Server
    1. Install Apache by typing

      sudo apt install apache2

    2. Restart the Apache Server by typing

      sudo service apache2 restart

    3. Test that it is running by opening Firefox and typing 127.0.0.1 in the address bar
    4. Check that it says it works (Figure 17)
  3. Install MySQL database management system
    1. From a terminal install mySQL by typing

      sudo apt install mysql-server

    2. Verify it was installed by typing

      sudo mysql -v

    3. Set the password validation by typing

      sudo mysql_secure_installation

      1. Press y and set the password strength according to your needs
      2. Press y to remove anonymous users
      3. Press y to disallow remote root login
      4. Keep the test database by pressing n
      5. Reload the privilege tables by pressing y
    4. Test the operability of mysql
      1. Start mysql by typing

        sudo mysql -u root

      2. Create a database by typing

        create database <name>;

      3. List all the databases by typing

        show databases;

    5. You should have a screen that looks like (Figure 18)
    6. To leave mysql and return back to the Ubuntu Server console, type

      exit

  4. Install PHP web-server scripting language module
    1. From the terminal, install PHP by typing

      sudo apt install php

    2. View the version by typing

      php -v

    3. Make a check file by typing

      sudo vi /var/www/html/info.php

      1. Type i and add the following information

        <?php
        phpinfo();
        ?>

      2. Save the file by pressing the escape key followed by

        :wq

    4. Restart the Apache service by typing

      sudo service apache2 restart

    5. Test PHP by opening Firefox and typing the following into the web browser address bar 127.0.0.1/info.php
    6. You should get the following screen (Figure 19)

 

NOTE: if a service fails to start and you do not know why, try the following commands:

systemctl status <service>

Record the service’s process ID (PID) number.

journalctl _PID=<pid_number>

Look at the error logs closely, they often help locate the root of most issues!

 

End of Lab

 

Figures for Print Version
Picture of commands
Figure 1 – Create a new VM

 

Picture of commands
Figure 2 – VM resource settings

 

Picture of commands
Figure 3 – Hard disk settings

 

Picture of commands
Figure 4 – Install Ubuntu Server

 

Picture of commands
Figure 5 – Select your language

 

Picture of commands
Figure 6 – Ubuntu Server

 

Picture of commands
Figure 7 – Accept default network connections

 

Picture of commands
Figure 8 – Proxy address if needed

 

Picture of commands
Figure 9 – Alternative mirror if needed

 

Picture of commands
Figure 10 – Use the default storage configurations

 

Picture of commands
Figure 11 – Confirm and continue

 

Picture of commands
Figure 12 – Enter profile information

 

Picture of commands
Figure 13 – Skip updating to pro

 

Picture of commands
Figure 14 – Install OpenSSH server

 

Picture of commands
Figure 15 – No snaps needed

 

Picture of commands
Figure 16 – Reboot now

 

Picture of commands
Figure 17 – Apache installed

 

Picture of commands
Figure 18 – mySQL is installed

 

Picture of commands
Figure 19 – PHP Test Successful

 

License

Icon for the Creative Commons Attribution 4.0 International License

Mastering Enterprise Networks Copyright © 2024 by Jacob Christensen and Mathew J. Heath Van Horn, PhD is licensed under a Creative Commons Attribution 4.0 International License, except where otherwise noted.

Share This Book