Tuesday, August 13, 2013

yum setup on RHEL 6 and samba installation

Here are the quick steps:

mkdir -p  /var/OSimage/RHEL_6
 mount -o loop /ISO/rhel-server-6.4-x86_64-dvd.iso  /var/OSimage/RHEL_6

To make sure that the iso is mounted after each reboot make it permanent in the fstab file:

[root@RHEL-6 ~]# cat /etc/fstab

/ISO/rhel-server-6.4-x86_64-dvd.iso             /var/OSimage/RHEL_6 loop         defaults 0 0

Create a file:

vi /etc/yum.repos.d/rhel6.repo

[RHEL-6]
name=RedHat nterprise Linux 6
baseurl=file:///var/OSimage/RHEL_6
enabled=1
gpgcheck=0

save and exit

1 means enabled 0 means disabled. Here we are enabling the file:///var/OSimage/RHEL_6 as a yum repository.

Now run following two commands:

1. yum clean all
2. yum repolist

[root@RHEL-6 ~]# yum clean all
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: RHEL-6
Cleaning up Everything

[root@RHEL-6 ~]# yum repolist
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Bad id for repo: Raj's ISO Repository, byte = ' 3
RHEL-6                                                                                                                                                           | 3.9 kB     00:00 ...
RHEL-6/primary_db                                                                                                                                                | 3.1 MB     00:00 ...
repo id                                                                         repo name                                                                                         status
RHEL-6                                                                          RedHat nterprise Linux 6                                                                          3,648
repolist: 3,648

To test I installed samba - It will resolve the dependencies on ots own.

[root@RHEL-6 ~]# yum install samba
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Bad id for repo: Raj's ISO Repository, byte = ' 3
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package samba.x86_64 0:3.6.9-151.el6 will be installed
--> Processing Dependency: samba-winbind-clients = 3.6.9-151.el6 for package: samba-3.6.9-151.el6.x86_64
--> Processing Dependency: samba-common = 3.6.9-151.el6 for package: samba-3.6.9-151.el6.x86_64
--> Processing Dependency: libwbclient.so.0()(64bit) for package: samba-3.6.9-151.el6.x86_64
--> Running transaction check
---> Package samba-common.x86_64 0:3.6.9-151.el6 will be installed
---> Package samba-winbind-clients.x86_64 0:3.6.9-151.el6 will be installed
--> Processing Dependency: samba-winbind = 3.6.9-151.el6 for package: samba-winbind-clients-3.6.9-151.el6.x86_64
--> Running transaction check
---> Package samba-winbind.x86_64 0:3.6.9-151.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================================
 Package                                              Arch                                  Version                                         Repository                             Size
========================================================================================================================================================================================
Installing:
 samba                                                x86_64                                3.6.9-151.el6                                   RHEL-6                                5.0 M
Installing for dependencies:
 samba-common                                         x86_64                                3.6.9-151.el6                                   RHEL-6                                 10 M
 samba-winbind                                        x86_64                                3.6.9-151.el6                                   RHEL-6                                2.2 M
 samba-winbind-clients                                x86_64                                3.6.9-151.el6                                   RHEL-6                                2.0 M

Transaction Summary
========================================================================================================================================================================================
Install       4 Package(s)

Total download size: 19 M
Installed size: 68 M
Is this ok [y/N]: y
Downloading Packages:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                    24 MB/s |  19 MB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : samba-winbind-3.6.9-151.el6.x86_64                                                                                                                                   1/4
  Installing : samba-winbind-clients-3.6.9-151.el6.x86_64                                                                                                                           2/4
  Installing : samba-common-3.6.9-151.el6.x86_64                                                                                                                                    3/4
  Installing : samba-3.6.9-151.el6.x86_64                                                                                                                                           4/4
RHEL-6/productid                                                                                                                                                 | 1.7 kB     00:00 ...
  Verifying  : samba-winbind-clients-3.6.9-151.el6.x86_64                                                                                                                           1/4
  Verifying  : samba-winbind-3.6.9-151.el6.x86_64                                                                                                                                   2/4
  Verifying  : samba-3.6.9-151.el6.x86_64                                                                                                                                           3/4
  Verifying  : samba-common-3.6.9-151.el6.x86_64                                                                                                                                    4/4

Installed:
  samba.x86_64 0:3.6.9-151.el6

Dependency Installed:
  samba-common.x86_64 0:3.6.9-151.el6                      samba-winbind.x86_64 0:3.6.9-151.el6                      samba-winbind-clients.x86_64 0:3.6.9-151.el6

Complete!
[root@RHEL-6 ~]# rpm -qa | grep -i samba
samba-common-3.6.9-151.el6.x86_64
samba-winbind-3.6.9-151.el6.x86_64
samba-winbind-clients-3.6.9-151.el6.x86_64
samba-3.6.9-151.el6.x86_64










Monday, August 12, 2013

mount dvd - RHEL 6

Follow the following:

[root@RHEL-6 ~]# mount /dev/sr0 /mnt/
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@RHEL-6 ~]# cd /mnt/
[root@RHEL-6 mnt]# ll
total 732
-rw-r--r-- 1 root root   5165 Feb 29  2012 blafdoc.css
drwxr-xr-x 3 root root   2048 Feb 29  2012 Cluster
drwxr-xr-x 3 root root   4096 Feb 29  2012 ClusterStorage
-rw-r--r-- 1 root root   6830 Feb 29  2012 EULA
-rw-r--r-- 1 root root   7041 Feb 29  2012 eula.en_US
-rw-r--r-- 1 root root   3334 Feb 29  2012 eula.py
-rw-r--r-- 1 root root  18390 Feb 29  2012 GPL
drwxr-xr-x 4 root root   2048 Feb 29  2012 images
drwxr-xr-x 2 root root   2048 Feb 29  2012 isolinux
-rw-r--r-- 1 root root   3547 Feb 29  2012 README-en
-rw-r--r-- 1 root root   7897 Feb 29  2012 README-en.html
-rw-r--r-- 1 root root  35456 Feb 29  2012 RELEASE-NOTES-en
-rw-r--r-- 1 root root  38444 Feb 29  2012 RELEASE-NOTES-en.html
-rw-r--r-- 1 root root   1397 Feb 29  2012 RPM-GPG-KEY
-rw-r--r-- 1 root root   1397 Feb 29  2012 RPM-GPG-KEY-oracle
drwxr-xr-x 4 root root 593920 Feb 29  2012 Server
-rw-r--r-- 1 root root    105 Feb 29  2012 supportinfo
-r--r--r-- 1 root root   4436 Feb 29  2012 TRANS.TBL
drwxr-xr-x 3 root root   8192 Feb 29  2012 VT

Thursday, August 1, 2013

SSH Passwordless login

This is tested on RHEL-6

run the following command to generate the public key and copy it over to the system where you want to login without password.

[root@RHEL-6 .ssh]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
ea:86:92:04:ac:35:21:e8:bf:9d:3c:72:26:f4:46:3a root@RHEL-6
The key's randomart image is:
+--[ RSA 2048]----+
|.                |
|o .              |
|o. .             |
|.oo              |
|.o..    S        |
|. .o . .         |
| ...B.o          |
|  oE.@.          |
|   .B.o          |
+-----------------+
[root@RHEL-6 .ssh]# ll

type in the following command now :

ssh-copy-id -i ~/.ssh/id_rsa.pub  rsangvik@cluster1

You would get the following message: And the  .ssh/authorized_keys is created automatically with th command

Now try logging into the machine, with "ssh 'rsangvik@cluster1'", and check in:

  .ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

[root@RHEL-6 .ssh]# ssh rsangvik@cluster1

See the prompt:

Last login: Thu Aug  1 10:25:28 2013 from rhel-6.example.com
-bash-3.2$ hostname
cluster1




Sunday, June 9, 2013

YUM repository setup on ISO based - RHEL -5

Initially I created mkdir /var/repo/
mount -o loop /var/rhel5.iso /var/repo
cd /var/repo
createrepo .
and then ran createrepo on it. But would get the following error:
Directory must be writable.
To resolve that create a soft link
mkdir /var/repo/Server --> This is the path where I will dump my all RPM's from Server directory
ln -s /var/repo/Server/ /var/repo/Server
createrepo /var/repo/Server

Now......... Add following to the file

 cat /etc/yum.repos.d/iso.repo

[My ISO Repository]
name=test
baseurl=file:///var/repo/Server
enabled=1
gpgcheck=0

Now... Lets test:

[root@smtreeprd02 ~]# rpm -qa | grep -i telnet
telnet-0.17-38.el5
[root@smtreeprd02 ~]# yum remove telnet-0.17-38.el5
Loading "installonlyn" plugin
Loading "rhnplugin" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Remove Process
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package telnet.i386 1:0.17-38.el5 set to be erased
--> Running transaction check

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Removing:
 telnet                  i386       1:0.17-38.el5    installed          96 k

Transaction Summary
=============================================================================
Install      0 Package(s)
Update       0 Package(s)
Remove       1 Package(s)

Is this ok [y/N]: y
Downloading Packages:
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Removing  : telnet                       ######################### [1/1]

Removed: telnet.i386 1:0.17-38.el5
Complete!
[root@smtreeprd02 ~]#
[root@smtreeprd02 ~]# yum install telnet-0.17-38.el5
Loading "installonlyn" plugin
Loading "rhnplugin" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Setting up repositories
My ISO Repository         100% |=========================|  951 B    00:00
ftp://192.168.60.143/var/ftp/Server/repodata/repomd.xml: [Errno 4] IOError: [Errno ftp error] 550 Failed to change directory.
Trying other mirror.
Error: Cannot open/read repomd.xml file for repository: Server
[root@smtreeprd02 ~]# cd /etc/yum.repos.d/
[root@smtreeprd02 yum.repos.d]# ls
iso.repo  rhel-debuginfo.repo
[root@smtreeprd02 yum.repos.d]# rm rhel-debuginfo.repo
rm: remove regular file `rhel-debuginfo.repo'? y
[root@smtreeprd02 yum.repos.d]# cd
[root@smtreeprd02 ~]# yum install telnet-0.17-38.el5
Loading "installonlyn" plugin
Loading "rhnplugin" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
primary.xml.gz            100% |=========================| 600 kB    00:00
################################################## 2113/2113
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for telnet to pack into transaction set.
telnet-0.17-38.el5.i386.r 100% |=========================| 7.7 kB    00:00
---> Package telnet.i386 1:0.17-38.el5 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 telnet                  i386       1:0.17-38.el5    My ISO Repository   56 k

Transaction Summary
=============================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 56 k
Is this ok [y/N]: y
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 37017186

Public key for telnet-0.17-38.el5.i386.rpm is not installed
[root@smtreeprd02 ~]# vi /etc/yum.repos.d/iso.repo
[root@smtreeprd02 ~]# yum install telnet-0.17-38.el5
Loading "installonlyn" plugin
Loading "rhnplugin" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package telnet.i386 1:0.17-38.el5 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 telnet                  i386       1:0.17-38.el5    My ISO Repository   56 k

Transaction Summary
=============================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 56 k
Is this ok [y/N]: y
Downloading Packages:
Running Transaction Test
warning: telnet-0.17-38.el5: Header V3 DSA signature: NOKEY, key ID 37017186
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: telnet                       ######################### [1/1]

Installed: telnet.i386 1:0.17-38.el5
Complete!




Friday, June 7, 2013

mount DVD in RHEL 5

I was not able to find this on internet and on forums. But I knew I had one Linux box where I had done full installation and DVD would get mounted there. Hence ran ls -l /dev/dvd and found that it is soft linked to hdc. So did the following:

[root@smtreeprd05 ~]# ln -s /dev/hdc /dev/dvd
[root@smtreeprd05 ~]# ls -l /dev/dvd
lrwxrwxrwx 1 root root 8 Jun  4 01:22 /dev/dvd -> /dev/hdc
[root@smtreeprd05 ~]# mount /dev/dvd /mnt/
mount: block device /dev/dvd is write-protected, mounting read-only
[root@smtreeprd05 ~]# cd /mnt/
[root@smtreeprd05 mnt]# ls
Cluster         README-en.html  README-or.html         RELEASE-NOTES-de.html  RELEASE-NOTES-ml.html     RPM-GPG-KEY-fedora
ClusterStorage  README-es.html  README-pa.html         RELEASE-NOTES-en       RELEASE-NOTES-mr.html     RPM-GPG-KEY-fedora-test
EULA            README-fr.html  README-pt_BR.html      RELEASE-NOTES-en.html  RELEASE-NOTES-or.html     RPM-GPG-KEY-redhat-auxiliary
eula.en_US      README-gu.html  README-ru.html         RELEASE-NOTES-es.html  RELEASE-NOTES-pa.html     RPM-GPG-KEY-redhat-beta
GPL             README-hi.html  README-si.html         RELEASE-NOTES-fr.html  RELEASE-NOTES-pt_BR.html  RPM-GPG-KEY-redhat-former
images          README-it.html  README-ta.html         RELEASE-NOTES-gu.html  RELEASE-NOTES-ru.html     RPM-GPG-KEY-redhat-release
isolinux        README-ja.html  README-te.html         RELEASE-NOTES-hi.html  RELEASE-NOTES-si.html     Server
README-as.html  README-kn.html  README-zh_CN.html      RELEASE-NOTES-it.html  RELEASE-NOTES-ta.html     TRANS.TBL
README-bn.html  README-ko.html  README-zh_TW.html      RELEASE-NOTES-ja.html  RELEASE-NOTES-te.html     VT
README-de.html  README-ml.html  RELEASE-NOTES-as.html  RELEASE-NOTES-kn.html  RELEASE-NOTES-zh_CN.html
README-en       README-mr.html  RELEASE-NOTES-bn.html  RELEASE-NOTES-ko.html  RELEASE-NOTES-zh_TW.html

Thanks.

Monday, June 3, 2013

mount: special device /dev/dvd does not exist

[root@localhost ~]# mount /dev/dvd /mnt/
mount: special device /dev/dvd does not exist

tried the following command and it worked!
ln -sf /dev/hdc /dev/dvd

[root@localhost ~]# mount /dev/dvd /mnt/
mount: block device /dev/dvd is write-protected, mounting read-only
[root@localhost ~]# cd /mnt/
[root@localhost mnt]# ls
Cluster         README-or.html         RELEASE-NOTES-ml.html
ClusterStorage  README-pa.html         RELEASE-NOTES-mr.html
EULA            README-pt_BR.html      RELEASE-NOTES-or.html
eula.en_US      README-ru.html         RELEASE-NOTES-pa.html
GPL             README-si.html         RELEASE-NOTES-p

OUTPUT truncated.........................

Sunday, June 2, 2013

RHEL 5 Kickstart setup and installation

Below is the short process of how to setup the Kickstart server and create a Kickstart file for automated installation with HTTP style.

Set up web server Apache which is default on RHEL-5.
Create an iso with the dd command as shown below
mount the DVD

# mount /dev/dvd /mnt
# dd if=/dev/dvd of=/var/rhel5.iso
# mkdir /var/www/html/kick
# cd /var/www/html/kick
dump your DVD mounted files and directories with following way:

#  rsync -rv /mnt/* .

copy the anaconda.ks.cfg file from /root and modify as per your requirement. Here is the basic one just to get the things going - So this is simply just for reference - in case you forget OR set up the Kickstart after a while :-) in that case you may really need some notes to refer.

Example ks.cfg file:

# Kickstart file automatically generated by anaconda.

install
url --url http://192.168.60.130/kick
key --skip
lang en_US.UTF-8
langsupport --default=en_US.UTF-8 en_US.UTF-8
keyboard us
xconfig
network --device eth0 --bootproto dhcp
rootpw --iscrypted $1$mgirnE1C$tK92VwNASset7OLfUSznD/
firewall --disabled
selinux --disabled
authconfig --enableshadow --enablemd5
timezone America/Phoenix
bootloader --location=mbr --append="rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --all --initlabel
part /boot --fstype ext3 --size=100
part / --fstype ext3 --size=3000 --grow --maxsize=4000
part /home --fstype ext3 --size=1000 --grow
part swap --size=1000 --grow --maxsize=2000

%packages
@ admin-tools
@ text-internet
@ gnome-desktop
@ dialup
@ smb-server
@ base-x
@ web-server
@ printing
@ server-cfg
grub
e2fsprogs
kernel

%post

boot your client with bootable CD or with iso

linux ks=http://192.168.140.22/kick/ks.cfg



Thanks.