SA Notes Module 1
SA Notes Module 1
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 comes in various distributions , which are collections of the Linux kernel, system utilities,
● Popular Linux distributions include Ubuntu,Fedora, Debian, Centos, Red Hat Enterprise 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.
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.
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.
● 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).
● 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.
● 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.
● 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:
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:
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.
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.
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.
● 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.).
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.
grep, awk, sed: Command-line utilities for text processing and pattern matching.
Tab Completion: Helps in quickly completing filenames, commands, and paths by pressing the Tab key.
export: Sets the value of environment variables, making them available to child processes.
curl, wget: Command-line tools for making HTTP requests, useful for interacting with web services.
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.
Special files
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.