Basic
---
Configure Firewall on CentOS 8
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld
systemctl start NetworkManager.service
systemctl enable NetworkManager.service
systemctl restart NetworkManager.service
systemctl stop NetworkManager.service
Using nmcli Tool [network will on/off]
# nmcli networking off
# nmcli networking on
[root@mail ~]# vi /etc/selinux/config
SELINUX=disabled
elrepo-release
dnf -y install elrepo-release
dnf --enablerepo=elrepo install [packages]
dnf -y install elrepo-release
OR
# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
# dnf install https://www.elrepo.org/elrepo-release-8.0-2.el8.elrepo.noarch.rpm
# dnf -y install dnf-utils
Update System Software
# dnf check-update
# dnf -y update
# dnf clean all
yum -y update
SSH
# dnf -y install openssh-server
systemctl start sshd
systemctl enable sshd
firewall-cmd --zone=public --permanent --add-service=ssh
systemctl reload sshd
Install System Utilities
# dnf install nano vim wget curl net-tools lsof bash-completion
dnf -y install yum-utils nmap mailx lsof net-tools quota* xfsprogs xfsdump xfsprogs-devel xfsprogs-qa-devel htop iptraf-ng iftop mutt vim* mlocate httpd* NetworkManager-tui gcc openssl cyrus* ntsysv curl lsof bash-completion git wget unzip bash-completion cronie grep NetworkManager* crontabs webmin
dnf -y install git zlib-devel libuuid-devel libmnl gcc make git autoconf automake pkgconfig curl findutils
Cockpit on CentOS 8
dnf install cockpit -y
# systemctl start cockpit.socket
# systemctl enable --now cockpit.socket
# systemctl status cockpit.socket
# ps auxf|grep cockpit
https://<Your-CentOS8/RHEL8-System-IP>:9090
pstree commands to discover and identify all unwanted services and remove them from the system
# dnf install psmisc
# pstree -p
Set Hostname in CentOS 8
# nmtui-hostname
Set Static IP Address in CentOS 8
# nmtui-edit
# ifconfig enp0s3
# ip a
# ping -c2 google.com
Manage Services in CentOS 8
# systemctl list-units
# systemctl list-unit-files -t service
install syslog on RHEL 8 / CentOS 8
# dnf install rsyslog -y
# rpm -q rsyslog
# dnf info rsyslog --verbose
[...]
Installed Packages
Name : rsyslog
Version : 8.37.0
Release : 6.el8
Arch : x86_64
Size : 2.2 M
Source : rsyslog-8.37.0-6.el8.src.rpm
Repo : @System
[...]
Install time : Thu Dec 27 12:24:35 2018
# systemctl status rsyslog.service
# systemctl start rsyslog.service
# systemctl stop rsyslog.service
# systemctl disable rsyslog.service
# systemctl enable rsyslog.service
# echo "test message from user root" | logger
Securing SSH Remote Logins
# dnf -y install openssh-server
# vi /etc/ssh/sshd_config
Find the line that says #PermitRootLogin yes, uncomment the line by deleting the # from the beginning of the line and modify the line to.
PermitRootLogin no
# systemctl restart sshd
# ssh root@192.168.0.110
# systemctl start sshd
# systemctl enable sshd
Open the firewall rules to accept incoming traffic on SSH port 22:
# firewall-cmd --zone=public --permanent --add-service=ssh
# the list of services that are active now
[root@dlp ~]# systemctl -t service
# list of all services
[root@dlp ~]# systemctl list-unit-files -t service
[root@dlp ~]# systemctl stop smartd
[root@dlp ~]# systemctl disable smartd
---