Skip to content

Commit b109a0b

Browse files
committed
changes to Tutorial1&2
1 parent 15522b5 commit b109a0b

19 files changed

+244
-21
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
*~
1+
*~
2+
.DS_Store

tutorial1/README.md

+69-4
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ If your workstation or laptop is running Windows, then you may proceed using eit
523523

524524
### Username and Password
525525

526-
Once you've successfully logged into your head node VM, you are encouraged to change your password so that you may access your head node through the OpenStack VNC console interface.
526+
Once you've successfully logged into your head node VM, you are encouraged to setup your password login as a fail safe incase your ssh keys are giving issue, you may also access your head node through the OpenStack VNC console interface.
527527

528528
```bash
529529
sudo passwd <username>
@@ -539,10 +539,75 @@ Once logged into your head node, you can now make use of the [previously discuss
539539

540540
<p align="center"><img alt="Verifying head node basic networking configuration." src="./resources/head_node_basic_networking_commands.png" width=900 /></p>
541541

542-
## Manual Pages `man`, Reading Documents `cat` and the `-h` Switch
543-
## Piping `|` Through `grep`, `more` or `less`
544-
## Redirecting `>>` Console Output to a File
542+
## Manual Pages `man`
543+
In linux every information about all linux commands is found in a linux built in manual page document. This doncument is accessible via a command called `man` short term for manual page. Run the ff commands to understand what each command mean, scroll up and down then press `q` to exit the page, these are some of the commands you will use throught the week.
544+
545+
```bash
546+
man sudo
547+
man ping
548+
man tracepath
549+
man ls
550+
man cat
551+
552+
```
553+
<p align="center"><img alt="manual page for `sudo` command" src="./resources/man_sudo_feedback.png" width=900 /></p>
554+
555+
556+
## the `-h` Switch
557+
If you don't want to use the `man` command to learn about each command and related options, you can use the `--help or -h` flag to see which options are available for a specific command. run the ff command to learn about available options each command has.
558+
559+
```bash
560+
561+
sudo -h
562+
ifconfig -h
563+
ping -h
564+
ssh-keygen --help
565+
grep --help
566+
567+
```
568+
569+
<p align="center"><img alt="manual page for `sudo` command" src="./resources/sudo_with-h_flag.png" width=900 /></p>
570+
571+
572+
## Reading Documents
573+
you will be reading a lof of files throughout the week and the ff commands can be used to read files with ease, use `man` to learn about each command. All the following command are used to read the content of a file `staff_list.txt`
574+
575+
```bash
576+
less staff_list.txt
577+
more staff_list.txt
578+
cat staff_list.txt
579+
vi staff_list.txt
580+
nana staff_list.txt
581+
582+
583+
```
584+
585+
<p align="center"><img alt="cat prints the content of file on screen" src="./resources/cat_command.png" width=900 /></p>
586+
587+
<p align="center"><img alt="read the content of the file with `less` command " src="./resources/less_command.png" width=900 /></p>
588+
589+
## Piping
590+
591+
`|` Through `grep` is used when searching the content of the file, if it exist it will be printed on the screen, if the search does not exist nothing will show on the screen.
592+
593+
<p align="center"><img alt="search the file with `grep` command " src="./resources/search_commands_grep.png" width=400 /></p>
594+
595+
## Console Output to a File
596+
597+
`>` replaces the content of an output file with all input content
598+
`>>` appends the input content to the end of the output file.
599+
600+
<p align="center"><img alt="appends james at the endo of staff_list.txt file" src="./resources/append.png" width=900 /></p>
601+
602+
<p align="center"><img alt="replaces the content of staff_list.txt file with james" src="./resources/replaces.png" width=900 /></p>
603+
545604
## GNU `history` Library
605+
`history` command shows all commands you have executed so far, the feedback is numbered, use `!14` to rerun the 20th command
606+
607+
<p align="center"><img alt="history command " src="./resources/history_command.png" width=900 /></p>
608+
609+
<p align="center"><img alt="rerun commands from history " src="./resources/rerun_command_from_history.png" width=900 /></p>
610+
546611
## Brief Introduction to Text Editors (Vi vs Vim vs Nano)
547612
### Your First Chat GPT Query
548613

tutorial1/resources/append.png

255 KB
Loading

tutorial1/resources/cat_command.png

182 KB
Loading
344 KB
Loading

tutorial1/resources/less_command.png

188 KB
Loading
1.83 MB
Loading

tutorial1/resources/replaces.png

316 KB
Loading
Loading
51.2 KB
Loading
1.73 MB
Loading

tutorial2/README.md

+173-16
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,12 @@ This tutorial will demonstrate how to access web services that are on your virtu
9393

9494
# Spinning Up a Compute Node in OpenStack
9595

96-
play around
9796

98-
scripting and automation to test out differnet configurations
97+
# Manually from openstack dashboard
98+
To launch your compute node vm, go to `Compute-> Instances` click `launch instance` and follow the headnode vm launch process on Tutorial 1. **remember** to use `compute` flavors and `local_team_keys` used when launching the headnode on Tutorial 1.
99+
100+
101+
# scripting and automation to test out differnet configurations
99102

100103
As previously discussed in [Tutorial 1: OpenStack Flavors](../tutorial1/README.md#openstack-instance-flavors), an important aspect of system administration is resource monitoring, management and utilization. Once you have successfully stood up your head node, your team will need to plan and manage the resources remaining which will be available for your compute node(s).
101104

@@ -112,7 +115,7 @@ Sensible default instance flavors have already been identified and configured fo
112115

113116
One important distinction between your head node and compute node(s), is that the compute nodes will **not** have a floating IP associated to them. Your head node will act as a ***Gateway*** for your Compute Node(s), and ***Route*** traffic between the internet and your cluster, using a method referred to as ***Network Address Translation (NAT)***, which was discussed in the [WiFi Hotspot Example](../tutorial1/README.md#wifi-hotspot-example).
114117

115-
The final important consideration that must be made for your compute node is that you must not forget to configure an SSH key, so that you may access it after it has successfully launched. For ease of access and to simplify your configuration, you are *strongly* advised to use the same SSH key that you'd [previously generated](../tutorial1/README.md#generating-ssh-keys).
118+
The final important consideration that must be made for your compute node is that you must not forget to configure an SSH key, so that you may access it after it has successfully launched. For ease of access and to simplify your configuration, you are *strongly* advised to use the same SSH key that you'd [previously generated](../tutorial1/README.md#generating-ssh-keys) on your local machine/laptop.
116119

117120
# Accessing Your Compute Node
118121

@@ -128,7 +131,7 @@ TODO: High level explanation of OpenStack's automatic network configuration and
128131

129132
TODO: Maybe remove the default routing table on compute node and route through headnode?
130133

131-
## Command Line Proxy Jump Directive
134+
## Command Line Proxy Jump Directive
132135

133136
From you workstation, using either MobaXTerm or Windows Powershell, you can `ssh` directly into your compute node by first making an **ssh** connection too your head node and then establishing a TCP forwarding connection to your compute node. Using this method, the SSH keys for both your head node and compute node must reside on your local workstation:
134137

@@ -207,8 +210,11 @@ Just as you did so in the previous tutorial when you generated SSH keys [on your
207210

208211
# Understanding the Roles of the Head Node and Compute Node
209212
Networking Diagram and client server model
213+
headnode (hd) and compute node (cn) relationship follow a server (hd) - client (cn) relations, the headnode carries the systems services and compute node does all the computations
210214
System software need to be installed on both head node and compute nodes
211-
Do not ssh endlessly between head and compute nodes, one terminal example or multiplexing
215+
Do not ssh endlessly between head and compute nodes, one terminal example or multiplexing (screen sessions via `tmux`)
216+
217+
212218
## Terminal Multiplexers
213219

214220
Discuss GNU Screen and [tmux](https://github.com/tmux/tmux/wiki)
@@ -256,7 +262,7 @@ sudo apt-get install tmux
256262
To start a new `tmux` session on your **head node**:
257263

258264
```bash
259-
tmux
265+
tmux new -s session_name
260266
```
261267

262268
### Working on your Head Node and Compute Node in Two Adjacent Panes
@@ -333,18 +339,169 @@ Should your terminal application close, or if you relocate from the laboratores.
333339
To connect to an existing `tmux` session on your **head node**:
334340
335341
```bash
336-
tmux attach
342+
tmux a -t session_name
343+
```
344+
345+
346+
## Basic Linux commands
347+
348+
# Basic System Monitoring
349+
`top` `htop` are system built commands used to monitor server resource suage. for `htop` first install epel source repository then install htop
350+
https://docs.rockylinux.org/gemstones/htop/
351+
352+
```bash
353+
sudo dnf -y install epel-release
354+
sudo dnf makecache
355+
sudo dnf -y install htop
356+
htop
357+
358+
```
359+
360+
<p align="center"><img alt="htop output" src="./resources/htopcommand.png" width=900 /></p>
361+
362+
363+
364+
# Print current working space
365+
If you are lost and don't know where you currently working use `pwd` (print working directory), it will show you your current woring space
366+
367+
```bash
368+
pwd
369+
```
370+
371+
372+
## Manipulating Files and Directories
373+
374+
# Make a New Directory
375+
376+
`mkdir` command is used to create folders or directories, the `-p` flag means create the directory path `mnu/2024` if it does not exits before creating `SCC` directory.
377+
378+
```bash
379+
mkdir SCC
380+
mkdir -p mnu/2024/SCC
381+
```
382+
383+
384+
385+
# creating new Files
386+
The following commands are used to create and edit files
387+
`touch` create a new file(s)
388+
389+
`vi, vim, nano ` file editor commands and are used to edit existing files, but if a file does not exist it will create the file and open it for editing.
390+
391+
392+
```bash
393+
touch file
394+
395+
vi file1
396+
```
397+
398+
399+
400+
# List Directory
401+
`ls` (list) command used to list the content of directory/folder.
402+
403+
```bash
404+
ls
405+
406+
ls mnu/2024/SCC
407+
```
408+
409+
`ls` list or prints the content of the current directory
410+
`ls mnu/2024/SCC` list or print the content of the last `SCC` directory
411+
412+
413+
414+
# Change Directory
415+
416+
`cd` commad allow you move from directory to directory
417+
418+
```bash
419+
420+
cd mnu/2024/SCC
421+
422+
```
423+
424+
`cd mnu/2024/SCC` means moving to `SCC` directory, you can verify your current working directory by `pwd` command
425+
426+
<p align="center"><img alt="change from current to SCC directory" src="./resources/cdexample.png" width=700 /></p>
427+
428+
429+
430+
431+
# Copy File or Directory
432+
433+
`cp` copy files/directories from source to destinations, it works like windows `copy and paste`.
434+
435+
```bash
436+
mkdir -p mnu/2024/team
437+
cp -r mnu/2024/SCC mnu/2024/team/
438+
439+
```
440+
441+
`mkdir -p mnu/2024/team` creates a team directory/folder under mnu/2024 directoy path
442+
`cp -r mnu/2024/SCC mnu/2024/team/` will recursilvely copy the `SCC` directory and it content to `mnu/2024/team/` directory.
443+
444+
<p align="center"><img alt="creating the SCC directory" src="./resources/cpexamble.png" width=700 /></p>
445+
446+
447+
448+
449+
# Move File or Directory
450+
451+
`mv` command literally moves files/directories from source to destinations, it work like windows `cut and paste`.
452+
453+
454+
```bash
455+
mv staff_list.txt mnu/2024/team/SCC
456+
457+
```
458+
459+
`staff_list.txt` file is being moved to SCC directory
460+
461+
<p align="center"><img alt="moving staff list file to SCC directory" src="./resources/mvcommandexample.png" width=700 /></p>
462+
463+
464+
465+
466+
# Remove File or Directory
467+
468+
`rm` remove command used to delete files, directory with `-r` flag
469+
470+
```bash
471+
rm mnu/2024/team/SCC/staff_list.txt
472+
rm -r mnu/2024/team/SCC
473+
474+
```
475+
476+
<p align="center"><img alt="moving staff list file to SCC directory" src="./resources/rmcommand.png" width=700 /></p>
477+
<p align="center"><img alt="moving staff list file to SCC directory" src="./resources/rmcommandexample.png" width=700 /></p>
478+
479+
480+
481+
482+
# The history Command
483+
484+
`history` command shows all commands you have executed so far, the feedback is numbered, use `!14` to rerun the 20th command
485+
486+
<p align="center"><img alt="history command " src="./resources/history_command.png" width=900 /></p>
487+
<p align="center"><img alt="rerun commands from history " src="./resources/rerun_command_from_history.png" width=900 /></p>
488+
489+
490+
491+
492+
# The virtual environment Command
493+
494+
`virtualenv` command helps you run multiple services with conflicting packages without any problems. each virtual enviroment is treated as an independant entity.
495+
Below is how you create and source or access a virtual enviroment then deactivate to exit, ensure to use sensible names.
496+
https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-programming-environment-on-rocky-linux-9
497+
498+
```bash
499+
python -m venv env
500+
source env/bin/activate
501+
deactivate
502+
337503
```
338504
339-
## Basic System Monitoring
340-
# Manipulating Files and Directories
341-
## List Directory `ls`
342-
## Change Directory `cd`
343-
## Copy File or Directory `cp`
344-
## Move File or Directory `mv`
345-
## Make a New Directory `mkdir`
346-
## Remove File or Directory `rm`
347-
## The `history` Command
348505
## Recommended Project Folder Structure
349506
# Verifying Networking Setup
350507

tutorial2/resources/cdexample.png

98.1 KB
Loading

tutorial2/resources/cpexamble.png

179 KB
Loading

tutorial2/resources/htopcommand.png

1.31 MB
Loading

tutorial2/resources/lsdirectory.png

61.7 KB
Loading
264 KB
Loading

tutorial2/resources/rmcommand.png

205 KB
Loading
440 KB
Loading

0 commit comments

Comments
 (0)