High Availbility

OS & Virtualization

Wednesday, April 06, 2016

Linux & command - Firewalld

Firewall

The firewall on Redhat 7 Linux system is enabled by default.
  1. Stop and Start RHEL7 firewall

    root@rhel7 ~] service firewalld stop
    root@rhel7 ~]# service firewalld start |
  2. Disable and Enable RHEL7 firewall

    [root@rhel7 ~]# systemctl disable firewalld
    [root@rhel7 ~]# systemctl enable firewalld
  3. How to open http port 80 on Redhat 7 Linux using firewall-cmd

    [root@rhel7 ~]## firewall-cmd --zone=public --add-port=80/tcp

    Once you add the above firewall rule reload firewall service:

    [root@rhel7 ~]# firewall-cmd --reload 4.
  4. List all the port

    [root@SGNWH01HP1DB1 firewalld]# firewall-cmd --zone=public --list-all public


Start, Stop and Restart services on systemd RHEL



  1. list all currenly running services

    [root@rhel7 ~]# systemctl list-units --type=service | grep running
  2. list all active services available

    [root@rhel7 ~]# systemctl list-units --type=service

Journal Analysis

  1. To get the content of the Systemd journal,
    # journalctl
  2. To get all the events related to the crond process in the journal
    # journalctl --unit=chronyd
  3. To get all the events that appeared today in the journal, type:
    # journalctl --since=today
  4. To display the disk space used by Journald# journalctl --disk-usage
  5. To get the 10 last events
    # journalctl -f

Boot Process

  1. To get the boot process duration
    # systemd-analyze


Service Management

Systemd deals with all the aspects of the service management. The systemctl command replaces the chkconfig and the service commands
  1.  To activate the NTP service at boot
    # systemctl enable ntpd
  2. To deactivate it, start it, stop it, restart it, reload it, type:
    # systemctl disable ntpd
    # systemctl start ntpd
    # systemctl stop ntpd
    # systemctl restart ntpd
    # systemctl reload ntpd
  3. To get the status of the Apache service
    # systemctl status httpd
  4. To get the list of services that failed at boot, type:
    
    
    # systemctl --failed
  5. To get all the configuration details about a service (here httpd), type:
    
    
    # systemctl show httpd

Other commands

  • nmtui
  • nmcli
  • ip


How to add a user to the sudoers list

How to add a user to the sudoers list?



 
cat << END >> /etc/sudoers
oracle ALL=(ALL) NOPASSWD:ALL
Defaults:oracle !requiretty
END