ivstefn

RHCSA notes



Snippets:

Table 3.2. Table of Metacharacters and Matches:

Pattern Matches
* Any string of zero or more characters
? Any single character
[abc...] Any one character in the enclosed class (between the square brackets)
[!abc...] Any one character not in the enclosed class
[^abc...] Any one character not in the enclosed class
[[:alpha:]] Any alphabetic character
[[:lower:]] Any lowercase character
[[:upper:]] Any uppercase character
[[:alnum:]] Any alphabetic character or digit
[[:punct:]] Any printable character that is not a space or alphanumeric
[[:digit:]] Any single digit from 0 to 9
[[:space:]] Any single white space character, which might include tabs, newlines, carriage returns, form feeds, or spaces

Output redirection

User accounts

Summary:

References:

Control access to files

Permission File Direktory
Read Open a file List contents of directory
Write Change contents of file Create and delete files
Execute Run a program file Change to the directory

Special permissions:

Permission File Directory
u+s (suid) file executes as the owner No effect
g+s (sgid) file executes the group owner created files have group owner of the directory
o+t (sticky) no effect users with write access to the directory can remove only files that they own

Setuid = u+s; setgit = g+s; sticky = o+t Setuid = 4; setgit = 2, sticky = 1

Systemd


Postfix

Configure Postfix as null client:

  1. postconf -e "relayhost=[smtp0.example.com]"
  2. postconf -e "inet_interface=loopback-only"
  3. postconf -e "mynetworks=127.0.0.0/8 [::1]/128
  4. postconf -e "myorigin=desktop0.example.com"
  5. postconf -e "mydestination="
  6. postconf -e "local_transport=error: local delivery disabled"
  7. systemctl reload postfix

References:

DNS

Errori

dnsmasq exercise

U dnsmasq.conf:

Host:

U /etc/resolv.conf:

bind exercise

  1. Kreiraj dir: /etc/named/zones/master/
  2. Kreiraj file: /etc/named/zones/master/db.rhcsa.local

db.rhcsa.local:

; BIND data file for rhcsa.local

$TTL    3h
@       IN  SOA ns1.rhcsa.local.    admin.rhcsa.local (
            1   ; Serial (broj promjena u fajlu)
            3h  ; Refrash
            1h  ; Retry
            1w  ; Expire
            1h  ; Negative cache TTL )
;
@               IN  NS  ns1.rhcsa.local.

rhcsa.local.    IN  A   172.25.250.11
ns1             IN  A   172.25.250.11
servera         IN  A   10.10.20.10
serverb         IN  A   10.10.20.20
serverc         IN  A   10.10.20.30
email           IN  A   10.10.20.40

db.172.25.250:

10.20.10.10.in-addr.arpa.       IN      PTR     servera

/etc/named.conf:

zone "rhcsa.local" {
    type master;
    file "/etc/named/zones/master/db.rhcsa.local"; }

email

/etc/postfix/main.cf:

telnet email

Exit with ctrl + đ, ili ctrl + ]

tmux


Apache:

<VirtualHost *:80>
    ServerName my.domain.local
    DocumentRoot /var/www/path_to_dir

    ErroLog /var/log/path_to_file
    CustomLog /var/log/path_to_file combined
</VirtualHost>
nginx:
    server{
        server_name www.nginx.local;
        listen 80;
        root /var/www/www_nginx_local/;
        error_log /var/log/www_nginx_err.log;
        access_log /var/log/www_nginx_local.log;

Storage

[root@host ~]# parted /dev/vdb mklabel gpt mkpart primary 1MiB 769MiB
...output omitted...
[root@host ~]# parted /dev/vdb mkpart primary 770MiB 1026MiB
[root@host ~]# parted /dev/vdb set 1 lvm on
[root@host ~]# parted /dev/vdb set 2 lvm on

LVM

  1. pvcreate /dev/vdb1 /dev/vdb2
  2. vgcreate vgname /dev/vdb1 /dev/vdb2
  3. lvcreate -n lvname -L 100M vgname
  4. mkfs -t xfs /dev/vgname/lvname
  5. mount ...

Display status:

Extend
  1. vgextend vg01 /dev/vdb3
  2. lvextend -L +500M /dev/vg01/lv01 ili lvextend -r -L +500M /dev/vg01/lv01
  3. xfs_growfs /mnt/lvmount ili resizefs /dev/vg01/lv01
Reduce
  1. pvmove /dev/vdb3
  2. vgreduce vg01 /dev/vdb3

Commands: lvremove, vgremove, and pvremove

Extend swap
  1. swapoff -v /dev/vg01/swap
  2. lvextend -L +300M /dev/vg01/swap
  3. mkswap /dev/vg01/swap
  4. swapon /dev/vg01/swap
LVM VDO (deduplication and compression)
  1. dnf install vdo kmod-kvdo
  2. lvcreate --type vdo --name vdo-lv01 --size 5G vg01

Stratis

  1. dnf install stratis-cli stratisd
  2. systemctl enable --now stratisd
  3. stratis pool create pool1 /dev/vdb
  4. stratis pool list
  5. stratis pool add-data pool1 /dev/vdc
  6. stratis blockdev list pool1
  7. stratis filesystem create pool1 fs1
  8. stratis filesystem list
  9. stratis filesystem snapshot pool1 fs1 snapshot1

fstab:

UUID=c7b57190-8fba-463e-8ec8-29c80703d45e /dir1 xfs defaults,x-systemd.requires=stratisd.service 0 0

Databases

MySQL / MariaDB

  1. yum groupinstall mariadb mariadb-client
  2. systemctl start mariadb

  3. port 3306

    • firewall-cmd --permanent --add-service=mysql
    • firewall-cmd --reload
  4. /etc/my.cnf
    • bind-address
    • skip-networking=1
  5. mysql_secure_installation(1)
  6. mysql -u root -h localhost -p: connect

SQL:

Inserting:

INSERT INTO product(name,price,stock,id_category,id_manufacturer) 
                      VALUES ('SDSSDP-128G-G25 2.5',82.04,30,3,1);

Access rights:

Logical backup:

Physical:

  1. mysql -u root -p
  2. FLUSH TABLES WITH READ LOCK;
  3. UNLOCK TABLES;

firewalld

Tune system performance

See

nice, renice

selinux

See: - getenforce(8) - setenforce(8) - linux_config(5)