Fix “Failed to load SELinux policy. Freezing”

Cause: You have input a wrong value to /etc/selinux/config file

Solution: on the boot menu, edit the boot configuration and add “selinux=0” to the boot command. In Redhat, it can be done in the following way:

  1. Boot the server and press “e” to edit the boot configuration
  2. Go to the main command which usually starting with “linux16”, then add “selinux=0” as on of the parameters
  3. Press CTRL+X to boot

Reference screenshot on step 2

Push ssh login notification to slack

The following script will help you post an alert when someone ssh to your Linux server

  1. Create a slack webhook
  2. Create a sshrc script as bellow
#------Push notification-------------------------------------#
flag=""
if [ "$alert" = 1 ];then
  now=$(date +"%T")
  co=$(curl --fail --silent --show-error -X POST http://ip-api.com/json/$ip?fields=countryCode | jq -r .countryCode | perl -ne 'print lc') 

  if [ "$co" = null ];then
     flag=":internal:"
  else 
     flag=:flag-$co:
  fi
  curl -X POST --data-urlencode 'payload={"channel": "alerts", "username": 
                 "SSH", "text": "'"$USER"' just logged in on '"$lhn ($host)"' 
                 at '"$now"' from '"$ip"' '"$flag"' ", "icon_emoji": ":ghost:"}' 
                 https://hooks.slack.com/services/url >/dev/null 2>&1
fi

vSphere Suite 6

The products in the vSphere Suite
 

The two core components of vSphere are VMware ESXi® and VMware vCenter Server®

VMware ESXi

The core of the vSphere product suite is the hypervisor, which is the virtualization layer that serves as the foundation for the rest of the product line.

VMware ESXi is the next generation of the VMware virtualization foundation. ESXi installs and runs without the Linux-based Service Console.

Read the rest of this entry

Docker – Part 4 – Manage data in docker containers

Mount a host directory as data volume

You can mount a directory from host to a container

# Create a directory on the host
[root@dockervn ~]# mkdir -p /var/docker/disk01

# Run a container with mounting /var/docker/disk01 to /mnt
[root@dockervn ~]# docker run -i -t -v /var/docker/disk01:/mnt centos /bin/bash
[root@2985e50c258f /]# df -h
Filesystem Size     Used     Avail     Use%     Mounted on
/dev/mapper/docker-253:0-17174473-8dd986c417c6d     10G     241M     9.8G     3%     /
tmpfs 921M 0     921M 0%     /dev
tmpfs 921M 0     921M 0%     /sys/fs/cgroup
/dev/mapper/centos-root                  14G      1.9G 13G      14%     /mnt
shm 64 M 0 64M      0%     /dev/shm

Read the rest of this entry

Docker – Part 3 – Installation

Add docker repo

sudo tee /etc/yum.repos.d/docker.repo <<-‘EOF’
[dockerrepo] name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/7/
enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg
EOF

Read the rest of this entry