Professional Documents
Culture Documents
Hello and thank you for buying my
Linux and Unix Learning the easy way book.
I hope you enjoy reading and performing the task you will be performing in this
book, as much as, I enjoyed creating them for you
I will not bore you with the Linux jargon that other books put you through.
I will just JUMP into it with you!
So who wants to install Linux?
Then lets get started.
Linux has been in the US for some time for sometime now.
A lot of companies need employees that know how to Administer Linux/Unix.
Even the pay is better if you reach the potential of being a good Linux System
Administrator.
Weather you are reading this book to learn how to install Linux or maybe you need
to have insight on what Linux is all about and want to see how to install and move
around Linux GUI or Command line Linux Shell. Either way this is a good place to
start if you have no prior experience with the Linux or Unix Operating System.
Then I will just introduce you to one Linux OS Version that is very popular in the US.
One that I think will help you with learning to install and use for your learning
purposes very easily.
Then you can later search on your own and find out what Linux is right for just you
and your needs. J
For your reference later, here are a few Linux OS versions and what you can do with
them.
Ubuntu Linux:
Very easy to install and use with the beginner in mind.
You can use this Linux at home and work. Installs very easily on a desktop or
laptop. Drivers interface good from my past experience in the past to present
(this is the one we will be using for our learning Sessions through out the book)
With Ubuntu Linux you can not only install a desktop edition. You can install as a
Server or Developer workstation if you want.
Good for Media Streaming and using the email client Thunderbird. Just a few things
you can do with Ubuntu Linux.
Download at www.ubuntu.com
Centos Linux:
It is however, a little bit more hands on to install.
You will maybe need to download some third-party drivers.
During the install of Centos Linux, It will look and find hardware good but may not
work always if you have an older Desktop pc or Laptop.
You can setup as a Linux Server, Linux Desktop or even as Linux Developer
workstation.
However, I have not had any wireless issues on install or had Hard Drive issues and
also seem to find USB pen drives ok too.
Keep in mind this OS is for a more advanced user level of Linux that your everyday
System administrator is use to for Linux.
You can learn more from the Centos website and download the User Manual and
Administration Manual should you want to learn the command line.
Download at https://www.centos.org
Suse Linux:
Geared for people that have more experience than the average user.
You can setup as a Linux Server, Linux Desktop or even as Linux Developer
workstation.
And will install easy if you want to give it a try.
Drivers work great.
Download at https://www.opensuse.org/
Kali Linux
Not one to begin with to me.
Kali is a Debian-based Linux distribution aimed at advanced Penetration Testing
and Security Auditing.
Kali contains several hundred tools aimed at various information security tasks,
such as Penetration Testing, Forensics and Reverse Engineering.
Kali Linux is developed, funded and maintained by Offensive Security, a leading
information security training company.
You can download and read more at: https://www.kali.org/
OK
Lets Get Ubuntu open browser and go to: www.ubuntu.com
Click on the Download link and Select Desktop
Figure 1.1
Figure 1.2
Downloading
Figure 1.3
Now go to your downloads folder or where ever you saved the Ubuntu.iso file
And double click on it and burn the dvd or use it as an ISO. If you are creating a
Virtual machine Or Maybe you will be booting from a DVD or ISO OS image.
Im booting from an .ISO image. Mounted during my VMware Setup
Figure 1.4
Now Select Install Ubuntu
Figure 1.5
Be sure to select install this third-party software. This will install video and other
drivers also.
Click Continue
Figure 1.6
10
Partition Layout
Remember you are sure you want to wipe this Hard Disk if so Continue.
Figure 1.7
Ok here is what we have so far.
Showing below:
If you are sure you want to continue click Install now.
Figure 1.8
11
Figure 1.9
Now create the SWAP Partition
(Note the /var position will be the same to create ok)
Figure 1.10
12
Remember your disk may look somewhat different but its ok you can install now.
Figure 1.11
Notice the Warning! IF you are again sure click on Continue
Figure 1.12
13
Figure 1.13 - Time zone
14
Click on Continue
Figure 1.15
Figure 1.16
15
Figure 1.17
Now log into the System using the credentials that we set up during the above steps
16
Figure 1.18
OK Lets Login
Figure 1.19
17
You should be on your desktop Showing below
Figure 1.20
18
Figure 1.21
19
Figure 1.21
20
Figure 1.22
OK so much for our Desktop GUI
21
Next we need to be sure all updates have been done
To do this we can simply use the Terminal shell
Go to Search you computer and online source icon on top left side of your screen
Then type in the name term or terminal as sheen in Figure 1.23 below
Figure 1.23
You will be using this often so right click on task bar and select
Lock to Launcher (So it will be located close by when you need it again) Showing in
Figure 1.24 below
Figure 1.24
22
Now if you notice here is a note inside the Terminal after you opened it.
If you wish to run as the user root you must use the command
sudo <command> We will speak of this now
Whenever you use a command to run a program or install a program you must have
elevated permissions know as root on Linux systems.
Some Linux Editions dont allow you to run as root when you login. But more of a
standard user and therefore you will not be able to run certain commands or install
applications etc. So what we do instead is ask to have root permission to install it by
telling the Linux computer to authorize it by typing the command sudo then
following by the command you wish to perform.
Example: sudo apt-get update
Permission to ask is: sudo
Request we are asking: run our ( apt-get update command )
Here is the command without asking with sudo
Notice the command below: apt-get update
Notice the Permission denied
Notice the question we are being ask (Are you root?) in Figure 1.25
Figure 1.25
OK here is how you need to run the command
sudo apt-get update
Now we are being asked our user password. Enter password to continue
Figure 1.26
23
Figure 1.27
Command has now completed with no errors
This Ubuntu is now up to date in figure 1.28 below
Figure 1.28
24
Figure 1.29
Above in Figure 1.29
Contains all our important information, required for booting to device drivers,
configuration files and other things. Lets describe just a few of the above and what
they are used for. Lets start hierarchically.
1. /
Root or / is the top level directory on a Linux System. This is it is the
directory in which all other directories, including their subdirectories,
and files reside. The root directory is designed by a forward slash ( / )
2. /bin
bin is a standard subdirectory of the root directory in Unixlike operating systems that contains the executable (ready to run)
programs that must be available in order to attain minimal
25
3. /boot
In the Linux, and other Unix-like operating systems,
the /boot/ directory holds files used in booting the operating system. The
usage is standardized in the File system Hierarchy Standard
4. /dev
The /dev directory contains the special device files for all the devices.
The device files are created during installation, and later with
the /dev/MAKEDEV script. The /dev/MAKEDEV.local is a script written
by the system administrator that creates local-only device files or links
5. /etc
6. /home
The /home directory contains a home folder for each user
7. /lib
The /lib directory contains libraries needed by the essential binaries
in the /bin and /sbin folder. Libraries needed by the binaries in the
/usr/bin folder are located in /usr/lib.
26
8. /media
The /media directory contains subdirectories where removable media
devices inserted into the computer are mounted. For example, when
you insert a CD into your Linux system, a directory will automatically
be created inside the /media directory. You can access the contents
of the CD inside this directory.
9. /mnt
10. /opt
The /opt directory contains subdirectories for optional software
packages. Although commonly used by proprietary software venders
that doesnt obey the standard file system hierarchy, So a
proprietary program might dump its files in /opt/application when you
install it by default unless you change it.
11. /sbin
The /sbin directory is somewhat similar to the /bin directory. And It
contains binaries that are generally intended to be run by the root
user for system administration.
12. / root
The /root directory is the home directory of the root user. Instead of
being located at /home/root, its located at /root. This is not the
same as /, which is the system root directory.
27
13. /proc
Init
Looks at the /etc/inittab file to decide the Linux run level.
Following are the available run levels
0 halt
1 Single user mode
2 Multiuser, without NFS
3 Full multiuser mode
4 unused
5 X11
6 reboot
Init identifies the default initlevel from /etc/inittab and uses that to
load all appropriate program.
If you want to get into trouble, you can set the default run level to 0 or
6. Since you know what 0 and 6 means, probably you might not do
that.
28
Run Levels
Example of the 6 stages of boot process the Runlevel Programs
Linux has 6 different Run Levels
Run level 0 /etc/rc.d/rc0.d/
Run level 1 /etc/rc.d/rc1.d/
Run level 2 /etc/rc.d/rc2.d/
Run level 3 /etc/rc.d/rc3.d/
Run level 4 /etc/rc.d/rc4.d/
Run level 5 /etc/rc.d/rc5.d/
Run level 6 /etc/rc.d/rc6.d/
There are also symbolic links available for these directories under /etc
directly. So, /etc/rc0.d is linked to /etc/rc.d/rc0.d.
Under the /etc/rc.d/rc*.d/ directories, you would see programs that start
with S and also K.
Programs starts that start with S are used during startup. S for startup.
Programs starts that start with a K are used during shutdown. K for kill.
29
Figure 1.30
Figure 1.31
30
OK
Lets install some applications or programs from within the GUI and From the
Command line
Lets install first from the GUI Desktop with the Ubuntu Software Center located on
your task bar
Figure 1.32
Lets install an alternative to Photoshop called GIMP
Search for gimp in figure 1.33 below
Figure 1.33
31
Figure 1.34
It will prompt for a password
Just enter password then click Authenticate - to start the installer process
Figure 1.35
Gimp is a Free Application like hundreds of other out there just waiting to be
discovered by you and others for the finding.
Figure 1.36
32
OK
Lets look for another app called Putty
This utility is used to connect to other workstations and server from the command
line ssh tool
Enter putty in search (Then enter password and install)
Figure 1.37
Are you someone that is a programmer or want to be a programmer?
Then here is a C and C++ IDE Application you can use to make programs
Again click install and enter password to start to install process
Figure 1.38
33
Installing software using Apt-get
Now what if you cant find what youre looking for in the UBUNTU Software Center?
Then you can use the Command Line Shell or Terminal
Open the Terminal we attached to the taskbar
NOTE:
Install PyCharm from PPA: PYTHON IS A PROGRAMMING Language
Theres a PPA repository for Ubuntu based users that contains both professional (30-day free trial) and
community version of PyCharm packages. So far, Ubuntu 15.04, Ubuntu 14.04, Ubuntu 12.04 and their
derivatives are supported.
1. To add the PPA, open terminal , Launcher, or via Ctrl+Alt+T shortcut keys. When it opens, run
command:
sudo add-apt-repository ppa:mystic-mirage/pycharm
Figure 1.39
Enter password
Figure 1.40
34
Enter to Continue
Figure 1.41
Installing apt-get repositories
Figure 1.42
2. After adding the PPA, update system package cache and install the IDE via Synaptic Package Manager.
Or just run below commands one by one in terminal:
sudo apt-get update ( This will update the apt-get package manager to
list the pycharm for you to grab and install on next command)
35
Figure 1.43
sudo apt-get install pycharm
OR
You may replace this last command via sudo apt-get install pycharmcommunity to install the community version, which is free.
Here is the command to better understand it.
(Please allow me to install a program) SUDO
(Please get the program) Apt-get
(Please install the program) Install
(Name of program to install is called) Pycharm
So all together the command is
sudo apt-get install pycharm
Figure 1.44
36
Figure 1.45
Now just sit back and wait for the apt-get installer to complete your
install of pycharm thats it for installing programs for now.
Should you want ot find any other programs just search Google for it
and it will be one out there someone Im sure has installed it before.
37
Great Job!
Figure 1.46
Figure 1.47
38
Figure 1.48
Figure 1.49
39
Great job
Figure 1.50
Figure 1.51
40
Figure 1.52
First we need to move to the Current Desktop Directory so we can see
what is going on as we create more folders
Lets change to the Desktop directory of our user profile.
Enter this command at your command prompt
cd Desktop
(Press the enter key to change that directory)
Figure 1.53
41
Figure 1.54
Enter the command mkdir Student5
(Now notice the new folders added on your Desktop Student4 and
Student5)
Figure 1.55
42
Now lets learn to Copy from our Desktop GUI and Desktop
Lets go to Google and find a few items that we can use for our copying
process.
Open the Firefox web browser
Figure 1.56
Go to google.com
Figure 1.57
43
Figure 1.58
Figure 1.59
44
Figure 1.60
Download for Linux
Figure 1.61
45
Figure 1.62
OK now lets make our own file using the text editor
Go to Ubuntu Search and open the text editor on the Desktop
Figure 1.63
46
OK Open the Text Editor and enter anything you wish inside so we can have Information saved inside it to
use for moving purposes.
Figure 1.64
Now click on Save (Save it as NewFile1 Save to your Downloads Folder)
47
Figure 1.65
Figure 1.66
Notice what we are seeing now. We are seeing the Name at the Bottom FileFile1 [New File]
Figure 1.67
48
To save this file you need to hit the esc key. Then type the following: :wq!
This will save and exit the editor.
Figure 1.68
Figure 1.69
49
To avoid all this altogether you can just type touch myfirstfile1
At the command line enter the following command touch filename and press enter thats it.
Figure 1.70
Now and easy way to move a folder is to copy and paste it from the File explorer window
Create a new folder on your desktop and call it Lab_folder (NOTE: On Linux Systems always connect a
space.) Never have a space in a folder or file name. Like Lab Folder you need to instead name it
Lab_Folder. This makes things run smoother later when you want to copy a file or folder. From one
server to another or from one network location place to another
50
Figure 1.71
Now open up the Lab_Folder and place both the Desktop folder and Network folder open on top of one
another like below to keep things simple J All you need to do is Right Click on each file and then copy
and paste to the below folder just as you would on a windows pc
(Please place back to desktop when you are done) for the command line copy we will do next
Figure 1.72
51
Figure 1.73
We need to be in our Desktop Directory (remember how to get there?) cd Desktop (correct? Yes)
OK now after typing the command we are now inside our Desktop
Figure 1.74
Now lets see what all is on our Desktop by typing the ls command
Notice that the white colors are files we created and the others or folders that we created earlier
52
Figure 1.75
Figure 1.76
53
Figure 1.77
54
Figure 1.78
Then run the ls command to view all files and folders
Figure 1.79
ok lets delete the file. Type the following command: rm FileFile1 and press enter key
Then do another ls command to see if you have anything inside folder ( As showing below no )
Figure 1.80
55
OK Now lets delete a Directory (But First type cd .. to move back one Directory to our Desktop again)
Figure 1.81
This type the ls command to view contents again.
Figure 1.82
To remove a directory you need to type: rmdir Student5 then press enter key
Figure 1.83
56
Figure 1.84
But what if the folder has a contents or files inside of it? Then you will need to issue an argument with the
ls command to remove folder and contents as follows:
rm rf Like this rm rf ( filename ) ( First copy files to the
Lab_Folder as showing below so we can perform this task please.)
Figure 1.85
57
Figure 1.86
58
59
Install Apache
sudo apt-get install apache2
Install PHP
sudo apt-get install php5 libapache2-mod-php5
Install MySQL
sudo apt-get install mysql-server
Install phpMyAdmin
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
60
61
62
Linux Cheat Sheet (Using the Bash Shell) Continued
63
64
Bash vi Editor (Cheat Sheet) Continued
65