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.

Comic strip about Linux servers. Zero looks up into the sky and asks One, "What are clouds made of?" One replies, "Linux servers mostly"
Used with permission by the artist – Romana A. Heath Van Horn

Many people are reluctant to use Linux because it typically uses a command-line interface (CLI) rather than a graphical user interface (GUI) like Windows or macOS. 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 few 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.
TIME: 45 minutes not including download

Learning Objectives

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

Prerequisites

Deliverables

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

Resources

Contributors and Testers

  • Kyle Wheaton, Cybersecurity Student, ERAU-Prescott

Phase I – Download and Installation

Installing a Linux Server is pretty straightforward. We will use the Ubuntu Linux distribution due to its extensive documentation and support. 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 optional tools, as you may need them later.

If you have limited PC resources, we recommend skipping Phase V (installing the LXDE Desktop) and using the CLI interface instead.

    1. Download Ubuntu Server
    2. Start Oracle VirtualBox Manager
    3. Click on New
      1. Pick a name, for this example, we use something clever like “Ubuntu Server – no GUI”
      2. Use the dropdown menu to select the Ubuntu Server ISO image that you downloaded
        Create a new VM
        Figure 1 – Create a new VM
      3. Open the settings for “Set up unattended guest OS installation” and complete the following fields:
        1. User Name (cannot use spaces)
        2. password
        3. confirm password
        4. Host Name (cannot use spaces or underscores)
      4. Click on “Install Guest Additions” – If you installed VirtualBox guest additions
        Unattended Guest OS settings
        Figure 2 – Unattended Guest OS settings
      5. Open the settings for “Specify virtual hardware” and complete the following fields:
        1. You can leave the hardware on its defaults for now and adjust them for specific uses later
          Hardware settings
          Figure 3 – Hardware Settings
      6. Open the settings for “Specify virtual hard disk” and complete the following fields:
        1. Disk size will vary based on your needs:
          1. 25 GB (default) is good for general use and saving space on your hard drive
          2. 50 GB is necessary to install a GUI
          3. Anything larger is based on need. We warn against making a large one-size-fits-all image. After all, if you add everything but only need one function, you will have a server at 100GB, then another at 100GB, and another at 100GB…
            New Virtual Hard Disk Settings
            Figure 4 – New virtual hard disk settings.
      7. Click on Finish
    4. The Ubuntu Server should start automatically since we selected an unattended install. It will take a few minutes.

      NOTE: If you want to manually install, read the instructions

       

    5. When the VM starts, log in using the credentials you created earlier

      NOTE: If you are new to Linux, the password cursor does not move. This is a security feature that masks the number of characters in the password. Anyone who shoulder surfs can accelerate their password brute-force efforts by knowing the password length.

    6. You may get an error at the end of the installation. Just reboot the VM, and it should clear
      Possible Error
      Figure 5 – possible error
    7. Use Chapter 6 to add the Ubuntu Server to the GNS3 Working Environment

Phase II – Install DHCP Server – Kea (Optional)

These are the instructions for installing Kea as the DHCP server, since isc-dhcp is no longer supported.

  1. At the terminal prompt, type

    sudo apt install kea

  2. On the Kea password screen, select ‘configured_password’
    Select authentication method
    Figure 6 – select authentication
  3. For the password, use one of your own or use the book’s default Security1
  4. Kea installation is now complete. If you need to configure Kea at this stage, type

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

  5. The instructions to configure Kea are included in the file
  6. You can also use the Kea tutorial to configure Kea

Phase III – Install DNS Server – BIND9 (Optional)

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. The Bind9 installation is now complete. If you need to configure Bind9 at this stage, we’ve included some commonly used commands:
    1. Modify the configuration file

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

    2. Configure master zone declarations

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

    3. Start DNS daemon

      sudo systemctl start named

    4. To restart

      sudo systemctl restart named

    5. To check status
      sudo systemctl status named

 

Phase IV – Install a GUI (Optional)

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

  • DO NOT install a GUI if you need a lightweight Linux server.
  • Installing this GUI will enable your Ubuntu server to have a Web Browser, which is not needed for server applications. However, you may occasionally choose to use your server for dual purposes.
  1. Install the LXQT GUI

    sudo apt install lxqt -y

  2. This can take a while
    Sleeping 0
    Figure Zzzzzz
  3. Reboot the server

    sudo reboot

  4. Upon restart, enter the credentials that you created earlier
    GUI install complete
    Figure 7 – GUI install complete

     

Phase V – Install a web hosting service (Optional)

Creating a web hosting service isn’t complicated, but it involves several steps. A web server requires a platform, a database, and an interface. Follow these steps to set up a local web hosting service and create a test website that is accessible.

  1. Install a GUI on the Ubuntu Server by following the steps in Phase IV
  2. Open a terminal
  3. 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
      shows directions
      Figure 8 – Apache2 default page
  4. Install MySQL database management system
    1. From a terminal, install MySQL by typing

      sudo apt install mysql-server

    2. Verify it was installed by viewing the version number by typing

      sudo mysql -v

    3. Quit the MySQL interface prompt by typing

      \q

    4. 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
    5. 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;

    6. You should have a screen that looks like
      verification that mySQL is installed
      Figure 9 – mySQL is installed
    7. To leave mysql and return back to the Ubuntu Server console, type

      exit

  5. 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
      PHP commands
      Figure 10 – PHP Test Successful

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

Feedback email
Figure 00 – Contact us via prmaster@erau.edu

 

License

Icon for the Creative Commons Attribution-NonCommercial 4.0 International License

Mastering Enterprise Networks 3e Copyright © 2024 by Mathew J. Heath Van Horn is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License, except where otherwise noted.