README.md 4.07 KB
Newer Older
Sergio Coronado's avatar
title    
Sergio Coronado committed
1
# Linux Basics 101 and GitLab R3 Workshop
Sergio Coronado's avatar
Sergio Coronado committed
2

Sergio Coronado's avatar
Sergio Coronado committed
3
4
## How to connect to a remote Session
***
Sergio Coronado's avatar
Sergio Coronado committed
5

Christophe Trefois's avatar
Christophe Trefois committed
6
7
8
9
10
11
12
13
### 1. My terminal is better than yours?

> Definition: A terminal is an interface in which you can type and execute text based commands.

#### Download your Terminal if you don't have one already.


+ Windows
Christophe Trefois's avatar
Christophe Trefois committed
14
  + PuTTy (use Windows installer) [download](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)
Christophe Trefois's avatar
Christophe Trefois committed
15
16
17
18
19
20
21
22
23
  + MobaXterm [download](http://mobaxterm.mobatek.net/download-home-edition.html)
+ Mac
  + iTerm2 [download](https://www.iterm2.com/downloads.html)
  + Terminal
+ Linux
  + Terminal


### 2. Generate your SSH key
Christophe Trefois's avatar
Christophe Trefois committed
24
25
26
27
28
29
30
31

#### Background information

+ What is SSH?
* What is a SSH key pair?

#### Key generation

Christophe Trefois's avatar
Christophe Trefois committed
32
33
34
35
36
+ Windows
  + PuTTyGEN [follow tutorial](https://hpc.uni.lu/users/docs/access.html#ssh-key-generation-on-windows)
+ Mac / Linux
  + ssh-keygen

37
        ```bash
38
39
40
41
42
43
44
45
46
        vagrant@vagrant-ubuntu-trusty-64:~$ ssh-keygen
        Generating public/private rsa key pair.
        Enter file in which to save the key (/home/vagrant/.ssh/id_rsa):
        Enter passphrase (empty for no passphrase):
        Enter same passphrase again:
        Your identification has been saved in /home/vagrant/.ssh/id_rsa.
        Your public key has been saved in /home/vagrant/.ssh/id_rsa.pub.
        The key fingerprint is:
        ac:d7:36:ee:74:f6:34:d1:ff:ee:dd:bc:d5:ee:70:36 vagrant@vagrant-ubuntu-trusty-64
Christophe Trefois's avatar
Updates    
Christophe Trefois committed
47
        The key\'s randomart image is:
48
49
50
51
52
53
54
55
56
57
58
        +--[ RSA 2048]----+
        |                 |
        |                 |
        |                 |
        |       .       . |
        |        S     . .|
        |       . .     .o|
        |      . . = o +E*|
        |       . + + o B*|
        |         .o   .=@|
        +-----------------+
Christophe Trefois's avatar
Updates    
Christophe Trefois committed
59
        ```
Christophe Trefois's avatar
Christophe Trefois committed
60

Christophe Trefois's avatar
Christophe Trefois committed
61
62
63
### 3. Create LUMS account

This task has been done already by your awesome R3 team.
Christophe Trefois's avatar
Christophe Trefois committed
64

Christophe Trefois's avatar
Christophe Trefois committed
65
dwdwdwd
Christophe Trefois's avatar
Christophe Trefois committed
66

Christophe Trefois's avatar
Christophe Trefois committed
67
### 4. Add SSH key to LUMS (**L**CSB **U**ser **M**anagement **S**ystem)
Christophe Trefois's avatar
Christophe Trefois committed
68

Christophe Trefois's avatar
Updates    
Christophe Trefois committed
69
70
71
1. Attach SSH key to your LUMS account
2. Go to https://lcsb-ipa.uni.lu
3. Login with first.lastname and password linuxwork2015
Christophe Trefois's avatar
Updates    
Christophe Trefois committed
72

Christophe Trefois's avatar
Updates    
Christophe Trefois committed
73
    > (Note: Use your password for existing LUMS account)
Christophe Trefois's avatar
Updates    
Christophe Trefois committed
74
75
76
77
78

### 5. Connecting to Virtual Machine

* Windows

Christophe Trefois's avatar
Christophe Trefois committed
79
80
  Enter the details into PuTTy

Christophe Trefois's avatar
Christophe Trefois committed
81
  <img src="images/screen1.png" width=400>
Christophe Trefois's avatar
Christophe Trefois committed
82
83
84

  Don't forget to add your SSH key

Christophe Trefois's avatar
Christophe Trefois committed
85
  <img src="images/screen2.png" width=400>
Christophe Trefois's avatar
Christophe Trefois committed
86

Christophe Trefois's avatar
Updates    
Christophe Trefois committed
87
88
89
* Linux
  * Open your terminal
  * Connect to the workshop virtual machine
Christophe Trefois's avatar
Updates    
Christophe Trefois committed
90

Christophe Trefois's avatar
Updates    
Christophe Trefois committed
91
        ```bash
Christophe Trefois's avatar
Updates    
Christophe Trefois committed
92
        ssh {first}.{lastname}@10.79.2.191 -p 8022
Christophe Trefois's avatar
Updates    
Christophe Trefois committed
93
        ```
Sergio Coronado's avatar
Sergio Coronado committed
94
95
96

## Discover your surroundings
***
Sergio Coronado's avatar
Sergio Coronado committed
97
98
99
100
101
102
103
* In which folder am I? (Hint: pwd)
* What is the contents of the current folder? (Hint: ls)
* Creating my first file (Hint: touch)
* Creating my first folder (Hint: mkdir)
* How do I enter my folder? (Hint: cd)
* Moving my first file to the new folder (Hint: mv)
* Copying **** (Hint: cp)
Sergio Coronado's avatar
Sergio Coronado committed
104

Christophe Trefois's avatar
Christophe Trefois committed
105
## Learn more about any *nix command
Sergio Coronado's avatar
Sergio Coronado committed
106
***
Sergio Coronado's avatar
Sergio Coronado committed
107
108
109
* Go to your home folder (Hint: cd <no arguments>)
* Are there any hidden files in my home folder? (Hint: man ls)
* How do I get such nice documentation for other unix commands? (Hint: man <mycommand>)
Sergio Coronado's avatar
Sergio Coronado committed
110
111
112

## Copy files to the VM or from the VM (only using console!!)
***
Sergio Coronado's avatar
Sergio Coronado committed
113
114
115
* Logout of the VM (Hint: logout)
* Go to training folder (./linux-training) (Hint: cd)
* Copy file1.txt to “my first folder” on the VM (Hint: scp –P 8022 first.lastname@1079.2.191:/myfirstfolder/)
Sergio Coronado's avatar
Sergio Coronado committed
116
117
118

## Start a simple program:
***
Sergio Coronado's avatar
Sergio Coronado committed
119
* Intro to command, parameters
Christophe Trefois's avatar
Christophe Trefois committed
120
* How to zip my folder? Unzip?
Sergio Coronado's avatar
Sergio Coronado committed
121
* wget -> untar -> changes -> re-pack
Sergio Coronado's avatar
Sergio Coronado committed
122

Christophe Trefois's avatar
Christophe Trefois committed
123
## Text editor
Sergio Coronado's avatar
Sergio Coronado committed
124
***
Sergio Coronado's avatar
Sergio Coronado committed
125
* nano [Tutorial](http://www.howtogeek.com/howto/42980/the-beginners-guide-to-nano-the-linux-command-line-text-editor/)
Sergio Coronado's avatar
Sergio Coronado committed
126
* Others, like vim, emacs, Atom, Sublime, etc…
Sergio Coronado's avatar
Sergio Coronado committed
127
128
129

## File System explore
***
Christophe Trefois's avatar
Christophe Trefois committed
130
### Midnight Commander `mc`
Sarah Diehl's avatar
Sarah Diehl committed
131
132
133
* [Tutorial](http://linuxcommand.org/lc3_adv_mc.php)
* if function keys do not work, use `Esc`+`1` for `F1`, `Esc`+`2` for `F2`, ..., `Esc`+`9` for `F9` and `Esc`+`0` for `F10`
* if you do not have an `Insert` key (e.g. on Apple keyboards) use `Ctrl`+`t` for (un-)selecting files and folders
Sergio Coronado's avatar
Sergio Coronado committed
134
135
136

## Scripts – bash
***
137
* Simple `bash` scripting [Tutotial](http://linuxconfig.org/bash-scripting-tutorial)
Sergio Coronado's avatar
Sergio Coronado committed
138
139
140

## Basic git (source control)
***
Sergio Coronado's avatar
Sergio Coronado committed
141
142
143
144
* add
* commit
* push
* pull