piątek, 19 kwietnia 2013

Self prepare for REDHAT RHCSA EX200 Part 2: Operate running systems

Part 2: Operate running systems

1) Boot, reboot, and shut down a system normally.
* reboot
* halt
* shutdown -r now (for reboot)
* shutdown -h now (for reboot)

some time and messages to users
* shutdown -r 19:45 'system is going for restart at 19:45'
* shutdown -r +5 'system is going for restart in 5 min'
* shutdown -h +5 'system is going down in 5 min'

* use init with level
init 0 for restart
init 6 for halt

2) Boot systems into different runlevels manually.
* init 0/1/2/3/4/5/6

  ;) from Part 1

  init LEVEL_NUMER, where they are possible to set from 0 to 6
  0 - halt (just shut down system)
  1 - single user mode, no services, no network, probably can ask for root password to get /bin/bash or /bin/sh, used for maintance tasks, repairs ...
  2 - multi user mode, no network
  3 - normal multi user mode, working services, network, no X11 interface (no gdm or kdm ;) )
  4 - not used
  5 - same options like 3 but with X11 interface, started GDM or KDM login screen
  6 - reboot

3) Use single-user mode to gain access to a system.

* at start time add letter s or word single to kernel cmd line in GRUB or LILO ;)
  then system should give root shell, sometimes it ask for password (PLD Linux asks ;) )

4) Identify CPU/memory intensive processes, adjust process priority with renice, and kill processes.
* top
* ps
  ps -aux list all user process
  ps -auxw(more wwww) shows long cmdline
  ps -auxew shows environment
  ps -e fZ shows tree
  ps -u USER to see user process
  ps fe -o pid,comm,nice

* pstree

* kill
  kill -9 PID
  kill -9 -1 ;)

* pkill

* killall -SIGNAL bla bla ;)

* renice, change priority of running program from -20 (very fast), 0 (normal) to +20 (very low)
 
  renice +1 987 -u daemon root -p 32
  would change the priority of process ID's 987 and 32, and all processes owned by users daemon and root

  user can only do from 0 to -20
  renice  +10 4863
  4863 (process ID) old priority 10, new priority 10

  renice  -10 4863
  renice: failed to set priority for 4863 (process ID): Permission denied

  sudo renice  -10 4863
  4863 (process ID) old priority 10, new priority -10


* nice, run CMD with modified sheduling priority
  nice -n +10 /bin/whatever

5) Locate and interpret system log files.
* maybe redhat use some magics ... https://access.redhat.com/site/documentation/en-US/Red_Hat_Directory_Server/8.1/html/Using_the_Admin_Server/Administration_Server_Basics-Logging_Options.html

* but go to /var/log/ and there is all ;)

* rsyslog !!!
Log Files
/var/log/messages = Logs anything of the info level or higher except for mail and authentication messages.
/var/log/secure = Logs all of the authentication attempts on the server.
/var/log/cron = Logs all cron related information.
/var/log/maillog = Logs all mail messages.
/var/log/boot.log = Logs boot related messages.

* /etc/rsyslog.conf (usually it is syslog.conf file when syslog package is used ;) )

* facility
debug,
info,
notice,
warn,
err,
crit,
alert,
emerg

* basics logging facility
authpriv    access-control-related messages
cron        cronjob messages
kern        kernel messages
mail        mail messages
news        news messages
user        user messages
uucp        uucp messages

* some redhat files
audit        includes audit.log SELinux logging
boot.log    services that start and shut down processes
btmp        lists failed login attempts, readable with the utmpdump btmp command
cron        information from the cron daemon
dmesg        basic boot messages
maillog        e-mail server messages
messages    messages from other services as defined in /etc/syslog.conf
secure        list login and access messages
setroubleshoot    messages from the SELinux troubleshooting tool
spooler        messages from the SELinux troubleshooting tool
Xorg.0.log    setup messages for the X Window System, config problems
yum.log        logs packages installed and updated with yum

6) Access a virtual machine's console.
* ssh
* vnc
* logon on text console
...

7) Start and stop virtual machines.
* some preparation on my redhat vbox ;)
  virt-what will show some info

* open virt-manager then find VM

* find virtsh command

*
  yum install virt-manager
  yum install libvirt libvirt-python libvirt-python python-virtinst
  or that ... yum groupinstall Virtualization

* now can use virsh  list

[root@localhost ~]# virsh  list
 Id    Name                           State
----------------------------------------------------

virsh start <virtualmachinename>
virsh shutdown <virtualmachinename>
virt-viewer domain_name
ssh username@virtual-ip-address-here


8) Start, stop, and check the status of network services.
* chkconfig

* ntsysv (ncurse gui ;) )

* service NAME (statuts, stop whatever ;) ) it does it like this: /etc/rc.d/init.d/NAME ...

* /etc/rc.d/init.d/NAME ... to do some job ;)


1 komentarz:

  1. I bought your RedHat updated EX200 question and answers last week, and I must say they were great. The product is of great quality. The answers to the questions are detailed and very easy to understand. Love you guys! Fantastic work! Thanks so so so much for your help! I will recommend DumpsForSure to others.

    OdpowiedzUsuń