--- tags: computer science, linux --- # Linux Operating System <img style = "float:right" src = "https://i.imgur.com/sxxzlUU.png" width = "300"/> <br><br><br><br><br> <p style="text-align: right"> "My name is Linus, and I am your God."<br>-- Linus Torvalds </p> <p style="text-align: right"> "Linux is only free if your time has no value."<br>-- Jamie Zawinski </p> ### Instructor's Information - Name: 盧政良 (Zheng-Liang Lu, Arthur) - Email address: arthurzllu@gmail.com ### Working Platform :::warning If you are new to Linux systems, especially having no experience of using the **command line interface (CLI)**, you may start with virtual machines to avoid suffering in the very beginning of the course. ::: - For Windows users, you may use [WSL2](https://learn.microsoft.com/zh-tw/windows/wsl/install) during the course. - For Apple users, you can use built-in terminals. Note that some instructions do differ from Linux but solvable. - For example, use apt (or apt-get) as the package manager in Debian/Ubuntu but use [homebrew](https://brew.sh/) in Mac OS. - To be a professional Linux users, you should migrate from virtual environments to physical machines. - Install Ubuntu (or any distribution of Linux, say [Debian](https://www.debian.org/)) on **old** desktop computers (laptop computers are not recommended due to unreliable hardware supports, for example, drivers). I've run Ubuntu on two machines of Intel 775 platform (e.g. Intel QuadCore Q9400 / Xeon L5420 wth DDR2-800 8GB DRAM) and they've worked well, especially in CLI. <!-- [Docker](https://www.docker.com/)、[QEMU](https://www.qemu.org/)、或者 [KVM](https://www.linux-kvm.org/page/Main_Page) --> ### Prerequisites - Experience of configuring computers, say setting IP, net mask, and gateway to connect to the Internet. - Linux is nothing without connection to the Internet. Everything in need is out there on the cloud. - Coding experience, say [Python](https://hackmd.io/@arthurzllu/HJNXq84SO) or [C++](https://www.csie.ntu.edu.tw/~d00922011/cpp.html). - We will learn how to write **shell scripts**, and some Python programs. ### Subjects - Linux Practice - Ubuntu: installation - Bash: basic operations - ssh - Networking - Routing - Firewall - Virtualization - Docker - Linux Kernel - 工作排程 - 記憶體管理 - 虛擬化技術 <center> ![](http://imgs.xkcd.com/comics/sandwich.png =300x) </center> ### Grading Policy - TBA ### Textbooks - TBA ## Syllabus ### Chapter 1: Introduction to Linux and Ubuntu - Overview of Linux and Ubuntu - Benefits of using Linux - Linux distributions ### Chapter 2: Installing Ubuntu - Preparing for installation - Installation process - Post-installation setup ### Chapter 3: Command Line Interface and Basic Commands - Introduction to CLI - Navigation commands - File and directory operations - Text processing commands - Package management ### Chapter 4: Bash Scripting - Introduction to Bash scripting - Variables and data types - Flow control: loops and conditionals - Advanced commands: sed, awk, xargs, parallel - Job scheduling with crontab ### Chapter 5: User Management - User and group management - Understanding and modifying file permissions - Sudo privileges ### Chapter 6: Network Setup - Basic networking concepts - Network configuration - Network troubleshooting tools - Network services and protocols ### Chapter 7: Storage Device Configuration and File Systems - Understanding block devices and file systems - Disk partitioning and formatting - Mounting and unmounting file systems ### Chapter 8: CPU Scheduling and Memory Management - Understanding processes - Process creation and management - CPU scheduling - Memory management concepts in Linux ### Chapter 9: Boot Process and System Services - Linux boot process and GRUB - Managing system services with systemd - System logs and troubleshooting ### Chapter 10: Parallelism in Linux - Introduction to parallel computing - Tools for parallel execution in Linux - Multithreading and multiprocessing ### Chapter 11: Virtualization with Docker - Introduction to Docker and containerization - Installing Docker on Ubuntu - Creating, managing, and deploying Docker containers - Docker Compose for multi-container applications ### Chapter 12: Continuous Integration and Continuous Delivery (CI/CD) in Linux - Overview of CI/CD concepts - CI/CD tools for Linux - Setting up a CI/CD pipeline - Automating build, test, and deployment processes ### Introduction & Installation - Syllabus - Installations - [VirtualBox](https://www.virtualbox.org/) - [Ubuntu 21.04](https://ubuntu.com/#download) ### New - 檔案路徑相關 ```bash= ls cd [相對路徑] cd .. cd [絕對路徑] pwd touch mv mkdir rmdir ``` - grep - 遠端登入 ```bash= ssh account@domain.name -p PORT_NUMBER ``` - 文件閱讀 ```bash= more less cat awk ``` - 文件編輯 - VI - VIM - 系統查詢 ```bash= uname -a lscpu lshw lsblk lsusb df -h top htop glances ps sensors # need to install lm-sensors ``` - 系統管理 ```bash= sudo reboot shutdown ``` - 套件管理 ```bash= apt apt-get ``` ### 第二回:腳本撰寫 - Bourne Again Shell (BASH) - https://cbb.sjtu.edu.cn/course/bi296/lecture/lec04.pdf - https://www.sheffield.ac.uk/polopoly_fs/1.171626!/file/shellintro1.pdf - https://www.gnu.org/software/bash/manual/bash.pdf ### 第三回:權限管理 ```bash= adduser passwd chmod groups usermod -a -G group_name user_account ``` ### 第四回:網路管理 - Router/firewall - 切VLAN ```bash= iptables netstat ip arp arp-scan ifconfig ping iperf3 ``` ### 第五回:伺服器架設 (以Java Spring框架的購物車為例) ### 第六回:資料庫架設 ### 第七回:Linux核心技術 - CPU排程 - 記憶體管理 - 效能調校 ### 第八回:虛擬化技術 - QEMU - PVE - Docker - k8s - stress testing ### 第九回: ### 第十回: ## References ### Introductory Level Textbook - 鳥哥 ### 安裝系統 - https://www.kjnotes.com/linux/29 ### 大專院校 - http://wiki.csie.ncku.edu.tw/linux/schedule - https://sysprog21.github.io/lkmpg/ - https://beta.hackfoldr.org/linux - https://courses.cs.washington.edu/courses/cse391/19au/lectures/ - https://cse.sc.edu/~conradp/csce215/ - https://www.twbsd.org/cht/book/index.php?ch=00 - https://chusiang.gitbooks.io/working-on-gnu-linux/content/ ### 網路管理 - https://iperf.fr/ - https://blog.gtwang.org/useful-tools/iperf-network-bandwidth-testing-tool-tutorial/ - https://www.ez2o.com/Blog/Post/MikroTik-RouterOS-RouterBOARD-RB750GL-Performance - [Wireshark](https://www.wireshark.org/) - https://www.man7.org/linux/man-pages/man8/ip-neighbour.8.html ### 虛擬化工具 - https://www.qemu.org/ - https://pve.proxmox.com/wiki/Main_Page - https://www.docker.com/ - https://kubernetes.io/ ### 系統測試 ```bash= sudo apt install glances htop s-tui stress ``` https://tldp.org/LDP/abs/html/index.html https://www.josehu.com/memo/2021/01/02/linux-kernel-build-debug.html https://www.unixmen.com/how-to-install-and-configure-qemu-in-ubuntu/ https://www.gnu.org/software/bash/manual/bash.pdf eBPF https://hackmd.io/@sysprog/linux-ebpf https://www.facebook.com/groups/system.software2020/learning_content/ ## References ### General Books - Carla Schroder, [Linux Cookbook](https://www.oreilly.com/library/view/linux-cookbook-2nd/9781492087151/), 2/e, 2021 ![](https://hackmd.io/_uploads/S1QjGHY7i.png =100x) - Evi Nemeth, Garth Snyder, Trent Hein, Ben Whaley, Dan Mackin, [UNIX and Linux System Administration Handbook](https://www.amazon.com/UNIX-Linux-System-Administration-Handbook/dp/0134277554), 5/e, 2018 ![](https://m.media-amazon.com/images/W/IMAGERENDERING_521856-T2/images/I/61ydSUheYOL._SX383_BO1,204,203,200_.jpg =100x) ### Shell Scripts - Stephen Kochan and Patrick Wood, [Shell Programming in Unix, Linux and OS X](https://www.amazon.com/Shell-Programming-Unix-Linux-Developers/dp/0134496000), 2016 ![](https://hackmd.io/_uploads/ByCDQHYmj.png =100x) - Daniel J. Barrett, [Efficient Linux at the Command Line](https://www.oreilly.com/library/view/efficient-linux-at/9781098113391/), 2022 ![](https://hackmd.io/_uploads/HJffBHYQs.png =100x) - William Shotts, [The Linux Command Line](https://linuxcommand.org/tlcl.php), 2/e, 2019 ![](https://hackmd.io/_uploads/SkgyUBYQj.png =100x) #### AWK - https://linuxcommand.org/lc3_adv_awk.php ### Kernel - https://www.kernel.org/ - https://docs.kernel.org/ - [The Linux Kernel Module Programming Guide](https://github.com/sysprog21/lkmpg) - Jonathan Corbet, Alessandro Rubini etc, [Linux Device Drivers](https://lwn.net/Kernel/LDD3/), 3/e, 2005 ![](https://hackmd.io/_uploads/SJj2d3yNo.png =100x) - [Linux Kernel Teaching](https://linux-kernel-labs.github.io/refs/heads/master/) - Peter Jay Salzman, Michael Burian, Ori Pomerantz, Bob Mottram, Jim Huang, [The Linux Kernel Module Programming Guide](https://sysprog21.github.io/lkmpg/), 2022 ![](https://hackmd.io/_uploads/rksiLBtXj.png =100x) ### Official Certificates - Christine Bresnahan and Richard Blum, [LPIC-1 Linux Professional Institute Certification Study Guide](https://www.amazon.com/LPIC-1-Linux-Professional-Institute-Certification/dp/1119582121), 5/e, 2019 ![](https://m.media-amazon.com/images/W/IMAGERENDERING_521856-T2/images/I/51TnLnicDEL._SX397_BO1,204,203,200_.jpg =100x) - LPIC-2 Linux Professional Institute Certification Study Guide, 2016 ### Computer Network - James F. Kurose and Keith Ross, [Computer Networking: A Top Down Approach](https://www.pearson.com/us/higher-education/program/Kurose-Pearson-e-Text-Computer-Networking-Access-Card-8th-Edition/PGM2877610.html), 8/e, 2020 ![](https://i.imgur.com/upcyUVA.jpg =100x) - https://gaia.cs.umass.edu/kurose_ross/instructor.htm - https://gaia.cs.umass.edu/kurose_ross/wireshark.htm ### Docker - https://docs.docker.com/ <center> ![](https://hackmd.io/_uploads/HyT2DeHNj.png =300x) </center> https://hackmd.io/@arthurzllu/HkvOPPCOD https://hackmd.io/@arthurzllu/HyCegSxCD https://hackmd.io/@arthurzllu/BJKnYPaTO https://hackmd.io/@arthurzllu/Skc_tT2oU [How to Write Your Own Makefile](https://hackmd.io/@arthurzllu/SyldsUyFo) Day12 什麼是 CICD https://ithelp.ithome.com.tw/articles/10219083