Wednesday 5 February 2020

CentOS 8

ip a / ip address     #show ip address
nmtui     #NetworkManager TUI
nmcli d     #NetworkManager device
 
yum install epel-release
yum update
yum install dnf
yum install vim
dnf install chrony

yum install iftop htop telnet tmux     #iftop -i eth0   #telnet only for test tcp port

yum install nc    #nc -z -v -u 192.168.10.12 161   #nc for test udp port

yum install traceroute
yum install nmap     #nmap -sU 192.168.10.12 to scan udp port
yum install iperf3
yum install bind-utils     #dig

yum install httpd
yum install mariadb-server
dnf install php php-opcache php-gd php-curl php-mysqlnd


#####################################################
Network interface configuration file:
[root@PacketFence-ZEN ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens160
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static     #or none/dhcp
DEFROUTE=yes     #yes: This interface is set as the default route for IPv4|IPv6 traffic.
IPV4_FAILURE_FATAL=no     #no: This interface is not disabled if configuration fails.
IPV6INIT=yes     #yes: Enable IPv6 on this interface.
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens160
UUID=27f5f975-99f0-444d-a2f0-2e0a039810d3
DEVICE=ens160
ONBOOT=yes     yes: This interface is activated at boot time.
HWADDR=08:00:29:5b:85:77
IPADDR=10.10.10.79
PREFIX=24
GATEWAY=10.10.10.1
DNS1=8.8.8.8
DNS2=8.8.4.4

[root@PacketFence-ZEN ~]# vim /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1              localhost localhost.localdomain localhost6 localhost6.localdomain6
1.2.3.4 www.google.com

[root@PacketFence-ZEN ~]# vim /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4

[root@PacketFence-ZEN ~]# vim /etc/sysconfig/network  #This file specifies global network settings
GATEWAY=10.10.10.1

Restart Network Services:
systemctl restart NetworkManager
nmcli networking off; nmcli networking on

#####################################################

NTP:
dnf install chrony
systemctl enable chronyd
vim /etc/chrony.conf
    allow 192.168.0.0/16     #If want to set Chrony to act as an NTP server for a local network.
    Server 192.168.1.150     #if want to set Chrony to act as an NTP client.
systemctl restart chronyd
firewall-cmd --permanent --add-service=ntp
firewall-cmd --reload
chronyc sources     #Check for NTP server sources.

timedatectl   #Read clock, RTC(hardware clock)
timedatectl set-local-rtc 1   #change the hardware clock time standard to localtime
timedatectl set-local-rtc 0   #revert to the hardware clock being in UTC
timedatectl set-timezone Asia/Kuala_Lumpur
timedatectl set-ntp yes
timedatectl set-ntp on
yum install ntp
ntpq -p
hwclock
ntpdate pool.ntp.org
ntpdate -u pool.ntp.org
logfile /var/log/ntp.log   #If you logfile
ss -atun | grep 123   #check if ntpd daemon is listening on it’s port


#####################################################

TMUX:
[root@centos8 ~]# tmux     #Creating sequence name Tmux Sessions
[root@centos8 ~]# tmux new -s session_name     #Creating Named Tmux Sessions
Ctrl+b d     #Detaching from Tmux Session
[root@centos8 ~]# tmux ls     #list all Tmux Session
[root@centos8 ~]# tmux attach-session -t 0     #Re-attaching to Tmux Session
Ctrl+b %     #Split current pane horizontally into two panes
Ctrl+b "     #Split current pane vertically into two panes
Ctrl+b o     #toggle between panes
 
#####################################################


yum install net-snmp net-snmp-utils

systemctl enable snmpd
vim /etc/snmp/snmpd.conf
    com2sec notConfigUser  default       <CommunityName>
    group   notConfigGroup v2c           notConfigUser
    view    allview       included   .1
    access  notConfigGroup ""      any       noauth    exact  allview none none
systemctl restart snmpd