Lecture
Lecture
Objectives
1. Introduction of Backup Tools: Understand tools used for data backup to protect against
loss.
2. Implementation of Backup Tools: Learn how to use these tools practically for efficient
backups.
1. Simple Copy
2. Rsync
3. Tar Utility
Definition: "Tar" stands for Tape Archive, a utility for archiving multiple files into a
single file.
Use Cases:
o Create compressed backups.
o Extract and manage archived files.
Key Commands:
1. Create a Tar Archive:
2. tar -cvf archive.tar /path/to/files
-c: Create a new archive.
-v: Show progress.
-f: Specify the file name.
3. Create a Gzipped Tar Archive:
4. tar -czvf archive.tar.gz /path/to/files
-z: Compress with gzip.
5. Create a Bzip2 Tar Archive:
6. tar -cjvf archive.tar.bz2 /path/to/files
-j: Compress with bzip2.
7. Extract Files from a Tar Archive:
8. tar -xvf archive.tar
-x: Extract files from
the archive.
9. Uncompress a Bzipped Tar Archive:
10. tar -xjvf archive.tar.bz2
11. List Contents of a Tar Archive:
12. tar -tvf archive.tar
-t: Display the files in the archive.
Command Syntax: Be able to write and explain the commands for cp, rsync, and tar.
Comparison:
o Understand the difference between rsync and cp.
o Explain the advantages of using tar for backups.
Scenarios:
o Given a situation, decide whether to use cp, rsync, or tar.
Objectives
1. Job/Process
Foreground Job:
o The shell waits for the process to complete before accepting new commands.
o Example: Running ls to list files.
Background Job:
o The shell does not wait for the process to finish, allowing you to run additional
commands.
o Execute a background job using the ampersand (&) operator.
o Example:
o sleep 10 &
3. Introduction to Scripting
What is Bash?
o A command-line shell used for writing and executing scripts.
o Scripts automate repetitive tasks using a series of commands.
Permissions in Scripting:
o Grant execute permission to a script using:
o chmod +x script_name.sh
1. Write to Output:
2. echo "Hello, World!"
3. Read User Input:
4. echo "Enter your name:"
5. read name
6. echo "Hello, $name!"
7. Arithmetic Operations:
8. num1=5
9. num2=3
10. sum=$((num1 + num2))
11. echo "Sum: $sum"
12. Script Execution:
o Execute the script:
o ./script_name.sh
6. References
1. Understand Concepts:
o Jobs and processes (foreground vs. background).
o Basics of bash scripting.
2. Memorize Commands:
o Practice command syntax and behavior for &&, ||, |, and others.
3. Scenarios:
o Write scripts for basic operations like reading input, arithmetic, and chaining
commands.
4. Explain Use Cases:
o Why use background jobs?
o How do logical operators improve scripting efficiency?
Objectives
1. Hypervisors
Definition:
o A hypervisor, or virtual machine monitor (VMM), enables multiple operating
systems (OS) to run concurrently on a single host computer.
o Acts as a traffic controller for system resources like memory and I/O.
Types of Hypervisors:
1. Type 1 Hypervisor (Bare Metal):
Runs directly on system hardware.
Examples: VMware ESXi, Microsoft Hyper-V, Xen.
2. Type 2 Hypervisor (Hosted):
Runs on a host operating system.
Examples: KVM, VMware Player, Oracle VirtualBox.
2. Virtualization
Full Virtualization:
o The guest OS operates as though it runs on dedicated hardware without knowing
about the hypervisor.
o Limitation: Performance issues due to hardware emulation.
Para-Virtualization:
o The guest OS is aware of being virtualized and communicates directly with the
host OS.
o Limitation: Requires modifications to the guest OS, leading to compatibility
issues.
3. Virtual Private Server (VPS)
Definition:
o A virtual machine provided as a service by hosting companies.
o Each VPS runs its own OS and allows users to install custom software.
Key Features:
o Dedicated resources within a shared environment.
o Full administrative (superuser) access.
4. Cloud Computing
Definition:
o Delivery of on-demand computing resources (applications, storage, data centers)
over the internet on a pay-per-use basis.
Key Characteristics:
1. Elastic Resources: Scales up/down quickly.
2. Metered Service: Pay only for what you use.
3. Self-Service: Access resources independently.
1. Public Cloud:
o Owned by third-party providers.
o Accessible via the internet.
o Examples: AWS, Microsoft Azure.
o Key Features:
Affordable computing resources.
Scalable IaaS, SaaS, and PaaS services.
2. Private Cloud:
o Exclusive infrastructure for a single organization.
o Offers greater control, security, and customization.
o Hosted internally or externally.
3. Hybrid Cloud:
o Combines private and public clouds.
o Benefits:
Keeps sensitive data in private environments.
Leverages public cloud for scalability and modern applications.
1. Infrastructure:
o VPS: A single server partitioned into multiple virtual servers.
o Cloud: A network of interconnected servers providing resources.
2. Availability:
o VPS: Downtime during server failure.
o Cloud: Minimal downtime as resources are rerouted to another server.
3. Payment Model:
o VPS: Payment for pre-allocated resources.
o Cloud: Pay-as-you-go model.
4. Resource Distribution:
o VPS: Shared CPU and memory among all VPS slices.
o Cloud: Dedicated resources as per allocation.
5. Choice of OS:
o VPS: Limited to the host OS.
o Cloud: Flexible to install or replace any OS.
References
1. Memorize Definitions:
o Hypervisors (Type 1 and Type 2), VPS, and Cloud.
2. Understand Comparisons:
o Full vs. Para-Virtualization.
o VPS vs. Cloud.
o Public vs. Private vs. Hybrid Clouds.
3. Practical Applications:
o Be prepared to explain real-world use cases for SaaS, PaaS, and IaaS.
4. Examples:
o Include examples of hypervisors and cloud services in answers.
Lecture#12
Lecture 12: SSH Key Pairs & RAID - Main Points Defined
Objectives
1. Telnet
Definition:
o A terminal emulation protocol enabling remote connection to a host over port 23.
o Example:
o telnet hostname
Use Case:
o Manage files or accounts on remote computers.
Limitation:
o No encryption, making it insecure for sensitive data.
Definition:
o A cryptographically secured protocol for remote communication and command
execution.
Key Features:
o Authentication of client and server.
o Encryption of data transfer.
How It Works:
1. The client sends the ID of the key pair for authentication.
2. The server checks for a matching public key in the authorized_keys file.
3. If found, the server encrypts a random number using the public key and sends it to
the client.
4. The client decrypts the message using the private key, calculates an MD5 hash
with the session key, and sends it back.
5. The server verifies the hash; if it matches, authentication is successful.
3. SSH-Keygen
Definition:
o A tool for generating authentication key pairs for SSH.
Use Case:
o Automates logins and authenticates hosts securely.
Key Generation Command:
ssh-keygen
Generated Keys:
o Private Key: Stored securely by the client.
o Public Key: Shared with the server for authentication.
Definition:
o A method of storing the same data across multiple disks to improve fault
tolerance and performance.
How It Works:
o Data is distributed across multiple disks.
o I/O operations overlap to enhance speed.
o Redundant storage increases fault tolerance.
5. RAID Controller
Definition:
o A hardware or software component that abstracts groups of disks as logical units.
Benefits:
o Enhances performance.
o Protects data during crashes.
6. RAID Levels
1. RAID 0 (Striping):
o Data is divided across disks.
o Advantage: High performance.
o Disadvantage: No fault tolerance.
2. RAID 1 (Mirroring):
o Data is duplicated across two or more disks.
o Advantage: Fault tolerance; faster read performance.
o Disadvantage: Storage capacity is halved.
3. RAID 2:
o Uses striping with error-checking and correcting (ECC).
o Note: Obsolete and not commonly used.
4. RAID 3:
o Data is striped, with one disk dedicated to storing parity information.
o Use Case: Sequential data access.
5. RAID 4:
o Similar to RAID 3 but stores parity information on a dedicated disk.
6. RAID 5:
o Striping with parity:
Parity is distributed across all disks.
Advantage: Can survive the failure of one disk.
Disadvantage: Write operations are slower due to parity calculation.
7. RAID 6:
o Similar to RAID 5, but with dual parity for added redundancy.
o Advantage: Can survive two disk failures.
References
1. Understand Comparisons:
o SSH vs. Telnet.
o RAID levels and their differences.
2. Command Usage:
o Practice SSH key generation and connection setup.
3. Fault Tolerance in RAID:
o Be prepared to explain how RAID levels handle disk failures.
4. Use Cases:
o Relate RAID configurations to practical scenarios (e.g., high-performance
systems or data-critical environments).
Lecture#13
Lecture 13: Extended Permissions & Database - Main Points Defined
Objectives
Definition:
o ACL provides a more flexible permission system than traditional UNIX file
permissions.
o It allows specific users or groups to have custom permissions on any file or
directory.
Key Features:
o Granular permissions for users and groups.
o Extends beyond the owner-group-others model.
Command to Modify ACL:
o To add permissions for a user:
o setfacl -m u:username:permissions filename
o To add permissions for a group:
o setfacl -m g:groupname:permissions filename
2. Databases
Definition:
o A database is a structured collection of data stored electronically.
Examples:
o Online store databases (products, customers, orders).
o Forum databases (members, topics, posts).
o Blog system databases (users, posts, categories, comments).
Why Use Databases?
o Structured and efficient storage.
o Handles large amounts of data better than plain text files (e.g., CSV).
3. Relational Databases
Definition:
o Stores data in tables with defined relationships between them.
o Enables querying and managing interconnected data.
5. MySQL
Advantages:
o Open source and free to use.
o Compatible with various platforms and web hosting setups.
o Easy to use and integrates well with PHP.
MySQL Installation:
o Recommended method: Install using RPM.
o Components:
1. MySQL: Core database server.
2. MySQL-client: Enables interaction with the server.
3. MySQL-devel: Libraries for compiling MySQL-related programs.
4. MySQL-shared: Shared libraries for the client.
5. MySQL-bench: Performance testing tools.
6. MySQL Commands
1. Database Selection:
2. USE databasename;
3. Show Databases:
4. SHOW DATABASES;
5. Show Tables in Database:
6. SHOW TABLES;
7. Show Columns of a Table:
8. SHOW COLUMNS FROM tablename;
9. Show Index Details:
10. SHOW INDEX FROM tablename;
11. Performance Stats:
12. SHOW TABLE STATUS LIKE 'tablename'\G;
Backup:
o Command to back up all databases:
o mysqldump --all-databases --single-transaction --user=root --
password > all_databases.sql
Restore:
o Command to restore a database:
o mysql -u root -p < all_databases.sql
References
1. ACL Configuration
2. MySQL for Beginners
Exam Preparation Tips
1. Commands:
o Memorize the ACL modification commands (setfacl) and common MySQL
administrative commands.
2. Concepts:
o Be able to explain the purpose of ACL, relational databases, and MySQL
advantages.
3. Practical Scenarios:
o Practice backing up and restoring MySQL databases.
o Provide examples of when to use ACL vs. traditional permissions.
Lecture#14
Lecture 14: DNS & DHCP - Main Points Defined
Objectives
Definition:
o Translates domain and host names into IP addresses and vice versa.
o Example: Converts www.example.com to its corresponding IP address.
Why Use DNS?:
o Simplifies remembering hostnames instead of numerical IP addresses.
1. Forward DNS:
o Resolves domain names into IP addresses.
2. Reverse DNS:
o Resolves IP addresses back to domain names.
DNS Database
Definition:
o A distributed, hierarchical database used for hostname-IP address lookups.
o Fully Qualified Domain Names (FQDN) structure:
Top-Level Domain Names (TLDN):
.com, .org, .edu, .net, etc.
Managed by root servers.
Second-Level Domains:
Organizational identifiers like example.com or redhat.com.
Hostnames:
Specific hosts like host1.example.com.
1. A Record:
o Maps domain names to IPv4 addresses.
2. AAAA Record:
o Maps domain names to IPv6 addresses.
3. CNAME Record:
o Creates aliases for domain names.
4. MX Record:
o Specifies mail servers for routing emails.
5. NS Record:
o Identifies authoritative name servers for a domain.
6. PTR Record:
o Used for reverse DNS lookups (IP to domain).
7. SOA Record:
o Contains administrative details about a DNS zone.
8. TXT Record:
o Stores arbitrary text, often used for email security (e.g., SPF records).
2. DHCP (Dynamic Host Configuration Protocol)
Definition:
o Automates IP address assignment to devices on a network.
o Ensures devices receive proper network configurations like subnet masks and
gateways.
DHCP Concept
Lease Process:
1. A client requests an IP address.
2. DHCP server assigns an available address.
3. Address is leased for a defined period.
DHCP Configuration
1. Installation:
o Install the DHCP server package on a network server.
2. Configuration File:
o Define IP address ranges, subnet masks, and lease durations.
o Example: /etc/dhcp/dhcpd.conf.
3. MAC Binding:
o Bind a specific IP address to a device’s MAC address.
References
1. Understand Concepts:
o Be able to explain the purpose of DNS and DHCP.
o Differentiate between Forward DNS and Reverse DNS.
2. Memorize Key DNS Records:
o A, AAAA, CNAME, MX, PTR, NS, SOA, and TXT.
3. DHCP Scenarios:
o Practice explaining IP address assignment and lease processes.
4. Real-World Applications:
o Provide examples where DNS simplifies web browsing and DHCP streamlines
network configuration.
Lecture#15
Lecture 15: HTTP, HTTPS & NTP - Main Points Defined
Objectives
Definition:
o A set of standards allowing the exchange of information (e.g., HTML pages) over
the World Wide Web.
Key Features:
o Works over an unencrypted connection.
o Vulnerable to eavesdropping and data interception.
o Commonly used for general web browsing where security is not critical.
Definition:
o A secure version of HTTP that uses Transport Layer Security (TLS) to encrypt
data.
Key Features:
o Protects data from eavesdropping.
o Default protocol for financial transactions and sensitive data exchanges.
o Shields users from censorship by governments or ISPs.
3. HTTP Caching
Definition:
o Temporary storage of web content (e.g., HTML pages, images) to reduce server
lag and speed up subsequent requests.
Categories of Caches:
1. Private Cache:
Stored on a user’s device (e.g., browser cache).
2. Public Cache:
Stored on shared infrastructure (e.g., proxy servers).
Benefits:
o Reduces bandwidth usage.
o Speeds up website load times.
o Decreases server load.
Definition:
o A protocol for synchronizing the clocks of computer systems over data networks
with variable latency.
Importance:
o Accurate Timekeeping:
Prevents issues in distributed systems and security mechanisms.
o Consistency:
File system updates and coordinated processes depend on synchronized
clocks.
How NTP Works:
1. The NTP client sends a time request to the NTP server.
2. The server responds with the correct time.
3. The client adjusts its clock based on the server's response.
1. Key Differences:
o Understand and explain the differences between HTTP and HTTPS.
o Emphasize the added security benefits of HTTPS.
2. Caching:
o Know the types of caching (private vs. public) and their use cases.
3. NTP Significance:
o Highlight scenarios where accurate timekeeping is crucial (e.g., security,
distributed systems).
4. Practical Examples:
o Provide examples of HTTPS usage in e-commerce or banking.
o Mention NTP's role in ensuring synchronized timestamps in transaction logs.