1 / 3
2 / 3
3 / 3

Monday, August 10, 2020

Linux Series #5: Boot Up Process

 


Hello everyone. In this article, I would like to share you what I learnt - "Linux Boot Up Process"

#1 


▶ System is turned on

#2


▶ BIOS Check - System checks for all the Hardware devices. Ex. I/O Devices

#3


▶ System looks for Boot Sector, Boot Loader ( like GRUB )  in HDD/SSD

#4


▶ Now the Linux Kernel will be loaded

#5


▶ Next, the initial RAM disk will be loaded. Basically, it contains some device drivers

#6


▶ Initialization System - File System along with all the necessary services needed by the Operating System will be loaded

#7


▶ Once all the necessary services are loaded and files system is mounted, then the initial RAM is no more needed. So it will be removed

#8


▶ Now the Initialization System continues to load the services

NOTE: All the events, processes that take place in the system will be written by the Linux Kernel into a part of RAM called "Kernel Ring Buffer". You can also find the boot log here ( all the events that take place while the system boots up ). 

Sometimes, you will come across two partition schemes - MBR and GPT

Let's have a brief look at what are they.

MBR - Master Boot Record


▶ This is an old partition scheme which supports only 26 partitions.
▶ 3 - Primary Partitions ( Actually 4 )
▶ In case you need to have more than 3 partitions,
▶ Convert one primary partition to extended partition and have 23 more logical partitions.
▶ MBR runs only with the disks that has a maximum capacity of 2 TB only.
▶ But MBR can run in systems with Legacy Boot ( Older Systems )

GPT - GUID Partition Table


▶ You can have 128 Partitions
▶ Maximum capacity of the disk is in "Exabytes" range.
▶ Using GPT requires UEFI ( Unified Extensible Firmware Interface ) instead of traditional BIOS and a 64-bit Operating System.

Hope you got a clear idea on the boot process and partition schemes. Let me know if there is any room for improvement or change.

Read More

Tuesday, July 21, 2020

Linux Series #4: Exploring the Directories



Hello everyone. While we were working on Windows we would have seen Volumes like C:, D: and so on depending on our wish. But whereas when you see Linux you will not find anything like, instead you can see several folders inside "/" root. Today we will see what all these inside the / root mean.

/bin  - Essential User Binaries


▶ All the User Binaries are present in this directory. Binaries here means compiled source code of the executable files.
▶ You can also find Important System Files/Utilities such as Bash Shell and files related to Linux Commands
▶ Ex. ps, ping, ls, grep

/boot -  Static Boot Files


▶ All the files needed to boot the system is present in this directory but you can't find the config files here.
▶ Ex. GRUB, Linux Kernel files, Static Files

/cdrom -  Historical Mount Point for CD-ROMs


 It is the temporary location for the CDROM inserted into the drive.

/dev - Device Files


▶ When you insert any device into a Linux system it considers them as a file. And these files are present in these folders. 
▶ It is also the home for all the Pseudo/Virtual Devices
▶ Ex. /sda - SATA, USB, Keyboard, etc.,

/etc - Configuration Files


▶ All the files needed for the configuration of the system are present here. Including files for the startup, shutdown, etc., These are editable files.

/home - Home Folders


▶ It is the home folder for each user. It holds all the data, saved and user config files.

/lib - Essential Shared Libraries


▶ Contains all the necessary libraries needed by the binaries.
▶ Contains Kernel modules and shared library required to boot the system and run commands.

/lost+found - Recovered Files


▶ If any files have been corrupted due to system crash or unexpected shutdown then those files are pushed out this directory from which we can recover. But nowadays in modern Linux systems, you can't find such a directory. It's a legacy feature.

/media - Removable Media


▶ This directory includes subdirectories removable media devices. 
▶ Also known as Temporary Mount Directory

/mnt - Temporary Mount Points


▶ To be short it is referred to as Mount Points for Temporary File System like Windows.

/opt - Optional Packages


▶ It includes the Sub-directories for optional software packages. These are used by the third-party or proprietary software that does not follow standard file system hierarchy. 

/proc - Kernel & Process Files


▶ This directory includes all the files of the system process information, running process, process ID.
▶ Considered as Pseudo Virtual System
▶ They are generated on the go.

/root - Root Home Directory


 This is the home directory of the "root" user.
▶ It is completely different from this root "/"

/run - Application State Files


▶ It provides a standard place for the applications to store transient files
▶ Also considered as a solution for an early-runtime-dir problem

/sbin - System Administration Binaries

 
▶ Has essential binaries that are needed to be run by the root user for system administration and maintenance purposes
▶ Ex: iptables, ifconfig, disk, swapon

/SELinux - SELinux Virtual File System


 Contains all the necessary files required by SELinux

/srv - Service Data


▶ Holds all the server-specific and server related files.
▶ Ex. Apache

/tmp - Temporary Files


▶ All the temporary files generated by the Applications are stored here and it gets deleted when the system gets restarted.
▶ Both the User and root has access to it.

/var - Variable Data Files


▶ It holds all the log, lock, spool, mail, packages and database files.


/usr - User Binaries & Read-Only Data



▶ It contains all the user binaries, documentation, libraries, header files, etc.,


Hope you got a high-level idea on these different directories.
If there's is any doubt or room for improvement please let us know.

Join the Telegram group for more stuff.
Read More

Friday, June 19, 2020

Linux Series #3: Open Source

Hello Everyone. This post is about Open Source. At the end of this post, you will get an idea of what Open Source means.


What is Open Source?


If you come across someone saying, "It's an Open Source Software", you might wonder what it means? Does it mean, the software is free? Does it mean it gives full privacy? 

If the software is Open Sourced, then it means that the source code of that particular software is available for the public. Anyone can view and modify it for their personal or other purposes. For example, when it comes to Windows you have to pay to get a genuine copy. Whereas when it comes to Linux, the genuine copy is available for free. In this case, Windows is known as Proprietary Software and Linux is said to be an Open Source Operating System.


Why Open Source? What are its benefits?


Let's say I came up with a Software called "X". Now I am Open Sourcing it.  Since the Source Code is available to all, a lot of people will start exploring the code. Here development is done Collaboratively. Many People will show interest to contribute to my software with new ideas, unlike Proprietary Softwares where only the Company or the Owner is responsible for innovative ideas. More the number of people from different background work in the project better the quality of review will be. For an Open Source Project, reviews and suggestions can be made by anyone, from anywhere. Open Source never guarantees that the software is always free. And do not confuse Open Source with Privacy issues. 


Some of the features of Open Source are,


 Collaboration
 Peer and Community Review
 Transparent
 Cheaper
 Flexibility
 Reliability
 Control
 Training
 Security
 Stability
In the field of Artificial Intelligence, Cloud Computing and Data Science, a a lot of innovations occur and most of them are derived from Open Source.

Examples of Popular Open Source Sofware are,
 Linux OS
 Ansible
 Kubernetes
 Apache
 MySQL
 PHP
 Android OS
 Firefox
When you discuss Open Source, you will come across the terms OSI  ( Open Source Initiative ) and FSF ( Free Software Foundation ) and Licenses.

 

Free Software Foundation (FSF)


Richard Stallman came up with this foundation to promote the growth of free and open-source software. During his time he saw increased usage of proprietary Softwares which denied the users their freedom to access and modify the source code. So he designed an Open Source Operating System called GNU (GNU is Not Unix). The word "free" in FSF doesn't mean that the software is available at free cost, it refers to the "freedom" of the users. FSF promoted and provided Funding for free software development. According to him, the software has to follow the below regulations to be recognised by FSF.
 Freedom to run the program for their own personal use.
 Freedom to access and examine how the program functions, and change it so that it performs as per the instructions.
 Freedom to redistribute the copies.
 Freedom to redistribute copies of your modified versions.
 One of the most popular licenses offered by FSF is the GNU General Public License v3. To see the complete list of available FSF licenses, check here.


Open Source Initiative (OSI)


OSI is a non-profit organisation, found by B.Perens and Raymond in 1998. The aim of this organisation is to spread the principles of Open Source. You can check the licenses here. Like FSF, OSI too had their own regulations.

1. Free Redistribution

The license shall not restrict any party from selling or giving away the software as a component of an aggregate software distribution containing programs from several different sources. The license shall not require a royalty or other fees for such sale.

2. Source Code

The program must include source code and must allow distribution in source code as well as compiled form. Where some form of a product is not distributed with source code, there must be a well-publicized means of obtaining the source code for no more than a reasonable reproduction cost, preferably downloading via the Internet without charge. The source code must be the preferred form in which a programmer would modify the program. Deliberately obfuscated source code is not allowed. Intermediate forms such as the output of a preprocessor or translator are not allowed.

3. Derived Works

The license must allow modifications and derived works, and must allow them to be distributed under the same terms as the license of the original software.

4. The integrity of The Author's Source Code

The license may restrict source-code from being distributed in modified form only if the license allows the distribution of "patch files" with the source code to modify the program at build time. The license must explicitly permit distribution of software built from modified source code. The license may require derived works to carry a different name or version number from the original software.

5. No Discrimination Against Persons or Groups

The license must not discriminate against any person or group of persons.

6. No Discrimination Against Fields of Endeavor

The license must not restrict anyone from making use of the program in a specific field of endeavour. For example, it may not restrict the program from being used in a business, or from being used for genetic research.

7. Distribution of License

The rights attached to the program must apply to all to whom the program is redistributed without the need for execution of an additional license by those parties.

8. License Must Not Be Specific to a Product

The rights attached to the program must not depend on the program's being part of particular software distribution. If the program is extracted from that distribution and used or distributed within the terms of the program's license, all parties to whom the program is redistributed should have the same rights as those that are granted in conjunction with the original software distribution.

9. License Must Not Restrict Other Software

The license must not place restrictions on other software that is distributed along with the licensed software. For example, the license must not insist that all other programs distributed on the same medium must be open-source software.

10. License Must Be Technology-Neutral

No provision of the license may be predicated on any individual technology or style of interface.

Source: https://opensource.org/docs/osd
Hope you got an Idea what Open Source means.
Share if you find it useful. And Comment if there is any doubts/room for improvement.

Join the telegram group for more.


Read More

Sunday, June 14, 2020

Linux Series #2: Package Managers



Hello Everyone. In the previous post, we came across the term Package Manager. In this post, we will have a peek and get to know what actually Package Managers are.

What is Package?


I will try to explain as simple as possible. Packages can generally refer to the Software/Installation file of the software. Let's say you want to install firefox in CentOS. To install it, you need to download the installation "package" first and then proceed for installation. What does a Package contain?

Source Codes    -  It consists of all the code needed for the software to function properly.
Metadata            -  Software's Name, Description, Version and Vendor Details
Checksum         -  To verify the Data Integrity
List of Dependencies - Sometimes software cannot run alone and need some more libraries to function efficiently. In that case, this list will have the details of all Library files needed by the software.


So now you will have an idea about what a Package is.

What is a Package Manager?


Package Manager is a tool that helps us to install, uninstall, update and modify the software. Before Package Manager tools arrived, people had to manually perform several steps to install the software. But now the Package Manager takes care of all the manual steps needed to perform. What it does is, 

 The user enters a command to install firefox
 Package Manager receives the command from the User                        
 It searches for Firefox package in the Software Repositories
 After finding, it downloads the package
 Installs the Package

Basic Functions of a Package Manager


 Provides CLI/GUI to manage the Packages

    - When it comes to Linux you will most probably use a CLI tool but you can also install GUI tool if you wish. 
       Ex: CLI - apt, dpkg
             GUI - Synaptic Package Manager

 Working with File Archivers to Extract the files

    - The Source file will be usually archived. So Package Manager Extract the files to install them.

 Ensuring Integrity/Authenticity using Digital Certificates and Checksums

    - It refers to the accuracy and completeness of the file. It makes sure that the data is not modified or tampered.

 Grouping Packages by function to reduce user confusion

    - It groups the package as per the functions to reduce workload and confusion for the users.

 Cascading Package Removal

    - While removing a Parent Package you need to remove its dependency packages also. This feature enables removes dependencies automatically while removing the parent package. There is no need for manual intervention.

 Batch Installation

    - Let's say you need to install a bunch of software at a time. You can't do that individually. So this feature helps us to install everything in a single go.

 Safe Upgrading

    - Softwares come in different versions. If you are going to upgrade to a newer version, with the help of safe upgrading the software will update the application but will still retain the older version packages, in case you need them.

Types of Package Managers


Low-Level Package Manager


 Low-Level package managers are good at backend handling. Meaning, they are responsible for installing and removing packages. They unpack individual packages, run the necessary scripts that help in installing the software.

High- Level Package Manager


 High-Level Package managers help in frontend handling. They download the package, search for the dependencies, deals with the group of packages, metadata searching.

Different Package Managers


The most popular package managers used in Linux are,
  rpm-based
 Debian-based
 Pacman for Arch Linux

Some of the RPM-based package managers are,
 DNF
 yum
 urpmi

Some of the Debian-based package managers are,
 aptitude
 apt-get
 dpkg

Package Managers in other Operating Systems


Windows uses OneGet, APPX and XAP 
(Chocolatey - A third party Package Manager)

MacOS uses Homebrew

Since in day to day life you will encounter different package managers and formats. so you can use "Alien" tool that can help you to convert packages like Linux Standard base, RPM, .deb, Stampede (.slp) and Slackware (.tgz) packages. 

Hope you got an Idea what Package Managers are.

Share if you find it useful. And Comment if there is any doubts/room for improvement.



Read More

Wednesday, June 10, 2020

Linux Series #1: Intro to Linux


Welcome Everyone to our new Linux from Scratch Blog Series !! Let's start with a very basic question.

Why Linux?

Right from your Smartphone, Smart TV, Servers to the Spacecraft we use for exploration has Linux in it. So it's a must for almost everyone to learn it. Turn around and have a look, I am sure you will have at least one Linux powered Machine. I hope that's enough to convince you why you need to learn Linux. To be short, 
                                                                               "Linux is Everywhere"
Is Linux Hard to Learn?

Not that hard. We will take you through a series of articles that will make your life easier. At the end of this series, you will be able to get a good command over Linux. 


Now let's taste some Linux !!!

History of Linux

The man behind such a revolutionizing Operating System is Mr Linus Torvalds. Initially, Linus was taking courses at a University under his professor Andrew S. Tenenbaum, who taught Computer Science. To make it easy to understand for his students he designed an Operating System which is a clone of Unix called Minix. Why can't they use Unix? Because Unix, at that time, was a proprietary software and not every student was able to afford it. So to ease the pain of students, Tenenbaum came up with Minix, so that students can get hands-on experience in Minix before getting into Unix. 

Inspired by his professor's work, Linus started to design his own cloned Operating System. He went on to write his own kernel code and named his Operating System after him, Linux. Adding to that, he released the source code of his OS for free, which we call, "Open-Sourced". Why for free? Because at that time, he designed Linux for hobby and never had any intention to commercialize it. He even called people to add additional features and improve his Operating System. This paved the way for Linux to revolutionize the world. As people started to contribute more and more to Linux, it got fixed up, earned new features and tools and gained the ability to run on different hardware. Don't forget that Linus, initially designed Linux for personal computers. But owing to its popularity and potential, professionals started to use it.


Linus Torvalds
Linus Torvalds

Open Source

Before getting into Linux, you should also get to know about Open Source. What is Open Source? To be simple Open Source Softwares are those whose source codes have been released for free. People can download, modify and redistribute it for free. Let's see more about Open Source in an Upcoming article in this series. Stay tuned for it.

Linux Today

Since Linux is an Open Source Operating System, anyone can download it and modify for their own benefit. Due to this, unlike Windows which has no cloned derived operating systems, Linux has a number of derived Operating Systems. To be precise, there are about 600 Linux Distributions today. That's huge, isn't?  You may wonder why these many distros are there? Each distro has its own use case and it is particularly tailored for it. Let's see what makes a distribution.

Components of a Linux Distribution


Even you can create your own Linux once you get familiar with it. You just need a Kernel, library, drivers and some utils. That's it.
You can classify the distros based on how they manage the software. You can classify them as follows,

RPM (RedHat Package Manager) based Distros
Debian based Distros  
Pacman based Distros 
Gentoo based Distros
Slackware based Distros
  Source-based Distros

These are just package managers. Package managers in simple terms are those that handle the software in an Operating System. Among these, the most popular ones are RPM and Debian. 

RPM Based Distributions

RPM packages have an extension of .rpm or .spm/.src.rpm
Some of the features of RPM-based distributions include Installing, Updating and Uninstalling Softwares. RPM packages can also be verified with GPG and MD5 hash. Based on this package manager RedHat, Slackware and Mageia are some of the popular Operating Systems. 

Popular RPM based Distros ( Distributions )

RedHat has its own commercial Operating System called RedHat Enterprise Linux ( RHEL ). And out of that Fedora and CentOS are derived and supported by RedHat. CentOS is a replica of RHEL but its not commercialized. From the source code of RedHat, Oracle came up with its own OS called Oracle Unbreakable Linux.

Another important and older distro based on RPM is Slackware. From Slackware, the Operating System SUSE came up. SUSE Linux was originally developed by Germans and later became popular in Europe. It also has an enterprise version called SUSE Enterprise Linux.

Debian Based Distributions

Debian packages have an extension of .deb or .dpkg.
Debian based Operating Systems rely on Older versions of the software which is more stable and reliable. Some of the popular Debian based Operating Systems are Ubuntu and Kali Linux. 

Popular Debian Based Distros ( Distributions )


Elementary OS and Linux Mint are some of the popular OS derived from Ubuntu.

Usage of Linux

Usage of Linux can be broadly classified into Personal Computing, Server Systems, Mobile Devices, Cloud Infrastructure and Embedded Systems.

Linux Use Cases

Server Systems

 Web Servers:        Apache and Nginx
 Email Servers:       Postfix, Dovecot
 Database Servers: MariaDB, MySQL, PostgreSQL
 Virtualization:         Xen, KVM
 Containers:            Docker, Kubernetes
 Compatibility with DOS using DOSBox, FreeDOS
 Compatibility with Windows using Samba, WINE and Steam

Mobile Devices: Let's have a look at what Android is made of.

                  Components in Android  Operating System ( OS )

Though people say Android is based on Linux, only 25% of it has modified Linux kernel, whereas the rest 75% are proprietary drivers/codes.

And when it comes to iOS, it is based on UNIX. And if you remember, Linux is derived from UNIX.

Cloud Infrastructure: About 90% of the entire cloud infrastructure is powered by Linux Machines. 

Embedded Systems: Operating Systems based on Linux Kernel is used in several Embedded systems. For example consumer electronics like Set-top box, Smart TVs, In-Vehicle Infotainment, etc.,


-----------------------------------------------------------------------------------------------------------------------------------------------------

So far we have seen a high-level view of What Linux is. So don't get confused if you don't understand certain topics. More posts dedicated to Package Managers and Open Source will be posted soon for a detailed understanding.

Hope you got an idea on Linux. See you in the next article. Take Care and Stay Safe.



Share this article if you find it useful. Comment if there is any room for improvement or if you need help.
                                                                                                     Join our Telegram group for more.

Read More

Search This Blog

Powered by Blogger.

Pages

Featured Post

Linux Series #5: Boot Up Process

  Hello everyone. In this article, I would like to share you what I learnt - "Linux Boot Up Process" #1   ▶  System is turned on #...