How to Mount USB Flash Drive on CentOS 7

In this blog article, I’ll show you how to mount a USB Flash Drive on CentOS 7 terminal. In my case, I needed to mount a USB Flash Drive on my minimal CentOS 7 machine to copy a file to the USB Flash Drive.

USB Flash Drive

The file system of my USB flash drive is FAT32. I used a Windows 10 computer to create a folder called System Volume Information on the USB flash drive.

fat32-type

Mounting

First, go to your CentOS 7 computer and create a folder where you’ll mount the contents of the USB flash drive to.

mkdir -p /media/USB

/dev is a location that represents devices attached to your computer. Check the /dev directory’s contents by typing:

ls /dev/sd*

You should see something like this:

sda-check

Next, insert your USB flash drive into the CentOS 7 machine. You could also use ls /dev/sd (then hit tab). You should see a new sdb and sdb1.

new-sd-letter

Our USB flash drive is represented by /dev/sdb1. We will mount the USB flash drive to the /media/USB folder that we created earlier.

mount -t vfat /dev/sdb1 /media/USB

Check if the USB flash drive is mounted by listing the contents of /media/USB.

[[email protected] ~]# ls /media/USB
System Volume Information

Since the /media/USB contains System Volume Information, I know that the USB flash drive was mounted properly. Now, I can copy any file to the mounted USB flash drive folder.

cp nfs-utils-1.3.0-0.21.el7_2.x86_64.rpm /media/USB/

Unmounting

After you are done with the USB flash drive, always remember to unmount the USB flash drive from the folder it is mounted on.

umount /media/USB

You can now safely eject the USB flash drive from the CentOS 7 machine.

How to Install Ansible on CentOS 7

Ansible is a useful configuration automation software that allows you to automate the setup of your machines. In comparison to other configuration automation out there like Chef or Puppet, I’ve found it to be much simpler to use for cluster setup.

Installation

First, I normally update the EPEL on CentOS 7 before installing ansible.

yum install epel-release

Afterwards, we can use yum install to setup ansible on our machine. If you have a cluster, install ansible on each individual node. Yum will install all dependencies that is required of ansible.

yum install ansible

To check if you have installed ansible correctly:

ansible --version
ansible 1.9.4
  configured module search path = None

How to Install Slurm on CentOS 7 Cluster

Slurm is an open-source workload manager designed for Linux clusters of all sizes. It’s a great system for queuing jobs for your HPC applications. I’m going to show you how to install Slurm on a CentOS 7 cluster.

  1. Delete failed installation of Slurm
  2. Install MariaDB
  3. Create the global users
  4. Install  Munge
  5. Install Slurm
  6. Use Slurm

Cluster Server and Compute Nodes

I configured our nodes with the following hostnames using these steps. Our server is:

buhpc3

The clients are:

buhpc1
buhpc2
buhpc3
buhpc4
buhpc5
buhpc6

 

Delete failed installation of Slurm

I leave this optional step in case you tried to install Slurm, and it didn’t work. We want to uninstall the parts related to Slurm unless you’re using the dependencies for something else.

First, I remove the database where I kept Slurm’s accounting.

yum remove mariadb-server mariadb-devel -y

Next, I remove Slurm and Munge. Munge is an authentication tool used to identify messaging from the Slurm machines.

yum remove slurm munge munge-libs munge-devel -y

I check if the slurm and munge users exist.

cat /etc/passwd | grep slurm

Then, I delete the users and corresponding folders.

userdel - r slurm
userdel -r munge
userdel: user munge is currently used by process 26278
kill 26278
userdel -r munge

Slurm, Munge, and Mariadb should be adequately wiped. Now, we can start a fresh installation that actually works.

 

Install MariaDB

You can install MariaDB to store the accounting that Slurm provides. If you want to store accounting, here’s the time to do so. I only install this on the server node, buhpc3. I use the server node as our SlurmDB node.

yum install mariadb-server mariadb-devel -y

We’ll setup MariaDB later. We just need to install it before building the Slurm RPMs.

 

Create the global users

Slurm and Munge require consistent UID and GID across every node in the cluster.

For all the nodes, before you install Slurm or Munge:

export MUNGEUSER=991
groupadd -g $MUNGEUSER munge
useradd  -m -c "MUNGE Uid 'N' Gid Emporium" -d /var/lib/munge -u $MUNGEUSER -g munge  -s /sbin/nologin munge
export SLURMUSER=992
groupadd -g $SLURMUSER slurm
useradd  -m -c "SLURM workload manager" -d /var/lib/slurm -u $SLURMUSER -g slurm  -s /bin/bash slurm

 

Install Munge

Since I’m using CentOS 7, I need to get the latest EPEL repository.

yum install epel-release

Now, I can install Munge.

yum install munge munge-libs munge-devel -y

After installing Munge, I need to create a secret key on the Server. My server is on the node with hostname, buhpc3. Choose one of your nodes to be the server node.

First, we install rng-tools to properly create the key.

yum install rng-tools -y
rngd -r /dev/urandom

Now, we create the secret key. You only have to do the creation of the secret key on the server.

/usr/sbin/create-munge-key -r
dd if=/dev/urandom bs=1 count=1024 > /etc/munge/munge.key
chown munge: /etc/munge/munge.key
chmod 400 /etc/munge/munge.key

After the secret key is created, you will need to send this key to all of the compute nodes.

scp /etc/munge/munge.key [email protected]:/etc/munge
scp /etc/munge/munge.key [email protected]:/etc/munge
scp /etc/munge/munge.key [email protected]:/etc/munge
scp /etc/munge/munge.key [email protected]:/etc/munge
scp /etc/munge/munge.key [email protected]:/etc/munge

Now, we SSH into every node and correct the permissions as well as start the Munge service.

chown -R munge: /etc/munge/ /var/log/munge/
chmod 0700 /etc/munge/ /var/log/munge/
systemctl enable munge
systemctl start munge

To test Munge, we can try to access another node with Munge from our server node, buhpc3.

munge -n
munge -n | unmunge
munge -n | ssh 3.buhpc.com unmunge
remunge

If you encounter no errors, then Munge is working as expected.

 

Install Slurm

Slurm has a few dependencies that we need to install before proceeding.

yum install openssl openssl-devel pam-devel numactl numactl-devel hwloc hwloc-devel lua lua-devel readline-devel rrdtool-devel ncurses-devel man2html libibmad libibumad -y

Now, we download the latest version of Slurm preferably in our shared folder. The latest version of Slurm may be different from our version.

cd /nfs
wget http://www.schedmd.com/download/latest/slurm-15.08.9.tar.bz2

If you don’t have rpmbuild yet:

yum install rpm-build
rpmbuild -ta slurm-15.08.9.tar.bz2

We will check the rpms created by rpmbuild.

cd /root/rpmbuild/RPMS/x86_64

Now, we will move the Slurm rpms for installation for the server and computer nodes.

mkdir /nfs/slurm-rpms
cp slurm-15.08.9-1.el7.centos.x86_64.rpm slurm-devel-15.08.9-1.el7.centos.x86_64.rpm slurm-munge-15.08.9-1.el7.centos.x86_64.rpm slurm-perlapi-15.08.9-1.el7.centos.x86_64.rpm slurm-plugins-15.08.9-1.el7.centos.x86_64.rpm slurm-sjobexit-15.08.9-1.el7.centos.x86_64.rpm slurm-sjstat-15.08.9-1.el7.centos.x86_64.rpm slurm-torque-15.08.9-1.el7.centos.x86_64.rpm /nfs/slurm-rpms

On every node that you want to be a server and compute node, we install those rpms. In our case, I want every node to be a compute node.

yum --nogpgcheck localinstall slurm-15.08.9-1.el7.centos.x86_64.rpm slurm-devel-15.08.9-1.el7.centos.x86_64.rpm slurm-munge-15.08.9-1.el7.centos.x86_64.rpm slurm-perlapi-15.08.9-1.el7.centos.x86_64.rpm slurm-plugins-15.08.9-1.el7.centos.x86_64.rpm slurm-sjobexit-15.08.9-1.el7.centos.x86_64.rpm slurm-sjstat-15.08.9-1.el7.centos.x86_64.rpm slurm-torque-15.08.9-1.el7.centos.x86_64.rpm

After we have installed Slurm on every machine, we will configure Slurm properly.

Visit http://slurm.schedmd.com/configurator.easy.html to make a configuration file for Slurm.

I leave everything default except:

ControlMachine: buhpc3
ControlAddr: 128.197.116.18
NodeName: buhpc[1-6]
CPUs: 4
StateSaveLocation: /var/spool/slurmctld
SlurmctldLogFile: /var/log/slurmctld.log
SlurmdLogFile: /var/log/slurmd.log
ClusterName: buhpc

After you hit Submit on the form, you will be given the full Slurm configuration file to copy.

On the server node, which is buhpc3:

cd /etc/slurm
vim slurm.conf

Copy the form’s Slurm configuration file that was created from the website and paste it into slurm.conf. We still need to change something in that file.

Underneathe slurm.conf “# COMPUTE NODES,” we see that Slurm tries to determine the IP addresses automatically with the one line.

NodeName=buhpc[1-6] CPUs = 4 State = UNKOWN

I don’t use IP addresses in order, so I manually delete this one line and change it to:

After you explicitly put in the NodeAddr IP Addresses, you can save and quit. Here is my full slurm.conf and what it looks like:

Now that the server node has the slurm.conf correctly, we need to send this file to the other compute nodes.

scp slurm.conf [email protected]/etc/slurm/slurm.conf
scp slurm.conf [email protected]/etc/slurm/slurm.conf
scp slurm.conf [email protected]/etc/slurm/slurm.conf
scp slurm.conf [email protected]/etc/slurm/slurm.conf
scp slurm.conf [email protected]/etc/slurm/slurm.conf

Now, we will configure the server node, buhpc3. We need to make sure that the server has all the right configurations and files.

mkdir /var/spool/slurmctld
chown slurm: /var/spool/slurmctld
chmod 755 /var/spool/slurmctld
touch /var/log/slurmctld.log
chown slurm: /var/log/slurmctld.log
touch /var/log/slurm_jobacct.log /var/log/slurm_jobcomp.log
chown slurm: /var/log/slurm_jobacct.log /var/log/slurm_jobcomp.log

Now, we will configure all the compute nodes, buhpc[1-6]. We need to make sure that all the compute nodes have the right configurations and files.

mkdir /var/spool/slurmd
chown slurm: /var/spool/slurmd
chmod 755 /var/spool/slurmd
touch /var/log/slurmd.log
chown slurm: /var/log/slurmd.log

Use the following command to make sure that slurmd is configured properly.

slurmd -C

You should get something like this:

ClusterName=(null) NodeName=buhpc3 CPUs=4 Boards=1 SocketsPerBoard=2 CoresPerSocket=2 ThreadsPerCore=1 RealMemory=7822 TmpDisk=45753
UpTime=13-14:27:52

The firewall will block connections between nodes, so I normally disable the firewall on the compute nodes except for buhpc3.

systemctl stop firewalld
systemctl disable firewalld

On the server node, buhpc3, I usually open the default ports that Slurm uses:

firewall-cmd --permanent --zone=public --add-port=6817/udp
firewall-cmd --permanent --zone=public --add-port=6817/tcp
firewall-cmd --permanent --zone=public --add-port=6818/tcp
firewall-cmd --permanent --zone=public --add-port=6818/tcp
firewall-cmd --permanent --zone=public --add-port=7321/tcp
firewall-cmd --permanent --zone=public --add-port=7321/tcp
firewall-cmd --reload

If the port freeing does not work, stop the firewalld for testing. Next, we need to check for out of sync clocks on the cluster. On every node:

yum install ntp -y
chkconfig ntpd on
ntpdate pool.ntp.org
systemctl start ntpd

The clocks should be synced, so we can try starting Slurm! On all the compute nodes, buhpc[1-6]:

systemctl enable slurmd.service
systemctl start slurmd.service
systemctl status slurmd.service

Now, on the server node, buhpc3:

systemctl enable slurmctld.service
systemctl start slurmctld.service
systemctl status slurmctld.service

When you check the status of slurmd and slurmctld, we should see if they successfully completed or not. If problems happen, check the logs!

Compute node bugs: tail /var/log/slurmd.log
Server node bugs: tail /var/log/slurmctld.log

Use Slurm

To display the compute nodes:

scontrol show nodes

-N allows you to choose how many compute nodes that you want to use. To run jobs on the server node, buhpc3:

srun -N5 /bin/hostname
buhpc3
buhpc2
buhpc4
buhpc5
buhpc1

To display the job queue:

scontrol show jobs
JobId=16 JobName=hostname
UserId=root(0) GroupId=root(0)
Priority=4294901746 Nice=0 Account=(null) QOS=(null)
JobState=COMPLETED Reason=None Dependency=(null)
Requeue=1 Restarts=0 BatchFlag=0 Reboot=0 ExitCode=0:0
RunTime=00:00:00 TimeLimit=UNLIMITED TimeMin=N/A
SubmitTime=2016-04-10T16:26:04 EligibleTime=2016-04-10T16:26:04
StartTime=2016-04-10T16:26:04 EndTime=2016-04-10T16:26:04
PreemptTime=None SuspendTime=None SecsPreSuspend=0
Partition=debug AllocNode:Sid=buhpc3:1834
ReqNodeList=(null) ExcNodeList=(null)
NodeList=buhpc[1-5]
BatchHost=buhpc1
NumNodes=5 NumCPUs=20 CPUs/Task=1 ReqB:S:C:T=0:0:*:*
TRES=cpu=20,node=5
Socks/Node=* NtasksPerN:B:S:C=0:0:*:* CoreSpec=*
MinCPUsNode=1 MinMemoryNode=0 MinTmpDiskNode=0
Features=(null) Gres=(null) Reservation=(null)
Shared=0 Contiguous=0 Licenses=(null) Network=(null)
Command=/bin/hostname
WorkDir=/root
Power= SICP=0

To submit script jobs, create a script file that contains the commands that you want to run. Then:

sbatch -N2 script-file

Slurm has a lot of useful commands. You may have heard of other queuing tools like torque. Here’s a useful link for the command differences: http://www.sdsc.edu/~hocks/FG/PBS.slurm.html

 

Accounting in Slurm

We’ll worry about accounting in Slurm with MariaDB for next time. Let me know if you encounter any problems with the above steps!

 

How to Install GlusterFS on CentOS 7

GlusterFS is a scale-out network-attached storage file system. In this tutorial, we’ll be setting up GlusterFS on a cluster with CentOS 7.  Our cluster has 6 nodes connected through a switch. I’ll be using all 6 nodes as servers for distributed replicated storage with opportunity for more nodes to be clients that can access files from the GlusterFS servers.

How does GlusterFS work

In a GlusterFS, servers are used to store data in a distributed manner, and clients can access that data. Let’s explain with our 6 node example. I’m using 3 replicas, so we have pairs of 2 that compose each replica. When we use 6 nodes as servers, nodes 1 and 2 (replication1), nodes 3 and 4 (replication2), and nodes 5 and 6 (replication3) will mirror each other.

Sometimes, files are retrieved from replication1, and other times, replication2, and other times, replication3. If you think about the entire storage file system, replication1, replication2, and replication3 combine into one larger storage system (distribution). The charm of GlusterFS is file location calculation without lookup. Less bottleneck.

gluster-distributed-illustration

 

Cluster Servers

I configured our nodes with the following hostnames using these steps. Our servers are:

3.buhpc.com
1.buhpc.com
2.buhpc.com
4.buhpc.com
5.buhpc.com
6.buhpc.com

Setting up the GlusterFS Servers

Update the yum repo and epel.

yum update -y
wget -P /etc/yum.repos.d http://download.gluster.org/pub/gluster/glusterfs/LATEST/EPEL.repo/glusterfs-epel.repo
yum install http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Install the GlusterFS server and Samba.

yum install glusterfs-server samba -y

We will make a directory on every server node, which will be the location of the mount point.

mkdir -p /gfs/glustervol

On every server node, we want to start the gluster service.

systemctl enable glusterd.service && systemctl start glusterd.service

On every server node, if you have firewalld running, we want to open the correct ports.

firewall-cmd --zone=public --add-port=24009/tcp --permanent
firewall-cmd --zone=public --add-port=24007/tcp --permanent
firewall-cmd --zone=public --add-service=nfs --add-service=samba --add-service=samba-client --permanent
firewall-cmd --zone=public --add-port=111/tcp --add-port=139/tcp --add-port=445/tcp --add-port=965/tcp --add-port=2049/tcp --add-port=38465-38469/tcp --add-port=631/tcp --add-port=111/udp --add-port=963/udp --add-port=49152-49251/tcp  --permanent
firewall-cmd --reload

You should see success on every added firewalld rule.

 

The Main GlusterFS Server

For our setup, we chose our 3.buhpc.com node to be our main server that connects all the other servers. Choose one node as the main server and connect the peers:

gluster peer probe 1.buhpc.com
gluster peer probe 2.buhpc.com
gluster peer probe 4.buhpc.com
gluster peer probe 5.buhpc.com
gluster peer probe 6.buhpc.com

We can check if we successfully added all the peers to our main server.

gluster peer status
Number of Peers: 5
Hostname: cumm024-0b08-dhcp07.bu.edu
Uuid: b7c48a28-2229-49f5-af28-41cd9cce2fe6
State: Peer in Cluster (Connected)
Other names:
2.buhpc.com

Hostname: 1.buhpc.com
Uuid: 5eacbc2e-6490-47bb-b4fd-9a2575db941f
State: Peer in Cluster (Connected)

Hostname: 4.buhpc.com
Uuid: 240282d8-a4cb-4bbc-8ca6-00a3383a0c48
State: Peer in Cluster (Connected)

Hostname: 5.buhpc.com
Uuid: 4edc641b-dbcb-415f-9618-718087004adc
State: Peer in Cluster (Connected)

Hostname: 6.buhpc.com
Uuid: 24364805-7cbe-405d-adcf-a6334f9f6e40
State: Peer in Cluster (Connected)

Now, we will create the GlusterFS volume. We are naming it glustervol. We are using 3 replicas to pair the 6 node servers that we have.

gluster volume create glustervol replica 3 transport tcp 3.buhpc.com:/gfs/glustervol 1.buhpc.com:/gfs/glustervol 2.buhpc.com:/gfs/glustervol 4.buhpc.com:/gfs/glustervol 5.buhpc.com:/gfs/glustervol 6.buhpc.com:/gfs/glustervol force

If all goes well, we can start the gluster volume.

gluster volume start glustervol
gluster volume info all
Volume Name: glustervol
Type: Distributed-Replicate
Volume ID: ed995f44-6649-48d0-b5a8-7e87c3568473
Status: Started
Number of Bricks: 2 x 3 = 6
Transport-type: tcp
Bricks:
Brick1: 3.buhpc.com:/gfs/glustervol
Brick2: 1.buhpc.com:/gfs/glustervol
Brick3: 2.buhpc.com:/gfs/glustervol
Brick4: 4.buhpc.com:/gfs/glustervol
Brick5: 5.buhpc.com:/gfs/glustervol
Brick6: 6.buhpc.com:/gfs/glustervol
Options Reconfigured:
performance.readdir-ahead: on

If we go into /gfs/glustervol and create a file, it appears on all the server nodes.

cd /gfs/glustervol
touch slothparadise.txt
ssh [email protected]
ls /gfs/glustervol
slothparadise.txt

 

Connecting Clients

The servers store the data efficiently in a distributed replicated manner. Now, we can add clients to be able to access those files. Let’s say that we had a node 7, 7.buhpc.com. Here’s how we would add node 7 as a client to the 6 node servers.

yum install glusterfs glusterfs-fuse attr -y

After installing the necessary glusterfs dependencies for clients, we can mount glusterfs volume onto a folder of node 7. We mount with type, glusterfs, and access the main server’s volume name, which we named glustervol, and we mount it into /mnt on node 7.

mount -t glusterfs 3.buhpc.com:/glustervol /mnt/
ls /mnt
slothparadise.txt

 

Deleting Gluster Volume

You may want to delete a gluster volume in the future. To find what gluster volumes you have:

gluster volume info all

To stop and delete the gluster volume:

gluster volume stop nameOfVolume
gluster volume delete nameOfVolume

How to Install Ganglia on CentOS 7

Ganglia is a scalable distributed monitoring system for high-performance computing systems such as clusters and Grids. Ganglia is useful when monitoring nodes of a cluster. Setting up Ganglia on CentOS 7 with a bunch of nodes can be confusing. In this blog, I’ll show you how to setup Ganglia and its web interface properly. Our cluster has 6 nodes connected through a switch.

Cluster Server and Clients

I configured our nodes with the following hostnames using these steps. Our server is:

3.buhpc.com

The clients are:

1.buhpc.com
2.buhpc.com
4.buhpc.com
5.buhpc.com
6.buhpc.com

 

Installation

On the server, inside the shared folder of our cluster, we will first download the latest version of ganglia. For our cluster, /nfs is the folder with our network file system.

cd /nfs
wget http://downloads.sourceforge.net/project/ganglia/ganglia%20monitoring%20core/3.7.2/ganglia-3.7.2.tar.gz

On the server, we will install dependencies and libconfuse.

yum install freetype-devel rpm-build php httpd libpng-devel libart_lgpl-devel python-devel pcre-devel autoconf automake libtool expat-devel rrdtool-devel apr-devel gcc-c++ make pkgconfig -y
yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/l/libconfuse-2.7-7.el7.x86_64.rpm -y
yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/l/libconfuse-devel-2.7-7.el7.x86_64.rpm -y

Now, we will build the rpms from ganglia-3.7.2 on the server.

rpmbuild -tb ganglia-3.7.2.tar.gz

After running rpmbuild, /root/rpmbuild/RPMS/x86_64 contains the generated rpms:

cd /root/rpmbuild/RPMS/x86_64/
yum install *.rpm -y

We will remove gmetad because we do not need it on the clients. Send the rest of the rpms to all the clients’ /tmp folder:

cd /root/rpmbuild/RPMS/x86_64/
rm -rf ganglia-gmetad*.rpm
scp *.rpm [email protected]:/tmp
scp *.rpm [email protected]:/tmp
scp *.rpm [email protected]:/tmp
scp *.rpm [email protected]:/tmp
scp *.rpm [email protected]:/tmp

SSH onto every client and install the rpms that we will need:

ssh [email protected]#.buhpc.com
yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/l/libconfuse-2.7-7.el7.x86_64.rpm -y
yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/l/libconfuse-devel-2.7-7.el7.x86_64.rpm -y
yum install /tmp/*.rpm - y

Back on the server, we will adjust the gmetad configuration file:

cd /etc/ganglia
vim gmetad.conf

buhpc will be the name of  our cluster. Find the following line and add the name of your cluster and ip address. I am using the subdomain instead of the ip address.

data_source "buhpc" 1 3.buhpc.com

Now, we edit the server’s gmond configuration file.

vim /etc/ganglia/gmond.conf

Make sure that these sections have the following and comment any extra lines you see that are within each section.

cluster {
  name = "buhpc"
  owner = "unspecified"
  latlong = "unspecified"
  url = "unspecified"
}

udp_send_channel {
  host = 1.buhpc.com
  port = 8649
  ttl = 1
}

udp_send_channel {
  host = 2.buhpc.com
  port = 8649
  ttl = 1
}

udp_send_channel {
  host = 3.buhpc.com
  port = 8649
  ttl = 1
}
udp_send_channel {
  host = 4.buhpc.com
  port = 8649
  ttl = 1
}

udp_send_channel {
  host = 5.buhpc.com
  port = 8649
  ttl = 1
}

udp_send_channel {
  host = 6.buhpc.com
  port = 8649
  ttl = 1
}

udp_recv_channel {
  port = 8649
  retry_bind = true
}

Now, SSH into each of the clients and do the following individually. On every client:

vim /etc/ganglia/gmond.conf

We will change the clients’ gmond.conf in the same way as the server’s.  Make sure that these sections have the following lines and comment any extra lines you see that are within each section.

cluster {
  name = "buhpc"
  owner = "unspecified"
  latlong = "unspecified"
  url = "unspecified"
}

udp_send_channel {
  host = 1.buhpc.com
  port = 8649
  ttl = 1
}

udp_send_channel {
  host = 2.buhpc.com
  port = 8649
  ttl = 1
}

udp_send_channel {
  host = 3.buhpc.com
  port = 8649
  ttl = 1
}
udp_send_channel {
  host = 4.buhpc.com
  port = 8649
  ttl = 1
}

udp_send_channel {
  host = 5.buhpc.com
  port = 8649
  ttl = 1
}

udp_send_channel {
  host = 6.buhpc.com
  port = 8649
  ttl = 1
}

udp_recv_channel {
  port = 8649
  retry_bind = true
}

We will start gmond on the clients for monitoring.

chkconfig gmond on
systemctl start gmond

Back on the server, we want to install the Ganglia web interface.

cd /nfs
wget http://downloads.sourceforge.net/project/ganglia/ganglia%20monitoring%20core/3.1.1%20%28Wien%29/ganglia-web-3.1.1-1.noarch.rpm -O ganglia-web-3.1.1-1.noarach.rpm
yum install -y ganglia-web-3.1.1-1.noarch.rpm

Next, we will want to disable SELinux. Change SELINUX inside /etc/sysconfig/selinux from enforcing to disabled. Then, restart the server node.

vim /etc/sysconfig/selinux
SELINUX=disabled
reboot

Now, on the server, we’ll open the correct ports on the firewall.

firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-port=8649/udp
firewall-cmd --permanent --zone=public --add-port=8649/tcp
firewall-cmd --permanent --zone=public --add-port=8651/tcp
firewall-cmd --permanent --zone=public --add-port=8652/tcp
firewall-cmd --reload

On the server, we will now start httpd, gmetad, and gmond.

chkconfig httpd
chkconfig gmetad on
chkconfig gmond on
systemctl start httpd
systemctl start gmetad
systemctl start gmond

Visit http://3.buhpc.com/ganglia to see Ganglia’s monitoring. You should see something like this:

ganglia-home-page

How to Fix yum Could not resolve host: repo Unknown error

You may receive a problem with yum not being able to resolve hosts when you try to install a yum package. I’m using CentOS 7.

yum install wget

If you already have Internet connection and can ping 8.8.8.8, the likely problem is that you don’t have nameservers in your /etc/resolv.conf.

vi /etc/resolv.conf

If /etc/resolv.conf does not have any nameservers, you can add this line somewhere in the file:

nameserver 8.8.8.8

Note: if you have used dhclient command, you should have a few nameservers like the following. However, you can just add the nameserver 8.8.8.8 to get yum working like I did above. The following is just a sample of what a /etc/resolv.conf would be generated by dhclient.

; generated by /usr/sbin/dhclient-script
 search bu.edu
 nameserver 128.197.253.183
 nameserver 128.197.253.120
 nameserver 128.197.253.254

After saving the file with at least one nameserver, restart the network.

systemctl restart network
yum install wget

You should be able to install your yum packages now!

How to Change hostname on CentOS 7

The best way to change hostname on CentOS 7 is editing the actual file that controls the hostname.

vi /etc/hostname

Originally, it is:

localhost.localdomain

But, we’ll delete that line and change it to:

buhpc2

buhpc is our hostname, but it also has the subdomain, 2.buhpc.com, that I have configured. Now, the second file that we also have to change is /etc/hosts.

vi /etc/hosts

The original file looks like:

You create a new line with IP address hostname subdomain. If you don’t have a subdomain, leave the subdomain blank. We’ll make a minor change and change the hosts file to:

Restart the network.
systemctl restart network

Let’s see if it worked:

hostnamectl status

Static hostname is set to: 2.buhpc.com
Now, we will have to set nameservers because NetworkManager may have deleted our old nameservers. Nameservers allow us to access subdomains and domains.

vi /etc/resolv.conf

If /etc/resolv.conf does not have any nameservers, you can add this line somewhere in the file:

nameserver 8.8.8.8

How to Set Static IP Address on CentOS 7

This blog post will show you how to set a static IP address on CentOS 7 from scratch with no prior knowledge of any information about the network.

See if NetworkManager is running. NetworkManager is a network daemon that handles our network interfaces dynamically, but we’ll change our network scripts to set static configurations. We should stop this service.

systemctl status NetworkManager
systemctl stop NetworkManager

Check what interfaces are available.

nmcli d

Connect your Ethernet cable into the computer.

Getting a valid IP address from DHCP

You can use dhclient to find a DHCP server on the network and get automated network configurations like IP address. Skip if this step if you already have static configurations in mind. We’ll use the DHCP network configurations and set the info statically.

dhclient

After using dhclient, you should be able to ping 8.8.8.8 or use yum install. If these commands work, then you can find the new details about your IP address, subnet mask, and gateway with:

ip addr show

You’ll see a a part of the output:

128.197.115.7 is the IP address that we’ll use.

Before you proceed, run yum, CentOS’s package installer, and make sure that it works:

yum install vim

You can CTRL-C when you receive the Y/N prompt if you don’t want vim. The command was just a test.

Setting the Static IP

cd /etc/sysconfig/network-scripts/

ifcfg-enp30s0 is the name of our interface. You may have a differently named ifcfg file. Usually, the file goes by the name of ifcfg-eth0.

cat ifcfg-enp30s0

Here’s what we currently have. The interface uses DHCP, but we want the network configuration to be static.

vi ifcfg-enp30s0

In the file, we need to add/change the following lines at minimum:

We change BOOTPROTO to static instead of dhcp. GATEWAY will always have the first three parts of IP address and tend to end with .1. For example, if the IPADDR that you’re using starts with 128.197.115, then GATEWAY will also start with 128.197.115 and end with .1 and BROADCAST will end with .255. The NETMASK is usually 255.255.255.0. We change ONBOOT to yes, so that the interface boots with our new settings. Setting NM_CONTROLLED to no will mean that the interface will be managed by this script instead of by the Network Manager daemon.

Now, we’ll restart the network.

systemctl restart network

We verify that the interface is working.

ip add

You should be able to ping Google’s server at 8.8.8.8 after restarting the network.

ping 8.8.8.8

If you receive results from the ping, then setting the static IP has been successful! You’ll see that our network interface is now connected.

nmcli d

We should kill dhclient now that we have set up static IP addresses based on the DHCP given IP address.

You’ll see something like this if you have dhclient running. The process name will be on the right side, so you’ll know for sure if you see it still running.

We want to kill the process ID, which will be the first number, 13025.

If dhclient does not appear, then we have killed dhclient successfully.

How to Install CentOS 7 Minimal Without a Mouse on Troubleshooting Basic Graphics Mode

Here are the list of steps to install CentOS 7 minimal without a mouse on a node or computer with no apparent graphics card.

Why do we have to use troubleshooting mode? Without the graphics card, the node or machine tends to freeze at setup because there is no graphics card to render the setup properly, so we have to use troubleshooting mode and take advantage of installing CentOS 7 in basic graphics mode.

 

Steps

Turn on the node and press F10 when the option becomes available to enter BIOS setup. Change the boot order so that “Removable Disk Drives” is first. Make “Hard Drive” last in boot order. Exit Saving Changes.

IMG_20151201_003705
For this machine, press F10 to enter BIOS SETUP.
IMG_20151201_004320
Make sure that on Boot Order, Removable Devices is first and Hard Drive is last.

 

Reboot the node with USB flash drive with CentOS 7 plugged firmly into node. Wait until node boots into CentOS 7 setup.

IMG_20151201_005212
USB Flash Drive is firmly plugged into the back of one of the machines/nodes.

 

Use boot with “Troubleshooting” option. Use “Install CentOS 7 in basic graphics mode” and enter.

IMG_20151201_005710
When the machine reboots, it will eventually proceed into the USB Flash Drive if you continue forward. CentOS 7 setup will appear if your USB Flash Drive is configured properly.

 

Wait until CentOS 7 loads. Screen will be out of bounds. Here comes the tricky part. You will have to use Tab to traverse. On the first screen, use tab until you get to Continue and press enter.

IMG_20151201_005813
The first screen that you will see is the language setup. Press Tab a few times until Continue is highlighted. Press enter once Continue is highlighted.

 

On the second screen, tab until the first instance of you seeing the top of the first button being highlighted as blue. Then, press Tab 5 times and press Enter.

IMG_20151201_005833
On the next screen, press Tab until you see the top of the button highlighted as blue. Then, press Tab 5 times to “complete items marked with the icon” and press enter. You just aren’t able to see the item.

 

Immediately on the third screen, press Enter to press Done. You should see an Installation Options window pop up. Press enter again to “Reclaim space.”

Then on the next window, press the Delete button on the keyboard to delete. Then, press enter to minimize the drive and make sure Action says “Delete.” Then, press tab two times and press Enter. Then, press tab another two times and press Enter to confirm the deletion.

IMG_20151201_005917
Press enter until you get to this screen, but it won’t look like this just yet. Press the delete button on the keyboard as was instructed in the steps and press enter once. Afterwards, this is what you will see. You will press tab twice and press enter to actually hit the Delete All button. Then, you will press tab twice again and press enter to confirm the deletion. I’m assuming you want to delete everything on the hard drive.

 

You should be brought to the Installation Summary window. Tab until you get to Begin Installation and hit enter.

IMG_20151201_005947
If you hit the correct amount of tabs, you will be brought to the Installation Summary again with no errors. Hit tab until “Begin Installation” is highlighted. Then, hit enter.

 

Press tab once and hit enter to set root password.

Set the root password and tab once to the Done button. Press enter once and if password is too weak, press tab two more times to reach the Done button and hit enter again.

IMG_20151201_010023
If you hit tab and enter on the next page, you will be brought to Root Password selection. Set the root password and hit Done. You might have to hit Done twice if you have a weak password.

 

Wait until installation of CentOS 7 minimal install is complete. Press tab twice and then, press enter to finish installation after CentOS 7 minimal is done.

IMG_20151201_010703
CentOS will install after setting the root password. Once “Complete,” press tab twice and hit enter to restart the computer. Afterwards, you can take the USB Flash drive out of the computer.

How to Create Bootable USB Flash Drive of CentOS 7 Minimal ISO

This article will provide the step to step instructions to create a bootable USB flash drive of CentOS 7 Minimal ISO on Windows, Mac, or Linux. The CentOS instance that we will install onto the bootable USB flash drive is CentOS-7-x86_64-Minimal-1503-01.iso.

 

Requirements

Windows: You will need to use a program like Cygwin. I have another blog post, teaching how to install Cygwin on Windows machines.

Macs and Linux: Your terminal will have the command already as a part of the machine.

 

Steps

I will show the steps being done on a Windows 10 machine with Cygwin already installed on the computer. If you use a Mac or Linux, the terminal will be able to do the same commands. First, we will download CentOS-7-x86_64-Minimal-1503-01.iso. This method should work with any CentOS minimal instance version 6.5 and greater. I have downloaded the minimal ISO inside:

C:/Users/huyle/Desktop/ISOs

Open Cygwin as an Administrator and change directory into this folder.

cd C:/Users/huyle/Desktop/ISOs

First, let’s check what /dev/sd removable devices we have. Type ls /dev/sd, don’t press Enter yet, then press the Tab button twice.

ls /dev/sd (Don't press Enter. Press Tab twice to see all the removable drives that start with /dev/sd)

You will see all the sd removable devices.

removable-sd-drives

Now, we will grab our USB Flash Drive. Plug your USB flash drive into your computer or laptop. Now, repeat the ls/dev/sd, then press Tab twice.

ls /dev/sd (Don't press Enter. Press Tab twice to see all the removable drives that start with /dev/sd)

removable-sd-drives-with-usb-flash-drive

 

You will see two new removable sd drives. Normally, the new sd drives will be: sdb and sdb1. Keep note of what appears after you plug your USB Flash Drive into the computer or laptop.

Since we are inside the folder where we kept our CentOS-7-x86_64-Minimal-1503-01.iso file. If we type:

ls

We should see the file inside the folder.

centos-is-in-folder

Now, we can add the CentOS-7-x86_64-Minimal-1503-01.iso on the USB Flash Drive with the dd command.

dd if=CentOS-7-x86_64-Minimal-1503-01.iso of=/dev/sdb bs=8M

dd-centos7

As long as the vertical line is blinking, then you can assume progress is being made. if is set to equal the ISO that you want to create the bootable USB flash drive. of selects the sd removable drive. In this case, we set of equal to /dev/sdb since it was the first /dev/sd that appeared that was new when we plugged our USB flash drive into the computer. bs selects the block size amount.

After a few minutes, the dd command should finish. You should be able to eject your USB flash drive, and boot a computer with the USB flash drive with the CentOS 7 Minimal ISO setup.

dd-command-finished

Safely eject your USB flash drive, and boot the computer on the USB Storage Device. CentOS 7 Minimal ISO setup will boot immediately afterwards.