Ex 200
Ex 200
1. Networking
hostnamectl set-hostname serverx.example.com
hostnamectl status
nmcli con mod ens160 ipv4.method manual ipv4.addresses 192.168.0.10/24 ipv4.gateway 192.168.0.1 ipv4.dns
172.25.254.254 connection.autoconnect yes
nmcli con reload
nmcli con up ens160
nmcli con show
2. Software Packages
dnf repolist all
vim /etc/yum.repos.d/new.repo
[base]
name=base
baseurl=http://content.example.com/rhel 7.0/x86_64/dvd/BaseOs
gpgcheck=0
[appstream]
name=appstream
baseurl=http://content.example.com/rhel 7.0/x86_64/dvd/Appstream
gpgcheck=0
:wq!
3. SELinux
rmpquery httpd
dnf install httpd
systemctl status httpd
systemctl enable - -now httpd
ls /var/www/html
firewall-cmd - -state
useradd harry
passwd harry
password
useradd natasha
passwd natasha
password
useradd sarah
passwd sarah
password
5. Access
mkdir -p /shared/sysadm
chown :sysadm /shared/sysadm
chmod 2770 /shared/sysadm
ls -ld /shared/sysadm
6. Scheduling jobs
Crontab -e -u natasha
*/1 * * * * /usr/bin/logger “Ex200 Testing”
vim /etc/auto.master
/- /etc/auto.misc
Vim /etc/auto.misc
/netdir -fstype=nfs, rw, sync classroom.example.com:/home/guests/netuserX
cd /netdir
df -h
8. Archiving
timedatectl status
vim /etc/chrony.conf
pool classroom.example.com iburst
:wq!
11. Advanced
grep ich /usr/share/dict/words > /root/lines
12. User
useradd -u 2334 unilao
passwd unilao
alberate
13. Advanced
vim /usr/local/bin/examscript.sh
#! /usr/bin/bash
Find /usr -size +50M -size -100M -exec cp -rpf {} /root/testdir/ \;
mkdir -p webroot/html
tree
cd
mkdir -p .config/systemd/user
cd .config/system/user
16. Boot
e
end (line starting with Linux)
rd.break
ctrl+x
passwd root
newpassword
touch /.autorelabel
exit
exit
vim /etc/yum.repos.d/new2.repo
[base]
name=base
baseurl= http://content.example.com/rhel 7.0/x86_64/dvd/BaseOs
gpgcheck=0
[appstream]
name= appstream
baseurl= http://content.example.com/rhel 7.0/x86_64/dvd/Appstream
gpgcheck= 0
:wq!
18. Lvm
parted /dev/sda
mklabel gpt
print
mkpart new xfs 2048s 100%
print
udevadm settle
pvcreate /dev/sda1
vgcreate -s 8M wgroup /dev/sda1
lvcreate -n wshare -l 50 wgroup
Systemctl daemon-reload
lsblk
reboot
19. Swap
Parted /dev/sda
mklabel gpt
print
mkpart swap1 linux-swap 1MB 401MB
print
udevadm settle
mkswap /dev/sda1
swapon /dev/sda1
swapon - -show
vim /etc/fstab
UUID=sakjflkfkljdflkdjsf swap swap defaults 0 0
:wq!
systemctl daemon-reload
20. LVM
lvdisplay
vgdisplay
pvdisplay
xfs_growfs mountpoint
or
resize2fs /dev/vgname/lvname
21. Tuning
rpmquery tuned
dnf install tuned
systemctl enable - -now tuned
tuned-adm list
tuned-adm active
tuned-adm recommend