You are on page 1of 95

BEGINNER’S GUIDE FOR LINUX – Start Learning

Linux in Minutes
Hello Friends,

Welcome to this exclusive edition “BEGINNER’S GUIDE FOR LINUX” by


TecMint, this course module is specially designed and compiled for those
beginners, who want to make their way into Linux learning process and do the
best in today’s IT organizations. This courseware is created as per
requirements of industrial environment with complete entrance to Linux, which
will help you to build a great success in Linux.
We have given special priority to Linux commands and switches, scripting,
services and applications, access control, process control, user management,
database management, web services, etc. Even though Linux command-line
provides thousands of commands, but only a few of basic commands you
need to learn to perform a day-to-day Linux tasks.

Prerequisites:
All students must have a little understanding of computers and passion to
learn new technology.

Distributions:
This courseware is presently supported on the latest releases of Linux
distributions like Red Hat Enterprise Linux, CentOS, Debian, Ubuntu, etc.

Course Objectives
Section 1: Introduction To Linux and OS Installations
 Linux Boot Process
 Linux File System Hierarchy
 Installation of CentOS 7
 Installation of Various Linux Distributions including Debian, RHEL, Ubuntu,
Fedora, etc
 Installation of CentOS on VirtualBox
 Dual Boot Installation of Windows and Linux
Section 2: Essentials of Basic Linux Commands
 List Files and Directories Using ‘ls’ Command
 Switch Between Linux Directories and Paths with ‘cd’ Command
 How to Use ‘dir’ Command with Different Options in Linux
 Find Out Present Working Directory Using ‘pwd’ Command
 Create Files using ‘touch’ Command
 Copy Files and Directories using ‘cp’ Command
 View File Content with ‘cat’ Command
 Check File System Disk Space Usage with ‘df’ Command
 Check Files and Directories Disk Usage with ‘du’ Command
 Find Files and Directories using find Command
 Find File Pattern Searches using grep Command
Section 3: Essentials of Advance Linux Commands
 Quirky ‘ls’ Commands Every Linux User Must Know
 Manage Files Effectively using head, tail and cat Commands in Linux
 Count Number of Lines, Words, Characters in File using ‘wc’ Command
 Basic ‘sort’ Commands to Sort Files in Linux
 Advance ‘sort’ Commands to Sort Files in Linux
 Pydf an Alternative “df” Command to Check Disk Usage
 Check Linux Ram Usage with ‘free’ Command
 Advance ‘rename’ Command to Rename Files and Directories
 Print Text/String in Terminal using ‘echo’ Command
Section 4: Some More Advance Linux Commands
 Switching From Windows to Nix – 20 Useful Commands for Newbies – Part 1
 20 Advanced Commands for Middle Level Linux Users – Part 2
 20 Advanced Commands for Linux Experts – Part 3
 20 Funny Commands of Linux or Linux is Fun in Terminal – Part 1
 6 Interesting Funny Commands of Linux (Fun in Terminal) – Part 2
 51 Useful Lesser Known Commands for Linux Users
 10 Most Dangerous Commands – You Should Never Execute on Linux
Section 5: User, Group and File Permissions
Management
 How to Add or Create New Users using ‘useradd’ Command
 How to Modify or Change Users Attributes using ‘usermod’ Command
 Managing Users & Groups, File Permissions & Attributes – Advance Level
 Difference Between su and sudo – How to Configure sudo – Advance Level
 How to Monitor User Activity with psacct or acct Tools
Section 6: Linux Package Management
 Yum Package Management – CentOS, RHEL and Fedora
 RPM Package Management – CentOS, RHEL and Fedora
 APT-GET and APT-CACHE Package Management – Debian, Ubuntu
 DPKG Package Management – Debian, Ubuntu
 Zypper Package Management – Suse and OpenSuse
 Linux Package Management with Yum, RPM, Apt, Dpkg, Aptitude and Zypper –
Advance Level
 27 ‘DNF’ (Fork of Yum) Commands for RPM Package Management – New Update
Section 7: System Monitoring & Cron Scheduling
 Linux Process Monitoring with top Command
 Linux Process Management with Kill, Pkill and Killall Commands
 Linux File Process Management with lsof Commands
 Linux Job Scheduling with Cron
 20 Command Line Tools to Monitor Linux Performance – Part 1
 13 Linux Performance Monitoring Tools – Part 2
 Nagios Monitoring Tool for Linux – Advance Level
 Zabbix Monitoring Tool for Linux – Advance Level
 Shell Script to Monitor Network, Disk Usage, Uptime, Load Average and RAM –
New Update

Section 8: Linux Archiving/Compression, Backup/Sync


and Recovery
Archiving/Compression Files
 How to Archive/Compress Linux Files and Directories using ‘tar’ Command
 How to Open, Extract and Create RAR Files in Linux
 5 Tools to Archive/Compress Files in Linux
 How to Archive/Compress Files and Setting File Attributes – Advance Level
Backup/Sync Files and Directories in Linux
 How to Copy/Synchronize Files and Directories Locally/Remotely with rsync
 How to Transfer Files/Folders in Linux using scp
 Rsnapshot (Rsync Based) – A Local/Remote File System Backup Tool
 Sync Two Apache Web Servers/Websites Using Rsync – Advance Level
Backup/Recovery Linux Filesystems
 Backup and Restore Linux Systems using Redo Backup Tool
 How to Clone/Backup Linux Systems Using – Mondo Rescue Disaster Recovery
Tool
 How to Recover Deleted Files/Folders using ‘Scalpel’ Tool
 8 “Disk Cloning/Backup” Softwares for Linux Servers
Section 9: Linux File System / Network Storage
Management
 What is Ext2, Ext3 & Ext4 and How to Create and Convert Linux File Systems
 Understanding Linux File System Types
 Linux File System Creation and Configurations – Advance Level
 Setting Up Standard Linux File Systems and Configuring NFSv4 Server – Advance
Level
 How to Mount/Unmount Local and Network (Samba & NFS) Filesystems –
Advance Level
 How to Create and Manage Btrfs File System in Linux – Advance Level
 Introduction to GlusterFS (File System) and Installation – Advance Level
Section 10: Linux LVM Management
 Setup Flexible Disk Storage with Logical Volume Management
 How to Extend/Reduce LVM’s (Logical Volume Management)
 How to Take Snapshot/Restore LVM’s
 Setup Thin Provisioning Volumes in LVM
 Manage Multiple LVM Disks using Striping I/O
 Migrating LVM Partitions to New Logical Volume
Section 11: Linux RAID Management
 Introduction to RAID, Concepts of RAID and RAID Levels
 Creating Software RAID0 (Stripe) on ‘Two Devices’ Using ‘mdadm
 Setting up RAID 1 (Mirroring) using ‘Two Disks’ in Linux
 Creating RAID 5 (Striping with Distributed Parity) in Linux
 Setup RAID Level 6 (Striping with Double Distributed Parity) in Linux
 Setting Up RAID 10 or 1+0 (Nested) in Linux
 Growing an Existing RAID Array and Removing Failed Disks in Linux
 Assembling Partitions as RAID Devices – Creating & Managing System Backups
Section 12: Manage Services in Linux
 Configure Linux Services to Start and Stop Automatically
 How to Stop and Disable Unwanted Services in Linux
 How to Manage ‘Systemd’ Services Using Systemctl in Linux
 Managing System Startup Process and Services in Linux
Section 13: Linux System Security and Firewall
Linux Security and Tools
 25 Hardening Security Tips for Linux Servers
 5 Best Practices to Secure and Protect SSH Server
 How to Password Protect Grub in Linux
 Protect SSH Logins with SSH & MOTD Banner Messages
 How to Audit Linux Systems using Lynis Tool
 Secure Files/Directories using ACLs (Access Control Lists) in Linux
 How to Audit Network Performance, Security, and Troubleshooting in Linux
 Mandatory Access Control Essentials with SELinux – New Update
Linux Firewall and Tools
 Basic Guide on IPTables (Linux Firewall) Tips / Commands
 How To Setup an Iptables Firewall in Linux
 How to Configure ‘FirewallD’ in Linux
 Useful ‘FirewallD’ Rules to Configure and Manage Firewall in Linux
 How to Install and Configure UFW – An Un-complicated FireWall
 Shorewall – A High-Level Firewall for Configuring Linux Servers
 Install ConfigServer Security & Firewall (CSF) in Linux
 How to Install ‘IPFire’ Free Firewall Linux Distribution
 How to Install and Configure pfSense 2.1.5 (Firewall/Router) in Linux
 10 Useful Open Source Security Firewalls for Linux Systems
Section 14: LAMP (Linux, Apache, MySQL/MariaDB
and PHP) Setup’s
 Installing LAMP in RHEL/CentOS 6.0
 Installing LAMP in RHEL/CentOS 7.0
 Ubuntu 14.04 Server Installation Guide and Setup LAMP
 Installing LAMP in Arch Linux
 Setting Up LAMP in Ubuntu Server 14.10
 Installing LAMP in Gentoo Linux
 Creating Your Own Webserver and Hosting A Website from Your Linux Box
 Apache Virtual Hosting: IP Based and Name Based Virtual Hosts in Linux
 How to Setup Standalone Apache Server with Name-Based Virtual Hosting with
SSL Certificate
 Creating Apache Virtual Hosts with Enable/Disable Vhosts Options in
RHEL/CentOS 7.0
 Creating Virtual Hosts, Generate SSL Certificates & Keys and Enable CGI
Gateway in Gentoo Linux
 Protect Apache Against Brute Force or DDoS Attacks Using Mod_Security and
Mod_evasive Modules
 13 Apache Web Server Security and Hardening Tips
 How to Sync Two Apache Web Servers/Websites Using Rsync
 How to Install ‘Varnish’ (HTTP Accelerator) and Perform Load Testing Using
Apache Benchmark
 Installing and Configuring LAMP/LEMP Stack on Debian 8 Jessie – New Update
Section 15: LEMP (Linux, Nginx, MySQL/MariaDB and
PHP) Setup’s
 Install LEMP in Linux
 Installing FcgiWrap and Enabling Perl, Ruby and Bash Dynamic Languages on
Gentoo LEMP
 Installing LEMP in Gentoo Linux
 Installing LEMP in Arch Linux
Section 16: MySQL/MariaDB Administration
 MySQL Basic Database Administration Commands
 20 MySQL (Mysqladmin) Commands for Database Administration in Linux
 MySQL Backup and Restore Commands for Database Administration
 How to Setup MySQL (Master-Slave) Replication
 Mytop (MySQL Database Monitoring) in Linux
 Install Mtop (MySQL Database Server Monitoring) in Linux
 https://www.tecmint.com/mysql-performance-monitoring/
Section 17: Basic Shell Scripting
 Understand Linux Shell and Basic Shell Scripting Language Tips – Part I
 5 Shell Scripts for Linux Newbies to Learn Shell Programming – Part II
 Sailing Through The World of Linux BASH Scripting – Part III
 Mathematical Aspect of Linux Shell Programming – Part IV
 Calculating Mathematical Expressions in Shell Scripting Language – Part V
 Understanding and Writing functions in Shell Scripts – Part VI
 Deeper into Function Complexities with Shell Scripting – Part VII
 Working with Arrays in Linux Shell Scripting – Part 8
 An Insight of Linux “Variables” in Shell Scripting Language – Part 9
 Understanding and Writing ‘Linux Variables’ in Shell Scripting – Part 10
 Nested Variable Substitution and Predefined BASH Variables in Linux – Part 11
Section 18: Linux Interview Questions
 15 Interview Questions on Linux “ls” Command – Part 1
 10 Useful ‘ls’ Command Interview Questions – Part 2
 Basic Linux Interview Questions and Answers – Part 1
 Basic Linux Interview Questions and Answers – Part 2
 Linux Interview Questions and Answers for Linux Beginners – Part 3
 Core Linux Interview Questions and Answers
 Useful Random Linux Interview Questions and Answers
 Interview Questions and Answers on Various Commands in Linux
 Useful Interview Questions on Linux Services and Daemons
 Basic MySQL Interview Questions for Database Administrators
 MySQL Database Interview Questions for Beginners and Intermediates
 Advance MySQL Database “Interview Questions and Answers” for Linux Users
 Apache Interview Questions for Beginners and Intermediates
 VsFTP Interview Questions and Answers – Part 1
 Advance VsFTP Interview Questions and Answers – Part 2
 Useful SSH (Secure Shell) Interview Questions and Answers
 Useful “Squid Proxy Server” Interview Questions and Answers in Linux
 Linux Firewall Iptables Interview Questions – New Update
 Basic Interview Questions on Linux Networking – Part 1 – New Update
Section 19: Shell Scripting Interview Questions
 Useful ‘Interview Questions and Answers’ on Linux Shell Scripting
 Practical Interview Questions and Answers on Linux Shell Scripting
Section 20: Free Linux Books for Learning
 Complete Linux Command Line Cheat Sheet
 The GNU/Linux Advanced Administration Guide
 Securing & Optimizing Linux Servers
 Linux Patch Management: Keeping Linux Up To Date
 Introduction to Linux – A Hands on Guide
 Understanding the Linux® Virtual Memory Manager
 Linux Bible – Packed with Updates and Exercises
 A Newbie’s Getting Started Guide to Linux
 Linux from Scratch – Create Your Own Linux OS
 Linux Shell Scripting Cookbook, Second Edition
 Securing & Optimizing Linux: The Hacking Solution
 User Mode Linux – Understanding and Administration
 Bash Guide for Linux Beginners – New Update
Section 21: Linux Certifications – Prepration Guides
 RHCSA (Red Hat Certified System Administrator) Certification Guide
 LFCS (Linux Foundation Certified Sysadmin) Certification Guide
 LFCE (Linux Foundation Certified Engineer) Certification Guide
Do let us know if you want to include any specific Linux howto’s, guides or tips
into this Linux learning guide. Don’t forget to join our social communities
and subscribe to our Email newsletter for more such howto’s
Section 1: Introduction To Linux and OS
Installations
Sec1.1. A Basic Guide to Linux Boot
Process
As promised in our earlier post, in this post we are going to review boot
process in Linux Operating System. How Operating system passes through
different stage of booting states. This article is written for those readers who
has just steps in Linux world. Understanding how Linux boots up is very
important in terms of effectively troubleshooting in case of system failure.
When a system switched on and after few moment we get a login prompt.
Have we try to find out what all stage of booting sequence has crossed and
what happened behind the scene during system boots up.
Linux Boot Loader Process

Power on
 BIOS (Basic Input Output System) is a software program comes pre-built in a
motherboard chipset.
 BIOS loads and scans for devices such as Hard Disk, CD-ROM, RAM, etc.
 BIOS searches for MBR (Master Boot Record: 1st sector) of the primary hard
drive, it scans for 1st stage loader (In our case boot loader is (GRUB LILO) and
hands over the responsibility to MBR.
 Boot PROM/FLASH/BIOS is proficient of loading the MBR into RAM and
executing it.
MBR (Master Boot Record)
 512 bytes of space –> MBR
 MBR contains the information of loader of most operating system
e.g UNIX, Linux and WINDOWS
 MBR holds the small binary information of 1st stage of loader
 MBR consist physical sector of the first disk drive (i.e 512 bytes) and it’s not part
of any partition.
 Placed on the prime disk drive, in the prime sector of the first cylinder of track is
0 and head is 0 (this whole path is generally booked for boot programs)
 MBR involve a mini executable programs and a table specify the primary
partitions.

Boot Code (GRUB) 446 bytes

partition 1: 16 bytes

partition 2: 16 bytes

partition 3: 16 bytes

partition 4: 16 bytes

magic Number: 2 bytes

 MBR also document which primary partition is ACTIVE.


 The BIOS surrender rights to the first stage boot loader, which then scans
partition table and finds second stage boot loader on the partition configured as
bootable.
Boot Loader
 The boot loader termed from 1st stage loader and loads itself into RAM. All this
go on in milliseconds.
 The default stage 2 boot loader is a GRUB (Grand Unified Boot Loader)
or LILO (Linux Loader)
 Once GRUB is loaded into RAM, then it’s search for the location of Kernel.
 GRUB will scrutinize the map file to find the kernel image, that is located under
(/boot) and load it.
 GRUB loads the kernel (vmlinuz-version) from /boot partition
Trivia 1
GRUB organize RAMDISK for initrd —> (RAMDISK is reserved space
from RAM). In addition, it drives initrd into RAM to ready the kernel for loading
itself into memory and depended modules so that it can leave the system to
“init” process
In, Linux most of the drivers are pre-built as modules, these would be initial
ram drive (initrd.img) where it can keep all the information of additional
modules. So, when the kernel boots, it creates ramdrive, loads
the initrd.img and its depended modules.
GRUB reads /boot/grub/grub.conf & shows us a clean interface for selecting
Operating System
Once Kernel loads its depended modules and then it hand over to “init”
process. The kernel image has a small, unpacked program that un-
compresses kernel and runs it.
Trivia 2
LILO needed to indicate MBR in order to locate operating systems on the
hard drive. Any modifications done to /etc/lilo.conf, that must be updated
in MBR, but in GRUB‘s case no need to update, it reads directly from the
file /boot/grub/grub.conf.
After making changes in /etc/lilo.conf, we’ll have to update the MBR manually

# /sbin/lilo -v
Trivia 3
The GRUB second stage loader resides within the MBR and
within /boot partition. Once GRUB is loaded into memory it becomes 2nd stage
loader.
Trivia 4
The /initrd directory should not be removed it is a temporary place holder for
kernel to have quick access to the modules that it needs to start the system
modules include device drivers.
Kernel initialization highlights include:
 initialize CPU components, eg, MMU
 initialize the scheduler (PID 0)
 mount the root filesystem in rw mode
 fork off the init process (PID 1)
In essence, kernel initialization does two things:

 Start the core system of shared resource managers (RAM, processor and mass
storage).
 Starts a single process, /sbin/init.
Init process (sbin/init) is the very fist process which loads all the various
daemons and mounts all the partitions which are listed under /etc/fstab.
About /etc/fstab
 The /sbin/init reads /etc/inittab file
 Set default runlevel ( the telinit command allows administrators to tell
the init process to change its current runlevel)
 Calls /etc/rc.d/rc.sysinit and /etc/rc.d/rc x (where ‘x‘ is a runlevel)
 In /etc/rc.d/rc5.d directory files starting with letter K –> kill scripts and files
starting with letter S –> Startup scripts.
 Start up the tty processes and xdm ( X display manager)
 Starts User’s login screen

Sec1.2. Linux Directory Structure and


Important Files Paths Explained
For any person, who does not have a sound knowledge of Linux Operating
System and Linux File System, dealing with the files and their location, their use
may be horrible, and a newbie may really mess up.
This article is aimed to provide the information about Linux File System, some
of the important files, their usability and location.
Linux Directory Structure Diagram
A standard Linux distribution follows the directory structure as provided below
with Diagram and explanation.

Linux Directory Structure


Each of the above directory (which is a file, at the first place) contains
important information, required for booting to device drivers, configuration
files, etc. Describing briefly the purpose of each directory, we are starting
hierarchically.

 /bin : All the executable binary programs (file) required during booting, repairing,
files required to run into single-user-mode, and other important, basic
commands viz., cat, du, df, tar, rpm, wc, history, etc.
 /boot : Holds important files during boot-up process, including Linux Kernel.
 /dev : Contains device files for all the hardware devices on the machine
e.g., cdrom, cpu, etc
 /etc : Contains Application’s configuration
files, startup, shutdown, start, stop script for every individual program.
 /home : Home directory of the users. Every time a new user is created, a directory
in the name of user is created within home directory which contains other
directories like Desktop, Downloads, Documents, etc.
 /lib : The Lib directory contains kernel modules and shared library images
required to boot the system and run commands in root file system.
 /lost+found : This Directory is installed during installation of Linux, useful for
recovering files which may be broken due to unexpected shut-down.
 /media : Temporary mount directory is created for removable devices
viz., media/cdrom.
 /mnt : Temporary mount directory for mounting file system.
 /opt : Optional is abbreviated as opt. Contains third party application software.
Viz., Java, etc.
 /proc : A virtual and pseudo file-system which contains information about running
process with a particular Process-id aka pid.
 /root : This is the home directory of root user and should never be confused
with ‘/‘
 /run : This directory is the only clean solution for early-runtime-dir problem.
 /sbin : Contains binary executable programs, required by System Administrator,
for Maintenance. Viz., iptables, fdisk, ifconfig, swapon, reboot, etc.
 /srv : Service is abbreviated as ‘srv‘. This directory contains server specific and
service related files.
 /sys : Modern Linux distributions include a /sys directory as a virtual filesystem,
which stores and allows modification of the devices connected to the system.
 /tmp :System’s Temporary Directory, Accessible by users and root. Stores
temporary files for user and system, till next boot.
 /usr : Contains executable binaries, documentation, source code, libraries for
second level program.
 /var : Stands for variable. The contents of this file is expected to grow. This
directory contains log, lock, spool, mail and temp files.
Exploring Important file, their location and their
Usability
Linux is a complex system which requires a more complex and efficient way
to start, stop, maintain and reboota system unlike Windows. There is a well
defined configuration files, binaries, man pages, info files, etc. for
every process in Linux.
 /boot/vmlinuz : The Linux Kernel file.
 /dev/hda : Device file for the first IDE HDD (Hard Disk Drive)
 /dev/hdc : Device file for the IDE Cdrom, commonly
 /dev/null : A pseudo device, that don’t exist. Sometime garbage output is
redirected to /dev/null, so that it gets lost, forever.
 /etc/bashrc : Contains system defaults and aliases used by bash shell.
 /etc/crontab : A shell script to run specified commands on a predefined time
Interval.
 /etc/exports : Information of the file system available on network.
 /etc/fstab : Information of Disk Drive and their mount point.
 /etc/group : Information of Security Group.
 /etc/grub.conf : grub bootloader configuration file.
 /etc/init.d : Service startup Script.
 /etc/lilo.conf : lilo bootloader configuration file.
 /etc/hosts : Information of Ip addresses and corresponding host names.
 /etc/hosts.allow : List of hosts allowed to access services on the local machine.
 /etc/host.deny : List of hosts denied to access services on the local machine.
 /etc/inittab : INIT process and their interaction at various run level.
 /etc/issue : Allows to edit the pre-login message.
 /etc/modules.conf : Configuration files for system modules.
 /etc/motd : motd stands for Message Of The Day, The Message users gets upon
login.
 /etc/mtab : Currently mounted blocks information.
 /etc/passwd : Contains password of system users in a shadow file, a security
implementation.
 /etc/printcap : Printer Information
 /etc/profile : Bash shell defaults
 /etc/profile.d : Application script, executed after login.
 /etc/rc.d : Information about run level specific script.
 /etc/rc.d/init.d : Run Level Initialisation Script.
 /etc/resolv.conf : Domain Name Servers (DNS) being used by System.
 /etc/securetty : Terminal List, where root login is possible.
 /etc/skel : Script that populates new user home directory.
 /etc/termcap : An ASCII file that defines the behaviour
of Terminal, console and printers.
 /etc/X11 : Configuration files of X-window System.
 /usr/bin : Normal user executable commands.
 /usr/bin/X11 : Binaries of X windows System.
 /usr/include : Contains include files used by ‘c‘ program.
 /usr/share : Shared directories of man files, info files, etc.
 /usr/lib : Library files which are required during program compilation.
 /usr/sbin : Commands for Super User, for System Administration.
 /proc/cpuinfo : CPU Information
 /proc/filesystems : File-system Information being used currently.
 /proc/interrupts : Information about the current interrupts being utilised currently.
 /proc/ioports : Contains all the Input/Output addresses used by devices on the
server.
 /proc/meminfo : Memory Usages Information.
 /proc/modules : Currently using kernel module.
 /proc/mount : Mounted File-system Information.
 /proc/stat : Detailed Statistics of the current System.
 /proc/swaps : Swap File Information.
 /version : Linux Version Information.
 /var/log/lastlog : log of last boot process.
 /var/log/messages : log of messages produced by syslog daemon at boot.
 /var/log/wtmp : list login time and duration of each user on the system currently.
That’s all for now. Keep connected to Tecmint for any News and post related
to Linux and Foss world. Stay healthy and Don’t forget to give your value-able
comments in comment section.

Sec 1.3 Installation of “CentOS 7.0″


with Screenshots
This tutorial will guide you on how to perform a minimal installation of latest
version of CentOS 7.0, using the binary DVD ISO image, an installation that is
best suitable for developing a future customizable server platform, with no
Graphical User Interface, where you can install only the software that you
need.
Installation of CentOS 7
If you want to find out more about what’s new in this release of CentOS
7.0 holds and download links, I suggest reading the previous article on release
announcements:
 CentOS 7.0 Features and Download ISO Images

Requirements
 CentOS 7.0 DVD ISO
CentOS 7.0 Installation Process
1. After downloading the last version of CentOS using above links or using
official CentOS download page. Burn it to a DVD or create a bootable USB stick
using LiveUSB Creator called Unetbootin.
2. After you have created the installer bootable media, place your DVD/USB
into your system appropriate drive, start the computer, select your bootable
unit and the first CentOS 7 prompt should appear. At the prompt choose Install
CentOS 7 and press [Enter] key.
CentOS 7 Boot Menu
3. The system will start loading media installer and a Welcome screen should
appear. Select your Installation Process Language, that will assist you through
the entire installation procedure and click on Continue.
CentOS Installer Loading
Select Installation Process Language
4. The next step, present screen prompt is Installation Summary. It contains a
lot of options to fully customize your system. First thing you may want to setup
is your time settings. Click on Date & Time and select your server physical
location from the provided map and hit on upper Done button to apply
configuration.
Select Date & Time and Location
5. The next step is to choose your Language Support and Keyboard settings.
Choose your main and extra language for your system and when you’re
finished hit on Done button.
Select Language and Keyboard
Select English Language
6. The same way choose your Keyboard Layout by hitting the plus button and
test your keyboard configuration using the right input filed. After you finish
setting up your keyboard, again hit on upper Done button to apply changes
and go back to main screen on Installation Summary.
Choose Keyboard Layout
Choose English Keyboard
7. On the next step you can customize your installation by using
other Installation Sources than your local DVD/USB media, such as a network
locations using HTTP, HTTPS, FTP or NFS protocols and even add some
additional repositories, but use this methods only if you know what you’re
doing. So leave the default Auto-detected installation media and hit on Done to
continue.
Choose Installation Sources
Auto Detect Installation Type
8. On the next step you can choose your system installation software. On this
step CentOS offers a lot of Server and Desktop platform environments that
you choose from, but, if you want a high degree of customization, especially if
you are going to use CentOS 7 to run as a server platform, then I suggest you
select Minimal Installwith Compatibility Libraries as Add-ons, which will install a
minimal basic system software and later you can add other packages as your
needs require using yum groupinstall command.
Software Selection
Select CentOS 7 Minimal Install
9. Now it’s time to partition your hard-drive. Click on Installation
Destination menu, select your disk and choose I will configure partitioning.
Choose Installation Destination
Installation Device Selection
10. On the next screen, choose LVM (Logical Volume Manager) as partition
layout and, then, click on Click here to create them automatically, option which
will create three system partition using XFS filesystem, automatically
redistributing your hard-disk space and gathering all LVS into one big Volume
Group named centos.
 /boot – Non LVM
 /(root) – LVM
 Swap – LVM
Select LVM Partition Type
Create Partitions
11. If you are not pleased with the default partition layout done automatically
by the installer you can completely add, modify or resize your partition scheme
and when you finish hit on Done button and Accept Changes on the Summary of
Changes prompt.
Summary of Partition Changes
NOTE: For those users, who have hard-disks more than 2TB in size, the
installer automatically will convert partition table to GPT, but if you wish to use
GPT table on smaller disks than 2TB, then you should use the
argument inst.gpt to the installer boot command line in order to change the
default behaviour.
12. The next step is to set your system hostname and enable networking.
Click on Network & Hostname label and type your system FQDN (Fully
Qualified Domain Name) on Hostname filed, then enable your Network
interface, switching the top Ethernet button to ON.
If you have a functional DHCP server on you network then it will automatically
configure all your network setting for enabled NIC, which should appear under
your active interface.
Set System Hostname
Enable Ethernet Interface
13. If your system will be destined as a server it’s better to set static network
configuration on Ethernet NIC by clicking on Configure button and add all your
static interface settings like in the screenshot below, and when you’re finished
hit on Save button, disable and enable Ethernet card by switching the button
to OFF and ON, and, then hit on Done to apply setting and go back to main
menu.
Enter Network Settings
14. Now it’s time to start installation process by pressing on Begin
Installation button and set up a strong password for root account.
Click on Begin Installation
Select Root Password
Enter Root Password
15. After you finish setting up a strong password for root account move to User
Creation and create your first system user. You can designate this user to
become a System Admin with root privileges using sudo command by
checking the box Make this user administrator, then click on Done to go back on
main menu and wait for the installation process to finish.
CentOS 7 Installation Process
User Creation and Set Password
16. After the installation process finishes, the installer will show a successfully
message on screen, demanding to reboot your system in order to use it.
CentOS 7 Installation Complete
Congratulation! You have now installed last version of CentOS on your bare
new machine. Remove any installation media and reboot your computer so
you can login to your new minimal CentOS 7 environment and perform other
system tasks, such as update you system and install other useful software
needed to run day to day tasks

Sec1.4 (Skip)
Sec1.5
VirtualBox 5.1 Released – Install on
RHEL/CentOS/Fedora and
Debian/Ubuntu/Linux Mint
VirtualBox is an open source cross-platform virtualization software, it can be
installed on any operating system and enable you to install and run multiple
guest operating systems on same computer. For example, if you install it on
your Linux system, you can run Windows XP operating system under it as
a Guest OS or run Linux OS on your Windows system and so on. This way, you
can install and run as many as guest operating systems as you like, the only
limit is disk space and memory.

Install VirtualBox 5.1 in Linux


Recently Oracle has released latest stable version of Virtualbox 5.1.0, the
newest version of Virtual box comes with so many major changes and new
features added to it.
Whats new in Virtualbox 5.1
1. Paravirtualization Support for Linux and Windows Guests: Significantly
improves performance of Linux guest operating systems by leveraging built-in
virtualization support.
2. Improved CPU Utilization: A set of CPU instructions to the guest OS, allowing
application to use newest hardware instructions sets for better performance.
3. Support of USB 3.0 Devices: Guest OS now supports USB 3.0 and can operate at
maximum 3.0 speeds, also guest OS can be configured for USB 1.1, 2.0, and 3.0
support.
4. Bi-Directional Drag and Drop Support: Guests can now support “drag and drop”
(copying or opening files or directories) of content between host and guests on all
host platforms.
5. Disk Image Encryption: During run-time, Data can be transparently encrypted on
virtual hard disk images with the support of 256 bit data encryption keys.
You can see the complete new change log details about VirtualBox 5.1 on
their Official Changelog Page.
This guide explains how to install VirtualBox 5.1 on RHEL 7/6/5, CentOS
7/6/5 and Fedora 24-12 systems using VirtualBox’s own repository
with YUM and DNF (for Fedora 23+ releases) tool.
This guide also explains how to install VirtualBox 5.1 on Debian 9/8/7/6, Ubuntu
16.04/15.10/15.04/14.10/14.04 and Linux Mint 18/17/16/15 systems
using VirtualBox’s own repository with APT-GET command.
Installing VirtualBox 5.1 in RHEL/CentOS and
Fedora
If you’ve any earlier version of Virtualbox installed, remove that before
installing latest version.

# yum remove VirtualBox-4*

Adding VirtualBox Repository


Next add the VirtualBox own repository to install latest VirtualBox 5.1 on
following systems.
For RHEL/CentOS 7/6/5

# cd /etc/yum.repos.d/

# wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo

For RHEL/CentOS 5

# wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-
4.noarch.rpm
# rpm -Uvh epel-release-5-4.noarch.rpm

For Fedora 24-12

# cd /etc/yum.repos.d/

# wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo

Install Dependency Packages for VirtualBox


VirtualBox uses vboxdrv kernel module to control and allocate physical
memory for execution of guest operating systems. Without this module, you
can still use the VirtualBox to create and configure virtual machines, but they
will not work. So, to make VirtualBox fully functional you will need to update
your system first, then install some additional modules like DKMS, kernel-
headers and kernel-devel and some dependency packages.

# yum update

# yum install binutils qt gcc make patch libgomp glibc-headers glibc-devel


kernel-headers kernel-devel dkms

Install VirtualBox 5.1


Once you’ve installed all the needed dependency packages, you can install
latest version of VirtualBox using following command.

# yum install VirtualBox-5.1


Rebuild Kernel Modules for VirtualBox 5.1
The below command will automatically create vboxusers group and user and
also search and automatically rebuild required kernel modules. If the below
build process fails, you will get a warning messages. Please have a look at
/var/log/vbox-install.log to trace why the build process failed.
------------- Fedora 24-19 and CentOS/RHEL 7 -------------
/usr/lib/virtualbox/vboxdrv.sh setup
------------- Fedora 18-16 and CentOS/RHEL 6/5 -------------
/etc/init.d/vboxdrv setup
## OR ##
service vboxdrv setup

Next, replace user_name in the following command with your own user name.

# usermod -a -G vboxusers user_name

Troubleshooting
If you get any error message like KERN_DIR or if your kernel source directory
not detected automatically by build process, you can set it by using following
command. Make sure you change kernel version according to your system as
shown in red color.

## RHEL / CentOS / Fedora ##

KERN_DIR=/usr/src/kernels/3.10.0-229.7.2.el7.x86_64
## Export KERN_DIR ##
export KERN_DIR

Installing VirtualBox 5.1 in Debian, Ubuntu and


Linux Mint
First, uninstall any earlier version of Virtualbox if any.

$ sudo apt-get remove virtualbox-4*


Next, install latest 5.1 version using official Virtualbox repository. To add the
repository, use the following command as shown.

$ sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian


$(lsb_release -cs) contrib" >> /etc/apt/sources.list.d/virtualbox.list'

$ wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-


key add -

$ sudo apt-get update

$ sudo apt-get install virtualbox-5.1

Starting VirtualBox 5.1


Simply execute following command to start it from the terminal or use
launcher from menu to start.

# VirtualBox
VirtualBox Screenshots on CentOS 7

VirtualBox 5.0 on CentOS 7


Create New Guest OS
Guest OS Settings
VirtualBox Screenshots on Linux Mint 17

Virtualbox 4.3 Preview

Virtualbox Video Capture Support


Virtualbox 4.3 Running VM’s

Installing VirtualBox Extension Pack


If you need some additional functionality such as VirtualBox RDP, PXE, ROM
with E1000 support and USB 2.0 Host Controller support, etc. You need to
download and install the VirtualBox Extension Pack using
following wget command.

# wget
http://download.virtualbox.org/virtualbox/5.1.0/Oracle_VM_VirtualBox_Extensio
n_Pack-5.1.0.vbox-extpack

To install the extension pack, you must have Virtualbox 5.1 installed, once you
downloaded vbox-extpack open with Virtualbox as shown below. If it doesn’t
work out, then open Virtaulbox –> Preferences –> Extensions and browse for
the vbox-extpack to install it.
Install VirtualBox Extension Pack

VirtualBox Extension Pack


Updating VirtualBox
If you want to update the VirtualBox with latest version in the future, you can
simply run the following command to update it.
On RHEL/CentOS/Fedora

# yum update VirtualBox-5.1

On Ubuntu/Linux Mint

# apt-get install VirtualBox-5.1

Remove VirtualBox
If in case you want to remove VirtualBox completely, just use the following
command to remove it completely from your system.
On RHEL/CentOS/Fedora

# cd /etc/yum.repos.d/

# rm -rf virtualbox.repo

# yum remove VirtualBox-5.1

On Ubuntu/Linux Mint

# apt-get remove VirtualBox-5.1

You can also Download VirtualBox 5.1 for other Linux, Windows and Mac OS
X platforms.
Sec1.6 Installing CentOS 7.1 Dual
Boot With Windows 8.1 on UEFI
Firmware Systems
This tutorial discusses the installation of CentOS 7.1 in dual-boot with Windows
8.1 on UEFI Firmwaremachines that comes pre-installed with Windows
Operating System.
However, if your machine has no Operating System installed by default and
you still want to use the dual-boot, Windows alongside CentOS, it’s
recommended that you first install Windows OS, create the necessary
partitions during the Windows installation process and, then, install CentOS or
any other Linux Operating System.

Prerequisites
One important thing needed to be mentioned is that in order to install a Linux
system on machines that comes with UEFI firmware you must
enter UEFI settings and disable the Secure Boot option (if your system supports
this option, although it has been reported that CentOS can boot with Secure
Boot enabled).
Also, be aware that booting your machine on UEFI mode and installing an
Operating System in this mode implies that all your disks will be formatted
in GPT partition layout (MBR partition style can be used in conjunction with
Legacy Mode).
Also, if you want to install CentOS from a different media type than a DVD
ISO image, such as a USB bootable drive, you must create a bootable CentOS
USB drive using a utility such as Rufus, which can format your USB drive to be
compatible with UEFI systems and GPT partition style.
To boot in UEFI/Legacy Mode please consult your machine motherboard
manual for the specific boot function key (such as F2, F8, F12) or push a small
button located on machine sideways, usually found on new Laptops.
However, if you can’t install or boot CentOS from UEFI mode,
enter UEFI settings, switch to Legacy Mode (if supported) and use the
traditional DVD/USB method to install the systems.
Another mention I would like to remind you stands for machines that comes
pre-installed with Windows 8 or 8.1Operating System and a single partition. In
order to make some available disk space required for the CentOSinstallation,
open Windows Command Prompt with Administrator privileges and run
the diskmgmt command to open Disk Management system utility.
Once Disk Management console opens, go to C: partition and Shrink Volume in
order to create available disk space for CentOS partitions.

Shrink Volumes for CentOS Installation

Requirements
CentOS 7.1 Bootable DVD ISO Image http://centos.org/download/
Installation of CentOS 7.1 Dual Boot with
Windows 8.1
1. Once you have burned CentOS DVD ISO image or prepared a bootbale USB
drive using Unetbootin utility, place the DVD/USB image into your machine
DVD drive or USB port, restart the computer and enter UEFI settings in order
to instruct the machine to boot from the DVD/USB from UEFI firmware.
2. After the booting sequence a new screen should appear on your display.
Choose the first option, Install CentOS 7, press Enter key and wait for the
installer to load the kernel and all the required modules and services.
CentOS 7.1 Boot Menu
Loading Required Kernel Modules
3. After the installer loads all the necessary programs, the Welcome screen
should appear. Choose the languagethat will be used for the installation
process and click the below Continue button to proceed further.
Select Installation Language
4. On the next step the Installation Summary screen should appear. This screen
gathers almost all your system settings for the installation process. First start
by setting up your system Date and Time. Hit the Date & Timemenu, then
select from the map your nearest physical location. Once the location is set hit
the above Donebutton and you will be brought back to the initial settings
screen.
Select Date and Time
Select Country Location
5. Next, hit the Keyboard menu and choose your keyboard input language. If
you need to add extra keyboard languages support, hit the plus (+) button and
add the language. When you’re done, hit the above Done button to go back to
the main settings screen.
Select Keyboard
Select Keyboard Language
6. On the next step click the Language Support menu and configure your
system Language. After you finish language settings, hit the Done button
again to go back.
Select Language Support
Select to Install Language
7. The next step is to configure your Installation Sources. If you are installing the
system from a local DVD/USB media, then you can skip this step. This step is
only required if your using as an network installation method from an PXE
server or you have an extra storage on hard drive with an CentOS ISO image.
The installation media DVD/USB should be automatically detected by the
installer.
Configure Installation Source
Select Installation Source
8. On the next step hit the Software Selection menu in order to choose your
installation environment. Form here you can choose a minimal installation
type (only command line) or a Graphical Installation with your favorite Desktop
Environment.
If the machine is not destined to be a server (you can also optate for a server
with GUI), then choose a complete Gnome Desktop Environment from the left
filed with the following Add-Ons:
Gnome Applications, Internet Applications, Legacy X Window System Compatibility,
Office Suite and Productivity, and Compatibility Libraries. If you want to develop
applications and secure your system, then, also, check Development
Tools and Security Tools.
The same Add-Ons also apply in case you want to use KDE Plasma Desktop
Environment. Once you’re done with system environment hit Done button to
move forward with the installation settings.
Software Selection
Mark Software for Installation
9. The next step is the most important one, because you will now configure
your system partitions. Hit the Installation Destination menu, check your hard
drive, choose the I will configure partitioning option, then hit Done to proceed
further with the manual disk partition.
Select Installation Destination
Select Installation Drive
10. Now it’s time to manually partition your disk. If you already have Windows
OS installed on your machine, then you will notice that some partitions are
already present on your partition table as illustrated on the below screenshots.
Important: Do not touch or alter those partitions in any way. In exchange you
will use the free space from your hard disk to create the Linux partitions. For
this guide we will configure three partitions for the system in the following
manner:
1. Swap partition – double size of your RAM Memory – no mount point.
2. Root partition – at least 10 GB – mount point / – Standard partition type –
Formatted XFS
3. Home partition – the rest of space – mount point /home – – Standard partition
type – Formatted XFS
Manual Partitioning

11. First create the swap partition by hitting the below plus (+) button, choose
swap as Mount Point with the space value for this partition, then hit Add mount
point as presented on the below screenshot.
Create Swap Partition

12. Then, create the root partition by hitting the plus button again with / as a
mount point and at least 10 GBspace. Hit Add mount point, then, from the right
menu choose Standard Partition.
Create root Partition
Select Root Filesystem Type

13. Repeat the same steps as above to create the /home partition with the left
free space (leave the Desired Capacity value empty in order to use all the
remained free space).
Create Home Partition
Select Home Filesystem

Don’t worry about the /boot/efi partition, because it will be added automatically
to your partition table.
14. Once you finish with configuring the partitions, hit the above Done button,
review your new partition table and Accept Changes from the pop-up warning
window in order to proceed further with the last installation settings.
Accept Partition Changes

15. Once you’re back to the main installer screen, hit the Kdump menu and
uncheck the Enable kdump feature. Hit Done to apply settings and go back to
main screen.
Enable kdump
Kdump Selection

16. On the next step configure your Network and Hostname. Choose a
descriptive name for your machine Host name (you can type use a FQDN
name). If you want to set up your Network Interface with static IP
configurations, hit the below Configure button, go to IPv4 Settings tab,
select Manual and enter your network IP addresses.
When you’re done hit the Save button, switch the Ethernet to ON, then hit
above Done button to go back to the main screen. The following screenshots
illustrates this steps.
Select Configure Network
Set System Hostname
Set Network IP Address

17. Now it’s time to install the system. Hit the below Begin Installation button
from the Installation Summaryscreen and a new screen with User
Settings should appear.
From this point on the installation procedure is automatically started and can’t
be reverted. Select the Root Password menu and enter your system root
password twice. Hit Done when you finish to go back and create the first user.
Root Password
Set Root Password

18. The last setting of User Creation is optional. If you want to create a user,
then hit the User Creation menu and enter the username and the password for
this new user.
Check the Make this user administrator box if you want to add root privileges for
this user and, also, check the Require a password to use this account box for
extra security. As soon as you finish, hit the Done button to go back to the
main screen and wait for the installer to complete.
Select User Creation
Create User Account

19. Now you’re almost done. Once the installation process finishes, Reboot the
system, choose CentOS from the Grub menu (you will notice that Windows
Boot Loader is also present here), hit the License Information menu and check
the I accept the license agreement box. Hit Done to go back and Finish
Configuration button.
CentOS Grub Menu
Select License Agreement
Accept License Agreement

20. That’s all! Now, Sign in to CentOS system with the new user credentials
created during the installation process and you’re done. To view CentOS
release version, open a Terminal and issue the following command:

$ cat /etc/centos-release

Also, make sure your system is up-to-date by issuing the following command:

$ sudo yum upgrade


CentOS Login
Check CentOS Version
Update CentOS

21. CentOS 7 has no default support for NTFS filesystem. In order to be able to
mount and access Windows NTFS partitions, add the Epel repositories
package to CentOS and install the ntfs-3g package by issuing the below
commands:

$ sudo yum install epel-release

$ sudo yum upgrade

$ sudo yum install ntfs-3g

23. After installing ntfs-3g, you can mount your Windows NTFS partitions using
following command.
$ sudo mount -ro ntfs-3g /dev/sda5 /mnt

$ cd /mnt

$ ls -l

Mount Windows Partition

Where /dev/sda5 is the my default Windows Partition, in your case the drive
may be different..
Enjoy CentOS 7.1 in dual-boot with Windows 8.1 on your machine. To switch
back to Windows Operating System, reboot the machine and choose Windows
Boot Manager from the Grub menu.
Section 2: Essentials of Basic Linux
Commands

You might also like