TIPS & TRICKSTo search the contents of the man pages # man -k searchterm # man -K searchterm Container tasks examplesTo keep in mind:Example for the generate, folder and linger: # man podman-generate-systemd Build a container 1| Use the URL http://classroom.example.com/Containerfile to build the container image with the name “web”| Build it in ~/mycontainer as harry user.| Do not modify the container file. Connect to Harry user and create the /mycontainer directory: $ mkdir ~/mycontainer
[ TAG ] : RH2024
TIPS & TRICKSTo search the contents of the man pages # man -k searchterm # man -K searchterm Configure LVMTo keep in mind: Création de partition LVM Création de PV (pour chaque partition) Création de VG (Englobant 1 ou plusieurs PV) Création de LV (Faisant partie d’un VG) Formatage du LV dans un système de fichier Création de répertoires pour monter les LV (1 LV = 1 Répertoire) Rendre persistant dans /etc/fstab Les PV:Un simple fdisk pour partitionner, ajouter le type (t) lvm: # fdisk /d
TIPS & TRICKSTo search the contents of the man pages # man -k searchterm # man -K searchterm SELinux task examplesTo keep in mind. Context: # cat /etc/selinux/config // Edit context - permanent Web site: # vim /etc/httpd/conf/httpd.conf // Change document root if needed# systemctl enable httpd.service --now# systemctl reload httpd.service # man semanage-fcontext# semanage fcontext -a -t httpd_sys_content_t "/myBlog(/.*)?"# restorecon -R -v /myBlog Users di
TIPS & TRICKSTo search the contents of the man pages # man -k searchterm # man -K searchterm Swap partition tasks examplesDon’t forget # mkswap /dev/sdb1# swapom /dev/sdb1 And in fstab: UUID=29ee03a0-196a-42cd-986f-4560097c9764 swap swap defaults 0 0UUID=fe0b8dff-238d-4748-8e16-c576c4c0b8be swap swap pri=42 0 0 Create a swap partition 1Create a swap partition of 512MB at /dev/sdb, with a persistent prioity of 20. # free -m # fdisk /dev/sdb/ // g, n, +512M, t, swap, w# partprobe# lsb
TIPS & TRICKSTo search the contents of the man pages # man -k searchterm # man -K searchterm Default target tasks examplesDefault target 1| Set the default target to boot into X Window level (previously level 5). It is simple task configuring systemd properly: # systemctl set-default graphical.target We can also check if it succeeded with: # systemctl get-default Additional comment: Here is the list of all targets in systemd: 0 poweroff.target 1 rescue.target 2 multi-user.targe
TIPS & TRICKSTo search the contents of the man pages # man -k searchterm # man -K searchterm Configure autofs task examplesAlways: # dnf install nfs-utils autofs -y # systemctl enable autofs --now# systemctl restart autofs Configure autofs 1| Configure autofs to automount the home directories of netuserX user.| Note theFollowing:| - netuserX home directory is exported via NFS, which is available on classroom.example.com(192.168.1.43)| and your NFS-exports directory is /netdir/netuserX for
TIPS & TRICKSTo search the contents of the man pages # man -k searchterm # man -K searchterm Manage FirewallMaybe very hard to memorize, so, if needed : # firewall-cmd -h | grep <pattern># firewall-cmd --<TAB> Then ALREADY RELOAD THE CONFIG for APPLY CHANGES: # firewall-cmd --reload Manage Firewall Example 1| Refuse domain 172.25.0.0/16 to access the server. # firewall-cmd --zone=block --add-source=172.25.0.0/16 --permanent# firewall-cmd --reload Manage Firewall Example 2| Rem
TIPS & TRICKSTo search the contents of the man pages # man -k searchterm # man -K searchterm Repository task examplesCreate a repository 1| Add new repositories :| - http://classroom.example.com/rhel8.0/x86_64/dvd/AppStream| - http://classroom.example.com/rhel8.0/x86_64/dvd/BaseOS Do it in console (not remote), if there is no ip or hostname assigned to take remote connectivity. You can do that: # dnf config-manager --add-repo http://classroom.example.com/rhel8.0/x86_64/dvd/AppStream# dnf c
TIPS & TRICKSTo search the contents of the man pages # man -k searchterm # man -K searchterm Script bash tasks examplesScript bash 1| Create a script file:| - if the paramater is “GM” it outputs “good morning”| - if it is “GN”, it outputs “good night” #!/bin/bash# Vérifie si exactement un argument est fourniif [ $# != 1 ]; then echo "Erreur : Ce script nécessite exactement un argument (GM ou GN)." exit 1fi# Vérifie la valeur de l'argumentif [ "$1" = "GM&quo
TIPS & TRICKSTo search the contents of the man pages # man -k searchterm # man -K searchterm Manage Root PasswordManage Root Password 1SUPPRIMER TOUTES DIRECTIVES console=... puis Ctrl-X. Ajouter init=/bin/bash dans la console de grub On doit obtenir un prompt # en bas d’écran, pensez à taper sur entrée au cas où le terminal soit rempli de messages console.Si l’écran reste noir, vous avez laissé traîner des console=, c’est vrai aussi avec rd.break. # mount -o remount /# /sbin/load_polic
TIPS & TRICKSTo search the contents of the man pages # man -k searchterm # man -K searchterm Users, groups and group memberships tasks examplesCreate users, groups and group memberships 1| Create the following users, groups and group memberships:| - A group named admin.| - A user harry who belongs to admin as a secondary group.| - A user natasha who belongs to admin as a secondary group.| - A user sarah who doesn’t have access to an interactive shell and who’s not a member of admin.| - Th
TIPS & TRICKSTo search the contents of the man pages # man -k searchterm # man -K searchterm Manage JournaldConfigure Journald 1| Configure journald to persist between reboots # vim /etc/systemd/journald.conf#Storage=autoStorage=persistent Apply (Seems you need to reboot to seen logs in /var/log/journal): # systemctl restart systemd-journald.service Then verify with journalctl after reboot (1 for 1rst reboot, 2 for second, etc.q): # journalctl -b 1 From man journald.conf: Storage=Cont
TIPS & TRICKSTo search the contents of the man pages # man -k searchterm # man -K searchterm Configure TunedTo keep in mind. If necessary: # yum install tuned -y # systemctl start tuned# systemctl enable tuned To manage tuned, you must use tuned-adm: # tuned-adm <TAB> Configure Tuned 1| Set the recommended tuned profile for your system. # tuned-adm recommend# tuned-adm profile virtual-guest // or whatever profile that it recommends Verify: # tuned-adm active Configure Tuned 2| set
TIPS & TRICKSTo search the contents of the man pages # man -k searchterm # man -K searchterm Configure NTPTo keep in mind. If necessary: # yum install chrony -y # systemctl restart chronyd.service# systemctl enable chronyd.service --now # vim /etc/chrony.conf Configure NTP 1| Configure your system so that it is an NTP pool of 2.centos.pool.ntp.org NTP is a service that is using chrony deamon. It should be already installed in the system but it does not cost You to issue: # yum install -y
TIPS & TRICKSTo search the contents of the man pages # man -k searchterm # man -K searchterm Manage FindTo keep in mind.Execute a simply find command in order to display the result in the terminal: # find / -user harry If it seems ok, you can use exec <cmd> {} <target> \; after: # find / -user harry -exec cp -rf {} /root/find.user \; Manage Find 1| Find all files owned by harry and copy them to /root/find.user| Find files (not subdirectories) owner by user
TIPS & TRICKSTo search the contents of the man pages # man -k searchterm # man -K searchterm Cron job tasksTo keep in mind: # systemctl status crond.service# systemctl enable crond.service# systemcdl restart crond.service Fin the full path by using the which command and use it in the crontab: # which <cmd> Exemple: # which echo/usr/bin/echo Files to check: # cat /var/log/cron // it shows list of cronjobs# cat /etc/crontab // it shows how cronjob works Cron job 1| Set a Cron
TIPS & TRICKSTo search the contents of the man pages # man -k searchterm # man -K searchterm Manage networkingManage networking Example 1| Assign hostname and ip address for your virtual machine.| - Hostname: servera.lab.example.com| - Ip address: 192.168.1.42| - Mask: 255.255.255.0| - Gateway: 192.168.1.1| - NameServer: 192.68.1.200 On console (not remote console) : # hostnamectl set-hostname servera.lab.example.com# hostnamectl Note the interface with the ethernet type: # nmcli connectio
Podman pour POD manager est un outil pour développer, gérer et exécuter des conteneurs sur des systèmes Linux, Podman est un projet open source de Red Hat. Son architecture inclusive et sans daemon le rend plus accessible et sécurisé pour gérer les conteneurs, les outils et fonctions qui l’accompagnent sont notamment Buildah et Skopeo. Par défaut, avec Podman, les conteneurs sont lancés en tant qu’utilisateurs non privilégiés. Podman, par rapport à Docker verrouille les environnements contre le