0% found this document useful (0 votes)
4 views

SA Notes Module 1

Uploaded by

dwarakadileep05
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

SA Notes Module 1

Uploaded by

dwarakadileep05
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

Server

Administration
Module 1
Course Code : 6131B
Semester : 6 Credits: 4
Course Category: Program Elective
Linux Operating System:
● Linux is an open-source Unix-like operating system

● Linux kernel was first published on 17 September 1991 by Linus Torvalds.

● Linux comes in various distributions , which are collections of the Linux kernel, system utilities,

libraries, and additional software.

● Popular Linux distributions include Ubuntu,Fedora, Debian, Centos, Red Hat Enterprise Linux,

Suse, Arch Linux

● Each distribution may have its own package management system, software repositories, and

default desktop environment, providing users with a wide range of choices and customization

options.
Open source software and GNU
● Open source software refers to software whose source code is freely available to the public.
● Anyone can view, modify, and distribute the code.
● The primary characteristics of open source software include the freedom to use, modify, and redistribute
the software.

● The GNU Project, initiated by Richard Stallman in 1983,


● It is a free software movement that aims to develop a complete, Unix-compatible operating system
composed entirely of free software.
● The GNU General Public License (GPL) is a key component of the GNU Project
● The GNU Project has developed numerous essential tools and utilities, including the GNU Compiler
Collection (GCC), the GNU C Library (glibc), and the GNU Core Utilities except kernel.

Linus Torvalds released the Linux kernel, which, when combined with the GNU tools, resulted in the creation
of a complete, free, and open-source operating system known as "GNU/Linux" or simply "Linux."
GNU Public License
The GNU General Public License (GPL) is a widely used open-source software license.

Created by the Free Software Foundation (FSF) as part of the GNU Project.

The GPL is designed to ensure that software remains free and open, allowing users to view,
modify, and distribute both the original and modified versions of the software.

Versions of the GPL are GPL-2.0 and GPL-3.0

Copyleft: A general method for making a program free and ensuring that all subsequent
versions of that program are also free.

eg:if we distribute a modified version of a GPL-licensed program, you must also distribute the
source code of your modifications under the GPL

Freedom to Use, Modify, and Distribute: The GPL grants users the freedom to use, modify,
and distribute the software. This principle aligns with the broader philosophy of the free software
movement.
GNU Public License
Distribution of Source Code: If you distribute a program covered by the GPL, you must also
provide access to the corresponding source code. This ensures that users can see how the
software works, make modifications, and benefit from the collaborative nature of open-source
development.

No Discrimination Against Persons or Groups: The GPL prohibits any form of discrimination
against individuals or groups. Everyone has equal rights to use, modify, and distribute the
software.

No Additional Restrictions: The GPL allows anyone to use the software for any purpose and
does not impose additional restrictions on how the software is used. However, it does place
requirements on the distribution of modified versions.

Applicability to All Users: The GPL is designed to protect the rights of all users, ensuring that
everyone who receives the software has the same freedoms to use, modify, and share it.
Advantages of Open Source Software
● Cost-efficiency
● Freedom and Flexibility
● Community Collaboration
● Enhanced security
● Stability and Reliability
● Interoperability
● Licensing Flexibility
Difference between Linux and Windows.
Linux Server installation:
A Linux server refers to a computer system that runs a Linux-based operating system and is specifically configured to
provide services, resources, or applications to other computers on a network.

Variety of Server Roles:

● Web Servers: Linux is widely used as a platform for hosting websites. eg:Apache, Nginx
● Database Servers:Used to run database servers like MySQL, PostgreSQL, MongoDB.
● File Servers:Linux servers can function as file servers using protocols like Samba or NFS to
share files across a network.

● Application Servers:Linux supports various application server technologies, such as Tomcat for
Java applications.

● Mail Servers:Email services are often hosted on Linux servers using software like Postfix,
Sendmail, or Exim.
Hardware and Environmental Considerations for Linux Server installation
Consider both hardware and environmental factors to ensure optimal performance,
reliability, and longevity.

Hardware Considerations:
● Processor (CPU): Consider multiple cores for better parallel processing, especially
for tasks like virtualization or multi-threaded applications.
● Memory (RAM): Ensure sufficient RAM, Memory capacity and speed can
significantly impact performance.
● Storage (Hard Drives or SSDs): SSDs provide faster read/write speeds and are
beneficial for I/O-intensive applications.
● Network Interface Card (NIC):Choose a reliable NIC that supports the required
network speed (1 Gbps, 10 Gbps, etc.).
● Motherboard: Consider features such as expansion slots, USB ports, and
BIOS/UEFI(Unified Extensible Firmware Interface) options.
Hardware and Environmental Considerations for Linux Server installation

Hardware Considerations:
● Power Supply :Select a power supply unit (PSU) with sufficient capacity for the
entire system.
● Form Factor :Choose a form factor (e.g., ATX, MicroATX) that fits your server
chassis.
● Cooling Solutions :Consider server-grade cooling solutions, especially for systems
with high-performance CPUs.
● Remote Management : Servers often benefit from remote management features like
IPMI (Intelligent Platform Management Interface)
Environmental Considerations:
● Temperature and Humidity :Use air conditioning or proper ventilation in server rooms.
● Physical Security :Secure server rooms to prevent unauthorized access,Use locks and
access control systems.
● Power Infrastructure : Ensure stable power supply with surge protection, use UPS
● Noise: Use soundproofing or relocate servers to a dedicated server room.
● Dust and Contaminants : Use air filters, clean the environment regularly, and consider
server room isolation.
● Fire Suppression : Choose fire-resistant materials for server room construction.
● Cabling Management :Label cables for easy identification.
● Backup Power: Implement backup power solutions like generators for extended power
outages.
Linux Server Design
1. Define Server Requirements:
a. Identify Purpose: Clearly define the purpose of the server (e.g., web hosting, file
storage, database server).
b. Workload Analysis: Assess the expected workload to determine hardware
requirements.Select Hardware:
2. Select Hardware:
a. CPU: Choose a CPU that meets performance requirements.
b. RAM: Ensure sufficient RAM for the server's workload.
c. Storage: Decide on storage type (HDD or SSD) and capacity.
d. Network Interface: Select a NIC with appropriate speed and redundancy if needed.
e. Power Supply: Choose a reliable PSU with sufficient capacity.
Linux Server Design
3. Choose Linux Distribution:

a. Select a Distribution: Choose a Linux distribution based on your expertise and the
specific needs of your server (e.g., Ubuntu Server, CentOS, Debian).

4. Plan Network Configuration:

a. IP Addressing: Plan IP addressing for the server,


b. DNS Configuration: Set up domain name resolution for the server.
c. Firewall Rules: Define firewall rules to control incoming and outgoing traffic.
Linux Server Design
5. Security Considerations:

a. SSH Configuration: Secure SSH access with key-based authentication and


disable root login.
b. Firewall Implementation: Use iptables or a firewall management tool to control
traffic.
c. Regular Updates: Establish a system for regular software updates and security
patches.
d. Security Auditing: Implement security auditing tools to monitor server activity.
Linux Server Design
6. Storage and File System Design::

● Partitioning: Plan disk partitioning for the operating system, data, and
swap.
● File System Selection: Choose an appropriate file system (e.g., ext4,
XFS) based on your needs.

7. User and Group Management:

● Create Users and Groups: Set up user accounts and assign appropriate
permissions.
Linux Server Design
8. Server Software Installation:

● Web Server: Install and configure a web server (e.g., Apache, Nginx).
● Database Server: Set up a database server (e.g., MySQL, PostgreSQL).
● Application Software: Install and configure additional software based on
server requirements.

9. Backup and Recovery:

● Backup Strategy: Develop a backup strategy for data and configuration files.
● Regular Testing: Regularly test backup and recovery processes to ensure
reliability.
Linux Server Design
10. Testing:

● Performance Testing: Conduct performance tests to ensure the server


meets expectations.
● Security Testing: Perform security assessments to identify and mitigate
vulnerabilities.

11. Deployment:

● Gradual Rollout: If possible, deploy the server gradually to identify and address
issues early.
● Monitoring After Deployment: Monitor the server closely after deployment to
catch any unexpected behavior.
Linux Server Design
10. Testing:

● Performance Testing: Conduct performance tests to ensure the server


meets expectations.
● Security Testing: Perform security assessments to identify and mitigate
vulnerabilities.

11. Deployment:

● Gradual Rollout: If possible, deploy the server gradually to identify and address
issues early.
● Monitoring After Deployment: Monitor the server closely after deployment to
catch any unexpected behavior.
Linux Server Design
There are several methods to install a Linux server,
Choice of method depends on factors such as the distribution, hardware, preferences.

1. Local Installation from ISO


2. Network Installation PXE (Preboot eXecution Environment)
3. Automated Installations (Kickstart, Preseed)
4. Virtualization Templates (VM Images)
5. Cloud Installation (IaaS Platforms)
6. Remote Installation via SSH
7. Containerized Installations (Docker)
Introduction to BASH
● BASH is an acronym for Bourne Again Shell
● It is an open source GNU project.
● It was released in 1989 as one of the most popular shell distribution of GNU/Linux
operating systems.
● BASH is a powerful command-line shell and scripting language used in Unix and
Linux environments.
● It provides an interface for users to interact with the operating system, execute
commands, and write scripts for automation.
Bash scripting
A bash script is a file containing a sequence of commands that are executed by
the bash program line by line.
It allows you to perform a series of actions, such as navigating to a specific
directory, creating a folder, and launching a process using the command
The term "shell" refers to a program that provides a command-line interface
for interacting with an operating system. Bash (Bourne-Again Shell) is one
of the most commonly used Unix/Linux shells and is the default shell in
many Linux distributions.ine.
It displays a $ when it is waiting for a command from the user.

If the shell is running as root (a user with administrative rights), the prompt is
changed to #. The superuser shell prompt looks like this:
Although Bash is a type of shell,
There are other shells available as well, such as Korn shell (ksh), C
shell (csh), and Z shell (zsh).
Each shell has its own syntax and set of features, but they all share the
common purpose of providing a command-line interface for interacting
with the operating system.

Determine your shell type using the ps command:

Enter any command after the $ sign and see the output on the
terminal.
Basic bash commands
cd: Change the directory to a different location.eg: cd Documents
ls: List the contents of the current directory. eg: ls, ls -a
mkdir: Create a new directory. eg: mkdir my_directory
touch: Create a new file. eg: touch myfile.txt
rm: Remove a file or directory. eg: rm myfile.txt, rm -r mydirectory
cp: Copy a file or directory. eg: cp myfile.txt /path/to/destination/
mv: Move or rename a file or directory. eg: mv myfile.txt /path/to/destination/
echo: Print text to the terminal. eg: echo "My name is test"
cat: Concatenate and print the contents of a file. eg: cat myfile.txt
Basic bash commands
grep: Search for a pattern in a file. eg:grep "search_pattern" filename.txt
chmod: Change the permissions of a file or directory. eg:chmod 700 myfile.txt
sudo: Run a command with administrative privileges. eg:sudo ls /root
df: Display the amount of disk space available. eg: df -h
history: Show a list of previously executed commands. eg:history N
ps: Display information about running processes. eg: ps aux
Command Line Shortcuts:
Navigation Shortcuts:
Ctrl + A: Move to the beginning of the line.
Ctrl + E: Move to the end of the line.
Ctrl + U: Cut text from cursor to the beginning of the line.
Editing Shortcuts:
Ctrl + C: Interrupt (stop) the currently running command.
Ctrl + D: Logout or exit the current shell (if used at an empty prompt).
Ctrl + Z: Suspend the currently running command.
Development Tools
Development tools in Linux typically refer to a set of software applications,
libraries, and utilities that assist developers in creating, building, debugging, and
maintaining software on a Linux system.

These tools are essential for software development,system-level programming,


application development, or scripting.
Utilities and practices that developers commonly use when working with Bash
scripts or in the command line environment.
1. Text Editors: Vim, Emacs, Nano: Common command-line text editors for writing and editing Bash
scripts directly in the terminal.

Vim (Vi Improved): To start Vim: vim filename

● Well-suited for users who value efficiency and are willing to invest time in learning its powerful features.
● It's particularly popular among system administrators and programmers.
● Allowing users to switch between different modes (normal, insert, visual, etc.).

Emacs: To start Emacs: emacs filename


● Emacs is a highly extensible and customizable text editor.
● It can function as a complete development environment.

Nano: To start Nano: nano filename


● Nano is a simple and user-friendly text editor designed to be easy for beginners.
● Nano is often the default text editor in many Linux distributions.
Utilities and practices that developers commonly use when working with Bash
scripts or in the command line environment.
2. Bash Debugger:

bashdb: A debugger for Bash scripts. It allows you to set breakpoints, inspect variables, and step
through your script to identify and fix issues.

3. Linters:

ShellCheck: A static analysis tool for shell scripts. It helps identify syntax errors, stylistic issues

4. Testing Frameworks:

Bats (Bash Automated Testing System): A testing framework for Bash scripts. It enables you to write unit tests for
your scripts to ensure they behave as expected.

5. Version Control:

Git: Even though Bash scripts are often smaller than entire projects, using version control is still a good practice. Git
helps track changes, collaborate with others, and maintain a history of your scripts.
Utilities and practices that developers commonly use when working with Bash
scripts or in the command line environment.
6. Scripting Best Practices:

Code Modularization: Break your script into smaller, modular functions to improve readability and
maintainability.

Comments: Use comments to explain complex logic or provide context for sections of your script.

Error Handling: Implement proper error handling using conditional statements (if, else, elif) to make
your scripts more robust.

Variables and Parameters: Utilize variables and command-line parameters to make your scripts more
flexible.

7. Interactive Debugging:

set -x: Add set -x at the beginning of your script to enable debugging mode. It prints each command
and its arguments to the standard error output before executing it.
Utilities and practices that developers commonly use when working with Bash
scripts or in the command line environment.
8. File Management and Manipulation:

cp, mv, rm, mkdir, rmdir, touch: Basic file management commands to copy, move, remove, create,
and modify files and directories.

9. Process Management:

ps, kill: Commands for listing processes and sending signals to processes, respectively.

10. Text Processing Tools:

grep, awk, sed: Command-line utilities for text processing and pattern matching.

11. Command-Line Shortcuts:

Tab Completion: Helps in quickly completing filenames, commands, and paths by pressing the Tab key.

Ctrl+C, Ctrl+Z: Interrupts or suspends the currently running process.


Utilities and practices that developers commonly use when working with Bash
scripts or in the command line environment.
12. File Management and Manipulation:

cp, mv, rm, mkdir, rmdir, touch:

13. Shell Variables and Environment:

export: Sets the value of environment variables, making them available to child processes.

14. Miscellaneous Tools:

curl, wget: Command-line tools for making HTTP requests, useful for interacting with web services.

jq: A lightweight and flexible command-line JSON processor.


FILES
In Linux system, everything is a file and if it is not a file, it is a process.

A file doesn't include only text files, images and compiled programs but also
include partitions, hardware device drivers and directories. Linux consider
everything as as file.

Files are always case sensitive.


Types of Files:
Regular files (-): It contain programs, executable files and text files.

Directory files (d): It is shown in blue color. It contain list of files.

Special files

● Block file (b)


● Character device file (c)
● Named pipe file (p)
● Symbolic link file (l)
● Socket file (s)
Linux File Commands
Command Description
file : Determines file type.
touch : Used to create a file.
rm : To remove a file.
cp : To copy a file.
mv : To rename or to move a file.
rename : To rename file.
The Linux file system contains the following sections:

● The root directory (/)


● A specific data storage format (EXT3, EXT4, BTRFS, XFS and so on)
● A partition or logical volume having a particular file system.

1. Linux file system is generally a built-in layer of a Linux operating system


2. It is used to handle the data management of the storage.
3. It helps to arrange the file on the disk storage.
4. It manages the file name, file size, creation date, and much more information about a file.
Linux File Ownership

Every Linux system have three types of owner:

User: A user is the one who created the file. By default, whosoever, creates the
file becomes the owner of the file. A user can create, delete, or modify the file.

Group: A group can contain multiple users. All the users belonging to a group
have same access permission for a file.

Other: Any one who has access to the file other than user and group comes in the
category of other. Other has neither created the file nor is a group member.

You might also like