Sie sind auf Seite 1von 44

System Admin

Linux 01
Linux System Administrator Course, ver. CENTOS 8

By Mohamed Fouad Fakhruldeen Under Creative Common BY-SA 4.0 License 1


Linux 01

Module 01
Performing Basic System Management

By Mohamed Fouad Fakhruldeen Under Creative Common BY-SA 4.0 License 2


Hi, I’m
Mohamed Fouad Fakhruldeen
Your mentor for today

3
01
Installation
First Steps

By Mohamed Fouad Fakhruldeen Under Creative Common BY-SA 4.0 License 4


Minimum System Requirements for CentOS 8
1. 2 GB RAM
2. 2 GHz or Higher Processor
3. 20 GB Hard Disk
4. 64-bit x86 System

Download
1. Latest CENTOS ISO from the official site https://www.centos.org/
a. We will use the CentOS Linux DVD ISO
2. Virtualization software
a. Vmware workstation https://www.vmware.com/mena/products/workstation-pro.html
b. Or Virtual Box https://www.virtualbox.org/ (free)

By Mohamed Fouad Fakhruldeen Under Creative Common BY-SA 4.0 License


By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
By Mohamed Fouad Fakhruldeen
Under Creative Common BY-SA 4.0 License
02
Essential Tools
--

By Mohamed Fouad Fakhruldeen Under Creative Common BY-SA 4.0 License 31


whoami, pwd, ls,
mohamed@fou4d ~]$ pwd
/home/fouad
mohamed@fou4d ~]$ whoami
Mohamed
mohamed@fou4d ~]$ ls
Desktop Documents Downloads Music Pictures Public Templates Videos
mohamed@fou4d ~]$ ls -l
drwxr-xr-x. 2 fouad fouad 6 Feb 1 13:37 Desktop
drwxr-xr-x. 2 fouad fouad 6 Feb 1 13:37 Documents
mohamed@fou4d ~]$ ls -la
rwx------. 15 fouad fouad 4096 Feb 1 13:58 .
drwxr-xr-x. 3 root root 19 Feb 1 13:37 ..
-rw-r--r--. 1 fouad fouad 18 Nov 8 18:21 .bash_logout
-rw-r--r--. 1 fouad fouad 141 Nov 8 18:21 .bash_profile

By Mohamed Fouad Fakhruldeen


Under Creative Common BY-SA 4.0 License
Su -, ip addr, free
mohamed@fou4d ~]$ su -
password:
root@fou4d ~]# whoami
Root
root@fou4d ~]# exit
mohamed@fou4d ~]$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
.......

mohamed@fou4d ~]$ free -m


total used free shared buff/cache available
Mem: 1806 1143 189 9 472 496
Swap: 2047 75 1972

By Mohamed Fouad Fakhruldeen


Under Creative Common BY-SA 4.0 License
df, cat, findmnt
mohamed@fou4d ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 887M 0 887M 0% /dev
tmpfs 904M 0 904M 0% /dev/shm
tmpfs 904M 9.7M 894M 2% /run
mohamed@fou4d ~]$ cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
mohamed@fou4d ~]$ findmnt
ARGET SOURCE FSTYPE OPTIONS
/ /dev/nvme0n1p1
│ xfs rw,relatime,seclabel,attr2,inode64,noquota
├─/sys sysfs sysfs rw,nosuid,nodev,noexec,relatime,seclabel
│ ├─/sys/kernel/security securityfs securityfs rw,nosuid,nodev,noexec,relatime
........

By Mohamed Fouad Fakhruldeen


Under Creative Common BY-SA 4.0 License
bash
1. Tab completion
2. wc word count
3. History
a. !3 !2
b. !f
c. ctrl+R
d. Piping
i. Output from first as input to next
ii. ps aux | less

By Mohamed Fouad Fakhruldeen Under Creative Common BY-SA 4.0 License


redirection
mohamed@fou4d ~]$ ls > lsfiles.txt
mohamed@fou4d ~]$ cat lsfiles.txt
Desktop Documents Downloads Music Pictures Public Templates Videos
mohamed@fou4d ~]$ whoami >> lsfiles.txt
Desktop Documents Downloads Music Pictures Public Templates Videos
Mohamed
mohamed@fou4d ~]$ ls hfhgd *
ls: cannot access 'hfhgd': No such file or directory
Desktop Documents Downloads Music Pictures Public Templates Videos
mohamed@fou4d ~]$ ls hfhgd * 2> err
Desktop Documents Downloads Music Pictures Public Templates Videos
mohamed@fou4d ~]$ cat err
ls: cannot access 'hfhgd': No such file or directory
mohamed@fou4d ~]$ ls hfhgd 2> /dev/null
mohamed@fou4d ~]$ grep -R fouad /etc 2> /dev/null

By Mohamed Fouad Fakhruldeen


Under Creative Common BY-SA 4.0 License
environment variables, aliases
mohamed@fou4d ~]$ env
LANG=en_US.UTF-8
GDM_LANG=en_US.UTF-8
HISTCONTROL=ignoredups
DISPLAY=:0
COLORTERM=truecolor
..........
mohamed@fou4d ~]$ LANG=fr_FR.UTF-8
mohamed@fou4d ~]$ alias
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
.............

mohamed@fou4d ~]$ alias fou='ls -la'


mohamed@fou4d ~]$ fou
total 24
drwx------. 15 fouad fouad 4096 Feb 1 13:58 .
drwxr-xr-x. 3 root root 19 Feb 1 13:37 ..
-rw-r--r--. 1 fouad fouad 18 Nov 8 18:21 .bash_logout
-rw-r--r--. 1 fouad fouad 141 Nov 8 18:21 .bash_profile
-rw-r--r--. 1 fouad fouad 312 Nov 8 18:21 .bashrc

By Mohamed Fouad Fakhruldeen


Under Creative Common BY-SA 4.0 License
I/O redirection and piping
1. STDIN --> CMD --> STDOUT standard input and standard output
a. File1 < CMD > FILE2
b. > < >>
2. Standard error STDERR
a. 2> 2> /dev/null
3. History
a. !3 !2
b. !f
c. ctrl+R
d. Piping
i. Output from first as input to next
ii. ps aux | less
iii. Ls -la /etc | grep host

By Mohamed Fouad Fakhruldeen Under Creative Common BY-SA 4.0 License


man
mohamed@fou4d ~]$ man man
/section
1 Executable programs or shell commands
.......
5 File formats and conventions eg /etc/passwd
.......
8 System administration commands (usually only for root)
// G --> BOTTOM OF THE PAGE and examples are near to bottom
// q --> quit
root@fou4d ~]# mandb
mohamed@fou4d ~]$ apropos user //or man -k user
mohamed@fou4d ~]$ Man -k user | grep 8

By Mohamed Fouad Fakhruldeen


Under Creative Common BY-SA 4.0 License
Filesystem Hierarchy Standard

root

etc home root var

Configuration
files Normal user Dynamic data
directories /var/log

Vmlinuz kernel boot usr dev devices


to boot
Binaries files

By Mohamed Fouad Fakhruldeen Under Creative Common BY-SA 4.0 License


directories
mohamed@fou4d ~]$ man hier
mohamed@fou4d ~]$ cd /etc
mohamed@fou4d ~]$ cat centos-release
CentOS Linux release 8.1.1911 (Core)
mohamed@fou4d ~]$ cd ..
mohamed@fou4d ~]$ cd ../../../
mohamed@fou4d ~]$ cd /home/fou4dDesktop
mohamed@fou4d ~]$ mkdir testing
mohamed@fou4d ~]$ ls
mohamed@fou4d ~]$ rmdir testing
mohamed@fou4d ~]$ ls

By Mohamed Fouad Fakhruldeen


Under Creative Common BY-SA 4.0 License
VIM editor
1. Vim is the default editor
2. Command mode
a. After starting
b. :wq! (write quite don’t complain)
3. Edit mode (insert mode)
a. Pres I insert, a append O new line
b. dd delete line/cut, yy copy line, p paste, d$ to the end of line
c. U undo, ctrl-r redo,
d. /text search text, ?text search opposite direction
e. N next search, ? opposite direction
f. :%s/old/new/g
g. Esc to go back to command

By Mohamed Fouad Fakhruldeen Under Creative Common BY-SA 4.0 License


Globbing & cockpit

mohamed@fou4d ~]$ cd /etc


mohamed@fou4d ~]$ ls host*
mohamed@fou4d ~]$ ls ?os*
mohamed@fou4d ~]$ ls [hm]os*
mohamed@fou4d ~]$ mkdir temp && touch temp/script{0..9}
mohamed@fou4d ~]$ ls script[0-9][0-9]
CentOS Linux release 8.1.1911 (Core)
mohamed@fou4d ~]$ systemctl enable --now cockpit.socket
mohamed@fou4d ~]$ systemctl status cockpit

By Mohamed Fouad Fakhruldeen


Under Creative Common BY-SA 4.0 License
Thank You
Online version of this presentation will be available shorly on my website
https://fou4d.com

Mohamed Fouad Fakhruldeen


+20 10 30 80 88 49
i@fou4d.com

By Mohamed Fouad Fakhruldeen Under Creative Common BY-SA 4.0 License 44

Das könnte Ihnen auch gefallen