Add User to Sudoers on CentOS

You can do this in 2 methods- however, IMHO method-2 usually works great for me.

Method-1

Step 1: Verify the Wheel Group is Enabled

Your CentOS 7 installation may or may not have the wheel group enabled. Open the configuration file by entering the command:

visudo

Scroll through the configuration file until you see the following entry:

## Allows people in group wheel to run all commands
# %wheel        ALL=(ALL)       ALL

If the second line begins with the # sign, it has been disabled and marked as a comment. Just delete the # sign at the beginning of the second line so it looks like the following:

%wheel        ALL=(ALL)       ALL

Then save the file and exit the editor. Continue reading “Add User to Sudoers on CentOS” »

Share

Remove Old Unused Kernels in CentOS

To display the current version of Linux (kernel) running on your system, run this command.

# uname -sr
Linux 3.10.0-327.10.1.el7.x86_64

List All Installed Kernels on System

You can list all kernel images installed on your system like this.

# rpm -q kernel
kernel-3.10.0-229.el7.x86_64
kernel-3.10.0-229.14.1.el7.x86_64
kernel-3.10.0-327.3.1.el7.x86_64
kernel-3.10.0-327.10.1.el7.x86_64

Removing Old/Unused Kernels on CentOS/RHEL

You need to install yum-utils, which is an assortment of utilities that integrate with yum to make it more powerful and easier to use, by extending its original features in several different ways. Continue reading “Remove Old Unused Kernels in CentOS” »

Share

Install MySQL 5.7 on CentOS 7

Preqrequsite:

It’s better to have installed development tools and disable NetworkManager for a produciton envrionment. You can optionally follow the steps-

Disabling NetworkManager:

systemctl stop NetworkManager
systemctl disable NetworkManager

Install Development Tools:

yum group install "Development Tools"

Remove MariaDB pre-installed libraries-

yum -y remove mariadb-libs

Enable MySQL Repository

First of all, You need to enable MySQL 5.7 community release yum repository on your system. The rpm packages for yum repository configuration are available on MySQL’s official website.

First of all, import the latest MySQL GPG key to your system.

sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

Now, use one of the below commands to configure the Yum repository as per your operating system version. Continue reading “Install MySQL 5.7 on CentOS 7” »

Share

Postfix SMTP Rotating IP using IPTables

I got 5 Public IPs. i’m Gonna configure them, so Postfix can use multiple interfaces/ips for outgoing smtp connections.

First we need creating Interface aliases for those 5 public IPs.

In my system, using centos:

# cd /etc/sysconfig/network-scripts/
# cp ifcfg-eth0 ifcfg-eth0:1
Edit ifcfg-eth0:1
# vi ifcfg-eth0\:1
DEVICE=eth0 <-- default device
HWADDR=XX:XX:XX:XX:XX:XX
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
IPADDR=202.XXX.XX.2 <-- default eth0 IP address
PREFIX=24
GATEWAY=202.XXX.XX.1
DNS1=202.XXX.XX.XX

Change DEVICE and IPADDR parameters Continue reading “Postfix SMTP Rotating IP using IPTables” »

Share

Install MariaDB 10 on Centos or Springdale Linux

Step 1: Add MariaDB Yum Repository

Start by adding the MariaDB YUM repository file MariaDB.repo for RHEL/CentOS and Fedora systems.

# nano /etc/yum.repos.d/MariaDB.repo

Now add the following lines to your respective Linux distribution version as shown.

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Continue reading “Install MariaDB 10 on Centos or Springdale Linux” »

Share

Disable ipv6 on Linux Machine

Disable on Centos/RHEL system:

1. Append below lines in /etc/sysctl.conf:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

NOTE : To disable IPv6 on a single interface add below lines to /etc/sysctl.conf :

net.ipv6.conf.[interface].disable_ipv6 = 1 ### put interface name here [interface]
net.ipv6.conf.default.disable_ipv6 = 1

2. To make the settings affective, execute :

# sysctl -p

Disable on Debian/Ubuntu system:

One method to make this option persist is modifying /etc/sysctl.conf.  Add the following lines to the file:

net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1

For the settings to take effect use:

sudo sysctl -p
Share

Install Development Tool on CentOS and Debian

Well, in my working domain I face these tools to be installed, so that most of the dependent tools or programs that need to be deployed later don’t face much of dependency issue. So here goes the installation process for both the OS.

On CentOS/RHEL system use the follwoing command (either one of it would work)-

Type the following yum command as root user:

# yum group install "Development Tools"

Continue reading “Install Development Tool on CentOS and Debian” »

Share

Install VirtualBox legacy version 5.x on CentOS 7

Install Dependencies

Install Extra Packages for Enterprise Linux (EPEL)

# sudo yum install epel-release wget -y

Install Dynamic Kernel Module Support (DKMS)

# sudo yum --enablerepo=epel install dkms -y

This will install quite a few packages:

Install Development Tools

# sudo yum groupinstall "Development Tools" -y

Continue reading “Install VirtualBox legacy version 5.x on CentOS 7” »

Share

How to Disable Network Manager on CentOS 7

1. To disable the Network Manager service, perform the following steps:

Disable Network Manager with the following commands:

CentOS 6, CloudLinux 6, Red Hat Enterprise Linux 6 (RHEL), or Amazon Linux:

service NetworkManager stop
chkconfig NetworkManager off

CentOS 7, CloudLinux 7, or RHEL 7:

systemctl stop NetworkManager
systemctl disable NetworkManager

2. Change to the /etc/sysconfig/network-scripts directory.

3. Open the ifcfg-eth0 and ifcfg-lo files with your preferred text editor and, if they exist, set the following keys’ Continue reading “How to Disable Network Manager on CentOS 7” »

Share