Lesson 1: The Very Basics

Today's Agenda

_images/Tux.png

A note about notation

_images/stickynote.png

How to get (to) Linux

_images/dualboot.png
_images/osm_server.jpg

Trying Linux on a Virtual Machine

Virtual machines act as a full system on a physical machine

_images/virtualbox.png

Installing Linux on Virtualbox

Warning

Your home directories in all CS labs are mounted over NFS. If you run a virtual machine from your home directory you will crash the file server and get your account disabled.

You can stop this from happening by adding "export VAGRANT_HOME=/tmp/$USER-vagrant.d/" to your .bashrc (or .zshrc, etc.) and changing the virtualbox default machine location to /tmp. This setting can be found in File -> Preferences -> General in Virtualbox.

Note

Try other distributions if you like to see what's different. Fedora or Manjaro are great next steps to try out.

  1. Download and install: https://www.virtualbox.org/wiki/Downloads

  2. Grab the latest minimal ISO: http://cdimage.debian.org/debian-cd/current/amd64/iso-cd/

  3. Create VM
    1. New -> Name "Debian" -> Default Ram -> Default Disk settings
    2. Settings -> Storage -> Empty -> CD/DVD Drive -> Select ISO
    3. Start -> press enter -> Skip media check
  4. \o/

Vagrant & VirtualBox

Note

You can see the gui by uncommenting the line in the Vagrantfile.

# clone
git clone https://github.com/WWUDevOps/vagrantfile

# rename
mv vagrantfile devopsbootcamp-vagrant

# start up
cd devopsbootcamp-vagrant
vagrant up

# access vm
vagrant ssh

Vagrant cheat sheet

Note

We'll get into more detail later in how you can access ports on your VMs and other use cases.

# start
vagrant up

# stop
vagrant halt

# destroy (remove vm)
vagrant destroy

# ssh to the vm
vagrant ssh

Also check out the Vagrant Documentation for more information.

The Terminal

_images/crashcart.jpg
_images/televideo_terminal.jpg
_images/teletype_terminal.jpg

Basic Shell Commands

Note

Explain architecture:
 built in commands vs. external binaries
Demo commands:Directory movement and file manipulation: Cd, pwd, ls, rm, mv, touch
User info:id, whoami, w
Pipes:redirection (pipe.txt, redirect.txt)
Special variables:
 $?, $$ (pid.sh), !!, !*, !$
_images/pylogo.png
test@x230 ~ $ tree
.
├── Documents
│   ├── Code
│   │   └── scripts
│   │       └── test.sh
│   ├── School
│   └── Work
└── Pictures
    ├── manatee.gif
    └── turtle.png

6 directories, 5 files

Invoking a script

Note

Permissions discussed later.

$ ls -l
$ chmod +x $filename

Arguments are extra information that you pass to a script or program when you call it. They tell it in more detail what you want to do.

$ ls -a -l
$ ls -al

Why pass arguments on the command line rather than having an interactive mode?

File Paths

test@x230 ~ $ ls
Documents  Pictures
test@x230 ~ $ cd Documents/
test@x230 ~/Documents $ ls
Code  School  Work
test@x230 ~/Documents $

Note

root directory is not to be confused with a home directory for the root account

Special Characters

_images/xkcd_regex.png

Type less

_images/space_cadet_keyboard.gif

Automation > Typing > Mouse

Help, get me out of here!

_images/exit.jpg

Knowledge Check

test@x230 ~ $ tree
.
├── Documents
│   ├── Code
│   │   └── scripts
│   │       └── test.sh
│   ├── School
│   └── Work
└── Pictures
    ├── manatee.gif
    └── turtle.png
6 directories, 5 files

More about Man Pages

Documentation

Man pages, blogs you find by Googling, StackOverflow

_images/google.gif

Asking for help

It's okay to ask.

  1. What should be happening?
  2. What's actually happening?
  3. Google it
  4. Skim the manuals of each component
  5. Identify a friend, mentor, or IRC channel who could help
  6. When they're not busy, give them a quick synopsis of points 1 and 2, mentioning what possibilities you've ruled out by searching.

Contributions = expertise + time

Don't waste experts' time, but do build your expertise.

IRC

_images/multiple_networks.gif

A Client

Note

Switche to a terminal and show example

Use irssi in screen

# This step is optional, but persistent IRC is cool
$ ssh <username>@<preferred shell host>

# start Screen
$ screen -S irc

# start your client
$ irssi

# after ending ssh session, to get back:
$ ssh <username>@<preferred shell host>
$ screen -dr IRC

Networks

_images/multiple_networks.gif
/connect irc.freenode.net

/nick <myawesomenickname>
/msg nickserv register <password> <email>

/nick <myawesomenickname>
/msg nickserv identify <password>

Channels

/join #osu-lug
/join #devopsbootcamp
/list:
  • tells all channels on network
  • Don't do this on Freenode!
/topic:

tells you the current channel's topic

/names:

tells you who's here

Commands

/say $thing
/join, /part, /whois <nick>, /msg, /help <command>

Note that nothing shows up in the channel when you run a /whois command; it shows up either in your status buffer or your conversation with the person.

12:04 -!- _test_ [~test@c-50-137-46-63.hsd1.or.comcast.net]
12:04 -!-  ircname  : Example User
12:04 -!-  channels : #ExampleChannel
12:04 -!-  server   : moorcock.freenode.net [TX, USA]
12:04 -!-  hostname : c-50-137-46-63.hsd1.or.comcast.net 50.137.46.63
12:04 -!-  idle     : 0 days 0 hours 2 mins 38 secs [signon: Wed Nov  6
12:00:30
                      2013]
12:04 -!- End of WHOIS

Useful tricks

Screen & Irssi Hints

SCREEN(1)                                                               SCREEN(1)

NAME
       screen - screen manager with VT100/ANSI terminal emulation

SYNOPSIS
       screen [ -options ] [ cmd [ args ] ]
       screen -r [[pid.]tty[.host]]
       screen -r sessionowner/[[pid.]tty[.host]]
Manual page screen(1) line 1 (press h for help or q to quit)

Etiquette

Terminology

_images/jargon.jpg

Review