DAY 17 - YUM | SSH | SYSTEMCTL | CRON JOB | SYSTEM LOG

q  YUM [Yellow Dog Updater Modified]: 

v  Option 01:

§  mkdir -p /opt/myPackages/rpms
§  cp -rf /run/media/root/RHEl-8-1-0-BaseOS-x86-64/AppStream/Packages/* /opt/myPackages/rpms

§  yum whatprovides createrepo
§  yum repolist
§  cd /etc/yum.repos.d
§  rm -rf *

Ãœ  createrepo -d /opt/myPackages

    o   repodata | rpms

§  yum-config-manager --add-repo=file:///opt/myPackages
§  cd /etc/yum.repos.d
§  opt-myPackages.repo

v  Option 02:

§  cd /etc/yum.repos.d
§  vi rhel9_local.repo

[BaseOS]
name=REHL 9 - BaseOS
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///rhel9/BaseOS/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
 
[AppStream]
name=RHEL 9 - AppStream
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///rhel9/AppStream/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
 
Ãœ  Update the Package Index
§  yum clean all

Ãœ  Test Local Yum/DNF Repository
§  yum repolist
§  yum install nginx

v  yum localinstall vsftpd-3.0.5-150600.8.5.x86_64.rpm
v  yum remove vsftpd-3.0.5-150600.8.5.x86_64.rpm

r  In production always follow procedure:

v  I-Install
v  S-Start
v  E-Enable
v  T-Test

r  Service/Systemctl

§  service – Till Linux 6
§  systemctl – Start from Linux 7
§  systemctl <Action-start/stop/restart/status/enable/disable/reload > <ServiceName-sshd/crond/nginx/httpd/Networkmanager>

v  systemctl status crond
v  systemctl is-active crond.service
v  systemctl is-enabled crond.service
v  systemctl stop crond.service
v  systemctl disable crond.service
v  systemctl start crond.service
v  systemctl restart crond.service

v  systemctl get-default

§  graphical.target

v  systemctl set-default multi-user.target
v  systemctl isolate graphical.target
v  systemctl mask crond.service [Never start service although manually start]
v  systemctl unmask crond.service
 
r  Cron Job:

§  Packages: crontabs
§  Config File: /etc/crontab
§  Service: crond

v  Config Command:

§  crontab -l [l means list]
§  crontab -e [e means edit]
§  crontab -r [r means remove]
§  crontab -l -u <username>
§  crontab -e -u <username>
§  crontab -r -u <username>

MOH   HOD    DOM   MOY    DOW  COMMAND
*/2          *         *           *           *       mkdir /tmp/shohan [Run every after 2 minutes]  
23        14         *           *           *       /bin/echo “Hello World” [Run 14:23]

[root@rhel ~]# cd /var/spool/cron/ [Will be created a file for every user]
[root@rhel cron]# crontab -r -u shohan
[root@rhel cron]# crontab -e -u shohan
[root@rhel cron]# crontab -l -u shohan
[root@rhel cron]# vi /etc/cron.deny [not allowed user to use crontab ]
                              --shohan | alex
[root@rhel cron]# vi /etc/cron.allow [manually allow specific user]
                              --shohan | alex

r  Log-System

§  tail -f /var/log/message [Till Linux 7]
§  systemctl status systemd-journald [Start from Linux 8]
§  cd /var/log [all service log file]

§  [root@rhel log]# journalctl [All log are there]
§  [root@rhel log]# journalctl -u crond.service [u means unit – specific service]

Previous Post Next Post

نموذج الاتصال