July 2016
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Categories

July 2016
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Monit and CentOS – Solving the Error “Could not execute systemctl”

Monit and CentOS – Solving the Error “Could not execute systemctl”

My Problem – “Error: Could not execute systemctl”

I’m using Monit 5.16 on a CentOS 7 server. Monit is monitoring some crucial services like Apache and MySQL (okay, okay, it’s MariaDB). I have a very simple service check to start with: check process apache […]

Solving NFS Mounts at Boot Time

Let’s face it. NFS is a magical thing. It allows you to centralize your storage, share volumes across systems, and all while maintaining sane permissions and ownership. Unfortunately, it can also be a bit of a fickle beast. Let’s say you just had your volume configured and you set up the mounts. You go and […]

REDUCE A LOGICAL VOLUME ONLINE WITHOUT ANY DATA LOSS

It’s possible to reduce the size of a logical volume without any data loss occurring.

The first step is to check the existing size of the logical volume:

[root@slave ~]# lvdisplay /dev/myvg/mylv — Logical volume — LV Path /dev/myvg/mylv LV Name mylv VG Name myvg LV UUID K31i4c-mJmI-mNhJ-CvkB-c38D-7wCd-I2erTM LV Write Access read/write LV Creation host, […]

DDING DISK SPACE TO AN EXISTING VOLUME GROUP

In the situation where you have exhausted all of the disk space in a volume group, you can add additional disks to the volume group in order to remediate the situation.

Locate the additional disk using the fdisk -l command.

[root@slave ~]# fdisk -l Disk /dev/sdd: 3221 MB, 3221225472 bytes, 6291456 sectors Units = sectors […]

MOUNTING ISO FILES WITHIN RHEL

Download the ISO file using wget.

[root@memberserver ~]# cd tmp;wget http://cdimage.debian.org/debian-cd/7.6.0/multi-arch/iso-cd/debian-7.6.0-amd64-i386-netinst.iso Create a directory which you will use to mount the ISO file to.

[root@memberserver ~]# mkdir /isodir Edit the /etc/fstab as per the below entry:

[root@memberserver ~]# vi /etc/fstab /tmp/debian-7.6.0-amd64-i386-netinst.iso /isodir iso9660 defaults,loop 0 0 Run partprobe to make the kernel aware of the […]

ADDING A GATEWAY ADDRESS

[root@slave network-scripts]# nmcli con show –active NAME UUID TYPE DEVICE CocoChopper e8f14903-4b12-44b2-9e15-a9d47c720d14 802-3-ethernet enp0s3 hostonly febb8ba7-a989-40a7-8683-53388f70da39 802-3-ethernet enp0s8 In /etc/sysconfig/network-scripts, there will be a ifcfg-CocoChopper file which will need to be modified.

[root@slave network-scripts]# cat ifcfg-enp04 TYPE=Ethernet BOOTPROTO=dhcp DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_PEERDNS=yes IPV6_PEERROUTES=yes IPV6_FAILURE_FATAL=no NAME=enp04 UUID=e8f14903-4b12-44b2-9e15-a9d47c720d14 DEVICE=enp0s3 ONBOOT=yes We can now […]

RESTRICTING NETWORK ACCESS WITH IPTABLES

The first thing is to install the iptables-services.x86_64 package.

[root@slave ~]# yum -y install iptables-services.x86_64 In this example, we will be blocking traffic from the 10.10.0.0/8 network.

[root@slave ~]# iptables -A INPUT -s 10.10.0.0/8 -j REJECT [root@slave ~]# service iptables restart Redirecting to /bin/systemctl restart iptables.service Verify that the network is being blocked by issuing […]

CREATING A SWAP PARTITION IN RHEL

In this demonstration, I will be adding at 2GB swap partition to /dev/sdb.

You can identify the relevant disk which you wish to add the swap partition to from issuing the following command:

[root@slave ~]# fdisk -l To add the swap partition, rerun the fdisk command with the relevant disk location:

[root@slave ~]# fdisk /dev/sdb […]

HOW TO CREATE LVM USING PVCREATE, VGCREATE, LVCREATE, AND LVEXTEND COMMANDS

HOW TO CREATE LVM USING PVCREATE, VGCREATE, LVCREATE, AND LVEXTEND COMMANDS

What is LVM?

LVM is a tool for logical volume management which includes allocating disks, striping, mirroring and resizing logical volumes. With LVM, a hard drive or set of hard drives is allocated to one or more physical volumes.

How to setup LVM in […]

SETTING UP A LOCAL NFS SERVER

On the NFS Server, we will need to install the following packages:

yum -y install portreserve quota rpcbind nfs4-acl-tools.x86_64 nfs-utils.x86_64 # service rpcbind start # chkconfig rpcbind on # service nfs start # chkconfig nfs on The next step is to make the physical mount point (in this example, it’s /ilovecoco). We then need to […]