Friday, 4 November 2016

Ldap Installation and configuration in rhel 6

Ldap Installation & Configurations

Step 1 - Ldap installation:

Run the following command to install ldap

yum install *openldap* -y

or

yum install openldap openldap-clients openldap-servers -y


Step 2 - Assign ldap admin password

Run the following command to assign password for admin ldap

slappasswd

New password : password
re-enter new password : password

{SSHA}50UEVw19zeh7LT53hQH69znzj4OuSrHd


Step 3 - Add root user password hash in configuration file

Root user only have access to add user, groups, OU etc... Do the following in the olcDatabase={2}bdb.ldif file

cd /etc/openldap//slapd.d/cn\=config

vi olcDatabase\=\{2\}bdb.ldif

if olcRootPW doesn't exist create it add the password like below

olcRootPW: {SSHA}50UEVw19zeh7LT53hQH69znzj4OuSrHd

after that we need to made some changes in that file that mentioned below

change distinguished name (DN) of the olcSuffix to something appropriate.

olcSuffix: dc=test,dc=com
olcRootDN: cn:ldap,dc=test,dc=com



Step 4 - Modify RootDN in olcDatabase={2}


follow the steps below to add root dn


vi olcDatabase\=\{1\}monitor.ldif

modify the olcAccess line so the dn.base matches with olcRootDN from olcDtabase={2}

olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" read by dn.base="cn=ldap,dc=test,dc=com" read by * none


Step 5 - Hide the HASH password from other users

edit the oclDatabase\=\{2\}bdb.ldif file

vi olcDatabase\=\{2\}bdb.ldif

and add the following details to last line
                      
olcAccess: {0}to attrs=userPassword by self write by dn.base="cn=ldap,dc=test,dc=com" write by anonymous auth by * none 
olcAccess: {1}to * by dn.base="cn=ldap,dc=test,dc=com" write by self write by * read

These line only allow the users to read or write users own passwords.


Step 5 - Start the ldap service

service slapd start

May be you will get error like below

581cb279 ldif_read_file: checksum error on "/etc/openldap/slapd.d/cn=config/olcDatabase={1}monitor.ldif"
581cb279 ldif_read_file: checksum error on "/etc/openldap/slapd.d/cn=config/olcDatabase={2}bdb.ldif"

Just ignore for this time.

make sure to turn on it automatically at restart

chkconfig slapd on


Step 6 Creating DN entry in ldap tree by manually
An LDAP directory is analogous to a tree. Nodes in this tree are
called LDAP "entries" and may represent users, groups, organizational
units, domain controllers, or other objects. The attributes in each
entry are determined by the LDAP schema. In this tutorial we will build entries based on the InetOrgPerson schema (which ships with OpenLDAP by default).In order to build our LDAP tree we must first create the root entry. 
Root entries are usually a special type of entrycalled a domain controller (DC).  
Because we are assuming that the organization is called something, and that the domain is "test.com," we will create a domain controller LDAP entry called dc=test,dc=com. Again, you will need to replace "test" with your organization's domain name.  
Also note that dc=test,dc=com is what is called an LDAP distinguished name (DN). An LDAP distinguished name uniquely identifies an LDAP entry.

create a file test.ldif in /tmp and add the below mentioned line.

cd /tmp
vi test.ldif

dn: dc=test,dc=com
objectClass: dcObject
objectClass: organization
dc: test
o : test


Step 7 Add the content to LDAP

Run the following commands to add that we create ldif file to LDAP tree
ldapadd -f test.ldif -D cn=ldap,dc=test,dc=com -w password
now the content will added to the ldap. Make sure that it's entered correctly or not with following command
ldapsearch -x -LLL -b dc-test,dc=com

it will show the result like below

dn: dc=test,dc=com
objectClass: dcObject
objectClass: organization
dc: test
o : test


Step 8 Allow or disable the firewall

by default rhel have enable the iptables you can allow the ldap port to access or you can just disable to move on

for disabling run the folowing command.

service iptables stop
chkconfig iptables off

if you want to then do the following.

iptables -A INPUT -p tcp -m tcp --dport 389 -j ACCEPT

service iptables save


Step 9 - Adding OU in ldap tree

add temprory file in tmp and you can delete once it added to ldap tree 

cd /tmp
vi users/ldif

and add the following line

dn: ou=Users,dc=test,dc=com
objectClass: organizationalUnit
ou: Users
Now add the content to ldap
ldapadd -f users.ldif -D cn=ldap,dc=test,dc=com -w password


Step 10 - Add users to ldap

Same as step 9

cd /tmp
vi testuser.ldif

add the following line

dn: cn=test user,ou=Users,dc=test,dc=com
cn: test
sn: user
objectClass: inetOrgPerson
userPassword: test123
uid: testuser

now add the content to ldap tree

ldapadd -f testuser.ldif -D cn=ldap,dc=tes,dc=com -w password


Step 11 - Add group to ldap

same as step 9 and 10

cd /tmp
vi testgroup.ldif

now add the following lines

dn: cn=testgroup,ou=Users,dc=test,dc=com
cn: testgroup
objectClass: groupOfNames
member: cn=test user,ou=Users,dc=test,dc=com

now add to ldap

ldapadd -f testgroup.ldif -D cn=ldap,dc=tes,dc=com -w password


Step 12 - Add user to group in ldap

same as above 

cd /tmp
vi addusertogroup.ldif

add the following lines

dn: cn=testgroup,ou=Users,dc=test,dc=com
changetype: modify
add: member
member: cn=test user,ou=Users,dc=test,dc=com

now add to ldap

ldapadd -f addusertogroup.ldif -D cn=ldap,dc=tes,dc=com -w password

that's all to configure basic openldap ....

Thursday, 3 November 2016

Hadoop Multinode Installation in RHEL 6

Step 1

Assign static ip to all the required servers.

Ex.

192.168.0.90 - master
192.168.0.91 - slave1
192.168.0.92 - slave 2

Step 2

Make sure all machines have host entries of all servers.

vi /etc/hosts

192.168.0.90  master
192.168.0.91  slave 1
192.168.0.92  slave 2

Step 3


Create hadoop user in all the servers

useradd hadoop

passwd hadoop

Step 4

Setup ssh passwordless authentication for all the server for inter communication.

su hadoop

ssh-keygen -t rsa

cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

chmod 0600 ~/.ssh/authorized_keys

ssh-copy-id -i ~/.ssh/id_rsa.pub hadoop@slave1

ssh-copy-id -i ~/.ssh/id_rsa.pub hadoop@slave2

Same need to do all the slave servers.

Step 5

Disable the ipv6 in master and slave servers hadoop will not support. insert the below details in /etc/sysctl.conf in last line


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

Step 6

Set environment variables uses by hadoop by editing /etc/profile file 
and append the following values at the end of the file by excuting below commands

echo "" >> /etc/profile

echo "### HADOOP Variables ###" >> /etc/profile

echo "export HADOOP_HOME=/opt/hadoop" >> /etc/profile

echo "export HADOOP_INSTALL=\$HADOOP_HOME" >> /etc/profile

echo "export HADOOP_MAPRED_HOME=\$HADOOP_HOME" >> /etc/profile

echo "export HADOOP_COMMON_HOME=\$HADOOP_HOME" >> /etc/profile

echo "export HADOOP_HDFS_HOME=\$HADOOP_HOME" >> /etc/profile

echo "export YARN_HOME=\$HADOOP_HOME" >> /etc/profile

echo "export HADOOP_COMMON_LIB_NATIVE_DIR=\$HADOOP_HOME/lib/native" >> /etc/profile

echo "export PATH=\$PATH:\$HADOOP_HOME/sbin:\$HADOOP_HOME/bin" >> /etc/profile

Reload Configuration using below command.

source /etc/profile

Step 7

Create Hadoop data directories in all nodes (root can only have the access to create)

mkdir -p /data/hadoop-data/nn 

mkdir -p /data/hadoop-data/snn

mkdir -p /data/hadoop-data/dn

mkdir -p /data/hadoop-data/mapred/system

mkdir -p /data/hadoop-data/mapred/local

chown -R hadoop:hadoop /data/

step 8

Download the hadoop package and tar it to hadoop folder. 
(root can only have the access to create)

cd /opt/

wget http://mirror.fibergrid.in/apache/hadoop/common/hadoop-2.7.3/hadoop-2.7.3-src.tar.gz

tar -xvf hadoop-2.7.3-src.tar.gz

mv hadoop-2.7.3 hadoop

change the directory owner to hadoop

chown -R haddop:hadoop /opt/hadoop/

Step 9

Now we need to check the java version and assign the java home in hadoop by following steps.

java -version

java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)

hadoop-env.sh

Environment variables that are used in the scripts to run hadoop

now edit the file hadoop-env.sh in hadoop

vi /opt/hadoop/etc/hadoop/hadoop-env.sh

add the JAVA_HOME like

export JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64

save and exit

step 10

hdfs-site.xml 
Configuration settings for HDFS daemons, the namenode, the secondary namenode and the datanodes.
Edit the hdfs-site.xml file with append below details.

vi /opt/hadoop/etc/hadoop/hdfc-site.xml

and add the details below between configuration

<configuration>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:///opt/hadoop/hdfs/data</value>
<description>DataNode directory for storing data chunks.</description>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:///opt/hadoop/hdfs</value>
<description>NameNode directory for namespace and transaction logs storage.</description>
</property>
<property>
<name>dfs.replication</name>
<value>3</value>
<description>Number of replication for each chunk.</description>
</property>

</configuration>

save and exit

Step 11

core-site.xml

Configuration settings for Hadoop core such as I/O settings that are common to hdfs and Mapreduce.

Now edit core-site.xml file with append below details.

vi /opt/hadoop/etc/hadoop/core-site.xml

<configuration>

<property>
<name>fs.defaultFS</name>
<value>hdfs://master:9000</value>
</property>
<property>
<name>dfs.permissions</name>
<value>false</value>
</property>

</configuration>

save and exit

Step 12

mapred-site.xml

Configuration settings for MapReduce Applications.

Now edit mapred-site.xml file with append below details.

vi /opt/hadoop/etc/hadoop/mapred-site.xml

<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
<description>Execution framework.</description>
</property>
</configuration>

save and exit

Step 13

yarn-site.xml

Configuration settings fot ResourceManager and NodeManager.

Now edit yarn-site.xml file with append below details.

vi /opt/hadoop/etc/hadoop/yarn-site.xml

<configuration>

<property>
<name>yarn.resourcemanager.hostname</name>
<value>master</value>
<description>The hostname of the ResourceManager</description>
</property>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
<description>shuffle service for MapReduce</description>
</property>
<property>
<name>yarn.resourcemanager.resource-tracker.address</name>
<value>master:8025</value>
</property>
<property>
<name>yarn.resourcemanager.scheduler.address</name>
<value>master:8030</value>
</property>
<property>
<name>yarn.resourcemanager.address</name>
 <value>master:8040</value>

</configuration>

save and exit

Step 14

Slaves

A list of machines (one per line)  that each run a Datanode and Nodemanager

Now edit slaves file and append the slave hostname or ip in that file

vi /opt/hadoop/etc/hadoop/slaves

master
slave1
slave2

save and exit

Step 15

Copy the hadoop directory to the all the slave servers with following command

scp-r /opt/hadoop hadoop@slave1:/opt/
scp-r /opt/hadoop hadoop@slave2:/opt/

In slave server you have to change the permission or owner for that folder to access 

chown -R hadoop:hadoop /opt/hadoop

Step 16

Masters

A list of machines (one per line) that each run a secondary name nodes.

In master server we have to create masters in hadoop conf location and add the master.

vi /opt/hadoop/etc/hadoop/masters

add

master

save and exit.

Step 17

Next we have to format the NameNode and start “all hadoop services”. The command used to format the NameNode is hdfs namenode –format.

cd /opt/hadoop

hdfs namenode -format

After formatting the NameNode, we can start the Hadoop services.

cd /opt/hadoop/sbin

start-all.sh

This will setup our multi-node cluster. We can check for the same by opening the browser and entering the IP of the NameNode. This is shown below:





URL List:

Name Node : http://192.168.0.90:50070 or http://master:50070
Yarn Services : http://192.168.0.90:8088
Secondary Name Node : http://192.168.0.90:50090
Data Node : http://192.168.0.90:50075

If datanode is not running then just we need to do the following steps

remove the data in data directory

rm -rf /data/*

then 

cd /opt/hadoop

bin/hadoop namenode -format

If datanode is not running in slave then follow the steps

bin/hadoop datanode 

it will start the datanode 

Thursday, 13 October 2016

GDBus.Error:org.freedesktop.DBus.Error.NoReply

Hi I have face this below issue and check for solution in online I got solution for this.



Solution :

It's very easy to solve this issue by following.

It looks like it was outdated configuration file that produced the issue. Just open the following file with your favorite editor /etc/pam.d/systemd-user

vi /etc/pam.d/systemd-user

modify the following with 

account include system-auth
session include  system-auth

to 

account include system-login
session include  system-login

that's all it will solve the issue.

Wednesday, 21 September 2016

The server rejected SFTP connection, but it listens for FTP

The server rejected SFTP connection, but it listens for FTP

This issue have made me mad. I have check all the way to find the solution but no one gives the perfect solution for this. Finally i have found the solution and cause of this issue. Below i have mentioned clearly.

Cause of this issue is limitation of session. For this you have to remove the session or increase the session. For me I can't remove running session so i have done increasing the session. Below i have mentioned the steps.

the location of session limit is /etc/security/limits.d/20-nproc.conf

in this root have unlimited soft session. we can assign or increase the user session limit on this session.

Unable to unmount CIFS in RHEL

Unable to unmount CIFS in RHEL

I have struggle with unmounting the cifs fie, I have tried but it shows the device is busy show i have given the below command it help  us to unmount the cifs filsystem.


umount -a -t cifs -l


Postfix Not starting

Postfix Not starting

I have faced postfix: fatal: config variable inet_interfaces: host not found: localhost this issue when i try to start post fix. I have try to find the solution so many confusion I got. But I have found the issue just we need to chang main.cf file configrations.

vi /etc/postfix/main.cf

and find the below content and change.

inet_interfaces = localhost

to

inet_interfaces = 127.0.0.1

now save and start the postfix it's will work

systemctl start postfix.service


that's all

cannot add dependency job for unit firewalld.service ignoring unit firewalld.service is masked

This issue have been a change of display manager so only it came. 

first we need to know which kind of display manager we are using so following command will so the 
display manager status.

systemctl status display-manager.service



then we need to update the display manager service 

systemctl reenable gdm.service



now issue have been fixed.

Monday, 19 September 2016

Extend the Logical volume in RHEL 6

Hi today I'm going to explain how to extend the logical volume. Before that we must know about what is PV ( physical volume ) VG ( Volume Group ) and LV ( Logical Volume ). So It's simple concept only I will explain that with my way of understanding. If you thought it's have any issue please command me with the correction. 

  • PV ( Physical Volume )
Physical volume means it has the answer with it's name. Physical disk is divided into physical volume so only we can create other volumes. So first we are going to create physical volume from physical disk.

fdisk -l

this command will show you the list of physical disks in the system.

after this i will show you the image that will give you the clear look of creating physical volume.

http://tr1.cbsistatic.com/hub/i/2015/05/07/67088bde-f48a-11e4-940f-14feb5cc3d2a/10042011figure_a.jpg

In this you see the 'n' it's call new partition. It will show the command action with two options. 
e extended
p primary partition

extended partition means like a container inside we can create many logical volume into this extended volume it will solve the drive limitation.

primary partition usually used to install OS but it can be used to logical volume.


we are going to extend the volume only so we are giving 'p'.

then partition number it's shows the physical volume number. It's a new physical volume so we can provide number and also I'm going to use full size of it so i gave '1'.
then it will ask sector number just give enter to default and again enter for default for last sector.

then 't' t means type in this we can provide the file system type like swap, ext3, ext4, etc .... 

8e means LVM partition.

then 'p' means print. we can see the created created linux LVM.

finally we give 'w' it means save. now we are going to create physical volume with following command

pvcreate /dev/sdd1

That's all we he physical volume.


  • VG ( Volume Group )
VG is a group of partition volume so we can have many resize-able LVM. It's a set of physical disk.

We can view the volume group with following command.

vgs 

It will show the VG in list. On that we have make a note the name of VG name that we are going to extend. Now we are going to extend the VG with following command.

vgextend vgname /dev/sdd1

now you can check th VG with following command.

vgdisplay vgname

That's all we complete the Volume Group.


  • LV ( Logical Volume )

LV is a partitions for linux. We can take size from VG and create LV for our Linux system. Now we extend the LV with following command.

lvextend -l +50G /dev/vgname/lv_root

and resize the partition with following command

resize2fs /dev/vgname/lv_root

now verify the file system with following command

df -h

That's all I have missed so many commands. but this commands enough to extend the logical volume.

Thursday, 15 September 2016

cannot access gvfs Transport endpoint is not connected

Hi Guys I have faced following issue and checked for solution but i didn't get any solution in online so I try some and find the solution for this. followed

df -h

df: â/run/user/0/gvfsâ: Transport endpoint is not connected
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/ol-root 40G 6.7G 34G 17% /
devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs 3.8G 172K 3.8G 1% /dev/shm
tmpfs 3.8G 494M 3.3G 13% /run
tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup
/dev/mapper/vg_data-lvol0 985G 1.4G 933G 1% /u01
/dev/mapper/ol-home 10G 40M 10G 1% /home
/dev/xvda1 497M 194M 304M 39% /boot
tmpfs 773M 16K 773M 1% /run/user/42
tmpfs 773M 0 773M 0% /run/user/1001
tmpfs 773M 32K 773M 1% /run/user/0
tmpfs 773M 0 773M 0% /run/user/1002


df: â/run/user/0/gvfsâ: Transport endpoint is not connected

this error occurred

solution :

cd /run/user/0

fusermount -zu gvfs

that's all....


Helm installation on rhel 9

 You can do install with 2 commands  first one is curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-hel...