Linux Foundation Lecture I & II (MBA(DSDA) 2024-26) PDF

Document Details

WelcomeTellurium

Uploaded by WelcomeTellurium

Symbiosis Centre for Information Technology, SIU

2024

Tags

Linux operating system introduction computer science

Summary

This document is a lecture on the Linux operating system, covering its history, features, distributions, and applications. It goes into details about the core concepts and introduces various types of Linux distributions and commands.

Full Transcript

Linux MBA(DSDA), Batch 2024-26 Foundation Symbiosis Centre for Information Technology, SIU Installation Online Linux Terminal Ubuntu Enabling Virtualization in BIOS (VT-x / AMD-V ) Install using Vmware Workstation player/ Oracle Virtual Box Vir...

Linux MBA(DSDA), Batch 2024-26 Foundation Symbiosis Centre for Information Technology, SIU Installation Online Linux Terminal Ubuntu Enabling Virtualization in BIOS (VT-x / AMD-V ) Install using Vmware Workstation player/ Oracle Virtual Box Virtual Machines Introduction Virtual Machines Introduction Why LINUX? Every major space program uses Linux, including one of the SpaceX vehicles, Falcon 9. Their software runs on Linux, and the language of choice is C++. All of the top 25 websites in the world are using Linux. 96.3% of the world’s top one million servers run on Linux. Only 1.9% use Windows, and 1.8% use FreeBSD. Linux has great applications for personal and small business financial management. GnuCash and HomeBank are the most popular ones. 90% of the public cloud workload runs on Linux. 90% of Hollywood’s special effects are made on Linux. Introduction Introduction Introduction Your Understanding of Linux Introduction Why it is required for Data Science & Data Analytics? Introduction Facts about Linux 47% of professional developers use Linux-based operating systems. (Statista) Linux powers 39.2% of websites whose operating system is known. (W3Techs) Linux powers 85% of smartphones. (Hayden James) Linux, the third most popular desktop OS, has a market share of 2.09%. (Statista) The Linux market size worldwide will reach $15.64 billion by 2027. (Fortune Business Insights) The world’s top 500 fastest supercomputers all run on Linux. (Blackdown) 96.3% of the top one million web servers are running Linux. (ZDNet) Today, there are over 600 active Linux distros. (Tecmint) About 90% of Hollywood special effects rely on Linux (Werts) Introduction Introduction Virus- and Spyware- Free No more antivirus and spyware hassles. Fedora is Linux-based and secure. 2014-15 Myths about Linux Linux is invulnerable and virus-free Linux/Rst-B or Troj/SrvInjRk-A, Phishing, HeartBleed, ShellShock Virus writers do not target Linux because it has a low market share Linux distros have almost 40% of the market share Windows malware cannot run on Linux Troj/JavaDl-NJ Introduction- Unix Originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, Michael Lesk and Joe Ossanna. The Unix operating system was first developed in assembly language 1973 had been almost entirely recoded in C Introduction- Unix UNIX Flavors AIX by IBM BSD/OS (BSDi) by Wind River CLIX by Intergraph Corp. FreeBSD by FreeBSD Group HP-UX by Hewlett-Packard Solaris by Sun Microsystems , etc Introduction- Unix 1985 - Free Software Foundation (FSF) was founded by Richard Stallman. Professor Andrew S. Tanenbaum- Created UNIX Like OS for IBM PC – Minix in 1987 Minix was for educational purpose. In 1991, Linux was created by Linus Torvalds Introduction- Unix In 80’s, Microsoft’s DOS was the dominated OS for PC Apple MAC was better, but expensive UNIX was much better, but much, much more expensive. Only for minicomputer for commercial applications People was looking for a UNIX based system, which is cheaper and can run on PC Both DOS, MAC and UNIX were proprietary, i.e., the source code of their kernel is protected No modification is possible without paying high license fees Introduction- Unix Linux succeeded thanks to selfishness and trust Linus Torvalds Introduction Linux is a multi-user, multitasking, very stable and very secure operating system that allows you to take full control of your computer. While Linux is good for multi-users it also serves very well as a stand alone system. You can make Linux to do what you want. Introduction Stability Security Speed Cost Multiprocessing and other high-end features Applications Introduction Red Hat Enterprise Linux, Fedora, SUSE Linux Enterprise, openSUSE, Debian GNU/Linux, Ubuntu, Mandriva Linux, Slackware Linux Gentoo, Open Linux, Turbo Linux, etc Introduction Distribution Types: Debian Based (dpkg, apt-get) Redhat Based (rpm package manager- yum or dnf) APT (Advanced Package Tool): Used by Debian and Debian-based distributions like Ubuntu. RPM (Red Hat Package Manager): Used by Red Hat, CentOS, Fedora,and related distributions. Pacman: Used by Arch Linux and its derivatives. YUM and DNF: Used by some RPM-based distributions. Introduction Release Cycles: Fixed/Point Release: These distributions have stable releases with a predetermined lifecycle. Examples include Ubuntu LTS (Long-Term Support) and CentOS. Rolling Release: Rolling-release distributions continuously update their software, offering the latest features and improvements. Examples include Arch Linux and openSUSE Tumbleweed. Regular Release: These distributions follow a regular release schedule, typically every six months to two years. Ubuntu’s regular releases fall into this category. Introduction Understanding the release cycle helps you choose between stability and access to the latest software. Introduction Use Cases Desktop Use For a user-friendly desktop experience, Ubuntu and Linux Mint are excellent choices. If you prefer a rolling-release model and enjoy configuring your system, consider Arch Linux. For lightweight systems, you can explore distributions like Xubuntu (lightweight Ubuntu variant) or Lubuntu. Server Use CentOS and Debian are well-suited for server environments, emphasizing stability and long-term support. Ubuntu LTS releases are also popular for server deployments due to their predictable support cycles. Introduction Open Source Software Generally refers to the software for which the source code is available and which the licensing scheme permits the user to modify it and redistribute it in modified or unmodified form Introduction GNU GPL Any modifications to the source code must be licensed under the GPL Sometimes called copyleft OpenSource Refers to software licensed under GPL Public domain No one has copyright to software Not same as GPL Introduction GNU GPL Nobody should be restricted by the software they use. There are FOUR freedoms that every user should have The freedom to use the software to any purpose The freedom to change the software to suit your needs. The freedom to share the software with your friends and neighbors , and The freedom to share the changes you make. Introduction GNU GPL Initially, Torvalds released Linux under a license which forbade any commercial use Changed in version 0.12 to the GPL Linux is licensed only under version 2 of the GPL Introduction Regular development pre-releases are titled release candidates, which is indicated by appending the suffix 'rc' to the kernel version, followed by an ordinal number. sometimes the version will have a suffix such 'ck' stands for Con Kolivas, 'ac' stands for Alan Cox, etc Introduction Used from Wrist watches to Super computers Many of the popular Web 2.0 services on the Internet, such as Twitter, Linked In, YouTube, and Google all rely on Linux as their operating system. Linux Kernel is Modular Distribution: C (52.86%) or C++ (25.56%), Java, Perl, and Lisp Over 95 percent of the kernel's code in written in C Still Capable of Operating usefully in under 4MB of RAM Introduction Open Source Principles 1. Free Redistribution: Open-source software can be freely shared, copied, and distributed. Users are not bound by restrictive licensing fees or restrictions on how they can use the software. 2. Access to Source Code: Open-source projects provide access to their source code, allowing anyone to view, modify, and improve it. This transparency fosters collaboration and innovation. 3. Derived Works: Users have the freedom to create derived works based on open-source software. This means that developers can build upon existing projects to create new and improved software. 4. No Discrimination: Open-source licenses do not discriminate against individuals or groups, ensuring that everyone has equal access to the software. 5. No Restrictions on Usage: Open-source software can be used for any purpose, including commercial applications, without limitations. Introduction Advantage of Open Source Cost-Effective: Open-source software is typically free to use, reducing software costs for individuals and organizations. Transparency: Users can inspect the source code, ensuring that there are no hidden backdoors or vulnerabilities. This transparency enhances security and trust. Flexibility: Open-source software can be tailored to specific needs and modified to meet unique requirements. Community Support: Users can tap into a global community for support, troubleshooting, and collaboration. Longevity: Open-source projects tend to have a longer lifespan, as they are not dependent on a single company’s financial health. Introduction Is Linux a KERNEL or Operating System?? Introduction Is Linux a KERNEL or Operating System?? Kernel is the heart of OS if some useful applications and utilities are added over the kernel, then the complete package becomes an OS Linux is a kernel as it does not include applications like file-system utilities, windowing systems and graphical desktops, system administrator commands, text editors, compilers etc. Introduction Linux Architecture Introduction Kerner Version & OS version Ctrl + Alt + F2 Introduction Kerner Version & OS version Linux Structure https://www.geeksforgeeks.org/linux-directory-structure/ Linux Structure Linux Structure df- Disk Filesystem Linux Structure Linux Editors Linux Editors Linux Editors Linux Editors Linux- Basic Commands cd ls pwd mkdir rm cat Absolute Path Relative Path Linux- permissions type: single character d : directory -: Ordinary file l : symbolic link b: block oriented devices c: character-oriented devices Linux- permissions permissions: set of characters describing access rights. There are 9 permission characters. 3 categories: users/owners (u); group (g); & others (o) Permissions are: read (r), write (w) and execute(x) Linux- permissions links: the number of filesystem links pointing to the file/directory Linux- permissions owner: the user who created the file/directory group: the collection of users who are allowed to access the file according to the group access rights size: the length of the file ( in bytes) name: the name of file or directory Linux- permissions date: the date when the file or directory was last modified( written to) The –u option display the time when the file was last accessed (read) Linux- permissions Linux- permissions $chmod Linux- Basic Commands mkdir, mkdir -p rmdir, rmdir -p Linux- Basic Commands cp, cp -i cp –r Linux- Basic Commands cp file1 file2 file3 file4 dir1 mv file1 file2 Linux- Basic Commands head tail Linux- Basic Commands ls > filename ls >> filename Linux- Basic Commands cat tac Linux- Basic Commands more less Linux- Basic Commands sort uniq Linux- Basic Commands gzip , gunzip (.gz) zcat , zmore bzip2, bunzip2 (.bz2) bzcat, bzmore tar -cvf filename (.tar) tar -xvf filename.tar Linux- Inode inode It’s simply a reference (index) about the file and directory on the System. This is an entry in Inode table. This data structure uses to represent a file system object, this can be one of the various things such as file or directory. It’s a unique number for files and directories under a disk block/partition. Linux- Inode ls -li Linux- Inode how it varies when cp command is used cp test1 test2 Linux- File Links type: single character d : directory -: Ordinary file l : symbolic link b: block oriented devices c: character-oriented devices Linux- File Links Linux- File Links Linux- File Links Linux- File Links LECTURE II LINUX Linux Installing Virtual Box Installing Ubuntu Linux- su Vs sudo su Switch user / substitute user sudo Switch user do it /substitute user do it Both give access to super user but in different way. su will ask you the root user password Once you’re done running commands in the root shell, you should type exit to leave the root shell and go back to limited-privileges mode Linux- su Vs sudo sudo will ask you your password (and you need to be cleared for sudo access to do that). sudo runs a single command with root privileges. It doesn’t switch to the root user or require a separate root user password. Ubuntu was the first popular Linux distribution to go sudo-only by default. When you install Ubuntu, the standard root account is created, but no password is assigned to it. By default, Ubuntu remembers the password for five/fifteen minutes and won’t ask for a password again until the fifteen minutes are up Linux- su Vs sudo Advantages of sudo over su. Only have to provide and remember a single password. Discourages users from logging in as the root user. Running fewer commands as root increases security and prevents accidental system-wide changes Linux- su Vs sudo Adding Users to the Sudoers File: vi /etc/sudoers Use tool visudo (preferred) Add the following line username ALL=(ALL) ALL Ex: ajeykumar ALL = (user1, user2) /usr/bin Linux Filesystem $sudo snap install tree type exit to leave the root shell and go back to limited-privileges mode Linux Filesystem $ tree -a Linux Filesystem $ tree -L 1 / Linux Filesystem /: Root directory. The root for all other directories. /bin: Essential command binaries. The place where binary programs are stored. /boot: Static files of the boot loader. The place where the kernel, bootloader, and initramfs are stored. /dev: Device files. Nodes to the device equipment, a kernel device list. /etc: Host-specific system configuration. Essential config files for the system, boot time loading scripts, crontab, fstab device storage tables, passwd user accounts file. /home: user Home directory. The place where the user’s files are stored. /lib: Essential shared libraries and kernel modules. Shared libraries are similar to Dynamic Link Library (DLL) files in Windows. Linux Filesystem /media: Mount point for removable media. For external devices and USB external media. /mnt: Mount point for mounting a filesystem temporarily. Used for legacy systems. /opt: Add-on application software packages. The place where optional software is installed. /proc: Virtual filesystem managed by the kernel. a special directory structure that contains files essential for the system. /sbin: Essential system binaries. Vital programs for the system’s operation. /srv: Data for services provided by this system. /tmp: Temporary files. /var: Variable data. Only data that is modifiable by the user is stored here, such as databases, printing spool files, user mail, and others; /var/log – contains log files that register system activity. Linux Filesystem /usr: Secondary hierarchy. The largest directory in Linux that contains support files for regular system users: /usr/bin – system-executable files /usr/lib – shared libraries from /usr/bin /usr/local – source compiled programs not included in the distribution /usr/sbin – specific system administration programs /usr/share – data shared by the programs in /usr/bin such as config files, icons, wallpapers or sound files /usr/share/doc – documentation for the system-wide files Linux- external /Built-in commands type cd type cat echo $? Linux- Shells Shell is user Program Command Language Interpreter Shell is not a part of system kernel SHELL is a program which provides the interface between the user and an operating system. When the user logs in OS starts a shell for user. Kernel controls all essential computer operations, and provides the restriction to hardware access, coordinates all executing utilities, and manages Resources between process. Using kernel only user can access utilities provided by operating system. Linux- Shells Shell Types The C Shell –Denoted as csh The Bourne Shell –Denoted as sh The Korn Shell-denoted as ksh GNU Bourne-Again Shell – Denoted as bash T Shell – Denoted as tsh Z Shell – Denoted by zsh Debian Almquist shell– Denoted by dash Restricted Bash – Denoted by rbash Linux- Shells To find all the available shells in your system $ cat /etc/shells Linux- Shells To find all the available shells in your system $ cat /etc/shells Linux- Shells How to prevent a Linux system user from logging into the system In Debian/Ubuntu usermod –s /bin/false user_name In fedora, Redhat, CentOS usermod –s /sbin/nologin user_name Linux- Shells Shell script is a series of command written in plain text file. Why to use Shell Script? Can take input from the user, file and output them on screen. Useful to create our own commands Save lots of time To automate some task of day to day life. Linux- Shells Using vi or any text editor. E.g. vi first Execute using – $ bash first $ sh first./first Linux- Shells Using vi or any text editor. E.g. gedit firstshellscript Linux- Shells Execute bash firstshellscript Linux- Shells if Linux- Shells which- This command locates an executable file (program or command) in the shell’s search path Linux- Shells $$- shows current process ID $PPID- shows Parent Process ID pidof – to show the pid of the process (name) Linux- Shells $$- shows current process ID $PPID- shows Parent Process ID pidof – to show the pid of the process (name) Linux- commands script Linux- commands script Linux- commands script Linux- add user Command useradd passwd usermod userdel Linux- commands.bashrc ~/.bashrc Linux- Firewall Packet filtering iptables Firewall firewalld Linux- Mannual Command man Linux- commands unix2dos file_name.txt dos2unix file_name.txt unix2mac file_name.txt mac2unix file_name.txt Linux- Assignment Install Docker Install Anaconda Linux- Assignment How to communicate between host machine and the Virtual Machine? VM Host VM1 VM2 Linux- Assignment How to communicate between host machine and the Virtual Machine? Add one more NAT Choose Host-Only Linux

Use Quizgecko on...
Browser
Browser