How to configure Btrfs on Centos 7

Check unit to add

#fdisk -l


Selecione o disco
Disk /dev/sdb: 17.2 GB, 17179869184 bytes, 33554432 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Adding partition:

#fdisk /dev/sdb
# M – “Show all options available”
# P – “Type ” p” to display information on the disc as the current partitions”
# n – “Show all options available”
# p – “primary partition”
# 1 – “Partition number 1”
# enter – “default”
# enter – “default”
# w “List unit”

Check unit created

# fdisk -l

Check BTRFS Version and Installation

#yum search btrfs
#yum install btrfs-progs.x86_64

FSTAB access the file and add the mount point and compression

#vim /etc/fstab

Add the following line:

/dev/sdb1 /opt btrfs compress=zlib,compress-force=zlib 1 1

Assembling Compression :

#mkfs.btrfs /dev/sdb1 -f

Restart the machine and starting from this moment the unit / opt ‘ll be using btrfs to compress the files.

Continue Reading

How to set a static MAC address on VMware ESXi virtual machine

Question: I want to assign a static MAC address to a virtual machine (VM) on VMware ESXi. However, when I attempt to start a VM with a static MAC address, the VM fails to start and throws an error “The MAC Address entered is not in the valid range. Valid values are between “xx:xx:xx:xx:xx:xx” and “xx:xx:xx:xx:xx”.

When you create a VM on VMware ESXi, each network interface of the VM is assigned a dynamically generated MAC address. If you want to change this default behavior and assign a static MAC address to your VM, here is how to do it.


As you can see above, VMware’s vSphere GUI client already has a menu for setting a static MAC address for a VM. However, this GUI-based method only allows you to choose a static MAC address from 00:50:56:xx:xx:xx, which is VMware-reserved MAC address range. If you attempt to set any arbitrary MAC address outside this MAC range, you will fail to launch the VM, and get the following error.


Fortunately, there is a workaround to this limitation. The solution is, instead of using vSphere GUI client, editing .vmx file of your VM directly, after logging in to the ESXi host.

First, turn off the VM to which you want to assign a static MAC address.

Enable SSH access to your ESXi host if you haven’t done it already. Then log in to the ESXi host via SSH.

Move to the directory where your VM’s .vmx file is located:

# cd vmfs/volumes/datastore1/[name-of-vm]

Open .vmx file with a text editor, and add the following fields. Replace the MAC address field with your own.

#ethernet0.addressType = "static"
#ethernet0.checkMACAddress = "false"
#ethernet0.address = "00:0c:29:1f:4b:ac"

Now you should be able to launch a VM with the static MAC address you defined in .vmx file.

Continue Reading

Install Cpanel/WHM on CentOS 7, RHEL 7

Here in this article we will discuss about latest cPanel & WHM Version 11.50 feature and prerequisites and installation on fresh CentOS 7  / RHEL 7 Version.
Latest Features of cPanel  & WHM 11.50 :

CentOS , CloudLinux , and RHEL 7 support
Use the XFS  or ext4 filesystems.
Less booting time
Greylisting feature : which protect server from unwanted emails and untrusted email servers .

Installation Recommended settings:

Disable OS Firewall before installation .
Recommended Hardware :
Minimum & Recommended Processor should be 226MHZ
Minimum RAM should be 1 GB.
Minimum Disk Space should be 20 GB .

Installation of cPanel in CentOS 7 / RHEL 7 / CloudLinux 7 :

Before doing cpanel & WHM installation first ensure your OS Version , RAM and diskspace.

Deactivate firewall on CentOS 7 , CloudLinux 7 and RHEL 7 :

# iptables-save > ~/iptables.rules
# systemctl stop firewalld.service
# systemctl disable firewalld.service

Disable Security Enhanced Features ( SELinux ) :

If your server running SELinux Features of security, then disable this features .

To disable , run the below command.

Edit the configuration file /etc/selinux/config and set the parameter SELINUX to disabled, below is my configuration file , after set the parameter you need to reboot the server.

# vim /etc/selinux/config

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#     enforcing - SELinux security policy is enforced.

#     permissive - SELinux prints warnings instead of enforcing.

#     disabled - No SELinux policy is loaded.


# SELINUXTYPE= can take one of these two values:

#     targeted - Targeted processes are protected,

#     minimum - Modification of targeted policy. Only selected processes are protected.

#     mls - Multi Level Security protection.


Installation set up steps :

cPanel installation need perl package , so we need to install perl before instaalation .

# yum install perl

After installation of perl, set the hostname of server , the hostname should be in FQDN i.e fully qualified domain name. Below is steps to set hostname in Centos / RHEL 7.

Below command to check  hostname of server :

# hostnamectl

To set hostname :

#hostnamectl set-hostname

Install cPanel/WHM

Now we will download cpanel script on home directory of server ,  which will install cpanel & WHM  .Follow below steps for installation.

# cd /home
# curl -o latest -L
# sh latest

Now script will run some hours and after installation you will get some output  like , time taken in installation as well as server access url and access details, you will use in login root as a user and use password of root user.

You will get WHM access like below url.

https://your –server-public-ip:2087/





After access of url in browser and put the username password details in access url and accept license agreement, you can configure server networking, ip address and nameserver as according to you , you should have good nice knowledge of System Admin part.

Hope you enjoy this post , for any concern please comment here and give us feedback. Thanks

Continue Reading

Install Guacamole on CentOS 7

This post is for installing the latest version of Guacamole on CentOS 7, as there are several difference from the previous guide I did. If you want to read more about Guacamole, and how awesome it is, I recommend you take a glance at my previous post here.

**Note, I am installing the MySQL Authentication package which allows me to store connections and authentication information in a database, instead of a plain-text XML file.
Let’s Get Started!

1.) prerequisites:

yum -y install epel-release wget
wget -O /etc/yum.repos.d/home:felfert.repo
yum -y install cairo-devel freerdp-devel gcc java-1.8.0-openjdk.x86_64 libguac libguac-client-rdp libguac-client-ssh libguac-client-vnc \
libjpeg-turbo-devel libpng-devel libssh2-devel libtelnet-devel libvncserver-devel libvorbis-devel libwebp-devel openssl-devel pango-devel \
pulseaudio-libs-devel terminus-fonts tomcat tomcat-admin-webapps tomcat-webapps uuid-devel

Above we are just installing adding the EPEL and Felfert repositories that contain the files we need, and installing all our prereqs. Easy.

2.) guacd install

mkdir ~/guacamole && cd ~/
tar -xzf guacamole-server-0.9.9.tar.gz && cd guacamole-server-0.9.9
./configure --with-init-dir=/etc/init.d
make install

Guacamole is delivered in two different pieces. The back-end is what we just installed above, from source, called guacd (or guacamole daemon). The other piece is the guacamole client, or web frontend. This is delivered via Jetty, and installed next.

3.) guacamole client

mkdir -p /var/lib/guacamole && cd /var/lib/guacamole/
wget -O guacamole.war
ln -s /var/lib/guacamole/guacamole.war /var/lib/tomcat/webapps/
rm -rf /usr/lib64/freerdp/
ln -s /usr/local/lib/freerdp/ /usr/lib64/freerdp/

We now have the guacamole server daemon and the guacamole client installed. Next up is the MySQL Authentication piece, using MariaDB.

4.) mysql authentication

yum -y install mariadb mariadb-server
mkdir -p ~/guacamole/sqlauth && cd ~/guacamole/sqlauth
tar -zxf guacamole-auth-jdbc-0.9.9.tar.gz
tar -zxf mysql-connector-java-5.1.38.tar.gz
mkdir -p /usr/share/tomcat/.guacamole/{extensions,lib}
mv guacamole-auth-jdbc-0.9.9/mysql/guacamole-auth-jdbc-mysql-0.9.9.jar /usr/share/tomcat/.guacamole/extensions/
mv mysql-connector-java-5.1.38/mysql-connector-java-5.1.38-bin.jar /usr/share/tomcat/.guacamole/lib/
systemctl restart mariadb.service

The above is installing mariadb, downloading the needed .jar’s, and moving them to where they belong. All but one jar file is included in the Guacamole MySQL Auth download, which is the MySQL Java Connector.

5.) configure database

mysqladmin -u root password MySQLRootPass
mysql -u root -p   # Enter above password
create database guacdb;
create user 'guacuser'@'localhost' identified by 'guacDBpass';
grant select,insert,update,delete on guacdb.* to 'guacuser'@'localhost';
flush privileges;

Here we created the database and user for guacd to use.

6.) extend database schema

cd ~/guacamole/sqlauth/guacamole-auth-jdbc-0.9.9/mysql/schema/
cat ./*.sql | mysql -u root -p guacdb   # Enter SQL root password set above

And here we extend the schema of the database we created.

7.) configure guacamole

mkdir -p /etc/guacamole/ && vi /etc/guacamole/

The above is creating our needed directories, and then creating the file. This file is what tomcat uses to know what port to talk to guacd on as well as how to access the database. Here is a basic file that will do what you need.

# MySQL properties
mysql-hostname: localhost
mysql-port: 3306
mysql-database: guacdb
mysql-username: guacuser
mysql-password: guacDBpass

# Additional settings
mysql-default-max-connections-per-user: 0
mysql-default-max-group-connections-per-user: 0

This will configure guacamole to use the database and user that we created on the default port of 4822. Note, this is for internal communication only and is not the port that you will be accessing the web interface on.

And we have to create a symlink so Guacamole can find the config file:

ln -s /etc/guacamole/ /usr/share/tomcat/.guacamole/

8.) Cleanup

All that’s left is a little housecleaning!

cd ~ && rm -rf guacamole*
systemctl enable tomcat.service && systemctl enable mariadb.service && chkconfig guacd on
systemctl reboot

Once your server boots, you’ll have Guacamole running and ready to be used! Head on over to http://guac_server_ip:8080/guacamole to start using your new Guacamole server! default username and password are both ‘guacadmin’.

If you’re having trouble accessing the webpage for Guacamole, make sure you have configured firewalld (or disabled it) to allow access to port 8080.

Leave me some feedback!

Continue Reading

Install Nagios 4.0.4 on Centos 7

For RHEL/CentOS users:

#yum install -y wget httpd php gcc glibc glibc-common gd gd-devel make net-snmp
#yum install   httpd php  gd gd-devel gcc glibc glibc-common openssl perl perl-devel makesasa

Download Nagios Core and Nagios Plugins Tarballs
For all systems, run the following commands in your terminal:

cd /tmp

This will download Nagios Core, and it’s required plugins.
Adding the Nagios User and Group
Next add the appropriate user and group for the Nagios process to run:

#useradd nagios
#groupadd nagcmd
#usermod -a -G nagcmd nagios

Nagios Core Installatiom

#tar zxvf nagios-4.0.4.tar.gz
#tar zxvf nagios-plugins-2.0.tar.gz

Change to the new Nagios directory and install the packages:

#cd nagios-4.0.4
#./configure --with-command-group=nagcmd
#make all
#make install
#make install-init
#make install-config
#make install-commandmode
#make install-webconf
#cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/
#chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers
#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
#/etc/init.d/nagios start

For RHEL/CentOS users:

#/etc/init.d/httpd start
#systemctl start httpd

Create a Default User for Web Access.
Add a default user for Web Interface Access:

#htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Nagios Plugin Installation

#cd /tmp/nagios-plugins-2.0
#./configure --with-nagios-user=nagios --with-nagios-group=nagios
#make install

Nagios Service Setup
The following commands will register the Nagios daemon to be run upon system startup.

chkconfig --add nagios
chkconfig --level 35 nagios on
chkconfig --add httpd
chkconfig --level 35 httpd on

Nagios Web Interface
After correctly following the procedures you should now
be able to access your Nagios Core installation from a
web browser.
Simply use the following:
And log in with the credentials you chose when adding
the nagiosadmin user to the htpasswd.users file.

Continue Reading