Saturday 13 June 2015

Chapter Overview and Key Learning Points
This chapter will explain the downloading and installing process Kali Linux on:

– Hard drives
– Thumb drives (USB memory sticks)
– SD cards
Kali Linux
I nstalling operating systems, such as Microsoft’s Windows, A pple’s O S X, or open source
platforms like D ebian and Ubuntu, may be second nature to some, but a refresher on
this process is always good. Those that have never installed an operating system before
should not worry, the following sections in this chapter will provide all of the steps
necessary to locate, download, and install Kali Linux.
Kali Linux is unique in many ways, but the most important distinctions of this
distribution are the ability to not only run from a hard drive installation but also boot as
a live disk and the number and type of specialized applications installed by default. A
live disk is an operating system installed on a disk including Compact D isks (CD s),
D igital Video D isk (D VD ), or Blu-Ray D isk. A s a penetration tester, the ability to boot live disk is quite important. Those with access to local machines on the network can
leverage live disks to use these machines even if the penetration tester does not have an
account on the installed operating system. The system will boot to the live disk instead of
the local hard drive; that is, if the machine is configured correctly the penetration tester
will then have access to many of the resources on the local network, while at the same
time not leaving evidence on the local machines hard drive. The software installed on
Kali Linux is another reason it is uniquely outfi􀄴ed for the penetration tester. By default
Kali Linux has 400 penetration testing and security tools, packages and applications
installed and has the ability to add more as they are needed.
System Information
A ll operating systems have uniqueness’s and slight deviations that will appear through
their initial installation and setup; however, most Linux/Unix-based platforms are
relatively similar in nature. When installing Kali Linux, as with other Linux operating
systems, planning before installation is crucial. Below is a short list of things to consider
when installing Kali Linux.
Will the operating system be running on a desktop computer or laptop?
What size hard drive is needed?
Does the available hard drive have sufficient space available?
How many hard drive partitions are needed?
Is log management a concern?
Is security a concern?
Selecting a Hardware Platform for Installation
Traditionally, the operating system is installed on the computer’s hard drive, however,
with operating systems such as Kali Linux, there is an ability to install the operating
system to thumb drives (aka flash drives) and S D cards due to the recent, availability,
and affordability of larger capacity devices. Regardless of the storage device is used to
install the operating system, it is critical to determine whether to install to a standalone
computer (such as a lab computer) or a laptop that will allow for a mobile solution?
I f very specific hardware, such as high-powered graphics cards, will be used for
cracking passwords, it is recommended that the installation of Kali Linux be installed on
a desktop computer. I f there is a need to carry the operating system from customer site
to customer site, or there is a desire to test wireless devices, a laptop is recommended.
The installation of the operating system is the same for laptop and desktop computers.
Hard Drive Selection
N ot to over use the phrase, but “S ize does ma􀄴er.” A general rule of thumb is the bigger
the drive, the be􀄴er. This book is recommending a drive with a minimum of 120GB of
space; however, even this can become full very quickly, especially in the case of password
cracking and forensics or pentesting projects that require a lot of control over, evidence,
logs and report generation or collection. I n the case of most commercial and government
security assessments, the operating system is cleaned, erased, or completely removed to
maintain an established baseline environment. This practice is widely accepted
throughout the security community due to the need for a proper handling of customer
confidential data and minimizing spillage of corporate information that could possibly
harm the company’s infrastructure or reputation.
Partitioning the Hard Drive
Partitioning is the act of separating out the file system to specific areas of the hard drive
by se􀄴ing special block sizes and sectors. Partitioning can prevent an operating system
from becoming corrupted by log files that take over a system and under certain
circumstances provide greater security. The operating system is, at the basic level,
already broken into two different partitions. The first partition is the swap area, which is
used for memory paging and storage. A second partition is designated for everything
else and is forma􀄴ed with a file structure such as the extended file system 3 (ext3) or
extended file system 4 (ext4). I n the case of laptops, especially those devices where the
operating system will be reloaded time and time again, further partitioning is not
necessary. For customized installations or computers that will have a more persistent
operating system, there is a need to at least separate out the temporary (tmp) files.
A dvanced partitioning of the hard drive and dual booting a computer are outside the
scope of this book and will not be covered. The only exception is in A ppendix A where
customized distributions are introduced with a third-party application called, Tribal
Chicken.
Security During Installation
Kali Linux is a very powerful operating system with a plethora of preinstalled tools that
can possibly destroy computers, network infrastructure, and if used improperly or
unethically, can lead to actions that will be perceived as criminal or law breaking. For this
reason passwords are essential. While passwords are the most basic security practice,
many administrators and security professionals often forget or ignore the use of
passwords. Basic security practices such as proper use of passwords are essential to
ensure that your installation of Kali Linux is not used by others who might inadvertently
or maliciously cause harm to a person, computer, or network.
Downloading Kali
Kali Linux is a distribution of Linux and is downloaded in an I SO (pronouncede: ye-so)
file. I t will need to be downloaded from another computer and then burned to a disk
prior to installation. At the time of writing this book, Kali Linux can be downloaded from
http://www.kali.org/downloads/. D ocumentation for advanced operations, configurations,
and special cases can also be found in Kali’s official website, http://www.kali.org/officialdocumentation/.
There is also a very large and active community where users can post
questions and help others with difficulties. Registration at this site is recommended to
gain access to the community boards that are managed by O ffensive S ecurity, the makers
of Kali Linux. O ffensive S ecurity will also send out messages about updates and
community information (Figure 2.1).
FIGURE 2.1 Downloading Kali Linux.
Be sure to select the right architecture (i386=32-bit, amd64=64-bit). The trusted
contributed images of Kali Linux is outside the scope of this book; however, if you wish
to get familiar with Kali or need a sandbox environment for greater control then the
VMware download is perfect for those situations. Click on the appropriate download link
to continue with your selection.
For Microsoft Windows7 users, double-click on the completed download and the Burn
I S O Wizard will appear. Follow the prompts to complete the conversion of I S O image to
a D VD that can be used for installation. Linux users will need to open the I S O in a
suitable disk burning application such as K3b.
Hard Drive Installation
The following sections will provide a textual and graphical installation guide designed
for simplicity. To correctly install Kali on the systems hard drive, or even boot to the live
disk, it is critical that the Basic I nput O utput S ystem (BI O S ) be set to boot from optical
disk. To begin the installation, place the CD in the computer’s CD tray and boot the
computer to the disk. A dvanced users comfortable with virtualization technology such as
VMware’s Player or O racle’s Virtualbox will also find this guide straightforward and
helpful as an aide to creating a virtualized version of Kali Linux.
Booting Kali for the First Time
A computer booted to the Kali Linux disk successfully will display a screen that looks
similar to Figure 2.2. The version of Kali Linux being used for this guide is 1.0.5 64-Bit;
versions downloaded at different times may look slightly different; however, the
graphical installations are quite similar in nature. A n updated guide for every new
release of Kali Linux can be found at http://www.kali.org/, and it is highly recommended
that this site is consulted for the latest documentation for your version prior to
installation or if you have any questions along the way.
FIGURE 2.2 Live ISO Boot menu.
Kali Linux is distributed as a “Live CD” (akaL ive ISO), which means that the operating
system can be run straight from the disk in addition to being installed to a hard drive.
Running Kali from the live disk allows the system to boot and all of the tools will execute;
however, the operating system presented is nonpersistent. N onpersistent means that
once the computer is shut down, any memory, saved se􀄴ings, documents, and possibly
very important work or research may be lost. Running Kali in a nonpersistent state takes
great care, advanced handling, and decent understanding of the Linux commands and
operating system. This method is great for learning the Linux operating system without
deleting the existing operating system already installed on the computer’s hard drive.
A nother installation, that is out of the scope of this book, is I nstallation with S peech
S ynthesis. This is newer feature to Kali and the D ebian operating system. I nstallation can
be controlled vocally if you have hardware that supports speech synthesis. This book will
focus on the graphical installation for now; therefore, highlight G raphical Install and
press the Enter key.
Installation—Setting the Defaults
The next few screens will allow the selection of the systems a default language, location,
and keyboard language. S elect the appropriate se􀄴ings and click on continue to advance
the installer. A s the computer begins to prestage the installation of Kali Linux, various
progress bars will be presented on the screen throughout the installation. S electing the
default settings is appropriate for most of the selection screens.
Installation—Initial Network Setup
Figure 2.3 details the initial setup and basic configuration of the primary network
interface card. Choose a hostname by typing in the box and clicking on continue.
Hostnames should be unique, as complications with networking can be a result of
computers that were accidentally configured with the same hostname while located on
the same network.
FIGURE 2.3 Setting a hostname.
A fter selecting a hostname and clicking on the Continue bu􀄴on, the next screen will
ask for the computer’s fully qualified domain name, FQ D N . This is necessary for joining
domain environments and not necessary for most lab environments. For this guide, the
FQ D N was left intentionally blank and can be bypassed by selecting the Continue
button.
Passwords
The next prompt in the wizard will ask for a root-level password. The default password is:
toor; however, it is recommended that a new password is selected that contains at least
one each of the following: uppercase, lowercase, number, and symbol. The password
should have no traceability to the user and not be easily guessed. A password of 10 or
more characters is suggested. For example if the user once played high school soccer,
then soccer22 would not be recommended. Passwords can be made from variations of
common phrases to increase recall. Here are some examples of strong passwords:
St0n(3)b@tt73 – “Stone Battle”
P@p3r0kCur5# – “Paper, Rock, Curse”
m!gh7yP@jjjama% h – “Mighty Pajamas”
When typing your password, it will show up as a series of dots or asterisk. This is
normal and hides your password from being displayed in case someone may be viewing
the computer screen. A fter entering in the same strong password twice, click on the
Continue button to advance further into the installation (Figure 2.4).
FIGURE 2.4 Setting a password.
Configuring the System Clock
Figure 2.5 shows the prompt for selecting a time zone. Click on the appropriate time
zone and the click on the Continue button to advance on in the installation.
FIGURE 2.5 Configure the clock.
Partitioning Disks
There are so many ways to configure partitions for se􀄴ing up a Linux operating system
that someone could devote an entire book to the subject. This guide will focus on the
most basic installation, G uided Partitioning. Figures 2.6 through Figures 2.10 show the
default se􀄴ings to that are initially highlighted. There will be nothing to select until
Figure 2.10. At this time, the installation may be sped up by clicking continue until
partitioning is complete, however, it is wise to take a moment and review each step of the
installation wizard.
FIGURE 2.6 Partition disks—1.
Figure 2.6 shows different options for partitioning hard drives during the installation.
LVM, or Logical VolumeManagement, is not recommended for laptop, thumb drive, or
S D card installation. LVM is for multiple hard drives and is recommended only for
advanced users. “Guided—user entire disk,” should be selected. Click on the Continue
button to advance through the installation process.
Figure 2.7 shows the hard drive that has been selected for installation. D epending on
hardware and version of Kali Linux, the installation experience may differ slightly. The
hard drive will be selected for and if acceptable click on the Continue bu􀄴on to advance
through the installation process (Figure 2.8).
FIGURE 2.7 Partition disks—2.
FIGURE 2.8 Partition disks—3.
A s this book is geared toward new users of the Kali Linux distribution: “A ll files in one
partition (recommended for new users)” is the best option and should be selected. Click
on the Continue button to advance through the installation process.
At the next prompt in the wizard, the partition guide has been completed and is
presented for your review. A primary partition containing all of the system, user, and
scripting files will be created as one partition. A second partition is created for swap
space. The swap area is virtual system memory that pages files back and forth between
the computer’s central processing unit (CPU) and random access memory (RA M). A ll
Linux systems are recommended to have a swap area and the general practice is to set
the swap area equal to or one and a half times the amount of physical RA M installed on
the computer. A s seen in Figure 2.9, “Finish partitioning and write changes to disk,” will
be selected for you. Click on the Continue bu􀄴on to advance through the installation
process.
FIGURE 2.9 Partition disks—4.
Figure 2.10 is a last chance review for partitioning before the hard drive configuration
is commi􀄴ed. There are ways to change partition sizes in the future if necessary, but
doing so could potentially cause massive damage to your operating system if not done
correctly. This prompt in the wizard is a warning that you are about to write data to a
specified hard drive with the previously defined partition tables. S elect YES and click on
the Continue button to advance through the installation process.
FIGURE 2.10 Partition disks—5.
A fter clicking continue at the last prompt of the partitioning section of the wizard, the
hard drive partition will begin. Figure 2.11 shows that the actual installation is being
conducted at this time. D epending on the hardware you possess, this process can take
just a few minutes or even an hour or more.
FIGURE 2.11 Installation is underway.
Configure the Package Manager
The package manager is a crucial part of the operating system’s setup. The package
manager refers to the update repository where Kali Linux will pull updates and security
patches. I t is recommended to use the network mirror that comes with the Kali Linux
I S O as this will the most up to date sources for package management. Figure 2.12 shows
that “YES” will be selected by default. Click on the Continue bu􀄴on to advance through
the installation process.
FIGURE 2.12 Configure the package manager.
I f using a proxy, enter the configuration information where appropriate on the next
prompt in the wizard or leave it blank as pictured in Figure 2.13. Click on the Continue
button to advance through the installation process.
FIGURE 2.13 Configuring a proxy.
Installing the GRUB Loader
TheGrand Unified Bootloader( GRUB) is the main screen that will be displayed every
time the computer is started. This allows the verification of certain se􀄴ings at boot, make
on the fly changes, and make se􀄴ing adjustments before the operating system loads.
While GRUB is not necessary for some advanced users, it is highly recommended for
most installation types. Figure 2.14 shows that “YES” to install the GRUB is selected for
you. Click on the Continue button to advance through the installation process.
FIGURE 2.14 Install GRUB.
Completing the Installation
N ow remove the disk from the computer and reboot you machine. When prompted do so
and then click on the Continue button to finish the installation (Figure 2.15).
FIGURE 2.15 Installation complete.
A fter rebooting, the welcome screen will be presented. Log in as the root user with the
predefined password set earlier in the installation process. Welcome to Kali Linux!
Thumb Drive Installation
US B memory devices, often referred to as thumb drives and many other names, are
nothing more than a storage device that is a􀄴ached via a US B interface to the computer.
This book recommends using a USB device with atl east 8GB of space, preferably much
more. N ew computers can boot to US B devices. I f this option is selected make sure that
the computer being used can support booting from a USB device.
The following sections break down the installation of Kali Linux on to US B using a
Microsoft Windows computer or Linux platform. Be sure to check the documentation
provided on the Official Kali Linux homepage for updates to this process.
When it comes to thumb drives being used as bootable devices, there are two key
terms that are very important: persistence and nonpersistence. Persistence refers to the
ability of your device to retain any wri􀄴en or modified files after the machine is powered
off. N onpersistence refers to the device losing all se􀄴ing, customizations, and files if the
machine reboots or is powered off. S pecifically for this book, the thumb drive installation
of Kali Linux from a Windows platform will be nonpersistent, and the installation from a
Linux platform will be persistent.
Windows (Nonpersistent)
Required application—Win32 D isk I mager:
http://sourceforge.net/projects/win32diskimager/
A fter downloading the Kali Linux I S O , put a thumb drive in the computer and allow it
to automatically be detected by Windows, taking note of the drive le􀄴er assigned. N ext
open Win32 D isk I mager. Click on the folder icon to browse and select the Kali I S O file
and then click the “O K” bu􀄴on. S elect the correct drive le􀄴er from the device drop-down
menu. Finally click the “Write” button.
When Win32 D isk I mager has completed burning the I S O , reboot the computer and
select the thumb drive from the BI O S PO S T menu. Most manufacturers have different
methodologies for booting to US B devices; be sure to check the computer manufacturer’s
documentation.
Linux (Persistent)
When building a persistent thumb drive, again, size does ma􀄴er! The bigger the thumb
drive, the be􀄴er. A lso, depending on the version of Linux in which you will be building
this US B device, be sure that the application GParted is installed. Be sure to check your
operating system’s documentation if you are having difficulties installing GParted. O ne
of the following methods may be necessary for your Linux installation if GParted is not
installed:
apt-get install gparted
aptitude install gparted
yum install gparted
A fter downloading the Kali Linux I S O , plug in thumb drive. O pen a terminal window
and verify the USB devices location the following command.
mount | grep -i udisks |awk ‘{print $1}’
Figure 2.16 shows that the output of the command as “/dev/sdb1.” The US B device’s
output may be different based on the computers se􀄴ings and configuration. I n the next
command, swap “sdb” to match the correct identification and remove any numbers at
the end.
FIGURE 2.16 Mounted USB.
Use the “dd” command to transfer the Kali ISO image to the USB device.
dd if=kali_linux_image.iso of=/dev/sdb bs=512k
Now launch Gparted.
gparted /dev/sdb
The drive should already have one partition with the image of Kali that was just
installed.
A dd a new partition to the US B by selecting N ew, from the menu that appears after
clicking on the Partition menu from the File Menu Bar. S light deviations in output can be
present from many different device manufacturers. O n average, the steps are similar to
the following.
Click on the grey “unallocated” space.
Click on “New” from the Partition drop-down menu.
Use the sliders or manually specify drive size.
Set the File System to ext4.
Click Add.
From the main window select, Apply All Operations from the Edit drop-down menu.
Click Okay when prompted. This may take a while.
To add in persistent functionality use the following command.
mkdir /mnt/usb
mount /dev/sdb2 /mnt/usb
echo "/ union" >> /mnt/usb/persistence.conf
umount /mnt/usb
Creation of the LiveUS B is now be completed. Reboot the computer and boot from the
thumb drive.
SD Card Installation
Microcomputing devices such as the RaspberryPi and Google’s Chrome N otebook are
capable of running on S D cards. These small devices can be used for a plethora of
purposed; someone is only limited by their own imagination. The greatest advantage of
devices; such as the Raspberry Pi, is that they are cheap and a huge hit in the open source
communities making resources readily available to tinkerers everywhere.
There is one drawback to the installing Kali Linux on A RM devices, the images are
custom and have to be defined for each piece of hardware. I mages for A RM devices can
be located on Kali’s official download pages, http://www.kali.org/downloads/. Be sure to
check out the website to see if your hardware has a supported image available for
download.
The following steps provide a short guide to installing Kali Linux to compatible A RM
architecture-based devices.
1. Download the appropriate image from Kali’s official website
(http://www.kali.org/downloads/).
2. Insert a blank SD card. Verify the mounted location with the following command.
mount | grep -i vfat
(Assuming/dev/sdb for the next step.)
3. Transfer the Kali.img file to the SD card.
dd if=kali.img of=/dev/sdb bs=512k
4. Unmount and sync any write operations before removing the device.
umount /dev/sdb
sync
5. Remove the SD card.
6. Insert the SD card containing the Kali Linux image into your ARM architecture
computing device and boot to the SD card.
Summary
I n this chapter, the topics covered will give the user the ability to install Kali Linux to
most computers, laptops, thumb drives, and microcomputing devices. I nstalling Kali
Linux is much like riding a bicycle; do it once, and you won’t really ever forget how to
install Kali. Be sure to check with the documentation and community message boards on
Kali’s official website as new updates, versions, and technologies developed in the
security community. Linking up and networking with other security professionals,
hobbyists, and hackers alike can, and will, expand the mind, delve deeper into new
projects, and assist in answer questions when able