Supplementary Chapter - Introduction To Linux and Installation

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 27

Supplementary Chapter: Introduction to

Linux & Installation


Hadoop is efficiently run under Linux platform, which is a family of open source Unix-like
operating systems based on Linux Kernel, an OS kernel first released in September 1991.
Linux is the leading OS on servers (over 96.4% of the top 1 million web servers' operating
systems are Linux).
Linux is typically packaged in a Linux distribution, which includes the Linux kernel and
supporting system software and libraries. Popular Linux distributions include Debian, Fedora,
CentOS and Ubuntu.

Linux Distributions
Linux distribution is an OS made as a collection of software based around the Linux kernel with
a collection of software of various sorts.
For x86 systems, the Linux distributions usually provide a ISO image with an installer program
that helps to install the boot loader, Linux Kernel and the included software of your choice.
There are currently over hundreds of Linux distributions. Among them, there are some well-
known, e.g. Fedora (Red Hat), Ubuntu. Debian and CentOS (Red Hat).
For our course, we choose CentOS 64-bit.
It is a package based on Red Hat Enterprise Linux, free of charge and multi-functional OS.
In addition to providing service about file & print server, CentOS can also be used to create Web
Server, Mail Server, Proxy Server, etc. Together with high stability, it has been popular so far.
Why choose CentOS Linux over Red Hat Enterprise Linux?
1. CentOS Linux is free of charge for download and updates while Red Hat Enterprise Linux is
not free.
2. The source code of CentOS Linux is similar with Red Hat Enterprise Linux, completely
compatible with the commercial and open source software running on Red Hat Enterprise
Linux.
3. The same updated package of CentOS is usually introduced at the same day that the updated
package of Red Hat Enterprise Linux is available and the updated package has been tested
completely by the engineers at Red Hat Enterprise Linux.
4. CentOS has been adopted by some popular public cloud providers such as Amazon EC2,
Oracle Cloud, etc. as Linux virtual machine providing stable and high-performance services
to their customers.
5. According to IDC data, CentOS Linux is the top 3 under the Linux server market and has
been adopted by “Fortune 500” companies.

1
User Interface of Linux
Users can adopt Graphical User Interface (GUI) to operate Linux.

Foreground and Background execution


Foreground execution
It is the common style of executing commands. For example, if we execute ls command, we can
only execute other commands only after the ls command has been executed.

However, if the execution time of a command is too long or infinite, we cannot enter another
command on the same location.

Background execution
In the following example, if we would like to issue another command when xclock is displayed,
we can add “&” after the command to make xclock to be running in background.

2
If we want to stop the execution of program running in background, we can use “ps” command
to recognize the PID of xclock, then use kill -0 <PID> to stop xclock.

Installing Linux Server Interactively


Getting the CentOS Installation Image
You could download the CentOS Installation DVD ISO image from an Internet Location as
follows.
Go to https://www.centos.org/download/ to get the CentOS Installation DVD ISO image.

After clicking the link “CentOS Linux”, select 7-2009 and click x86_64 link.

3
You can see there are a number of mirror sites I different countries for download. Please select
the one which is close to the local area as the downloading speed will be higher.

You can see an image file called CentOS -7-x86_64-DVD-2009.iso. Save it to somewhere in
your computer so that we shall use it for installing our Linux in the next section.
Remarks: We will install the CentOS Server on a virtual machine which could mount the
downloaded ISO file directly as a DVD Rom inside the virtual machine, so you are
not required to burn the ISO file to DVD.

4
Hardware Environment
In order to perform the exercises in our lab, you should install CentOS on a PC with the
specifications below:
 a CD or DVD drive.
 a 1 GHz processor or faster.
 At least 1 GB of memory (RAM)

How to Install Oracle VirtualBox as virtual machine


In the class, we will use a Linux installed as a virtual machine under VirtualBox.
A virtual machine is recommended since you can install Linux using your existing computer and
will not have the risk of affecting your current OS accidentally.
Note: VirtualBox can be insalled properly in Windows OS computer and Intel-Based MacBook.
However, VirtualBox does not officially support Apple Silicon-based Macs (M1 chip).
VirtualBox relies on x86 architecture, while M1 Macs use ARM architecture. For virtualization
on M1 Macs, consider using Parallels Desktop (which supports ARM-based virtualization) or
VMware Fusion.
VirtualBox is a free software and you can download it from Internet:
(https://www.virtualbox.org/wiki/Downloads)

5
Select Windows hosts, and the installation exe file will be downloaded.
Follow the instructions to install VirtualBox by clicking Next, Yes and install buttons.
After completion of Installation process, the Virtual Box window gets opened as follows:

Virtual Machine Setup for CentOS Linux Installation


For your reference, the following steps show the virtual machine setup in Virtual Machine as an
example:
1. When you run VirtualBox for the first time, the following screen prompts up. Click the
New… menu item from Machine menu to create a new virtual machine.

2. A dialog box appears for the user to input the virtual machine name, e.g. CentOS. Please
DON’T load ISO image here because we are going to do manually configure installation.

6
3. Set up the memory size as 2048MB.

4. Then, create a virtual hard disk of 40 GB and select “Pre-allocate full size” to improve
performance and ensure physical hard drive doesn’t run out of disk space:

7
5. Finally, you can view the summary before finishing the configuration.

6. Now, you can see the configuration of your virtual machine as follows. Click on the Settings
button of the new virtual machine.

8
7. There are a number of settings. Go to System setting, select Motherboard, change the
Pointing Device to be USB Tablet.

8. Inside System setting, then select Processor. Modify the number of processors to be 2.

Then, for Extended Features: select “Enable Nested VT-x/AMD-V”


9
9. Go to the Display Setting, modify the video memory to be 32 MB and enable 3D
Acceleration shown below.

10. Go to Storage Setting. Select Empty from “Controller: IDE”. Click on the icon beside the
IDE Secondary Master. A pop-up menu appears. Select Host Drive E: and then select
“Choose a disk file…” and open the downloaded centOS image file.

10
11. Go to Network setting, we use the default network adapter settings “NAT”. IP address will
be assigned to the Linux VM automatically. Then, click OK button to finish Settings.

11
12. Yare are ready to power it on to install CentOS. On the main menu, select the new virtual
machine, click Start icon.

12
Installing CentOS

1. By default, since there is nothing in the VM’s hard disk yet, it will boot from DVD ROM
ISO and a welcome screen appears:

2. After a while, the following appears. Select “English (United States) and click “Continue”.

3. Click on scrollbar and drag it down. Click “INSTALLATION DESTINATION”.

13
4. The 100MB VM hard disk is now selected by default. Just let CentOS installer program to
configure hard disk for you. Select Automatically configure partitioning and then click Done.

14
5. Click SOFTWARE SELECTION”, it is now set to “Minimal Install” which is not desired.

6. Select “Server with GUI” and click “Done” on the upper left corner. Then, click “Begin
Installation” near the bottom right corner.

15
7. Installation begins but you still need to configure additional settings before the installation
completes. Click ROOT PASSWORD.

8. Enter “sam12345” twice. Since the password configured is weak, it prompts you to confirm
using it again. Then, click Done. Click Finish Configuration. All settings required are now
configured and we shall wait for installation to complete.

9. After several minutes, the installation completes and the following screen is shown. Click
“Reboot” to reboot the virtual machine.

16
10. Wait until the following screen is shown. Then, click License link.

11. Check to select the license agreement. Then, click Done button.

17
12. Then, click “Finish configuration” box.

13. The installation from DVD ISO image is completed but you still need to configure some
post-installation setup. Select English and Click Next.

14. Still select “English (US)” and click “Next”.


18
15. Click Next for Privacy.

16. In “Time Zone” screen, type Macau and it will show you “Macau, Macau”. Click Next.

17. Click Skip.

19
18. In the “Full Name” textbox, enter your full name, such as “Tony Sam” and the username will
be filled with “tonysam”. Click Next.

19. Enter password sam12345$$$ in the Password box.


Remark: There are two user accounts now in CentOS, one is “root” and the other is “tonysam”.

20. Click “Start using CentOS Linux”.

20
Your CentOS Server is now successfully installed and you can start using it. You are now logged
in as user “tonysam” mentioned above.

Basic Operations with CentOS X-windows


1. Close the “Getting Started” dialog box.

21
2. Click “Applications” on the menu bar at the top. There is not any “Activities Overview” to
show all common activities on the left pane.

3. Now, let’s show the terminal screen to write a command to display Activities Overview on the
screen. Click Applications, then select Terminal.

4. Then, type sudo reboot to boot up the system again.


$ sudo reboot

22
5. After reboot, login as root

Then, go to Terminal screen and enter the following command.

6. Repeat Step 4 to reboot the system and login as root. Then, you can see the application
overview on the left pane. Click “Show Applications” icon at the bottom of the left pane.
Then, you can see applications at the center.

7. Click the “reverse triangle button” at the top right of the display. Then, click Settings button
from the following screen.

23
8. Click “Details” on the left pane.

9. In the “Device name” textbox, enter “tonyhadoop”.

24
10. Now, close the Details window. This time click the Power off button below.

25
11. Click Restart.

12. Enter password of the user and then click sign in. The last two steps are the normal procedure
to login through X-Windows everytime you restart the CentOS.

13. This time click “Terminal on the left pane.

26
Since we configure the hostname to tonyhadoop, in previous step, it becomes tonyhadoop as
shown in the prompt below.

14. You can invoke the following command: hostnamectl to view the details of the host.

15. If you want to change the host name in terminal, you can invoke the following command:
hostnamectl set-hostname new-hostname

e.g. hostnamectl set-hostname servera.abc.com


You can then issue hostnamectl again to see that the host name has been changed.

16. Change to root user, edit the ifcfg-enp0s3 file in /etc/sysconfig/network-scripts.


[root@tonyhadoop ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3

Then, press i key to go to Insert Mode and change ONBOOT value to yes, as shown below.
Then press Esc key, type :wq to save. Finally, reboot it.

27

You might also like