Posts

Secure Your SSH Logins: How to enable SSH 2FA on AlmaLinux

Image
Introduction Enabling two-factor authentication (2FA) for SSH logins on AlmaLinux significantly enhances your system’s security by adding an extra layer of protection. In this tutorial, we'll guide you through the process of setting up 2FA, ensuring your SSH connections are more secure against unauthorized access. This method integrates the use of Google Authenticator, providing a simple and effective way to bolster your server’s defense. Follow these detailed steps to configure 2FA on your AlmaLinux system, and safeguard your data with an additional verification step every time you log in. Install the Google Authenticator on AlmaLinux sudo dnf install epel-release -y sudo dnf install google-authenticator qrencode qrencode-libs -y After install completes, I will create a new secret key in ~/.ssh directory Run command as follows google-authenticator -s ~/.ssh/google_authenticator The output terminal as below [root@DevopsRoles ~]# google-authenticator -s ~/.ssh/google_authenticator ...

How to Perform speed test command line linux - Quick and Accurate Methods

Image
Introduction In the world of network administration and troubleshooting, knowing how to test your internet speed efficiently is a must. For Linux users, there are powerful command-line tools available to perform speed tests without the need for graphical interfaces or third-party applications. This article will guide you through several methods to measure download, upload, and ping speeds directly from the terminal, making it easier to diagnose connectivity issues and optimize your network performance. In this tutorial, How to  run a Speedtest from your command line. The requirement Nodejs version > 8+.  speed test command line Install speed test command line [vagrant@localhost ~]$ wget https://nodejs.org/dist/v14.15.4/node-v14.15.4.tar.gz [vagrant@localhost ~]$ tar xvf node-v14.15.4.tar.gz [vagrant@localhost ~]$ cd node-v14.15.4/ [vagrant@localhost node-v14.15.4]$ sudo ./configure [vagrant@localhost node-v14.15.4]$ sudo make [vagrant@localhost node-v14.15.4]$ sudo make ins...

Rasberry Pi 4 can't connect to WiFi ubuntu server [fixed]

Introduction In this tutorial, How to connect to WiFi ubuntu server on Rasberry Pi  4. Today, I buy Rasberry PI 4 new and install ubuntu 20.04 LTS. root@ubuntu:~# cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS" root@ubuntu:~#  after finish, Rasberry Pi 4 no identify ip address of wilfi. :D.  Rasberry Pi 4 can't connect to WiFi ubuntu server [fixed] The first, check network interface your system. ll -la /sys/class/net/ Create new file config for wifi " /etc/netplan/wlan.yaml" apply configure and reboot netplan apply The result, as below root@ubuntu:~# ll -la /sys/class/net/ total 0 drwxr-xr-x  2 root root 0 Jan  1  1970 ./ drwxr-xr-x 74 root root 0 Jan  1  1970 ../ lrwxrwxrwx  1 root root 0 Jan  1  1970 eth0 -> ../../devices/platform/scb/fd580000.ethernet/net/eth0/ lrwxrwxrwx  1 root root 0 Jan  1  1970 lo -> ../../devices/virtual/net/l...

How to change the order of columns in the output

In this tutorial, How to change the order of columns in the output of `uniq -c` command. I use read the file and show the unique Name from the file. How many time this name of the file? The content of file as example below [HuuPV@DevopsRoles ~]$ cat devopsroles.txt  huu huu phan van dev devopsroles dev huu huu I use awk, sort uniq command to read file and show the unique Name as example below [HuuPV@DevopsRoles ~]$ cat devopsroles.txt | awk '{print $1}' | sort | uniq -c | sort -nr       4 huu       2 dev       1 van       1 phan       1 devopsroles Now, How to change the order of columns in the output of file [HuuPV@DevopsRoles ~]$ cat devopsroles.txt | awk '{print $1}' | sort | uniq -c | sort -nr | awk '{ print $2,$1}' huu 4 dev 2 van 1 phan 1 devopsroles 1 [HuuPV@DevopsRoles ~]$ cat devopsroles.txt | awk '{print $1}' | sort | uniq -c | sort -nr | awk '{ print $1,$2}' 4 huu 2 dev 1 van 1 phan 1 devopsroles ...

ntfsfix fix NTFS not mount from Linux

Introduction Encountering issues with mounting an NTFS-formatted external USB drive on Fedora 32 is a common problem for Linux users. This typically happens due to file system errors or compatibility issues between Linux and NTFS. Fortunately, Linux provides powerful tools like ntfsfix to resolve these issues effectively. In this guide, we’ll walk you through the step-by-step process of identifying the problem, fixing the corrupted NTFS filesystem, and ensuring your external USB drive works seamlessly on Fedora 32. Whether you’re a beginner or an experienced Linux user, this solution will help you troubleshoot and resolve NTFS drive mounting issues with ease. How to Fix Corrupted NTFS External USB Drive on Fedora 32 Step 1: Install Required Packages First, install the ntfs-3g and ntfsprogs packages on your Fedora system to ensure you have the necessary tools for working with NTFS partitions. Run the following command:  sudo dnf install ntfs-3g ntfsprogs Step 2: Identify Your Ex...

How to Fix the semanage command not found in Centos 8

Introduction Encountering the "semanage command not found" error in CentOS 8? Learn how to fix it by installing the necessary package. This step-by-step guide will help you resolve the issue and get back to managing SELinux policies efficiently. If you're working with SELinux (Security-Enhanced Linux ) on CentOS 8, you may come across the error `bash: semanage: command not found`. This error indicates that the `semanage` command, which is essential for managing SELinux policies, is not available on your system. In this guide, we'll walk you through the steps to fix this issue by installing the required package. By the end of this tutorial, you'll have the `semanage` command up and running on your CentOS 8 system. Understanding the Error: "semanage command not found" What is the `semanage` Command? The `semanage` command is a part of SELinux, which stands for Security-Enhanced Linux. SELinux is a security architecture integrated into the Linux kernel, pro...

How to Upgrade php version on Centos 7: A Comprehensive Guide

Introduction Learn how to upgrade PHP version on CentOS 7 from PHP 7.1 to PHP 7.4 in this detailed guide. Follow our step-by-step instructions to ensure a smooth upgrade process on your CentOS 7 server. Upgrading your PHP version on CentOS 7 is essential for ensuring that your server is secure, efficient, and compatible with the latest web applications. In this guide, we will walk you through the process of upgrading from PHP 7.1 to PHP 7.4. Whether you're running a personal blog, a business website, or a complex application, keeping your PHP version up to date is crucial. This tutorial will cover everything you need to know, from checking your current PHP version to enabling the Remi repository and updating your server. Why Upgrade PHP on CentOS 7? PHP is a server-side scripting language that powers a large percentage of websites on the internet. Each new version of PHP brings improvements in performance, security, and features. By upgrading to PHP 7.4, you can take advantage of ...

How to Install Specific Version of Package use YUM

Image
Introduction Learn how to install specific versions of packages using YUM on CentOS/ RHEL systems with detailed steps and advanced examples. YUM (Yellowdog Updater, Modified) is a powerful package management tool used in CentOS and RHEL-based systems. While installing the latest version of a package is straightforward, sometimes you might need a specific version. This guide covers the steps to install a specific package version using YUM, from basic to advanced examples. Understanding YUM and RPM YUM is a front-end tool for RPM (Red Hat Package Manager) that manages package installations, updates, and removals. RPM is the underlying package format used by Red Hat-based distributions. Understanding these tools is crucial for efficient package management. What is YUM? YUM simplifies the process of managing RPM packages by resolving dependencies and retrieving package metadata from repositories. It can install, update, and remove packages from your system. What is RPM? RPM is a low-level...

How to resolve Error: rpmdb open failed In CentOS

In this tutorial, How to resolve Error: rpmdb open failed Error In CentOS. I was testing on nginx web server in Centos 7 VM Linode . Unfortunaely, I have install new package with yum command , I got this error message: error: rpmdb: BDB0113 Thread/process 3050/139803232012096 failed: BDB1507 Thread died in Berkeley DB library error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery error: cannot open Packages index using db5 -  (-30973) error: cannot open Packages database in /var/lib/rpm CRITICAL:yum.main: Error: rpmdb open failed It seemes like YUM broke down. I have not run any yum command. Solve problem, just do the following steps.   First backup the rpm database using command as root user: # mv /var/lib/rpm/__db* /tmp Run the following command: # yum clean all # yum update Clean backup # rm -i /tmp/__db* I hope this helps you.

How to Safely Remove old kernels in CentOS, RHEL and Fedora

Image
Introduction Learn how to safely remove old kernels on CentOS , RHEL , and Fedora to free up space and improve system performance. Step-by-step guide with best practices for maintaining your Linux system. As you continue to update and upgrade your Linux system, particularly on distributions like CentOS, RHEL, and Fedora, old kernels can accumulate over time. While these kernels are essential for booting your system, having too many can clutter your boot menu and consume valuable disk space. This guide will walk you through the process of safely removing old kernels from your system without risking stability, ensuring that your Linux machine runs smoothly and efficiently. Why Should You Remove Old Kernels? The Problem with Accumulating Kernels Linux kernels are the core of the operating system, responsible for managing hardware and system processes. Every time you update your system, a new kernel may be installed, but the old ones aren't automatically removed. This can lead to seve...