0% found this document useful (0 votes)
141 views5 pages

Ex 200

Uploaded by

optimus.7222
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
141 views5 pages

Ex 200

Uploaded by

optimus.7222
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

VM1

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!

dnf config-manager --enable base,appstream


dnf repolist all

3. SELinux

rmpquery httpd
dnf install httpd
systemctl status httpd
systemctl enable - -now httpd

ls /var/www/html

firewall-cmd - -state

semanage port -l |grep http


semanage port -a -t http_port_t -p tcp 82
semanage port -l |grep http

systemctl restart httpd


systemctl status httpd

systemctl enable - -now firewalld


firewall-cmd - -state
firewall-cmd - -add-port=82/tcp - -permanent
firewall-cmd - -reload
firewall-cmd - -list-all
curl localhost:82
4. User/Group
groupadd sysadm

useradd harry
passwd harry
password

useradd natasha
passwd natasha
password

useradd sarah
passwd sarah
password

gpasswd -a harry sysadm


gpasswd -a natasha sysadm
usermod -s /sbin/nologin sarah

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”

7. Network file system (nfs)

dnf install autofs nfsutils -y


systemctl enable autofs –now

vim /etc/auto.master
/- /etc/auto.misc

Vim /etc/auto.misc
/netdir -fstype=nfs, rw, sync classroom.example.com:/home/guests/netuserX

Systemctl restart autofs.service

cd /netdir
df -h

8. Archiving

tar -cjf /root/myetcbackup.tar.bz2 /etc


ls -l /root
file /root/myetcbackup.tar.bz2
tar -tf /root/myetcbackup.tar.bz2
9. Network Time Protocol

timedatectl status
vim /etc/chrony.conf
pool classroom.example.com iburst
:wq!

systemctl restart chronyd


chronyc sources

10. Linux File system (Find)


find / -user natasha -type f -exec cp -rpf {} /root/natashafiles/ 2> /dev/null \;

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/ \;

14. & 15. Containers


Sudo permission for jack? check
dnf install container-tools -y
ssh [email protected]
cd
wget ftp://192.168.0.1/pub/dockerfile
ls
cat dockerfile
podman build -t exam_image -f dockerfile
podman images

mkdir -p webroot/html
tree
cd

podman run -d - -name logserver -v /home/jack/Webroot/html:/usr/share/ngnix/html:Z localhost/exam_image


podman ps

mkdir -p .config/systemd/user
cd .config/system/user

podman generate systemd - -name logserver - -files - -new


ls
systemctl - -user daemon-reload
systemctl - -user enable - -now container-logserver.service
systemctl - -user status container-logserver.service
sudo loginctl enable-linger
VM2

16. Boot

e
end (line starting with Linux)
rd.break
ctrl+x

mount -o remount rw /sysroot


chroot /sysroot

passwd root
newpassword

touch /.autorelabel
exit
exit

17. Software Package

dnf repolist all

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!

dnf config-manager –enable base,appstream


dnf repolist all

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

mkfs -t xfs /dev/wgroup/wshare


mkdir -p /mnt/wshare
mount /dev/wgroup/wshare /mnt/wshare
vim /etc/fstab
/dev/wgroup/wshare /mnt/wshare xfs defaults 0 0
:wq!

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

vgextend vgname /dev/pvname


lvextend -L 700M /dev/vgname/lvname

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

tuned-adm profile name

You might also like