Lesson 1: First Steps

Homepage Content Slides Video

Warning

This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.

Overview

_images/Tux.png

Vocabulary

A 10,000ft view of the world
General Topics:
  • Software: A program that runs on a computer.
  • Operating System: Computer software that manages other software.
  • GNU/Linux: A free Operating System.
  • Computer Security: Like physical security but harder to solve with a baseball bat.
  • Virtual Machine: A computer emulated in software.
  • Containers: Not virtual machines, but basically virtual machines.

Vocabulary

Development:
  • Version Control: A way to track changes and contributions to a project.
  • Continuous Integration: Releasing updates continuously.
Buzzwords:
  • FOSS: Free (and Libre) Open Source Software. Free as in Speech, not Free as in Pizza (but that too usually).
  • 'The Cloud': Computers somewhere else.
  • Docker: Software that manages Linux containers

Notation

$ONE_VARIABLE_NOTATION
<another notation for variables>
this_is(code)  # everything after the octothorp is a comment!
other_code(line)  // This can also be a comment. It depends on the
                  // language!

Notation

Code-block:

#! /usr/bin/env python
# This is a code block.
# Most of the time you can copy this code and run it exactly as is.
# It should be clear Where it 'goes' and how to run it based on
# context.
print('Hello world!')
# Copy the text after `$` into your terminal & press enter.
$ echo Hello World

Exercise: Reading Examples

Trick question: how would you read this
#!/bin/python
dogs = ['$BREED_ONE', '$BREED_TWO', '$BREED_THREE']
for breed in dogs:
    print(breed)

Actually prints...

$BREED_ONE
$BREED_TWO
$BREED_THREE

Answer: Reading Examples

Replace the $BREED_N with actual dog breeds.

#!/bin/python
dogs = ['corgie', 'pug', 'french bulldog']
for breed in dogs:
    print(breed)

Actually prints...

corgie
pug
french bulldog

SSH: Secure Shell

Getting Setup on Linux

Tux Linux Logo

There are a variety of ways to run Linux!

Linux setup we're using today

Lecture Setup

  1. Get login credentials from your lecturer. You will be provided a port and password.

Linux/Mac:

  1. Open a terminal and verify you have ssh installed by entering the command ssh --version.
  2. Run the following command and enter the password when prompted (it will hide your password in the terminal):
$ ssh -p <port> dobc@dobc-shell.osuosl.org

Lecture Setup

Windows:
  1. Install an SSH Client (install Putty)

  2. Log into your remote Linux environment using the credentials given to you.

    1. Under 'Host Name (or IP address)' enter 'dobc@dobc-shell.osuosl.org', under 'Port' enter '<port>'.
    2. You will be prompted for your password in new window, it will hide the password as you type it.

Docker Setup

We suggest you install Docker and Docker Compose, a tool which makes it easy to run small Linux Containers on your system in a safe sandbox without requiring to install Linux on your own machine. This is the same setup we used in the lecture.

Make sure you read the install documentation for Docker to ensure your system supports running it and have the required BIOS settings enabled.

Docker Setup

After you have it installed, run this to start a container:

$ git clone https://github.com/DevOpsBootcamp/Bootcamp-Exercises.git
$ cd Bootcamp-Exercises
$ docker-compose up -d
$ docker-compose run -p 8080:8080 dobc bash

You can log out by typing exit and then enter which will stop the container.

To stop the container, run the following:

$ docker-compose kill
$ docker-compose rm --all

Docker Setup

Feel free to try other Docker images, some that we recommend include:

To run those, do the following:

$ docker run -it --rm <docker image name> bash

You can find have more images at the Docker Hub. We also recommend you read Getting started with Docker to have a better understanding of how it works.

Virtual Machine Setup

Instead of using Docker, you can also run a Linux Virtual Machines on your computer. This will give you a full Linux environment as if it were on a real machine.

We suggest you install Vagrant, a tool which makes it easy to run and acquire Virtual Machines.

You may also need to install VirtualBox or install VMWare (Requires TEACH access) a tool necessary for Vagrant to function.

Virtual Machine Setup

After you get Vagrant and either VirtualBox or VMWare installed, clone our vagrant repo (make sure you install Git first!) and then start the VM:

$ git clone https://github.com/DevOpsBootcamp/vagrant.git
$ cd vagrant
$ vagrant up
$ vagrant ssh
Vagrant logo

Windows Subsystem for Linux Setup

The Windows Subsystem for Linux (Bash on Windows) allows you to run userspace Linux software on Windows, while using less resources than a virtual machine.

Windows Store

If you installed the Fall Creators Update for Windows 10, you can install one or more Linux distributions through the Windows Store.

Exercise: Change Your Password!

Challenge Change your password on your Linux machine.
$ passwd
Changing password for user <user>.
Changing password for <user>.
(current) UNIX password: # Enter old password, hidden
New password:   # Enter new password, also hidden
Retype new password:
passwd: all authentication tokens updated successfully.

Don't forget: when you login next time, use the new password you just set.

Further Reading

Next: Lesson 2: Operating Systems