Hamburger Icon
  • Labs icon Lab
  • Core Tech
Google Cloud Platform icon
Labs

Linux Automation: Implement Automation Using Shell Scripts

In this lab, you’ll practice creating and debugging shell scripts. When you’re finished, you’ll have the knowledge needed to create your own scripts to run customized shell recipes in bash.

Google Cloud Platform icon
Labs

Path Info

Rating
(14 reviews)
Level
Clock icon Beginner
Duration
Clock icon 2h 30m
Published
Clock icon Oct 18, 2024

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Get Started in the Lab Environment

    Here are the initial instructions and explanation of the lab environment. Read this while your environment is busy creating itself from nothing. Yes, this violates physics; we know. How fun!

  2. Challenge

    Understand Script Files and Elements

    Using shell scripts in bash, or any shell, allow you to gain the ability to automate processes and ensure repeatability of events. Working through this challenge, you will learn the purpose of scripts and elements used in the script.

  3. Challenge

    Add Logic to the Script

    In this challenge, you will start adding logic to the script to determine if the Ubuntu package cache needs updating.

  4. Challenge

    Write a Replacement Script to Install Software

    Now that your script can determine that the apt cache metadata is out of date, you are able to use this as an alternative installer. Using Debian based systems it is necessary to update the metadata prior to installing software; however, this is a scheduled task on Red Hat based systems. As such, your script is most useful on Debian based distributions such as the Ubuntu lab system. You will now make a copy of the script to allow for the package name to be passed to the script for installing. Again, the script will not carry out the update or the install, but will echo what it would do

  5. Challenge

    Install Many Packages

    You can install a single package, but not more. You will now add a loop to the script allowing you to install many packages, plus will ensure the package list is correct.

  6. Challenge

    Install Many Packages in a Single Execution

    The script that you have created will install multiple packages, but for each package installed, a separate installation command is done. This takes incurs extra system time and resources. It would be far more efficient if a single installation is done, and you will implement that in this challenge by creating a list of validated packages.

  7. Challenge

    The Last Challenge

    Welcome to the final challenge! This is your last chance to experiment in the environment. Clicking Finish Lab will end this little world that flittered into existence just for you.

Andrew is a committed evangelist of the Linux Operating System and the concept of community and freedom that it provides. He has worked as a technical trainer since 1995 and has taught throughout the world, including Australia, the US, Germany and Eastern Europe. Andrew started teaching Linux in 2004 when Novell acquired SUSE and has been a long time supporter of Novell and provides SYSOP support the the Certifed Novell Instructor community on Linux. Andrew founded theurbanpenguin and has been submitting video training material to his YouTube channel since 2009 and currently has over 8,500 subscribers and 1.6 Million views. Andrew has had two publications with Packt: Citrix Access Gateway VPX Essentials (2012) and Citrix XenApp (2013).

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.