0% found this document useful (0 votes)
6 views5 pages

OS Midterm Reviewer

This document provides a comprehensive guide on installing and configuring virtual machines using Oracle's VirtualBox and VMware on Ubuntu, including detailed steps for setting up a virtual machine, installing necessary packages, and configuring Python. It also covers the basics of Linux, virtualization, and containerization using Docker, highlighting the advantages of virtualization and the differences between containers and virtual machines. Additionally, it outlines popular Linux distributions and their characteristics, along with installation instructions for SeaDAS and OCSSW.

Uploaded by

2242405
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

OS Midterm Reviewer

This document provides a comprehensive guide on installing and configuring virtual machines using Oracle's VirtualBox and VMware on Ubuntu, including detailed steps for setting up a virtual machine, installing necessary packages, and configuring Python. It also covers the basics of Linux, virtualization, and containerization using Docker, highlighting the advantages of virtualization and the differences between containers and virtual machines. Additionally, it outlines popular Linux distributions and their characteristics, along with installation instructions for SeaDAS and OCSSW.

Uploaded by

2242405
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

OS Virtualization Guide Installing Packages in Ubuntu

Note: The “$” symbol indicates a new command start. Do not


retype it; it appears automatically in Ubuntu Terminal.
How to Install and Configure a Virtual Machine Note: Scripting is CASE SENSITIVE
Step-by-Step Process
Accessing the Terminal
1. Setting Up the Virtual Machine • Open via Ubuntu app manager or Ctrl+Alt+T.
o Software: Oracle’s VirtualBox (free, supports
various OS). 1. Gaining Root Privileges
o Download VirtualBox:
https://www.virtualbox.org/wiki/Downloads a. Add User to Sudo Group
o Version: Use VirtualBox 6.1.30. $ sudo adduser <user> sudo

2. Installing Linux (Ubuntu)


o Linux Version: Ubuntu 16.04 (dependent on 2. Installing Required Programs and Packages
32- or 64-bit machine).
o Download Ubuntu .iso file: a. Java 17 (Oracle Version)
https://releases.ubuntu.com/16.04.7/. $ sudo add-apt-repository ppa:linuxuprising/java
$ sudo apt update
3. Opening VirtualBox Interface $ sudo apt install oracle-java17-installer --install-recommends
o Install VirtualBox, then open the interface. # Accept terms and conditions (press OK and Yes as needed).

4. Creating a New Virtual Machine b. Git (Required for Requests Installation)


o Click “New,” name the VM, and set the save $ sudo apt install git
folder. $ sudo apt update
o Selecting the OS name will auto-fill
type/version fields. Click Next. c. cURL (Required for OCSSW Installation)
$ sudo apt install curl
5. Allocating Memory $ sudo apt update
o Recommended: 1024 MB. Click Next.

6. Creating a Hard Disk


o Select “Create a virtual hard disk now” Configuring and Installing Python 3.6
(default). Click Create.
Python 3.6 Installation and Configuration for Ubuntu 16.04
7. Choosing Hard Disk File Type
o Default to VDI. Click Next. 1. Installing Python 3.6
$ sudo add-apt-repository ppa:deadsnakes/ppa
8. Selecting Storage Type $ sudo apt update
o Use “Dynamically Allocated” (prevents $ sudo apt install python3.6
space allocation issues). Click Next.
2. Installing Pip
9. Setting Disk Location and Size $ sudo apt install python3-pip
o Allocate at least 25 GB. Configure and save $ python3.6 -m pip install --upgrade pip
location.
3. Changing Default Python Version
10. Mounting the Operating System $ sudo update-alternatives --install /usr/bin/python3 python3
o Go to Settings > Storage. Under IDE /usr/bin/python3.5 1
Controller, click Empty > Attributes > load $ sudo update-alternatives --install /usr/bin/python3 python3
the Ubuntu .iso file. /usr/bin/python3.6 2
$ sudo update-alternatives --install /usr/bin/python python
11. Installing Ubuntu /usr/bin/python3.5 1
o Click Start and begin installation. $ sudo update-alternatives --install /usr/bin/python python
o Select “Install Ubuntu” to start the process. /usr/bin/python3.6 2

12. Skipping Updates 4. Installing the Requests Library


o Click Continue to proceed without updates. $ python -m pip install requests
o Clean install option will appear. Continue. $ git clone git://github.com/psf/requests.git
$ cd requests
13. Creating Username and Password $ python -m pip install .
o Remember credentials; required for login $ cd
and root verifications.
5. Configuring Requests in Python
14. Installing Guest Additions $ python
o Access: Devices > Insert Guest Additions CD >>> import requests
image. >>> r = requests.get('https://urs.earthdata.nasa.gov',
o Install and reboot to enable PC-like auth=('username', 'password'))
functions (e.g., copy-paste, full screen). >>> r.status_code
>>> r.headers['content-type']
>>> r.encoding
>>> r.text
>>> r.json()
>>> exit()
Section 2: Linux Distribution and Virtualization
Introduction to Linux
Installing SeaDAS and OCSSW
SeaDAS and OCSSW Installation in Ubuntu • History:
o 1969: Development of the C language and
1. Download SeaDAS Unix OS by Dennis Ritchie and Ken
• SeaDAS Download Page Thompson at AT&T Bell Labs.
o 1975: Commercial release of Unix by AT&T;
2. Move SeaDAS Installation File emergence of BSD Unix.
$ mv ~/Downloads/seadas_{version}_linux64_installer.sh ~/ o 1980s: IBM, Sun, HP, and others created
proprietary Unix versions, leading to diverse
3. Run SeaDAS Installation Command Unix dialects.
o GNU Project: Richard Stallman aimed to
$ sh seadas_{version}_linux_installer.sh create a freely available OS (GNU - "GNU is
Not Unix"), which later contributed tools to
Ex. $ sh seadas_8.1.0_linux64_installer.sh Linux.

• Linux Kernel Development:


o 1991: Linus Torvalds created the POSIX-
Section 1: Virtualization and Linux Virtual Machines compliant Linux kernel for Intel x86 PCs.
Overview of Virtualization o 1990s: Integration with GNU software
facilitated Linux's growth.
• Definition: Virtualization creates virtual o Internet and GUI Support: Implemented
representations of servers, storage, networks, and TCP/IP for internet access and X11 (X-
other hardware. windows) for GUI.
• Functionality: Simulates physical hardware to run
multiple virtual machines (VMs) on a single machine. Key Features of Linux
• Benefits: • Unix-like System: Combines features from popular
o Efficiency: Optimizes hardware resources, Unix systems.
maximizing returns on investment. • POSIX Compliance: Adheres to POSIX standards.
o Cloud Computing: Powers cloud services for • Wide Hardware Compatibility: Supports multiple
efficient infrastructure management. architectures (e.g., Intel x86, Motorola, SPARC, ARM).
• Free and Easy Installation: Popular among computer
Advantages of Virtualization science students and widely available for desktops
• Flexibility: Allows greater interaction with hardware and laptops.
resources.
• Reduced Physical Limitations: Linux in Modern Technology
o Eliminates issues like electricity
consumption, storage space, and • Global Usage:
maintenance. o Powers over 97% of supercomputers and
o Removes physical proximity and network more than 80% of smartphones.
design constraints. o Used in web servers, desktops, tablets,
appliances (e.g., routers, DVD players), self-
Virtualization Example driving cars, and even space station laptops.

1. Company Requirements: • Dominance: The most widely used operating system


o Email Storage: Requires more storage and a worldwide.
Windows OS.
o Customer-facing Application: Needs a Linux
OS and high processing power.
o Internal Business Application: Requires iOS B. Linux Distribution
and higher RAM.
The Linux Kernel
2. Traditional Setup: • Definition: Core part of an OS, responsible for
o Three dedicated physical servers with interfacing with hardware, managing CPU and
unique configurations. memory.
o High initial investment, ongoing • Role: Provides essential services to the system but
maintenance, and underutilized resources. cannot function as a standalone OS.
• Distinction from Android: Since Android is a
3. Efficient Hardware Use with Virtualization: complete OS, it isn’t classified as a Linux kernel
o Creates three virtual machines on a single despite using it.
physical server.
o Reduces hardware quantity and associated The Linux Distribution (Distro)
expenses. • Definition: A complete OS that includes the Linux
kernel plus additional software (utilities, libraries,
Infrastructure as a Service (IaaS) GUI, etc.).
• Cloud Instance: Uses VMs from cloud providers (e.g., • Development: Overseen by the Linux kernel
AWS, Google Cloud). development group, but each distro includes varying
• Benefits: packages, interfaces, and functions.
o Providers manage hardware.
o Customizable server resources. Popular Linux Distributions
o Simplified server management for IT teams. 1. Debian Linux
o Focuses on free software and supports
multiple hardware platforms.
o Uses .deb package format and dpkg package
manager.
2. Ubuntu Linux 2. Install VirtualBox
o Based on Debian, designed for regular o Double-click the downloaded .exe file to
releases and consistent user experience. install VirtualBox on Windows 10.
o Offers various official distributions (variants) o The installation will add an Oracle VM
with shared software repositories. VirtualBox icon to the desktop.

3. Linux Mint 3. Create a VirtualBox Virtual Machine (VM)


o Community-driven, based on Debian and o Open VirtualBox and click the New button.
Ubuntu. o Configure the VM with:
o Known for user-friendliness and multimedia ▪ Memory: 1024 MB
support, favored by beginners. ▪ Virtual Disk: 12 GB

4. RPM-based Linux (e.g., Red Hat, SUSE) 4. Install Ubuntu 14.04 on the VirtualBox VM
o Original RPM file format users, divided into o Insert the Ubuntu 14.04 installation DVD.
commercial and community-supported o Start the VM to boot from the DVD and
versions: install Ubuntu 14.04.
▪ Fedora (community) and Red Hat
Enterprise Linux (commercial) for 5. Adjust Display Size
Red Hat. o To resolve display resolution issues:
▪ openSUSE (community) and SUSE ▪ Open a terminal and enter the
Linux Enterprise (commercial) for xdiagnose command.
SUSE. ▪ In the X Diagnostic settings
window, enable all options under
5. Slackware Linux Debug to set the resolution to
o Highly customizable, prioritizes reliability 1024x768.
and ease of maintenance over automation.
o Targeted toward advanced users interested
in manual system configuration.
OPTION 2: Using the VMware Application

Overview: VMware is another popular virtualization option


C. Linux Hardware Platforms for x86-based PCs, with free versions like VMware
• Intel x86 Origin: Originally designed for Intel x86 PCs Workstation Player for basic tasks.
in 32-bit mode; now supports both 32-bit and 64-bit.
Steps for Installation and Setup on Windows 10
• Ported Architectures: 1. Download and Install VMware Workstation Player
o Motorola MC6800, MIPS, SPARC, PowerPC, o Visit VMware's download site to obtain
and ARM. VMware Workstation Player for Windows
o Predominant Platform: Still Intel x86, 10.
though ARM usage is growing for o Double-click the downloaded file to install
embedded systems. VMware, adding a Workstation icon to the
desktop.

2. Install Ubuntu 15.10 on VMware VM


D. Linux on Virtual Machines o Download Ubuntu 15.10 install DVD image
• Dual-Boot with Windows: Linux can be installed and burn it to a DVD disc.
alongside Windows (e.g., Windows 7 or 10) with a o Download VMware Workstation Player
dual-boot setup. 12 .exe file for Windows 10 and install it.
o Start VMware Workstation Player, then:
• Challenges: ▪ Choose Create a new virtual
o Many users avoid dual-boot due to technical machine.
difficulty or preference for Windows. ▪ Insert the Ubuntu DVD in the DVD
RW drive.
• Alternative: Install Linux within a virtual machine ▪ Choose Linux as the operating
(VM) on a Windows 10 host for easier access and system type and Ubuntu as the
use. version.
▪ Name the virtual machine
appropriately, e.g., ubuntu.
▪ VMware will configure the VM
OPTION 1: Using the VirtualBox Application with:
▪ Disk Size: 20 GB
Overview: VirtualBox is a powerful x86 and AMD64/Intel64 ▪ Memory: 1 GB
virtualization product from Oracle, compatible with Windows, ▪ Click Finish to complete the VM
Linux, macOS, and Solaris hosts. setup.
▪ Select Play virtual machine to boot
Steps for Installation and Setup on Windows 10 from the Ubuntu DVD and begin
1. Download VirtualBox installation.
o Visit the VirtualBox website to download
the following: 3. Run a C Program under Ubuntu Linux
▪ VirtualBox binary (e.g., VirtualBox- o After installation, the VM will start,
5.1.12-112440-win.exe) displaying the Ubuntu desktop, where you
▪ VirtualBox Extension Pack for USB can run applications such as a C program.
2.0 and 3.0 support, RDP, disk
encryption, NVMe, and PXE boot
for Intel cards.
Containerization Using Docker o docker run – Runs a command in a new
Introduction container.
• Container: A standard software unit that includes all ▪ -d – Runs the container in
code and dependencies, enabling reliable application detached (background) mode.
execution across different environments. ▪ -t – Allocates a pseudo-TTY.
• Docker Container Image: A lightweight, standalone, 4. docker container rm <container_name> – Deletes a
executable software package with: container.
o Code 5. docker image rm <image_name> – Deletes an
o Runtime image.
o System tools 6. docker exec – Runs a command in a running
o System libraries container.
o Settings o -ti – Keeps STDIN open even if not attached
• Run-time Containers: Images become containers at and allocates a pseudo-TTY.
runtime, managed by Docker Engine. Docker o Example: /bin/bash – To access the
containers work uniformly on various infrastructures container.
by isolating software from its environment, ensuring 7. docker stop <container_name> – Stops a running
consistency across development and staging. container.
8. docker kill <container_name> – Forcefully stops a
Container vs. Virtual Machines container.
• Containers: 9. docker restart <container_name> – Restarts a
o Operate at the application layer by running container.
packaging code and dependencies. Note: After executing the command, you are automatically
o Multiple containers share the OS kernel, logged into the Ubuntu container.
running isolated processes in user space.
o Lightweight, typically tens of MBs. Docker Environment Variables
o Allow multiple applications per container • DOCKER_API_VERSION: Override the negotiated API
and fewer VMs/OS instances. version for debugging (e.g., 1.19).
• Virtual Machines (VMs): • DOCKER_CERT_PATH: Location of authentication
o Operate by abstracting physical hardware, keys for the Docker CLI and daemon.
turning one server into multiple virtual • DOCKER_CONFIG: Path to client configuration files.
servers. • DOCKER_CONTENT_TRUST_SERVER: URL of the
o Each VM contains: Notary server, defaults to the registry URL.
▪ Full OS copy • DOCKER_CONTENT_TRUST: Enables Docker to use
▪ Application Notary for signing and verifying images.
▪ Required binaries and libraries • DOCKER_CONTEXT: Name of the Docker context to
o Heavier (tens of GBs) and slower to boot. use, overrides DOCKER_HOST.
• DOCKER_CUSTOM_HEADERS: Configures custom
Download and Installation of Docker Desktop HTTP headers for the Docker client.
1. Download: Visit Docker Desktop. • DOCKER_DEFAULT_PLATFORM: Specifies the default
2. Select OS: Choose the OS compatible with your platform for commands with --platform.
device. • DOCKER_HIDE_LEGACY_COMMANDS: Hides legacy
3. Run Installer: Execute the downloaded file. commands (e.g., docker rm, docker pull) in help
4. Configuration: Enable options like: output.
o Hyper-V Windows Features • DOCKER_HOST: Specifies the daemon socket to
o Windows components for WSL 2 connect to.
o Shortcut to desktop • DOCKER_TLS: Enables TLS for Docker CLI
5. Restart Device: Complete the installation with a connections.
device restart. • DOCKER_TLS_VERIFY: Verifies remote connections
with TLS.
Getting Started with Docker • BUILDKIT_PROGRESS: Specifies the progress output
1. Launch Docker Desktop: Open the application after type for BuildKit backend builds (e.g., plain, tty,
installation. auto).
2. System Tray Check: Docker logo should appear in the
System Tray or Notification area.
3. Version Check:
o Open Command Prompt. Exercises: Using an Existing Container
o Type: docker -v to verify Docker version.
1. Download an existing image:
Docker Commands o Run the command: docker pull
• Syntax: docker <command> <image_name>
• Help: Type docker <command> --help for o You can browse available images on Docker
descriptions and syntax assistance. Hub at Docker Hub.
2. Verify the image is downloaded:
o Run the command: docker images
3. Run the image to create a container:
Basic Docker Commands o Run the command: docker run -d -t
1. docker images – Displays the list of installed Docker <image_name>
images. ▪ The -d flag runs the container in
2. docker ps – Displays the list of running Docker detached mode (background).
containers. ▪ The -t flag allocates a pseudo-TTY.
o -a – Shows all containers (by default, only 4. Determine the container ID of the image:
running ones are shown). o Run the command: docker ps -a
3. Execute the Ubuntu container: ▪ This will show all containers,
o docker start <container_name> – Starts a including stopped ones.
Docker container. 5. Run the container:
o Run the command: docker exec -ti
<container_ID>
▪ The -ti flags keep STDIN open and
allocate a pseudo-TTY.
▪ This logs you into the container,
where you can execute commands.

Building Your First Java Docker Image

1. Create a working directory:


o Example: C:/d528Lab/Desktop/docker.demo

2. Create a Java application that prints out "Hello


World!" and save it as HelloWorld.java:
o Example code for HelloWorld.java:

public class HelloWorld {


public static void main(String[] args) {
System.out.println("Hello World!");
}
}

3. Compile the Java file:


• In your terminal or command prompt, navigate to
the directory and run: javac HelloWorld.java

4. Create a Dockerfile:
• Open Notepad++ or any text editor, and create a file
named Dockerfile (no extension).

5. Write the following inside the Dockerfile:


• Use this content in the Dockerfile:

- FROM openjdk:7 uses the OpenJDK 7 base image.


- COPY . /usr/src/myjava copies all files from your
current directory to /usr/src/myjava in the container.
- WORKDIR /usr/src/myjava sets the working directory
inside the container.
- RUN javac HelloWorld.java compiles the Java file.
- CMD ["java", "HelloWorld"] runs the Java application
when the container starts.

6. Build the Docker image:


• Run the command: docker build .
o The . refers to the current directory where
your Dockerfile and HelloWorld.java are
located.

7. Determine the image ID:


• Run the command: docker images
o This will list all the available images with
their IDs.

8. Run the image:


• Run the command: docker run -ti <image_ID>
o This will start the container from your Java
image and print "Hello World!" in the
terminal.

You might also like