Introduction to UNIX & LINUX
Files and Directories Management
User and Group Administration
Basic File Permissions
Disk Partitioning and Mounting File System
Data Backup and Recovery
Software Package Administration
Dynamic Host Configuration Protocol (DHCP)
FTP Server (vsftpd daemon)
DNS Server
Web Server (Apache)
Network File System (NFS)
User and Group Administration
Basic File Permissions
Disk Partitioning and Mounting File System
Data Backup and Recovery
Software Package Administration
Dynamic Host Configuration Protocol (DHCP)
FTP Server (vsftpd daemon)
DNS Server
Web Server (Apache)
Network File System (NFS)
File & directory management
nano
Vim
touch
tee
directory level operations
file permissions
644
r read
W write
X execute
change owner chown
Ownership
Owner, group, public
change group
chgrp
User management
users
group
Permission
system accounts
interactive accounts
sudo add user newuser;
m- creates directory for user, if not exist.
M- not creates directory for user
add /change password to user
passwd newuser;
groupadd newgroup;
creates new group.
gpasswd new group:
New password
re enter password
groups; to view all groups
groups group name
To view users in group
chgrp file/directory ownership to other group.
usermod
add & remove users from group
-a adds user to group only -G option
-G adds removes users to secondary groups
-g primary group
-d directory users directory
usermod -a -G group user
Disk quota management
backup fstab
backup grub file
edit files
Save
add quota to user, group
Remount & restart
Systemd services
systemd used to manage both services and daemons
systemctl –version
systemd 230
Units are the resources systemd knows how to interpret
12types
-
.service
-
.socket
-
.device
-
.mount
-
.automount
-
.swap
-
.target
-
.path
-
.timer
-
.snapshot
-
.slice
-
.scope
/lib/systemd/system (base unit files)
/etc/systemd/system (modified unit files at runtime)
-t service or sockets
-a loaded units
systemctl -t service
systemctl stop apache2
systemctl –all -t service | grep apache2
Start/stop/reload/restart/enable/disable/status
systemctl status network.service
systemctl is the utility used to control systemd
systemctl status
all status
systemctl status firewalld
Ufw iptables
list-units
systemctl list-units –type=socket
systemctl list-units –type=service
systemctl cat firewalld
Cat to read/write append etc.
cgroups or Control Groups
used assign resources for groups and users by admin
cpu,disk, memory,
Install & enable libcgroup
yum install libcgroup
systemctl enable cgconfig
CPU Slices
|
CPUShares
|
Linux process management
Process Management–bg, fg, nohup, ps, pstree, top, kill, killall, free, uptime, nice.
PID= process identification number
Pgrep used to know pid of process.
pgrep systemd
1
jobs − List of the current processes attached to the shell
ctrl+z to. sleep the current process.
ps command
ps axw | grep python
ps= process snapshot
grep : to filter the process name
a= Excludes constraints of only the reporting processes for the current user
X=Shows processes not attached to a tty or shell
W= Formats wide output display of the output
-u= shows all processes by specific user
-c all process by name or PID
-e selects all processes
–sort
to see all processs by user
ps -u www-data
all information about the process nginx
ps -wl -C nginx
top 10 memory consuming process
top,htop
Or
ps aux –sort =-pmem | head -10
pstree
tree like model
killall
killall chrome
kills all the process for all users.
pkill: kill the process by name
pgrep apache2
to know process id
pkill -9 apache2
Kill command
Kill pid
Signals graceful kill
SIGTERM
Firewall setup
firewalld in centos
iptables /, ufw in ubuntu debian Linux distributions
block ports,
block services,
block ipmasq
ICMP (Internet Control Message Protocol)
Block ip addresses
firewalld & ufw uses iptables as a backend.
Remote management of linux server
ssh client (putty), sftp client (winscp).
whm, capnel, zpanel etc.
Linux Log management
components behind systemd logging are: journald(daemon), journalctl(analyzes events logged by journald), and journald.conf(config file)
journalctl −k (kernel messages)
journalctl −u (units like services, sockets,sshd,apache2)
logs by type emergency,warn
0-emergency
1 alert
2 critical
3 error
4 warning
5 info
6 debug
journalctl -p 4
Warning logs.
Backup & recovery
321 rule
3 copies of data.(working data, backup on server weekly, offline in hdd)
rsync remote sync
rsync syntax:rsync [options] [local path] [[remote host:remote path] or [target path
or use sftp client to download compress data.
Syncing backup in local & remote
local
mkdir /root/etc_baks
rsync -aAvr /etc/ /root/etc_baks/
DD to Recovery Images
system updates & package management
system updates & install update packages
linux disruption upgrade
sudo apt-get update && sudo apt-get upgrade
Installing packages or additional softwares
add dependency or repository
To install precompiled softwares for your linux distribution.
or manually downloading & compile & install.
sudo apt-get remove curl
autoclean options are there.
Shell scripting
a bit knowledge of programming required.
Like logical operators, variables, condition statements, & loops .
Linux Volume management(LVM)
physical disk = dev/ sda
partition physical disk dev / sda1 dev/sda2
Volume group (group of physical volume by physical disks) 2disk each 1tb in a sysyem 2tb is the volume group.
Logical volume
LVM tools such as the System Storage Manager: lsblk, parted, and mkfs.xfs.
lsblk is a great tool for getting disk information
disks on this system: sda, sdb, and sdc.
sda has linux so,
parted /dev/sdb mklabel GPT
all data will ve deleted
Create the Partition
parted -a opt /dev/sdb mkpart primary ext4 0% 100%
any warnings
Update fstab
/etc/fstab
Make files system
(Which linux file system useful for you)
xfs filesystem
mkfs.xfs -f /dev/sdb1
Lets verify
lsblk -o NAME,FSTYPE
Mounting
mount -o defaults /dev/sdb1 /mnt/sdb
mount on boot we need to edit fstab.
Or ssm
apt install system-storage-manager
ssm list
To know the volumes
create -p NEW_POOL /dev/sdb1 /dev/sdc1
One large disk from freespace
or 3seperateeach 3.3gb out of 10gb.
root@localhost rdc]# ssm create -n disk001 –fs xfs -s 3GB -p NEW_POOL
Introduction to UNIX & LINUX
• History of UNIX and LINUX
• Differences between CentOS, Red Hat
Enterprise Linux & Fedora
• FHS and Linux Installation
Files and Directories Management
• Creating files using cat and touch
commands
• Creating directories using mkdir
command
• Modifying file content using vi / vim
editors
User and Group Administration
• Creating and deleting users from the
systems
• Creating and deleting groups
Basic File Permissions
• Verifying file permissions of existing
objects
• Modifying files permissions using chmod
command
Disk Partitioning and Mounting File
System
• Creating partition using fdisk command
• Formatting the partitions
• Mounting the partitions
Data Backup and Recovery
• Taking data backup using tar command
Software Package Administration
• Installing and deleting software packages
using RPM & YUM
• Querying and updating software
packages
Dynamic Host Configuration Protocol
(DHCP)
• Configuring Linux as DHCP Server
• Configuring various clients for DHCP
Server (Windows & Linux)
FTP Server (vsftpd daemon)
• Basics of File Transfer Protocol
• Configuring FTP protocol to download
and upload the files
DNS Server
• Configuration of DNS server
• Configuration of forward lookup zone
• Configuration of reverse lookup zone
• Testing tool of DNS zones
Web Server (Apache)
• Basics of Web Service
• Introduction to Apache
• Configuring Apache to host website
Network File System (NFS)
• Configuring NFS file sharing server
• Mounting NFS shared folder from client
systems
• Differences between CentOS, Red Hat
Enterprise Linux & Fedora
• FHS and Linux Installation
Files and Directories Management
• Creating files using cat and touch
commands
• Creating directories using mkdir
command
• Modifying file content using vi / vim
editors
User and Group Administration
• Creating and deleting users from the
systems
• Creating and deleting groups
Basic File Permissions
• Verifying file permissions of existing
objects
• Modifying files permissions using chmod
command
Disk Partitioning and Mounting File
System
• Creating partition using fdisk command
• Formatting the partitions
• Mounting the partitions
Data Backup and Recovery
• Taking data backup using tar command
Software Package Administration
• Installing and deleting software packages
using RPM & YUM
• Querying and updating software
packages
Dynamic Host Configuration Protocol
(DHCP)
• Configuring Linux as DHCP Server
• Configuring various clients for DHCP
Server (Windows & Linux)
FTP Server (vsftpd daemon)
• Basics of File Transfer Protocol
• Configuring FTP protocol to download
and upload the files
DNS Server
• Configuration of DNS server
• Configuration of forward lookup zone
• Configuration of reverse lookup zone
• Testing tool of DNS zones
Web Server (Apache)
• Basics of Web Service
• Introduction to Apache
• Configuring Apache to host website
Network File System (NFS)
• Configuring NFS file sharing server
• Mounting NFS shared folder from client
systems