Skip to main content

Posts

Showing posts from 2022

How to check for open TCP ports in Linux using netcat, ssh, nmap, telnet and even just cat

    There are may ways to check for open TCP ports. Usually I prefer to use netcat or telnet, however in some cases (especially within docker containers) these tools are not installed or available. This post shows most common ways to check if a remote port is open or not. telnet Even though the telnet client tool is supposed to be used for the telnet protocol (ie. remotely logging in to a Unix computer before we had ssh), it is also a handy tool to check for an open port. For example, we can use it to check if we can access www.google.com via HTTPS: $ telnet www.google.com 443 Trying 142.250.70.196... Connected to www.google.com. If we see the " Connected " message, we can deduct from this that the port is open - even though there are protocol differences. Furthermore, if the service is unencrypted, telnet will show us status messages / protocol hints and versions etc. The following connects to a Google mail / SMTP server. $ telnet smtp.google.com 25 Trying 74.125.24.27... Co...

Viewing and tailing multiple Kubernetes container logs concurrently

Why Often I need to look at multiple pod logs at the same time. For example the nginx ingress controller deployment or daemonset usually has at least a handful of pods running to share the load and for additional redundancy. To troubleshoot problems, I need to see them all. Options The trusted kubectl (I am a kube cuttle guy) command has an option to view or tail multiple containers based on a selector like this. $ kubectl logs -n nginx-ingress -l ' app.kubernetes.io/name=fluent -bit '  -f  --max-log-requests 60 --tail=1 --prefix=true However, if the pods in question come and go frequently, I am recommending stern instead:   https://github.com/wercker/stern

Migrate CentOS8 to Rocky Linux 8

  The following steps will migrate your CentOS8 server to Rocky Linux 8. dnf -y install wget wget https://raw.githubusercontent. com/rocky-linux/rocky-tools/ main/migrate2rocky/ migrate2rocky.sh chmod a+x migrate2rocky.sh ./migrate2rocky.sh -r rm -rf /etc/yum.repos.d/backups /etc/yum.repos.d/CentOS-Linux- AppStream.repo.rpmsave /etc/yum.repos.d/CentOS-Linux- BaseOS.repo.rpmsave sync && init 6   That's it.

Migrate from CentOS7 to CentOS8

    The following steps will migrate a CentOS7 server to CentOS8. yum -y install epel-release yum -y install yum-utils rpmconf rm -f /etc/ issue.net ; mv /etc/issue.net.rpmsave /etc/ issue.net rpmconf -a # 5 times N rm -rf /etc/yum.repos.d/reece.repo yum clean all package-cleanup --orphans | egrep 'noarch|x86_64' | xargs -r -n 1 yum -y remove package-cleanup --leaves | egrep 'noarch|x86_64' | xargs -r -n 1 yum -y remove # do above until none found - leaves 4-5 times yum install -y dnf dnf remove -y yum yum-metadata-parser rm -Rf /etc/yum dnf -y upgrade dnf -y install http://vault.centos.org/8.5. 2111/BaseOS/x86_64/os/ Packages/{centos-linux-repos- 8-3.el8.noarch.rpm,centos- linux-release-8.5-1.2111.el8. noarch.rpm,centos-gpg-keys-8- 3.el8.noarch.rpm} dnf -y upgrade https://dl.fedoraproject.org/ pub/epel/epel-release-latest- 8.noarch.rpm cd /etc/yum.repos.d && mkdir backups && mv CentOS-* backups tee CentOS-Linux-BaseOS.repo<<...

Migrate from RHEL7 to CentOS7

    The following steps will convert a RHEL7 Linux server to CentOS7.   yum -y remove rhnlib redhat-support-tool redhat-support-lib-python rpm -e --nodeps redhat-release-server rpm -e --nodeps redhat-logos rpm -e --nodeps yum rpm -e redhat-indexhtml-7-13.el7. noarch rpm -qa | egrep -i "rhn|redhat" rm -rf /usr/share/doc/redhat-release/ /usr/share/redhat-release/   mkdir tmp && cd tmp curl -O http://mirror.centos.org/ centos/7/os/x86_64/RPM-GPG- KEY-CentOS-7 curl -O http://mirror.centos.org/ centos/7/os/x86_64/Packages/ yum-plugin-fastestmirror-1.1. 31-54.el7_8.noarch.rpm curl -O http://mirror.centos.org/ centos/7/os/x86_64/Packages/ yum-3.4.3-168.el7.centos. noarch.rpm curl -O http://mirror.centos.org/ centos/7/os/x86_64/Packages/ centos-release-7-9.2009.0.el7. centos.x86_64.rpm curl -O http://mirror.centos.org/ centos/7/os/x86_64/Packages/ centos-logos-70.0.6-3.el7. centos.noarch.rpm rpm --import RPM-GPG-KEY-CentOS-7 rpm -Uvh *.rpm yum clean...