Compiling from Source

Hands-On Lab

 

Photo of Michael Christian

Michael Christian

Course Development Director in Content

Length

00:45:00

Difficulty

Beginner

In this hands-on lab, we will install software from source code on a CentOS7 system. Installing from the source code gives us an appreciation of using package managers such as dpkg and rpm, but it's also good experience to be able to install from source if necessary.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Compiling from Source

Introduction

In this hands-on lab, we will install software from source code on a CentOS7 system.

Connecting to the Lab

  1. Open your terminal application, and run the following command (remember to replace <PUBLIC_IP> with the public IP you were provided on the lab instructions page):
    ssh cloud_user@<PUBLIC_IP>
  2. Enter yes at the prompt.
  3. Enter your cloud_user password at the prompt.

Locate and Extract the Source File Archive

  1. Check which version of Red Hat is running.
    cat /etc/redhat-release
  2. List the current working directory.
    pwd
  3. List the contents of the current directory.
    ls
  4. Run the following command to extract the archived .tar file in /home/cloud_user:
    tar xzf htop-2.2.0.tar.gz

Run the configure Script to Prepare the Source for Installation

  1. List the contents of the current directory.
    ls
  2. Change to the htop-2.2.0 folder.
    cd htop-2.2.0
  3. Run the configuration script to prepare the source.
    ./configure

Compile the Source Code into Usable Binaries

  1. Run the following command:
    make

Install the Binaries

  1. Run the following command:
    sudo make install
  2. Enter your cloud_user password at the prompt.

Run the htop Utility to Verify That Installation Was Successful

  1. Run the following command:
    htop
  2. Press Q to exit the application.

Remove the Installation

  1. From the source directory /home/cloud_user/htop-2.2.0, execute the following command:
    sudo make uninstall

Conclusion

Congratulations, you've successfully completed this hands-on lab!