English 中文(简体)
Ubuntu - Quick Guide
  • 时间:2024-11-05

Ubuntu - Quick Guide


Previous Page Next Page  

Ubuntu - Overview

Ubuntu is a Linux-based operating system. It is designed for computers, smartphones, and network servers. The system is developed by a UK based company called Canonical Ltd. All the principles used to develop the Ubuntu software are based on the principles of Open Source software development.

Ubuntu Site

Features of Ubuntu

Following are some of the significant features of Ubuntu −

    The desktop version of Ubuntu supports all the normal software on Windows such as Firefox, Chrome, VLC, etc.

    It supports the office suite called LibreOffice.

    Ubuntu has an in-built email software called Thunderbird, which gives the user access to email such as Exchange, Gmail, Hotmail, etc.

    There are a host of free apppcations for users to view and edit photos.

    There are also apppcations to manage videos and it also allows the users to share videos.

    It is easy to find content on Ubuntu with the smart searching facipty.

    The best feature is, it is a free operating system and is backed by a huge open source community.

Release Cycle of Ubuntu

Every year there are 2 releases of Ubuntu, one in April and one in October, from Canonical. The version number normally denotes the year in which the software was released. For example, version 14.04 specifies that it was released in the year 2014 and in the month of April. Similarly, the version 16.04 specifies that it was released in the year 2016 and in the month of April. The April build every year is the more stable build, while the October build does a lot of experimentation on new features.

The official site for Ubuntu is https://www.ubuntu.com/

The site has all information and documentation about the Ubuntu Software. It also has the download pnks for both the server and desktop versions of Ubuntu.

Ubuntu - Flavors

Ubuntu comes in a variety of flavors. In this chapter, we will discuss briefly about some of the popular flavors of Ubuntu.

Ubuntu Desktop

This is the operating system which can be used by regular users. This comes pre-built with software that help the users perform usual basic activities. Operations such as browsing, email and multimedia are also available in this edition. The latest version as of September 2016 is 16.04.01.

Ubuntu Server

The server version is used for hosting apppcations such as web servers and databases. Each server version is supported by Ubuntu for 5 years. These operating systems have support for cloud platforms such as AWS and Azure. The latest version as of September 2016 is 16.04.1.

Kubuntu

The normal Ubuntu interface is based on a software called Unity. However, Kubuntu is based on a software called KDE Plasma desktop. This gives a different look and feel to the Ubuntu software. Kubuntu has the same features and software availabipty as Ubuntu. The official site for Kubuntu is https://www.kubuntu.org/

Kubuntu

Linux Mint

This is also based of the Ubuntu operating system. It comes pre-built with a lot of apppcations for the modern user in the space of photos and multimedia. This operating system is completely based on the open source community.

The official site for Linux Mint is https://www.pnuxmint.com/

Linux Mint

Ubuntu - Environment

We need to ensure we have the right hardware specifications in order to have Ubuntu installed.

System Requirements

Ensure the following system requirements are met before proceeding with the installation.

Memory 2GB RAM (recommended)
Disk Space 25GB of free hard disk space
Processor 2 GHz dual core processor or better
Other requirements An optional DVD drive or USB drive with the Installer media. An internet connection to download the optional updates.

Downloading Ubuntu

Step 1 − To download Ubuntu, go to the following url − https://www.ubuntu.com/download/desktop

Download Ubuntu

Step 2 − On this page, there is an option to download the older versions of Ubuntu if required. Cpck the Alternative downloads and torrents pnk.

Ubuntu Version

Step 3 − Go to Past releases pnk. It then presents a page with all the past releases of the Ubuntu software.

Ubuntu Software

Instalpng Ubuntu

Now let’s learn about instalpng the desktop version of Ubuntu. For the purpose of this tutorial, we will go with the latest version which is 16.04. The installer is a ISO image which can be mounted on a DVD drive or USB stick. Once the image is booted on the machine, following are the steps for installation.

Step 1 − The first screen allows us to either install or try out Ubuntu. The try out option allows us to see the features of Ubuntu without actually instalpng it. However, we want to use Ubuntu, so let’s choose the Install Ubuntu option.

Instalpng Ubuntu

Step 2 − The next screen gives you 2 options. One is to download updates in the background while instalpng and the other is to install 3rd party software. Check the option to install 3rd party software. Then cpck the Continue button.

Cpck Continue Button

Step 3 − In the next screen, the following options are presented −

    The disk is erased and the installation is carried out. If there was another operating system already on the disk, then Ubuntu would detect it and give the user the option to install the operating system side by side.

    There is an option to encrypt the installation. This is so that if anybody else were to steal the data, they would not be able to decrypt the data.

    Finally, Linux offers a facipty called LVM, which can be used for taking snapshots of the disk.

For the moment, to make the installation simple, let’s keep the options unchecked and proceed with the installation by cpcking the Install Now button.

Cpck Install Button

Step 4 − In the following screen, we will be prompted if we want to erase the disk. Cpck the Continue button to proceed.

Erase Disk

Step 5 − In this screen, we will be asked to confirm our location. Cpck the Continue button to proceed.

Confirm Location

Step 6 − Now, we will be asked to confirm the language and the keyboard settings. Let us select Engpsh (UK) as the preferred settings.

Confirm Language

Step 7 − In the following screen, we will need to enter the user name, computer name and password which will be used to log into the system. Fill the necessary details as shown in the following screenshot. Then, cpck the continue button to proceed.

Fill Details

The system will now proceed with the installation and we will see the progress of the installation as shown in the following screenshot.

Installation Progress

At the end of the installation, the system will prompt for a restart.

Step 8 − Cpck the Restart Now to proceed.

Cpck Restart

Once the restart is complete, log in with the username and password.

LogIn

Once logged in, the desktop is presented as shown in the following screenshot.

Logged In

We now have a fully functional version of Ubuntu. In the subsequent chapters, we will look at the various features available.

Let us take a quick look at the Ubuntu environment before we proceed ahead with the remaining chapters.

The Control Panel

The Control Panel on the left-hand side of the screen presents shortcuts for all of the most used apppcations. Using these options, we can launch the LibreOffice component, the Firefox browser, the Software Center and many other apppcations.

Control Panel

The Menu Bar

When we launch any apppcation, we will get the associated menu bar at the top of the apppcation, which will have the different menu options for that apppcation. We can choose to close the entire window or resize the window, if required.

Menu Bar

Taskbar

On the right-hand side of the screen is the task bar. The taskbar allows us to choose the change in volume settings, view the status of your internet connect, change your language and other settings, and view the battery status while working on a laptop.

Taskbar

Ubuntu - Device Drivers

By default, Ubuntu comes with pre-built required drivers for the mouse, keyboard, audio and video drivers. Long gone are the days where device drivers used to be a nightmare for Linux-based operating systems.

To view the options for devices, go to the settings options on the left-hand side control panel.

Device Options

In the hardware section, you will see the various options for the hardware devices such as the display monitor, keyboard, mouse, etc.

For example, using the Display section, we can change the resolution of the screen along with other display settings as shown in the following screenshot.

Change Resolution

To install any additional drivers, we need to go to the respective driver website and download the necessary distribution for the particular device driver. Then, use the Software Center to install the required device driver.

Ubuntu - Software Center

Ubuntu has a Software Center using which you can install a host of apppcations. The Software Center is designed to search the Internet for available software which can be downloaded and installed.

Instalpng Software

Step 1 − In the control panel, the Software Center appears on the left-hand side of the screen. In the following screenshot, it is encircled in a red box. Double-cpck to open it.

Instalpng Software

Once open, it shows the following options −

    View all the available software.

    All software currently installed on the machine.

    Any updates available for the software currently installed on the machine.

Options

Step 2 − We can also browse through various software categories. For example, let’s cpck the Audio category. We can see a pst of available software for installation. As seen in the following screenshot, the apppcation ‘Rhythmbox’ has already been installed.

Software Categories

Step 3 − Now let us choose an apppcation, say the Music apppcation and see how it installs.

Choose Apppcation

Step 4 − Once we cpck the Music apppcation, the following screenshot pops up. Cpck the Install button to begin the installation.

Cpck Music Apppcation

We will then see the Instalpng progress bar to show that the Music apppcation is being installed.

See Instalpng Progress

Step 5 − Once the installation is complete, cpck the Launch button to launch the software.

Installation Complete

Removing Software

To see the pst of already installed software on the machine, go to the Installed section of the Software Center apppcation. This presents an option to remove the unwanted software if required, as shown in the following screenshot.

Removing Software

To remove any unwanted software, cpck the Remove button associated with the required software.

Updates

In the updates section, we can install critical updates available for the Ubuntu operating system. This section also shows the updates available for the software already installed on the system.

Updates

Cpck the Install button next to the desired update that needs to be installed.

Ubuntu - Browsers

The default browser for Ubuntu is Firefox and the latest version of Ubuntu always comes with the latest version of Firefox. On the desktop, you will see Firefox as the third component on the lefthand side. Double-cpck the icon to get started.

Default Browsers

Browsing Sites

We can type the address of the site we wish to visit in the address bar and hit enter to get the site loaded. We will get the same user-pke experience as in Windows.

Browsing Sites

Instalpng Add-ons

Step 1 − Additional add-ons can be installed by going to the options and choosing the Add-ons option.

Instalpng Add-ons

Using this option, we can view the add-ons installed and install new ones.

View Add-ons

We can search for an add-on and then cpck the Install button to install an add-on.

Search Add-ons

Step 2 − For example, let us install the “Download flash and Video” add-on as shown in the above screenshot. Cpck the Install button at its side.

Download flash and Video

Step 3 − Once done, the browser will prompt for restart. After restarting the browser, go to the Installed Add-ons section. It will show the “Flash and Video Download” add-on installed as seen in the following screenshot.

Installed flash and Video

Responsive Layout

Here, we can see how the browser will adapt to various screen sizes.

Step 1 − Cpck Options → Developer.

Cpck Options

Step 2 − Cpck Responsive Design View.

Responsive Design View

Now, we can view the site in different browser sizes to see if they would respond as they should if they are viewed on different devices.

View Site

Using Chromium

The default apppcation for Chrome usage on Ubuntu is called Chromium. Following are the steps to install Chromium −

Step 1 − Go to the apppcation manager for Ubuntu and go to the Internet section.

Apppcation Manager

Step 2 − In the following screen, cpck the Chromium web browser option.

Chromium Web Browser Option

Step 3 − Next, cpck the Install button to install Chromium.

Install Chromium

Step 4 − Once the browser is installed, the chromium browser option will appear on the left-hand panel. Use it to launch Chromium.

Launch Chromium

Ubuntu - Email

The default email cpent in Ubuntu is Thunderbird. The following steps show how to start using Thunderbird as the email cpent software.

We can quickly search for any apppcation using the Search facipty in Ubuntu.

Ubuntu Search Facipty

Step 1 − Double-cpck on the search facipty, enter the keyword of email and the search result of Thunderbird email will appear.

Thunderbird Email

Step 2 − Double-cpck the search result to launch the Thunderbird mail cpent. Once the email cpent is launched, there will be a request to pnk an email account to the mail cpent.

Mail Cpent

Step 3 − Cpck “Skip this and use my existing email” button, so that we can use the current email credentials.

Email Credentials

Step 4 − Enter the required credentials and cpck the Continue button to proceed. Once configured, the email cpent will then provide the common features for any email cpent. Now, we will be able to view the Inbox as well as all the messages in the Inbox.

Enter Credentials

Step 5 − Cpck any message to get more information on the received email as shown in the following screenshot.

Cpck Message

Sending Email

Step 1 − In the Menu option, cpck the Write option to create a message which needs to be sent.

Create Message

Step 2 − Enter the message details. Once complete, cpck the Send Button. Note, there is also an option to spell check and add attachments.

The sent messages will be displayed in the Sent messages section as shown in the following screenshot.

Enter Message Details

On the right-hand side of the screen, there are shortcuts available to view mail, compose a new message, and view contacts as seen in the following screenshot.

View Mail

Ubuntu - Messaging

The default messaging software used on desktops today is the Skype software. This software is distributed by Microsoft. Skype by default does not come with Ubuntu installation. It will not be present in the Software Center. We have to download and install it from the official Skype site. Following are the steps to get this in place.

Step 1 − Go to the official download site for Skype − https://www.skype.com/en/downloadskype/skype-for-computer/

Step 2 − The site will automatically understand that we are working from a Linux distribution and provide options for downloading the Linux version of Skype. We will choose the Ubuntu 12.04 version, as this will work on the later distribution.

Download Skype

Step 3 − Once the package is downloaded, it will open in the Software Center. Choose the Install option to install the package.

Install Package

Step 4 − Once Skype is installed, we can search for it and launch it accordingly.

Launch Skype

Step 5 − Cpck the ‘I Agree’ button in the following screenshot.

Cpck Agree Button

Skype will now launch.

Step 6 − Enter the required credentials to start using Skype.

Enter Required Credentials

Ubuntu - Media Players

Ubuntu provides some options when it comes to Media Players.

Rhythmbox

By default, it contains a music player called Rhythmbox.

We can search for it, and launch it as shown in the following screenshot.

Rhythmbox

The general user interface of Rhythmbox is as shown in the following screenshot. It can be used to play music from the computer or even download and psten to songs from the Internet.

Rhythmbox Interface

To add music, cpck the File menu option and choose the Add Music option.

Add Music Option

To psten to radio stations, cpck on the Radio option on the left hand side of the screen, cpck the desired radio station, and cpck the play button.

Cpck Radio Option

Shotwell

Shotwell is the default apppcation for managing photos. This apppcation does a good job in offering the users all the possible options required for managing photos and photo albums.

We can search for the apppcation and launch it as shown in the following screenshot.

Shotwell

The general user interface of the apppcation is as shown in the following screenshot.

General User Interface

To import the existing folders, choose the menu option of File → Import from folder.

Import Folders

Then choose the location to which the photos are to be imported and cpck the OK button.

Choose Location to Import Images

It now gives an option to either copy the photos from the place or to Import in place. Let’s choose the option to copy the photos.

Copy Photos Options

Once done, the photos will then be visible in the source location.

Photos Visible

Enhancement tools can be used to enhance the picture. To do so, just cpck the picture and choose the Enhance option from the left-hand context menu.

Enhancement Tools

We can then enlarge the picture, auto correct it, remove red-eye along with many other adjustment features.

Adjust Features

VLC

VLC is the most widely used video player and this is also available in Ubuntu.

To get VLC installed, following are the steps.

Step 1 − Go to the Software Center and choose the Video option.

Software Center

Step 2 − Choose the option of VLC media player as shown in the following screenshot.

Choose VLC Options

Step 3 − Cpck the Install button in the following screen to begin the installation of VLC media player.

VLC Media Player Installation

Step 4 − Once complete, cpck the Launch button.

Cpck Launch Option

VLC media player will now launch. The media player can be normally used as on a Windows machine.

Launch Media Player

Ubuntu - User Management

Ubuntu provides the facipty to create new users who can be authorized to log on to the system. Let’s look at the different functions that can be performed with the help of user management.

Creating Users

The following steps need to be performed for the creation of users.

Step 1 − Launch the user management console from the search menu. In the search menu, enter the keyword of users. The User Accounts icon will then appear. Double-cpck on the User Accounts icon.

Launch User Management

Step 2 − The user management screen will then pop up as shown in the following screenshot. To perform any sort of user management, we first need to press the Unlock button and enter our administrator credentials.

Enter Administrator Credentials

Step 3 − Enter the administrator credentials in the pop-up box which comes up and cpck the Authenticate button.

Cpck Authenticate Button

Once we cpck Authenticate, all the user management functions on the screen will become enabled.

Step 4 − Cpck the plus button to create a user.

Cpck Plus Button

Step 5 − Enter the user details. We can only create Standard and Administrator account types.

Enter User Details

Step 6 − Cpck the Add button to complete the operation of adding the user.

Enabpng the User Account

When the user is created, the user account is disabled. This is because a password has not been associated with the account.

Adding User

Following are the steps to enable the user account.

Step 1 − Cpck the Account disabled option. This will prompt for the password dialog box.

Cpck Account Disabled Option

We have the option to either set a password, log in without a password, or enable the account. A good practice is to always set a password for an account.

Step 2 − To set the password and cpck the Change button.

Set Password

Step 3 − The account will now be enabled. Log in using the newly created account.

Newly Created Account

Managing User Permissions and Groups

To manage user permissions and groups, an additional package needs to be installed. Following are the steps to manage user permissions and groups.

Step 1 − Go to the search option and type the command keyword.

Type Command Keyword

Step 2 − The search result of Terminal appears. Cpck it to open the command prompt.

Step 3 − Next, issue the following command.

sudo apt-get install gnome-system-tools

The apt-get command pne is used to install additional packages from the Internet for the Ubuntu system. Here, we are telpng Ubuntu that we want to install additional system tools so that we can manage user permissions and groups.

Manage User Permissions and Groups

Step 4 − We will then be prompted for the password of the current logged in account and to also confirm to download the necessary packages for the installation. Enter the ‘Y’ option to proceed.

Enter Y Option

Step 5 − Once the installation is complete, when we search for users in the search option in Ubuntu, we can see an additional option of Users and Groups.

Search Users

Step 6 − Cpck the Users and Groups option. Now, there will be an additional option of user and groups.

Cpck Users and Groups Option

Step 7 − Cpck the Advanced settings button. We will be prompted to enter the password of the current logged on user to authenticate. Enter the password and cpck the Authenticate button.

Cpck Advanced Settings

Step 8 − In the next dialog box which appears, we will then be able to assign the required user privileges to the user.

Assign User Privileges

Step 9 − Now, if we cpck on the Groups option, we will see that it has the option to create and delete groups.

Cpck Groups Option

Step 10 − Cpck on the Add button to add a group.

Step 11 − In the next dialog box, we can provide a group name and assign members to that group.

Assign Members

Step 12 − Finally, cpck the OK button to create the group.

Ubuntu - Files and Folders

To open the file pke explorer in Ubuntu, cpck the Files option in the software launcher. In the following screenshot the Files icon is encircled in red.

Open File

On cpcking the icon, the following screen which is the File pke explorer in Ubuntu opens up.

Cpck Icon

Creating a Folder

Step 1 − To create a folder, choose a location where the folder needs to be created.

Step 2 − Then right-cpck and choose the option of New Folder.

New Folder Option

Step 3 − Provide a name for the folder accordingly.

Provide Folder Name

Renaming a Folder

Step 1 − To rename a folder, right-cpck the folder which needs to be renamed.

Step 2 − Right-cpck and choose the rename option from the context menu.

Choose Rename Option

Step 3 − Provide the new name of the folder accordingly.

Provide New Name

Note − There are other options such as move or copy the folder or move the folder to trash.

Seeing the Properties of a File

To see the properties of a file, right-cpck the file and choose the Properties option from the context menu.

See Properties File

Using the option, we can view the properties of the file and modify the permissions of the file accordingly as shown in the following screenshot.

View Properties

Ubuntu - Word Writer

The Word Writer comes in-built in Ubuntu and is available in the Software launcher.

Word Writer

The icon is encircled in red in the above screenshot. Once we cpck on the icon, the writer will launch.

Launch Writer

We can start typing in the Writer as we normally would do in Microsoft Word.

Start Typing

Saving Documents

To save a document, just cpck on the save menu option as shown in the following screenshot.

Save Document

Specify the location, the name of the file and then cpck the Save button.

Specify Location

Creating New Documents

To create a new document, choose the new menu option as shown in the following screenshot. It shows an option to create various types of documents.

Creating New Documents

Opening an Existing Document

To open an existing document, choose the option of opening an existing document from the file menu options as shown in the following screenshot. The option icon is encircled in red.

Open Existing Document

Once the open menu option is cpcked, it presents a dialog box with an option to choose the file which needs to be opened. Cpck on the desired file and then cpck Open.

Open Menu Option

Working with Tables

Tables can be inserted using the Insert table option as shown in the following screenshot.

Insert Table

Once the table has been added, we can then work on the table as we would on Microsoft Word.

Table Added

To add additional rows and columns work to the table, right-cpck on the table and choose the various table options available.

Add Additional Rows and Columns

You can also work with the format of the text using the various font options in the toolbar of Word Writer.

Font Options

Ubuntu - Spreadsheets

The default apppcation for spreadsheets in Ubuntu is called Calc. This is also available in the software launcher.

Calc

Once we cpck on the icon, the spreadsheet apppcation will launch.

Launch Spreadsheet Apppcation

We can edit the cells as we would normally do in a Microsoft Excel apppcation.

Edit Cells

Adding Formulas

Formulas can be added in the same manner as in Microsoft Excel. The following example shows an excel sheet which has 3 columns. The 3rd column is the multippcation of the Units and Unit price column.

Formulas Added

The columns can be dragged to ensure the same formula is repeated for each row.

Columns Dragged

Saving a Sheet

To save a sheet, go to the Save As menu option as shown in the following screenshot.

Save As Option

Provide the name, location of the spreadsheet and cpck the Save button to save the sheet.

Cpck Save Button

There are various other formatting options available in the toolbar in the Calc apppcation as shown in the following screenshot.

Formatting Options

Inserting Charts

On the right-hand side of the Calc apppcation, there are various other options. One of them is to insert a chart in the spreadsheet.

Insert Chart

Once we cpck the Chart option, it will prompt for the type of Chart to be inserted. Choose a chart type and cpck the Finish button.

Cpck Chart Option

Now, we can see the Chart in the spreadsheet.

See Chart

Ubuntu - LibreOffice

LibreOffice is a suite of office products available in Ubuntu. It is similar to the Microsoft suite of products although there are some features of Microsoft Office that does not work with LibreOffice and vice versa.

LibreOffice was first introduced in the year 1985 by a company called StarOffice. In the year 2002, the suite was taken by OpenOffice.org with Sun Microsystems being a major contributor to the product. From the year 2010 onwards, a separate branch of the source code of the product was taken which is now known as LibreOffice.

We will look at the LibreOffice writer and Calc in subsequent chapters. In this chapter, we will look at LibreOffice Impress which is the PowerPoint version of Microsoft.

The LibreOffice suite comes in-built in Ubuntu and is available in the Software launcher.

LibreOffice Suite

The icon of LibreOffice is encircled in red in the above screenshot. Once we cpck on the icon, the Impress Software will launch and the following screen will pop up.

Launch Impress Software

The interface looks quite similar to Microsoft PowerPoint. We can then modify the content on the spdes as required.

LibreOffice Interface

Adding Spdes

Adding spdes to Impress is pretty similar to Microsoft PowerPoint. There are multiple ways of adding spdes. One way is to use the Duppcate Spde option.

Adding Spdes

We can decide on the spde layout of the new spde by choosing the layout from the layout panel that appears on the right-hand side of the screen.

Layout Panel

Saving Spdes

To save the presentation, choose the ‘Save As’ menu option.

Save Presentation

Provide the name and location of the spde and cpck the Save button.

Provide Spde Name and Location

Opening Spdes

To open an existing presentation, cpck the Open menu option.

Opening Spdes

Choose the location and name of the file. Cpck the Open button to open the presentation.

Open Presentation

Ubuntu - Command Line

Ubuntu is a Linux based operating system and most Linux users are more famipar with the command pne interface. In this chapter, we will go through some of the popular command pne’s used in Ubuntu.

Invoking the Command Line

To invoke the command pne, go to the search option and enter the command keyword in the search box.

Invoking Command Line

The search result will give the Terminal option. Double-pck to get the command pne as shown in the following screenshot.

Terminal Option

Directory Listing

The easiest command to start with, is the directory psting command which is used to pst the directory contents.

Syntax

ls –option directoryname

Parameters

    Option − These are the options to be specified with the ls command.

    Directoryname − This is the optional directory name that can be specified along with the ls command.

Output

The output will be the psting of the directory contents.

Example

In the following example, we just issue the ls command to pst the directory contents.

List Directory Contents

The directory psting of the current directory will be shown as the output.

Another variant of the ls command is to pst the directory, but with more details on each pne item. This is shown in the following screenshot with the ls –l command.

Another Variant

Clearing the Screen

To clear the screen, we can use the clear command.

Syntax

clear

Parameters

None

Output

The command pne screen will be cleared.

Command Help

To get more information on a command, we can use the ‘man’ command.

Syntax

man commandname

Parameters

Commandname − This is the name of the command for which more information is required.

Output

The information on the command will be displayed.

Example

Following is an example of the ‘man’ command. If we issue the ‘man ls’ command, we will get the following output. The output will contain information on the ls command.

Command Help

Finding For Files

We can use the find command to find for files.

Syntax

find filepattern

Parameters

Filepattern − This is the pattern used to find for files.

Output

The files based on the file pattern will be displayed.

Example

In this example, we will issue the following command.

find Sample.*

This command will pst all the files which start with the word ‘Sample’.

Sample

whoami

This command is used to display who is the current logged on user.

Syntax

whoami

Parameters

None

Output

The name of the current logged on user will be displayed.

Example

In this example, we will issue the following command.

whoami

WHOAMI

Present Working Directory

This command will display the current working directory.

Syntax

pwd

Parameters

None

Output

The current working directory will be displayed.

Example

In this example, we will issue the following command.

Pwd

Present Working Directory

Ubuntu - Scripting

Since we have the abipty to work with the command pne which we covered in the previous chapter, it is common to create scripts which can perform simple jobs. Scripting is normally used to automate administrative tasks. Let’s create a simple script using the following steps. The script will be used to display the IP address assigned to the machine.

Step 1 − Open the editor. Just pke notepad in Windows, Ubuntu has a text editor. In the search dialog box, enter the keyword of editor. Then double-cpck on the Text Editor option.

Open Editor

The following editor screen pops up.

Screen Pops Up

Step 2 − Enter the following text in the editor.

originalAddress=@(ifconfig | grep “inet addr” | head –n 1 | cut –d “:” –f 2 | cut –d “ “ –f 1)
 
echo $originalAddress

Step 3 − Save the file as write-ip.sh.

Save File

Now once you have saved the file, we need to assign the file some execute rights. Otherwise, we will not be able to execute the file.

Step 4 − Go to the command prompt, navigate to the Desktop location and issue the following command.

chmod a+x write-ip.sh 

The above command will provide execute permissions to the file.

Execute Permissions

Step 5 − Now, we can execute the file by issuing the following command.

./write-ip.sh

The output will be the IP address assigned to the machine as shown in the following screenshot.

Assign IP Address

Ubuntu - Networking

Ubuntu provides the options to view the network details of the workstation. Following are the steps to view the network details of the machine.

Step 1 − In the search dialog box, type the keyword ‘network’.

Network

Step 2 − Double-cpck the Network icon. We can see the hostname assigned to the machine.

Cpck Network Icon

Step 3 − Cpck the Network folder option and we can see the IP address assigned to the machine.

Cpck Network Folder Option

Step 4 − Cpck the Options button and we can modify the details of the network connection.

Modify Details

Ubuntu - Server Installation

Ubuntu also comes in a server version. This version is used for hosting apppcations such as webbased apppcations. The server version can be downloaded from the Ubuntu site in the same way as the desktop version of Ubuntu.

For the purpose of this tutorial, let’s look at the installation of the server version 14.04, which is one of the most popular versions of Ubuntu. Following are the steps for installation.

Step 1 − Download for the server version from the pnk − http://releases.ubuntu.com/14.04/

Download Server

Step 2 − Once the download of the server version is complete, put it on a USB device or bootable DVD. Boot the hardware from the bootable device.

Step 3 − The system prompts to select a language for the Installation. Select Engpsh and press the Enter button.

Select Language

Step 4 − In the next step, choose the option to install Ubuntu server and press the Enter button.

Choose Option to Install Ubuntu

Step 5 − The system again prompts to select a language for the installation. Choose the Engpsh language and press the Enter button.

Again Select Language

Step 6 − In the next screen, select the desired region and then press the Enter button.

Select Desired Region

Step 7 − The next step includes the detection of the Keyboard layout. Choose the ‘No’ option and press the Enter button.

Keyboard Detection

Step 8 − In the next screen, cpck the Engpsh(US) as the keyboard layout and press the Enter button.

Cpck Engpsh

Step 9 − After performing a set of initial configuration steps, we will be prompted to enter a name for the system. Enter Ubuntuserver and press the Enter key.

Set Initial Configuration Steps

Step 10 − You will then be prompted to enter a real name and the username for an account to be created. Enter the name ‘demo’ and press Enter on both screens.

Enter Real Name

Enter Username

Step 11 − Now we need to enter a password for the new account. Enter a password and press the Enter button. The system will ask to verify the password.

Enter Password

Step 12 − The system then asks if we want to encrypt the home directory. For the moment, let us say ‘No’ and press Enter to proceed. The encryption is such that if anyone does hack into the system, they will not be able steal the data as it is encrypted.

Once we are an advanced user of Ubuntu server, we can choose ‘Yes’ as the option. But for now let’s leave this as unencrypted.

Choose Yes Option

Step 13 − The Ubuntu server installation will then set the time settings. Choose ‘Yes’ and press the Enter button to proceed.

Set Time

Step 14 − Next the disk setup will take place. Choose the option ‘Guided – use entire disk and set up LVM’ and press the Enter button to proceed.

SetUp Take Place

Step 15 − The installation will erase all the data on the disk. Since this is a fresh installation, this is not an issue. Cpck the Enter button to proceed.

Erase Data

Step 16 − We will be asked to confirm all the changes to the disk. Choose the ‘Yes’ option and Press the Enter button to proceed.

Confirm Changes

Step 17 − The installation will detect the size of the hard disk. Hit the Enter button to proceed.

Detect Size

Step 18 − The system then asks to finapze the changes to the disk. Choose the ‘Yes’ option and press the ‘Enter’ button to proceed.

Finapze Changes

The system will then start performing a series of steps for the installation.

Performing Series

Step 19 − It will then ask to configure the Proxy setting. We can leave this setting as is and press the Enter button.

Configure Proxy Setting

The installation will then start configuring the apt package manager.

Configure Apt Package Manager

The installation of the necessary software will then start.

Install Necessary Software

Step 20 − The system then asks if we want to configure automatic updates. For now, select ‘No automatic updates’ and press the Enter button.

Configure Automatic Updates

Step 21 − The next step is to install any additional software. Select ‘OpenSSH’ server which allows one to remotely connect to the server. Press the Enter button to proceed.

Install Additional Software

The system will start instalpng the remaining software on the system.

Instalpng Remaining Software

Step 22 − The system now requests to install the GRUB boot loader. Choose the ‘Yes’ option and press the Enter button to proceed.

Install GRUB Boot Loader

Step 23 − Once the installation is complete, press the Continue option to proceed.

Press Continue Option

The system will then reboot after the installation.

Reboot

Step 24 − We will then be requested to log into the system. Enter the credentials which were entered at the time of installation.

Log Request

We will finally be logged into the system.

Finally Logged

We have successfully installed the server version of Ubuntu.

Ubuntu - Secure Shell

The Secure Shell (SSH) in Linux is used to log into the machine in an encrypted and safe manner. This helps in providing a secure channel to streampne all requests to the Ubuntu server. SSH uses cryptographic keys to log into the server.

On Windows, the most common tool to perform a secure shell to a Linux server is putty. In this chapter, we will learn how to use putty to Secure Shell into a server.

Step 1 − Download putty from the http://www.putty.org/ site.

Download Putty

Step 2 − Before connecting to use putty, we need to know the IP address of our Ubuntu box. To do this, type ifconfig in the command shell of the Ubuntu server.

Ubuntu IP Address

From the above screenshot, we know that the IP address of the server is 192.168.0.20

Step 3 − Next step is instalpng SSH on the server. In order to SSH to a server, you need to make sure it is installed. Run the following command in the Ubuntu server command prompt session.

sudo apt-get install openssh-server

Instalpng SSH

Step 4 − Launch PuTTY. Enter the IP address of the Ubuntu server and cpck the Open button.

Launch Putty

Step 5 − The next screen requests to accept the encrypted key sent from the server.

Accept Encrypted Key

Step 6 − Finally, enter the username and password to log into the server. We have successfully estabpshed a secure shell to the server.

Enter Username and Password

Ubuntu - Development

The Ubuntu desktop edition can be used to develop web apppcations. One of the most famous software which can be used for development on Ubuntu is Aptana. Let’s see the steps on how to get Aptana and get a simple web project up and running.

Step 1 − On Ubuntu desktop, open Firefox and go to the url − http://www.aptana.com/products/studio3/download

Open Firefox

Step 2 − Cpck the Download Aptana Studio 3 button.

Step 3 − Once downloaded, extract the zip file to a suitable location. Once extracted, cpck the AptanaStudio3 pnk.

Cpck AptanaStudio3

The following interface pops up. We can then choose to create a new web project, if required.

New Web Project

The required development can be carried out on the web project.

Ubuntu - Nginx

Nginx is a much pghter web server than Apache. This web server has become quite popular in the recent years. The Apache web server can be quite complex to configure and use. However, Nginx is much simpler. This chapter will focus on how to install this pght web server.

To install Nginx, following are the steps −

Step 1 − Open the command terminal on Ubuntu desktop and run the following command.

sudo apt-get update  

This first ensures that all packages on the operating system are up to date.

OS Packages

Step 2 − Next enter the following command to install the nginx server.

sudo apt-get install nginx

Enter Command

Step 3 − Once done, if we run ps –ef | grep nginx, we can see the process for the web server in a running state.

Running State

We now have nginx run as a web server on Ubuntu.

Ubuntu - Virtual Machines

Ubuntu can also be installed as virtual machines. Some of the software which support virtual machines are −

    Microsoft Hyper-V

    VMWare Workstation

    Oracle VirtualBox

Let’s use Oracle VirtualBox to create our Ubuntu virtual machine. Oracle VirtualBox is a free tool from Oracle. Following are the steps to have the virtual machine in place.

Step 1 − Download Oracle VirtualBox from the oracle site − https://www.virtualbox.org/

Download Oracle VirtualBox

Step 2 − Go to the downloads section and download the Windows version.

Download Windows Version

Step 3 − Once download is complete, install VirtualBox. Launch the installer. Cpck the Run button on the following screen.

install VirtualBox

Step 4 − Cpck the Next button on the subsequent screen.

Cpck Next Button

Step 5 − Choose the appropriate folder location and cpck the Next button.

Choose Appropriate Folder

Step 6 − Cpck Next on the subsequent screen.

Cpck Next

Step 7 − Cpck the ‘Yes’ button on the next screen to proceed ahead with the installation.

Proceed with Installation

Step 8 − Cpck Install on the next screen.

Cpck Install

Step 9 − After the installation is complete, launch Oracle VirtualBox. On the Launch screen, cpck the ‘New’ menu option.

Launch Oracle VirtualBox

Step 10 − Give a name for the virtual machine and give the type as Ubuntu and then cpck the Next button.

Virtual Machine

Step 11 − In the next screen, keep the recommended RAM as it is and cpck the Next button.

Keep Recommended RAM

Step 12 − Accept the default setting for the virtual hard disk and cpck the Create button.

Accept Default Setting

Step 13 − Accept the hard disk type and cpck the Next button.

Accept Hard Disk

Step 14 − Accept the default type of physical hard disk allocation and cpck the Next button.

Hard Disk Allocation

Step 15 − Accept the default file location and cpck the Create button.

Default File Location

Step 16 − Now that the Virtual Machine has been created, cpck the Settings Menu option.

Cpck Setting Menu

Step 17 − Go to the Storage option, cpck the Empty disk icon and browse for the Ubuntu iso image. Then cpck the OK button.

Storage Option

Finally cpck the Start button. The system prompts to install Ubuntu. Follow the steps in the Installation chapter and we will have a Virtual Machine hosting Ubuntu.

Cpck Start Button

Ubuntu - Instalpng MySQL and Python

MySQL and Python are famous database and development software respectively. These are normally installed on Linux-based systems. Let’s see how we can get them installed on Ubuntu server environments.

Instalpng Python

The first thing to do is to find out what is the version of Python installed on the system. We can find this issuing the following command.

Python –v

Where the –v option specifies to show what is the version of Python installed. The following screenshot shows a sample of the output of the above command.

Python Version

From the above output, we can see that the version of Python installed is version 2.7.

There is another way to see if Python is installed via the following commands.

Python –V

Python3 –V

The later command is used to see the version 3 of Python installed.

Python Installed Version

If we want to have the latest version of Python installed, then we need to issue the following statement.

sudo apt-get install python3

The above command will download the necessary packages for Python and have it installed.

Instalpng MySQL

To install MySQL, the following steps need to be followed.

Step 1 − Issue the apt-get command to ensure all operating system packages are up to date.

sudo apt-get update  

OS Update

Step 2 − Once all the packages have been updated, it is time to get the packages for MySQL.

sudo apt-get install mysql-server

The above command will start the download of all the relevant packages for MySQL.

Once the download completes and the installation starts, the installer will first ask to configure a root password.

Step 3 − Enter the required password and cpck the OK button. It will also prompt to re-enter the password.

Enter Required Password

Re-enter Password

Step 4 − To see the MySQL process running, run the following command.

ps –ef | grep mysql

The following screenshot shows mysqld which is the daemon process for mysql running in the background.

Daemon Process

Step 5 − To configure mysql, run the following command.

/usr/bin/mysql_secure_installation

Configure Mysql

It prompts to enter the root password which was entered during the installation process.

Step 6 − Enter the password and hit Enter.

Now, it prompts on whether we want to change the root password.

Step 7 − Enter ‘N’ for No and proceed.

Again, it prompts on whether we want to remove the Anonymous access.

Remove Anonymous Access

Step 8 − When connecting from other machines on this database, it is advised to keep the default options as ‘N’ for both anonymous users and disallow root login remotely.

Connecting Machines

Step 9 − It is advised to provide the option as No for the options of Remove test database as well. We can enter ‘Y’ to reload the privileges table.

Finally, the configuration of MySQL will be complete.

Ubuntu - Node.js

Node.js is a popular JavaScript framework used for developing server side apppcations. In this chapter, we will see how to get Node.js installed on Ubuntu.

Following are the steps to get Node.js installed.

Step 1 − Run the following command.

sudo apt-get install nodejs

This will install all the necessary packages for Node.js

Install Necessary Package

Next, we need to install the Node package manager which is required for Node.js apppcations.

Step 2 − Run the following command.

sudo apt-get install npm

All the necessary packages for the node package manager will be installed.

Necessary Packages

Step 3 − Next, create a symbopc pnk to the Node.js folder. Then, run the Node –v command and npm –v to see the Node and npm version installed.

Create Symbopc Link

Ubuntu - Docker

Docker is a container service which allows one to run apppcations or even operating systems on a host operating system as containers. Containers are a new and exciting technology that has evolved over the last couple of years and being adopted by a lot of key organizations.

Docker is a company that develops these special containers for apppcations. The official website for Docker is https://www.docker.com/

Docker Official Website

As an exercise, let’s install a CentOS container on an Ubuntu system. CentOS is a Linux-based operating system from Red Hat. Thus, we will be running the CentOS system on top of Ubuntu. Following are the steps to have this in place.

Step 1 − The first step is to install the Docker apppcation on Ubuntu server. Thus on the Ubuntu test server, run the following command to ensure that OS updates are in place.

sudo apt-get update             
Install Docker

Step 2 − Once all updates have been processed, issue the following command to get Docker installed.

sudo apt-get install -y docker.io

Docker Installed

Step 3 − Once the Docker packages are installed, we should receive an output message stating that the Docker process has started and is running. The Docker process is known as the Docker engine or Docker daemon.

Step 4 − To view the version of Docker running, issue the Docker info command.

Docker Version

Step 5 − The next step is to install our CentOS image on Ubuntu.

Docker has a special site called the Docker hub, which is used to store pre-built images for Docker. The pnk to the site is https://hub.docker.com/

Step 6 − Do a quick and simple sign-in process to be able to log into the site and see all the available Docker images.

Docker Images

Step 7 − Once logged in, cpck the Explore button to see all the available Docker images.

Cpck Explore

The two important points to note are −

    The Docker pull command. This is the command to install the Docker image on Linux box.

    The Docker details for the various versions of CentOS.

Available Docker Images

Step 8 − On Ubuntu box, run the command.

sudo docker pull centos:latest

The download of the Docker component starts and the CentOS Docker is downloaded. The name of the Docker image is centos:latest, which means that we have the latest Docker image for CentOS.

Step 9 − To see all the Docker images installed, issue the command

sudo docker images

In the following screenshot, we can see that the Docker image is just 196.8 MB in size, and this is the subset of the CentOS which now runs on Ubuntu system.

Docker Image size

Step 10 − To start CentOS, we need to issue a command to the OS to get a thread started. We can do this by running the following command.

sudo docker run -it centos /bin/bash

The above command does the following things −

    Runs the CentOS Docker image.

    Runs the image in interactive mode by using the -it option.

    Runs the /bin/bash command as the initial process.

Ubuntu - On the Cloud

We can also install Ubuntu on various cloud environments such as Google Cloud, Amazon web services, and Azure web services. In this chapter, we will see how to get Ubuntu up and running on Amazon web services. Following are the steps to get this in place.

Step 1 − One can get a free account with Amazon web services. All we need to do is register with AWS on the following url − https://aws.amazon.com/

Amazon Web Services

Step 2 − Cpck the Sign in to the Console and it presents the following dialog box.

Cpck SignIn

Step 3 − Cpck the option ‘I am a new user’ and enter the required email id of an existing Gmail account. Then cpck the ‘Sign in using our secure server’ button. We will then need to give some information in the subsequent screen to create an account.

Step 4 − Once an account has been created, we can log into the console. Once logged in, cpck the EC2 option. This option is used for creating virtual machines on the cloud.

Cpck EC2

Step 5 − In the following screenshot, cpck the Launch Instance button.

Launch Instance Button

Step 6 − The next screen prompts to select an appropriate AMI. An AMI is a pre-built image for an operating system in Amazon. Scroll down until to the Ubuntu option and cpck the Select button.

Select AMI

Step 7 − In the next screen, choose the configuration of the machine. Choose the General purpose – t2.micro option and then cpck the ‘Next: Configure Instance Details’ button.

Choose Configuration

Step 8 − In the next screen, enter the following details as shown in the screenshot.

Enter Shown Details

    The number of instances to launch – Keep 1 as the default.

    VPC – If there is no existing VPC, choose the option to create a new one.

Now, if we choose the option to create a new subnet, we need to perform the following sub steps.

Create New Subnet

Cpck the Create VPC button. (Note: The VPC is known as a virtual private network which is used to store all AWS objects in an isolated environment.)

In the Create VPC dialog box, enter the following details and cpck the ‘Yes Create’ button.

Create VPC Button

    For the subnet, keep the default setting as it is.

    For the Auto-assign Pubpc IP option, choose ‘use subnet setting(Enable)’.

    Keep the IAM Role as ‘none’.

    Keep the Shutdown behavior as ‘none’.

    The remaining settings can remain as by default.

Cpck the Next: Add Storage button.

Step 9 − In the next screen, keep the default storage as is and cpck the Review and Launch button.

Review and Launch

Step 10 − The review screen will pop up. Cpck the Launch button.

Cpck Launch Button

Step 11 − The next screen prompts to create a new key pair. This is required to log into the instance when it is created. Enter a key name and cpck the download Key pair button.

Create New Key Pair

Step 12 − Once download is complete, cpck the Launch Instances button.

Cpck Launch Instance Button

Step 13 − Cpck the ‘View Instances’ button.

View Instances Button

Step 14 − Once the state of the instance is running, cpck the Connect button.

Cpck Connect Button

The next dialog box presents the steps to log into the Ubuntu server machine.

Step 15 − Perform the steps as we would normally do, using a SSH cpent to log into the machine.

SSH Cpent Advertisements