Course: System and Network Administration
Course: System and Network Administration
3. Comparative Analysis of OS
6. Advanced Topics
Windows OS
Attributes:
GUI-based (Graphical User Interface): Windows has a user-
friendly interface, featuring icons, windows, and menus that make
it easy for users to navigate.
Proprietary Software: Windows is a closed-source operating
system developed by Microsoft, meaning its source code is not
publicly accessible.
Key Features:
Pros:
Cons:
2. Linux OS
Attributes:
Open-source: Linux is an open-source OS, meaning its source
code is publicly available for anyone to modify and distribute.
Command-line based: While Linux has GUI options (like
GNOME, KDE), its core operations are typically done via the
command line.
Key Features:
Pros:
Cons:
Attributes:
Key Features:
Pros:
Cons:
1. Select Language:
o During the installation process, choose your preferred
language.
2. Choose Installation Type:
o Erase Disk and Install Linux: This option erases the entire
hard drive and installs Linux, ideal for beginners.
o Dual Boot: If you want to keep an existing OS (like
Windows) and install Linux alongside it, select "Install
alongside" for dual boot.
3. Partitioning (Optional):
o If you want to manually create partitions, select “Something
Else.” Common partitions include:
Root Partition (/): Where system files are stored.
Swap Partition: Used for virtual memory (usually
twice the size of your RAM).
4. Select Time Zone and Keyboard Layout:
o Choose your time zone and preferred keyboard layout.
5. Create a User Account:
o Set up a username and password that will be used for logging
into your system.
6. Start the Installation:
o After setting all options, begin the installation process. This
might take a few minutes.
Step 5: Post-Installation
1. Reboot:
o Once the installation is complete, the system will prompt you
to restart.
o Remove the USB drive to ensure the system boots from the
newly installed Linux OS.
1. Log In:
o Log into your system using the username and password you
created during the installation.
2. Check Linux Version:
o Open the terminal and run the following command to check
the installed Linux version:
lsb_release -a
4. Update Software:
o It’s essential to update the system after installation. Run these
commands to update your system:
sudo apt update
sudo apt upgrade
Local Services:
1. Installation:
o Install the CUPS (Common UNIX Printing System) for
managing print services.
2. Configuration:
o Start and enable the CUPS service.
1. Installation:
o Install Samba for file sharing between Linux and Windows
systems.
2. Configuration:
o Edit the Samba configuration file.
[shared]
path = /path/to/shared/directory
available = yes
valid users = username
read only = no
browsable = yes
public = yes
writable = yes
1. Driver Problems:
o If a device is not working, first check if the appropriate driver
2. Device Conflicts:
o Devices may conflict if they use the same resources (e.g.,
1. CPU Usage:
o Use the top command to view real-time CPU usage.
top
2. RAM Usage:
o Check memory usage with the free -h command.
free -h
3. Disk Usage:
o View disk usage using the df -h command.
df -h
Real-Life Example:
If your system is slow, you can use the top command to identify
processes consuming high CPU or RAM. If necessary, you can
terminate those processes.
System Updates:
1. Update System:
o To update your package lists and install package updates:
2. Full Upgrade:
o For a full system upgrade, which also manages additional
dependencies:
1. Release Upgrade:
o To upgrade from one major version (e.g., Ubuntu 20.04 to
22.04):
sudo do-release-upgrade
Real-Life Example:
To create a new user account, you can use the useradd command as
follows:
sudo useradd -m username
Setting a Password:
After creating the user account, you need to set a password for it:
sudo passwd username
Managing User Accounts:
Viewing User List: To see a list of all users, you can check the
/etc/passwd file:
cat /etc/passwd
If you also want to delete the user’s home directory, add the -r
option:
sudo userdel -r username
Creating Groups:
-aG: This option adds the user to the group without removing
them from other groups.
Setting Permissions:
In 755, the first digit (7) sets permissions for the owner (read, write,
execute), the second digit (5) for the group (read, execute), and the last
digit (5) for others (read, execute).
File Ownership:
Every file and directory has an owner and an associated group. To check
a file's ownership, use the ls -l command:
ls -l filename
The output will look like this:
-rwxr-xr-- 1 owner group 0 Sep 30 10:00 filename
Changing Ownership:
This command changes both the owner and the group of the file.
What is sudo?
The sudo command allows users to run commands with the security
privileges of another user (by default, the superuser). This is necessary
for performing administrative tasks without giving full root access to
users.
To grant a user sudo privileges, you can add them to the sudo group:
Once the user is in the sudo group, they can execute commands with
elevated privileges by prefixing the command with sudo:
sudo command
For example, to update package lists:
sudo apt update
Configuring sudo Access:
sudo visudo
Example Entry:
username ALL=(ALL) ALL
This entry means that the user username can run any command on any
host.
o Update:
o Upgrade:
o Remove:
o Update:
o Remove:
o Update:
o Remove:
This command will remove the specified package from the system.
Dependencies
Dependencies are the packages that are required for a software package
to function correctly. When you install software, the package manager
automatically installs the necessary dependencies.
Repositories
Repositories are servers where software packages are stored. You can
manage repositories within your package manager:
Adding a Cron Job: You can add a cron job that will automatically
update software daily. For example:
0 2 * * * sudo apt update && sudo apt upgrade -y
This job will run every day at 2 AM and update the system.
zone "example.com" {
type master;
file "/etc/bind/db.example.com";
}
server 0.pool.ntp.org
server 1.pool.ntp.org
2. Monitoring Tools
sudo wireshark
2.2 Nagios
o Allow a Port:
sudo ufw allow 80/tcp
o Deny a Port:
o Allow a Service:
o Reload Rules:
Configuration of GRUB:
GRUB_TIMEOUT=5
GRUB_DEFAULT=0
Features of GRUB:
Boot Sequence:
The boot sequence is the order in which system components load
when the computer starts. This process begins with the POST
(Power-On Self-Test), where hardware is checked.
Startup Services:
Systemd:
Managing Services:
2. Enable/Disable Services:
o Enable: To enable a service to start at boot.
3. Start/Stop Services:
o Start Service:
o Stop Service:
Process Management:
top Command:
o The top command displays real-time running processes and
their resource utilization.
top
ps aux
Killing Processes:
o If a process hangs or crashes, it can be terminated using the
kill command.
o Kill by PID:
kill <PID>
o Force Kill:
kill -9 <PID>
Systemd Services:
[Unit]
Description=My Custom Service
[Service]
ExecStart=/usr/bin/my_script.sh
[Install]
WantedBy=multi-user.target
What is IP Tables?
This command allows traffic on port 22 (SSH) via the TCP protocol.
Outgoing Traffic:
What is NAT?
1. Enable IP Forwarding:
o First, you need to enable IP forwarding.
Flushing Rules:
iptables -F
Log Incoming Traffic:
This rule will log dropped packets, allowing for easier diagnosis.
Testing Firewall Rules:
You can test the firewall rules using commands like ping,
telnet, or curl.
Example: Test SSH Connection
telnet <your_server_ip> 22
What is a VPN?
port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
Benefits of VPNs:
Secure communication
Anonymous browsing
Remote access to resources
Setting Up SSL/TLS:
1. Obtain a Certificate: You need an SSL certificate, which can be
obtained from a certificate authority (CA).
2. Install the Certificate: Install the certificate on your web server.
o Example: Enable SSL on Apache server:
a2enmod ssl
<VirtualHost *:443>
ServerName www.example.com
SSLEngine on
SSLCertificateFile
/path/to/your/certificate.crt
SSLCertificateKeyFile
/path/to/your/private.key
SSLCertificateChainFile
/path/to/your/chainfile.pem
</VirtualHost>
Benefits of SSL/TLS:
Data encryption
Authentication of the server
Integrity of data
HTTPS:
Setting Up IDS/IPS:
4. Start Snort:
snort -c /etc/snort/snort.conf -i eth0
Benefits of IDS/IPS:
Threat detection
Real-time monitoring
Response to security incidents
Advanced file systems and logs are crucial for enhancing system
performance, reliability, and security..
Btrfs Configuration:
ZFS Configuration:
1. Install ZFS:
sudo apt-get install zfsutils-linux
Viewing Logs:
cat /var/log/syslog
less /var/log/auth.log
tail -f /var/log/syslog
/var/log/myapp/*.log {
daily # Rotate logs daily
rotate 7 # Keep 7 copies
compress # Compress rotated logs
missingok # Ignore missing log
files
notifempty # Don't rotate empty
logs
create 0640 root adm # Create new log
files with specified permissions
}
Log Archival:
Monitoring Tools:
What is Bash?
Bash Syntax:
Basic Commands:
2. Add Commands:
#!/bin/bash
echo "This script will execute an automated
task"
cp /path/to/source /path/to/destination #
Copying a file
3. Make it Executable:
chmod +x myscript.sh
#!/bin/bash
echo "Enter your name:"
read name
echo "Your name is: $name"
Output Handling:
Error Handling:
What is Cron?
Cron is used in Linux to run scheduled tasks. You can create cron
jobs to execute scripts or commands automatically at specific
times.
1. Edit Crontab:
crontab -e
What is FTP?
1. Installation:
o To install vsftpd:
2. Configuration:
o To edit the configuration file:
anonymous_enable=NO
local_enable=YES
write_enable=YES
chroot_local_user=YES
3. Restart Service:
What is NFS?
1. Installation:
2. Configuration:
o Edit the /etc/exports file and add this line:
/path/to/shared_folder
client_ip(rw,sync,no_subtree_check)
o Example:
/srv/nfs *(rw,sync,no_subtree_check)
3. Export Shares:
sudo exportfs -a
What is Samba?
1. Installation:
2. Configuration:
o Edit the /etc/samba/smb.conf file:
[shared]
path = /path/to/shared_folder
available = yes
valid users = username
read only = no
browsable = yes
public = yes
writable = yes
bash
Copy code
sudo smbpasswd -a username
What is DHCP?
1. Installation:
2. Configuration:
o Edit the /etc/dhcp/dhcpd.conf file:
What is DNS?
1. Installation:
2. Configuration:
o Edit the /etc/bind/named.conf.local file:
zone "example.com" {
type master;
file "/etc/bind/db.example.com";
};
sudo cp /etc/bind/db.empty
/etc/bind/db.example.com
$TTL 604800
@ IN SOA ns.example.com.
admin.example.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative
Cache TTL
;
@ IN NS ns.example.com.
@ IN A 192.168.1.1
www IN A 192.168.1.2
6. Apache
What is Apache?
1. Installation:
3. Configuration:
o Edit the default configuration file:
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/html/example
<Directory /var/www/html/example>
AllowOverride All
</Directory>
</VirtualHost>