What The Hack - Linux Fundamentals
Introduction
This hackathon will serve as an introduction to important command line concepts and skills on Linux environments.
Linux History
Linux is a family of free and open-source operating systems based on the Linux kernel. Operating systems based on Linux are known as Linux distributions or distros. Examples include Debian, Ubuntu, Fedora, CentOS, Gentoo, Arch Linux, and many others.
The Linux kernel has been under active development since 1991 and has proven to be extremely versatile and adaptable. You can find computers that run Linux in a wide variety of contexts all over the world, from web servers to cell phones. Today, 90% of all cloud infrastructure and 74% of the world’s smartphones are powered by Linux.
To read more about Linux History, Linux Distributions and Linux Kernel, click here.
Learning Objectives
In this hack you will be challenged with some common tasks from a real world scenario in Linux administration duties, such as:
- Create a Linux Virtual Machine on Azure
- Handle files and directories
- Maninpulate file contents
- Work with standard Linux permissions
- Collect information about Linux processes in your environment
- Management of users and groups
- Basic shell scripting
- Work with disks, partitions and logical volume manager
- Linux package management
- Implement a basic webserver
Challenges
With the exception of challenge 01 which has as an outcome a Linux Virtual Machine which will be required for all other challenges, each challenge can be done separately and they are not interdependent. The level of complexity increases accordingly with the respective number of each one.
- Challenge 01: Create a Linux Virtual Machine
- A Linux Virtual machine is the prerequisite for the challenges, so create a new Ubuntu Linux VM
- Challenge 02: Handling Directories
- Learn how to perform common directory operations such as displaying your current directory and listing directory contents.
- Challenge 03: Handling Files
- Learn basic commands about file manipulation such as create, rename, find and remove files.
- Challenge 04: File Contents
- Learn about file content manipulation and discover how to count file lines, display specific lines from a file, and more.
- Challenge 05: Standard File Permissions
- Learn about the Linux standard file permissions and understand how to work with file permissioning on a Linux environment.
- Challenge 06: Process Management
- Your objectives will involve basic process management, such as checking processes running and identifying process ids.
- Challenge 07: Group and User Management
- In this challenge you will learn about the creation of user and groups in a Linux environment.
- Challenge 08: Scripting
- Learn some basic stuff on shell scripting and the usage of some commands such as echo, cut, read and grep.
- Challenge 09: Disks, Partitions and File Systems
- You will be working with disks and partitions and learn about linx filesystems and commands such as fdisk, mkfs and mount.
- Challenge 10: Logical Volume Manager
- Discover about the Logical Volume Manager on Linux, and how to use commands such as pvcreate, vgcreate, lvrcreate, and more.
- Challenge 11: Package Management
- Learn about package management and common activites such as update package distribution lists, install and uninstall packages.
- Challenge 12: Setting up a Webserver
- In this challenge we will setting up a webserver and deploy a simple PHP application into it. The usage of SSL could be a plus.
- Challenge 13: Protecting a Server
- In this challenge we will discover about how to use Fail2Ban to protect services in a Linux environment.
Prerequisites
- Your own Azure subscription with contributor access for the Challenge 01 or contributor access to a pre-created Azure Virtual Machine for all other challenges.
-
Access to a terminal. The terms “terminal,” “shell,” and “command line interface” are often used interchangeably, but there are subtle differences between them:
- A terminal is an input and output environment that presents a text-only window running a shell.
- A shell is a program that exposes the computer’s operating system to a user or program. In Linux systems, the shell presented in a terminal is a command line interpreter.
-
A command line interface is a user interface (managed by a command line interpreter program) which processes commands to a computer program and outputs the results.
When someone refers to one of these three terms in the context of Linux, they generally mean a terminal environment where you can run commands and see the results printed out to the terminal.
Becoming a Linux expert requires you to be comfortable with using a terminal. Any administrative task, including file manipulation, package installation, and user management, can be accomplished through the terminal. The terminal is interactive: you specify commands to run and the terminal outputs the results of those commands. To execute any command, you type it into the prompt and press ENTER.
For our activites, it is recommended to use the Azure Cloud Shell.
- There are some basic concepts that will be nice if you have them. If you would like to take a look they are listed here.
- Concepts around the Linux Filesystem Hierarchy Standard (FHS) are recommended, so you can get more details about it here.
- Regarding Linux commands, just for reference, here is a good cheat sheet.
- The Linux man pages are your best friend. Make sure to use as best you can.
Learning Resources
Feedback
Please share your experience during this Linux Hackathon and help us to improve.
Contributors