Category: Bash

Comment uncomment and replace characters in multiple lines in Vim

Modifying files in Vim can be arduous and time-consuming, especially when we want to modify multiple lines at once. The typical use case is modifying a configuration file in the system when it is required to comment or uncomment multiple lines at a time, or to replace the same character in many similar lines from the top to the bottom. Here are a few hints on how to facilitate multiple line modifications in text files using Vim editor.

Read More

Install and Configure Checkmk on CentOS 8 and Monitor Linux Hosts using Checkmk agent

If you have important production servers or critical services in your network, having monitoring tools becomes a must. In case of any hardware or software failures, it is crucial to get alerted as soon as possible and take appropriate actions to fix the failure.
In this article I would like to take a look at checkmk – a powerful monitoring software, developed by tribe29 GmbH with tons of configuration options and a user-friendly WebGUI, which can help you fully automate monitoring activities of your hardware and operating systems.
Read More

Configure Postfix SMTP Relay (Smart Host) on CentOS 8

Install and Configure Postfix SMTP Smart Host on CentOS
Postfix is a Mail Transport Agent (MTA), which can be easily configured as a private relay host, passing mail to other mail servers. Unlike Sendmail, Postfix is considered a very secure MTA, offering a high level of flexibility and ease of administration.
In this article, I am configuring Postfix on CentOS 8 as SMTP smart host (relay host) using SASL authentication to send out mail further to the OVH mail server.
Read More

Configure Sendmail MTA on CentOS 8 to work as SMTP Relay

Sendmail is easy to implement, lightweight electronic Mail Transport Agent (MTA), which enables you to automate the process of sending e-mail messages from your Linux host. It can play a significant role as a background mechanism for processing outbound emails from monitoring software to deliver status notifications to the system administrators or send diagnostic information at a specified time schedule.
In this article, I present how to install and configure Sendmail on CentOS 8 to work as SMTP Relay for outbound traffic to the OVH mail server.
Read More

Kickstart Tutorial – Practical Examples for RHEL 7 / CentOS 7

kickstart tutorial Red Hat 7 CentOS 7
Linux installation can be performed totally unattended using Kickstart file, which contains configuration, required setup and post installation tasks to fully automate installation process without being prompted for any input details. Kickstart file can be placed in the remote repository or can be included in ISO image in order to be read by Anaconda installer during system installation.

In this tutorial we present some practical solutions that can be placed in kickstart file to automate CentOS 7 / Red Hat 7 installation tasks.
Read More

Create tenant in OpenStack Newton using command line interface

Create tenant in Openstack Newton using command line interface
OpenStack comes out of the box with it’s dashboard called Horizon. Horizon provides GUI, which let us manage our OpenStack environment in pretty easy and inuitive way. However basic tasks, like tenant creation or instance commissioning, can be time consuming when performed in Horizon. Using command line interface with previously prepared command templates can be more efficient and faster.

In this tutorial we present how to create Project Tenant in OpenStack Newton using command line intrerface and launch Cirros based Instances inside the Tenant.

Some time ago OpenStack Community introduced new tool called OpenStackClient (OSC) with it’s openstack command utility to unify OpenStack management, which encompasses the following components: Compute, Identity, Image, Object Storage and Block Storage APIs. So far keystone command utility was withdrawn from OpenStack as deprecated and replaced by mentioned openstack command utility. In this tutorial for Newton release we are going to use openstack commands where possible to become familiar with OpenStackClient CLI.
Read More

Mount | Modify | Edit | Repack | Create UEFI ISO with Kickstart File inside

Mount Modify Edit Re-pack Create UEFI ISO including Kickstart file
Linux installation process can be simplified by means of Kickstart Installation method, used in Linux distributions like: Red Hat, Debian, Fedora, CentOS, Ubuntu. This method utilizes so called Kickstart File, which describes the configuration, required setup and post installation tasks for Kickstart Linux installation.

Kickstart File can be placed in the remote repository, accesible via NFS, HTTP, FTP, etc…, or can be included in ISO image, which is pretty convenient, especially when we don’t want to or don’t have a possibility to create network repository to store a Kickstart File.

In this tutorial we will download original CentOS 7.2 / RHEL 7.2 ISO image, mount it in the Linux file system, modify it by adding Kickstart File (ks.cfg) and re-pack it to create custom UEFI bootable RHEL 7.2 ISO image using mkisofs command.
Read More

Create USB Boot Disk in Linux using dd command

create usb boot disk using dd utility
Have you ever tried to quickly create USB Boot Disk in Linux and had no dedicated software to create one?
For a long time Linux distributions have come with basic tools like dd utility out of the box. dd command can be used to quickly create USB Boot Disk from the given ISO file without using dedicated tools like unetbootin.
Read More

Linux cp mv overwrite without prompt (disable interactive mode)

Linux cp mv disable prompt
Some Linux distributions (for example: RedHat) have aliases configured in the system, especially for root user, which modify basic command line operations like: cp, mv by adding “-i” parameter to prevent user from accidental overwriting or deleting files (interactive mode). This can be disturbing, especially when we are dealing with many files at a time. To get rid of this issue we can modify aliases in the system to disable interactive mode.
Read More

ifdata – network interface information tool – ifconfig alternative

ifdata is a quick, lightweight and simple tool to display network interface information in Linux, which can be used as an alternative for ip addr show or ifconfig.

Sometimes I want to quickly find out, if the particular network interface exists in the system or I want to display it’s IP address or MTU value only. If I used ifconfig for this case, I would have to parse the output using grep or other tools. ifdata resolves this problem in more sophisticated manner – it utilizes parameters to better control the output we want to obtain. This is another reason why ifdata is more friendly for use in BASH scripting.
Read More