Linux

Get going on linux and it’s issues!

Written by Jason Graham

Introduction

Linux is a Unix like operating system designed by Linus Torvalds for PC’s with intel like CPU’s.
It’s entire source code can be downloaded, uncompressed with 7zip or tar commands, compiled and run for free. Unix is another operating system that is old and has been used for many years. Both linux and Unix are command line driven. You can operate your PC with only a single terminal console (a command entry screen) instead of having a desktop and graphics user interface like Microsoft Windows.

More Advanced Topics Here

When you get and install linux, you download files that contain a distribution. A distribution contains the packages (software) and OS kernel (OS TSR program) that runs on the computer. There are many flavors of linux you can download. Keep in mind that when you install Linux onto your PC, you need to know what you are doing and if your PC already has an OS like microsoft windows, you could potentially erase it and all your files. So that being said, backup now and tread very carefully. The Linux installer will allow you to save all windows related data and maybe even allow you to run both on your PC. Loading of linux at boot is performed and managed by bootloader. There are 2 that I know. Grub and Lilo(linux loader). These store the location of a linux kernel file “vzlinux” that has been built, as well as ability to store multiple boot configurations and list them.

Back over 18 years ago, I worked for software and hardware companies that used Unix. Even though the CPU of these workstation computers had different architecture from intel, they had similarities. 2 guys designed Unix to run on very old DEC mainframe hardware. To this day, Unix and Linux are written to be very close to the hardware of a computer and as such many aspects of them are associated with computer processors and system architecture.

Unix and Linux are written in a programming language called C. Modern C can look similar to other languages which have the same structure, like C++ and Java.


RedHat / CentOS / Fedora

CentOS is a distribution of linux that forms the base of current versions of RedHat Enterprise Server and other RedHat paid distributions. It is free to download. Go to: http://www.centos.org to get a copy of it for your PC or device.
Fedora Linux is a flavor of RedHat that is also popular with hobbyist and science minded users. It’s often customizable for the environment that you need. https://getfedora.org/

Different Distributions


Ubuntu

Ubuntu linux is a distribution that contains similar packages to CentOS linux. It has more options to install than CentOS server. For example, there are versions for graphics workstations, lite desktop version, server version, bare bones versions, etc.

Ubuntu is popular for those wanting to have a fast booting OS for virtualization. Virtual OS and Hardware are like clones or small software based versions of the real thing only run on minimal cpu specs and can be managed from a central hosting server that can control the work balance of all virtual and physical elements of a computer and it’s available OS/hardware.

Download the latest Ubuntu here

Debian / Raspbian

Debian and Raspbian are distributions of linux that differ a bit from Ubuntu and CentOS. These 2 are flavors that can be highly customized probably a bit more easier than CentOS and Ubuntu. Raspbian is a version of Debian that is built to work well with Raspberry-PI devices. Raspberry-PI’s are very small hobbyist computers that can be held in the palm of your hand. They are most often used for hardware test and design and are a dream come true for prototypes and hobbyist hardware tweakers

To download Debian or Raspbian, search for the download links in google. For better results with Raspbian, include your hardware type.

Generic Linux

When I first started downloading Linux, there were very generic versions available. Kernel.org is a repository for these still to this day. Slackware linux is one of the first versions I learned with.

FreeBSD / NetBSD

FreeBSD is a very light OS that is very similar to Unix. In fact, it’s kernel is derived from Unix. NetBSD is a Unix like OS that can be run on a number of different devices, and is minimalist.

Download freeBSD here
Download netBSD here


Installing Linux

You can install Linux to your PC. This will erase your windows or other OS if you let it so before you start, make sure you read the installer directions for your type of computer.

Single harddrive laptop
Single harddrive Desktop
Dual harddrive Desktop

If you expect you’d like to keep windows on your PC, centos installer will let you do so. This is called a dual booting PC.
Linux and windows use what is called a boot loader to separate the bootable partitions on your hard drive.

Type of PC, number of drives

Single hard-drive laptops

On single drive laptops, there is only one boot drive and bootup partition. In linux, partitions are labeled by device name. Devices are the parts inside the PC like the drives, the memory, pci bus and other components. Drives are typically denoted hda, sda etc. The meaning of the letters and numbers refers to the type of drive, it’s data bus (A bus interface is the integrated controllers way to get the data on and off the drive). The “h” would stand for IDE or Parallel ATA (PATA) drive type bus. sda would mean SATA or Serial ATA bus type drive.

In addition to the primary drive, some laptops also have a restore drive or partition. Make sure that if you see this (usually ubuntu will tell you it’s small in size) that you leave it intact and install linux to a different one.

Single Hard-drive Desktops

Desktops have similar drive installation to laptops. The only difference is that your PC may or may not have a IDE or PCI card that controls drives and CDROM drives. If you see there are more than one type of bus controller for these, it will display it in the installation. Make sure you use the correct device, either this or the motherboards controller. If you are unsure, consult your desktop PC’s manual.

Dual hard-drive Desktops and Laptops

On dual drive computers, there might be hda or sda (hda, hdb, or sda,sdb) the b at the end of the bus specifier means that it is the second device. Similar to the single drive PC’s, some dual drive systems have a restore partition. It’s best to make some notes about all storage devices in your system. Keep this restore partition safe and do not use it for installing linux to.

Partitions

Drive partitions are space on a storage device that gets allocated in a file system table or MBR that is loaded onto a computer’s drive by it’s OS, like linux or windows. Once the partition gets set, it can either be a primary, logical, extended, seconday and can be set to “boot” or “main”. Linux and it’s OS loaders use GPT to store boot and partition data.

Disc vs SSD chip

Partition types can be logical (space inside extended partitions) or physical (reside on physical cylinders in the hard disks internals. Of course, if your hardware is SSD (solid state drive chip) then it will have these as virtual not real device hardware as that is a chip and not a magnetic disc and head controller hardware.

Formatting partitions

Storage partitions can be formatted in various digital formats. Linux usually quick formats installation root partitions as ext4, swap, and NTFS (USB).

Linux formatting types are:

ext4 (fourth extended file system with improvements over ext2,ext3)
FAT32 (File Allocation Table with 32bit design)
swap (a logical volume space used when storage is full)
NTFS (Windows NT File System)


Advenced Topics – How does Linux operate and shells

Linux loader (Lilo or Grub2) loads the init program and kernel and boots using a low level program called initram-fs. Linux kernels when built typically reside in a file called “vmlinuz”. The initram program uses the boot “fs” or filesystem which can be changed on the boot line, runs the system in init “0” for rebooting, init “1” for 1st bootup, which tells the BIOS to boot the processor (load kernel and OS) in single user mode, given parameters. These parmameters and initial mode tell linux to operate the computer as a “single user” (linux and unix are multi-user environments), and load settings into memory. These settings define what hardware to check for, what drivers to load and which devices can be used by linux.

Advanced – Linux Virtualization

Linux can also reside on VM’s or Containers.
A VM is like a physcical computer only it’s hardware is emulated.
Emulation is software that is written to mimic hardware. Modern computers can very quickly load and run VM emulators inside a host (physical PC). They can be controlled by a system called a hypervisor or hyper-VT if in Intel. This is hardware in the processor and BIOS that controls the VM space of processors.

When you use VM’s on local hardware, they are considered virtual on-prem based. When you use them in AWS in the cloud, they are considered in-cloud. Platforms like Amazon, Google and Microsoft use VM images that are created from a bare-metal or physical device image. Through special saving, this image can then be virtualized to run on these platforms. A good start is KVM (Kernel Virtual Module) Vm’s. These are simple text based, and loaded into modern Linux distributions.

Shells

RedHat Server, Ubuntu, CentOS and Debian all come with advanced shells. A shell is a text interface with prompt that allows the user to set system variables, type OS commands and configure a linux system quickly.

bash

Bash shell is a command driven shell for writing, executing and exporting system variables. When you start it in multi-user mode, it can also startup programs automatically from the /init directory.
Setup bash in a file on your computer in /home/username/.bashrc
rc files are source’d on the command line to set path, variables and other settings.

csh

C-shell is a programmable shell developed for Unix but is also in Linux. You can use it like C code, to set variables, run programs and script commands that can run in the system as scripts and crontabs.

More detail into linux internals to come..

Last Updated: 4/24/ by Jason

Leave a comment

Your email address will not be published. Required fields are marked *