[rajusa10@RHEL-6 ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/rajusa10/.ssh/id_rsa):
Created directory '/home/rajusa10/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/rajusa10/.ssh/id_rsa.
Your public key has been saved in /home/rajusa10/.ssh/id_rsa.pub.
The key fingerprint is:
7a:69:78:8a:b1:a8:1c:a7:30:6e:8d:58:f3:02:b9:7c rajusa10@RHEL-6
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| |
| |
| . S |
|o o o . |
|==o+. o = |
|*==E.+ = |
|o=o.o . |
+-----------------+
cat .ssh/id_rsa.pub | ssh rajusa10@dev01 'cat >> .ssh/authorized_keys'
[rajusa10@RHEL-6 ~]$ ssh dev01
|-----------------------------------------------------------------------------|
Last login: Thu Nov 21 11:47:21 2013 from gettoitwellorg.com
-bash-3.2$
Friday, November 29, 2013
Monday, November 18, 2013
New location for nproc limit in RHEL-6 --> "sudo: unable to change to runas uid: too many processes"
-bash-4.1$ cat /etc/security/limits.d/90-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
#* soft nproc 1024
* soft nproc unlimited
root soft nproc unlimited
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
#* soft nproc 1024
* soft nproc unlimited
root soft nproc unlimited
Wednesday, November 13, 2013
Thursday, October 24, 2013
list directories in GB starting with largest in the current working directory.
Here is the quick one:
cd to the current directory. Ex. cd /opt/apps/
du -hk | grep "[0-9][0-9]G" | sort -rn
thats it - 1 Cent :-)
Tuesday, October 1, 2013
Stale NFS file handle error after patching
login as root run fsck/lsof to check in case any files related
process are still hanging around.
In my case I did the same but I would get the Stale NFS file handle error.
searched for the man page .... and -l optin with umount did the trick.
[root@prodhost01 ~]# umount /export/brd_prod
umount: /export/brd_prod: device is busy
umount: /export/brd_prod: device is busy
umount -l /export/brd_prod
man umount
-l Lazy unmount. Detach the filesystem from the filesystem hierarchy now, and cleanup all references to the filesystem as soon as it is not busy anymore.
(Requires kernel 2.4.11 or later.)
-----------------------------
process are still hanging around.
In my case I did the same but I would get the Stale NFS file handle error.
searched for the man page .... and -l optin with umount did the trick.
[root@prodhost01 ~]# umount /export/brd_prod
umount: /export/brd_prod: device is busy
umount: /export/brd_prod: device is busy
umount -l /export/brd_prod
man umount
-l Lazy unmount. Detach the filesystem from the filesystem hierarchy now, and cleanup all references to the filesystem as soon as it is not busy anymore.
(Requires kernel 2.4.11 or later.)
-----------------------------
Monday, September 9, 2013
sftp connection via non-standard port and Identity file
-bash-3.00$ sftp -oPort=5722 sftpuser@sftpfoobar-example.com
Connecting to -sftpfoobar-example...
The authenticity of host 'sftpfoobar-example.com (195.246.229.39)' can't be established.
RSA key fingerprint is 0b:1a:e7:6d:56:5b:ec:6f:999:5a:5b:ca:28:20:df.
Are you sure you want to continue connecting (yes/no)? ^C
Second way is using an identity file. This is in case you are connecting the server out of your domain and the same key dosen't work for all. In this case get the ssh-keygen -t rsa generate the key specific to the hostname.
[root@RHEL-6 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): /home/suser/.ssh/id_rsa_cluster1
Enter passphrase (empty for no passphrase):
You can pass this option to the command - Now provide the passphrase and you should get the sftp prompt.
Connecting to -sftpfoobar-example...
The authenticity of host 'sftpfoobar-example.com (195.246.229.39)' can't be established.
RSA key fingerprint is 0b:1a:e7:6d:56:5b:ec:6f:999:5a:5b:ca:28:20:df.
Are you sure you want to continue connecting (yes/no)? ^C
Second way is using an identity file. This is in case you are connecting the server out of your domain and the same key dosen't work for all. In this case get the ssh-keygen -t rsa generate the key specific to the hostname.
[root@RHEL-6 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): /home/suser/.ssh/id_rsa_cluster1
Enter passphrase (empty for no passphrase):
provide the passphrase to add second security layer.
You can pass this option to the command - Now provide the passphrase and you should get the sftp prompt.
sftp -o Port=6022 -o
IdentityFile=/home/suser/.ssh/id_rsa.pub sftpuser@sftpfoobar-example.com
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
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
[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
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!
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.
[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
[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.........................
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.
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.
Sunday, May 26, 2013
RHEL 5 parted command step by step.
To test this we used RHEL 5 n vmware.
1. Add a new SCSI type hard disk
2. vm machine will save it and process for you
3. after may be one minute run fdisk -l as root and see if you can see the disk you created
Disk /dev/sdb: 1073 MB, 1073741824 bytes
81 heads, 26 sectors/track, 995 cylinders
Units = cylinders of 2106 * 512 = 1078272 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 186 195312+ 83 Linux
Partition 1 has different physical/logical endings:
phys=(24, 80, 26) logical=(185, 39, 2)
1. Add a new SCSI type hard disk
2. vm machine will save it and process for you
3. after may be one minute run fdisk -l as root and see if you can see the disk you created
Disk /dev/sdb: 1073 MB, 1073741824 bytes
81 heads, 26 sectors/track, 995 cylinders
Units = cylinders of 2106 * 512 = 1078272 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 186 195312+ 83 Linux
Partition 1 has different physical/logical endings:
phys=(24, 80, 26) logical=(185, 39, 2)
Now run the command:
[root@smtreeprd04 ~]# parted /dev/sdb
GNU Parted 1.8.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
Got following error:
(parted) mkpart
Error: Unable to open /dev/sdb - unrecognised disk label.
Lets label the disk:
(parted) mklabel msdos
(parted) mkpart
Partition type? primary/extended? primary
File system type? [ext2]?
Start? 1 200
(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 0.51kB 200MB 200MB primary
Now exit the parted utility and format the partition with mkfs
[root@smtreeprd04 ~]# mke2fs /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
48960 inodes, 195312 blocks
9765 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
24 block groups
8192 blocks per group, 8192 fragments per group
2040 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 31 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
create a directory for mount point
mkdir /sdb1
[root@smtreeprd04 ~]# mount /dev/sdb1 /sdb1/
[root@smtreeprd04 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 5.7G 2.3G 3.2G 43% /
/dev/sda1 99M 9.9M 84M 11% /boot
tmpfs 506M 0 506M 0% /dev/shm
/dev/sda7 965M 18M 898M 2% /home
/dev/sda6 1.5G 35M 1.4G 3% /opt
/dev/sda2 9.5G 5.4G 3.7G 60% /var
/dev/sdb1 185M 1.6M 174M 1% /sdb1
Thanks.
Friday, May 24, 2013
one liner for file system size in GB sorted.
This command will generate the output to check the file systems in GB larger on the top.
cd to the directory you want this command to run on.
du -sh * | egrep '([0-9][G])' | sed 's/[0-9][K,M]//g' | sort -rn
I ran this and found that, this works but with one glitch. It is going to return the file names too with size if the file names have "G" exactly in the name. To overcome this run following for loop in the directory which sub-directories file size you want to count.
for i in `ls -l | grep "^d" | awk '{print $9}'` ; do du -sh $i ; done | egrep '([0-9][G])' | sort -rn
Thanks
cd to the directory you want this command to run on.
du -sh * | egrep '([0-9][G])' | sed 's/[0-9][K,M]//g' | sort -rn
I ran this and found that, this works but with one glitch. It is going to return the file names too with size if the file names have "G" exactly in the name. To overcome this run following for loop in the directory which sub-directories file size you want to count.
for i in `ls -l | grep "^d" | awk '{print $9}'` ; do du -sh $i ; done | egrep '([0-9][G])' | sort -rn
Thanks
Tuesday, May 21, 2013
How to connect vsftpd via browser or Windows Explorer on Centos 6.4.
Here are the steps...
Install the vsftpd-2.2.2-11.el6_3.1.x86_64 rpm. This will create the /var/ftp/pub directory
upload your stuff here.
Make changes to the /etc/vsftpd/vsftpd.conf file as per your requirement. I added a few as follows:
banner_file=/etc/vsftpd/issue
local_enable=YES
xferlog_std_format=NO etc...
Add entry in the iptables:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
restart the vsftpd daemon:
[root@smacentos6 mnt]# service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]
Open the windows explorer or browser - It did not work.
Solution: load the following modules:
[root@smartcentos6 ~]# modprobe ip_nat_ftp
[root@smartcentos6 ~]# modprobe ip_conntrack_ftp
restart the vsftpd daemon:
[root@smacentos6 mnt]# service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]
Again restart the
see the screenshot:
Thanks,
-Raj
Install the vsftpd-2.2.2-11.el6_3.1.x86_64 rpm. This will create the /var/ftp/pub directory
upload your stuff here.
Make changes to the /etc/vsftpd/vsftpd.conf file as per your requirement. I added a few as follows:
banner_file=/etc/vsftpd/issue
local_enable=YES
xferlog_std_format=NO etc...
Add entry in the iptables:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
restart the vsftpd daemon:
[root@smacentos6 mnt]# service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]
Open the windows explorer or browser - It did not work.
Solution: load the following modules:
[root@smartcentos6 ~]# modprobe ip_nat_ftp
[root@smartcentos6 ~]# modprobe ip_conntrack_ftp
restart the vsftpd daemon:
[root@smacentos6 mnt]# service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]
Again restart the
see the screenshot:
Thanks,
-Raj
Issue: Changing the system time zone after installation in Red Hat 5.8
Checked the date with date command. showing the following output.
[support@smarthost ~]$ date
Wed Feb 13 13:42:57 PST 2013
Checked the /etc/localtime file it was not soft linked to
the required timezone.
Hence created a soft link as follows to the /usr/share/zoneinfo/PST8PDT
[root@smarthost ~]# ln -s /usr/share/zoneinfo/PST8PDT
/etc/localtime
[root@smarthost ~]# date
Wed Feb 13 21:52:07 UTC 2013
Still showing same old time. Thought about visiting the
hwclock command
And the glitch is there, see below:
[root@smarthost ~]# hwclock --show
Wed 13 Feb 2013 09:49:16 PM UTC -0.411498 seconds
Checked help on the command
[root@smarthost]# hwclock --help
hwclock - query and set the hardware clock (RTC)
Usage:
hwclock [function] [options...]
Functions:
-h | --help show this help
-r | --show read hardware clock and print result
--set set the rtc to the time given with
--date
-s | --hctosys set the system time from the hardware
clock
-w | --systohc set the hardware clock to the current
system time
--systz set the system time based on the
current timezone
--adjust adjust the rtc to account for systematic
drift since
the clock was last set or
adjusted
--getepoch print out the kernel's hardware clock
epoch value
--setepoch set the kernel's hardware clock epoch
value to the
value given with --epoch
-v | --version print out the version of hwclock to
stdout
Options:
-u | --utc the hardware clock is kept in UTC
--localtime the hardware clock is kept in local time
-f | --rtc=path special /dev/... file to use instead of
default
--directisa access the ISA bus directly instead of
/dev/rtc
--badyear ignore rtc's year because the bios is
broken
--date specifies the time to which to set the
hardware clock
--epoch=year specifies the year which is the beginning of
the
hardware clock's epoch value
--noadjfile do not access /etc/adjtime. Requires the
use of
either --utc or
--localtime
--adjfile=path specifies the path to the
adjust file (default is
/etc/adjtime)
--test do everything except actually updating
the hardware
clock or anything else
-D | --debug debug mode
Ran the following command and magic worked!
[root@smarthost ~]# hwclock -s
[root@smarthost ~]# date
Tue May 21 14:38:32 PDT 2013
chkconfig --level 35 ntpd on
[root@smarthost ~]# date
Tue May 21 14:47:06 PDT 2013
Friday, May 17, 2013
sosreport in red hat enterprise linux 6.
I came across this feature of RHEL-6 only when one of the box would reboot after certain interval of time.
It is real easy - What you need is the Redhat case number you are working on. and simply run the command sosreport as root.
[root@RHEL-6 app]# sosreport
sosreport (version 2.2)
This utility will collect some detailed information about the
hardware and setup of your Red Hat Enterprise Linux system.
The information is collected and an archive is packaged under
/tmp, which you can send to a support representative.
Red Hat Enterprise Linux will use this information for diagnostic purposes ONLY
and it will be considered confidential information.
This process may take a while to complete.
No changes will be made to your system.
Press ENTER to continue, or CTRL-C to quit.
Please enter your first initial and last name [RHEL-6]: rs
Please enter the case number that you are generating this report for [None]: 6565
Running plugins. Please wait ...
Completed [51/51] ...
Creating compressed archive...
Your sosreport has been generated and saved in:
/tmp/sosreport-rs.6565-20130517101218-255f.tar.xz
The md5sum is: fc67174ab37703f92999ee50a4fa255f
Please send this file to your support representative.
You have new mail in /var/spool/mail/root
Thanks!
It is real easy - What you need is the Redhat case number you are working on. and simply run the command sosreport as root.
[root@RHEL-6 app]# sosreport
sosreport (version 2.2)
This utility will collect some detailed information about the
hardware and setup of your Red Hat Enterprise Linux system.
The information is collected and an archive is packaged under
/tmp, which you can send to a support representative.
Red Hat Enterprise Linux will use this information for diagnostic purposes ONLY
and it will be considered confidential information.
This process may take a while to complete.
No changes will be made to your system.
Press ENTER to continue, or CTRL-C to quit.
Please enter your first initial and last name [RHEL-6]: rs
Please enter the case number that you are generating this report for [None]: 6565
Running plugins. Please wait ...
Completed [51/51] ...
Creating compressed archive...
Your sosreport has been generated and saved in:
/tmp/sosreport-rs.6565-20130517101218-255f.tar.xz
The md5sum is: fc67174ab37703f92999ee50a4fa255f
Please send this file to your support representative.
You have new mail in /var/spool/mail/root
Thanks!
Tuesday, May 7, 2013
Simple tip for cron and at :-)
May be funny but as today's enterprise environment is using more and more automated job schedulers and messaging solutions, cron and at got somewhat sidelined. And all of a sudden I had to schedule a cron job and laugh ha ha - I configured it but just was not seeing the output it took awhile to recollect from the memory - that the output is send by default to the user email.
So if you are testing the cronjob as user rajusa10. run the command mail and check the status of the cron or at job output. That is the default behaviour. You can always modify that redirecting the output via sendmail on SMTP port to the intended recipient.
in the below example:
[rajusa10@rhel-6 ~]$ crontab -l
* * * * * echo "Hi this is a test message"
I am broadcasting the message every minute. Lets test it by command mail
[rajusa10@rhel-6 ~]$ mail
Heirloom Mail version 12.4 7/29/08. Type ? for help.
"/var/spool/mail/rajusa10": 1 message 1 new
>N 1 Cron Daemon Tue May 7 13:24 21/770 "Cron echo "Hi this is a test message""
So if you are testing the cronjob as user rajusa10. run the command mail and check the status of the cron or at job output. That is the default behaviour. You can always modify that redirecting the output via sendmail on SMTP port to the intended recipient.
in the below example:
[rajusa10@rhel-6 ~]$ crontab -l
* * * * * echo "Hi this is a test message"
I am broadcasting the message every minute. Lets test it by command mail
[rajusa10@rhel-6 ~]$ mail
Heirloom Mail version 12.4 7/29/08. Type ? for help.
"/var/spool/mail/rajusa10": 1 message 1 new
>N 1 Cron Daemon Tue May 7 13:24 21/770 "Cron
Remove the cron job now or it will keep repeating the message every minute.
Lets test at command : which is used for one time job execution. Once you have entered the command enter and press Ctrl-D that will save the at job for execution depending on the time selected.
[rajusa10@rhel-6 ~]$ at 1:26pm
at> echo "Hello Raj"
at>
job 6 at 2013-05-07 13:26
The output:
Message 3:
From rajusa10@rhel-6.localdomain Tue May 7 13:26:01 2013
Return-Path:
X-Original-To: rajusa10
Delivered-To: rajusa10@rhel-6.localdomain
Subject: Output from your job 6
To: rajusa10@rhel-6.localdomain
Date: Tue, 7 May 2013 13:26:01 -0700 (PDT)
From: rajusa10@rhel-6.localdomain (Raj)
Status: R
Hello Raj
Some important tips:
1. no need to restart the crond daemon to apply the job updates. cron checks that for every minute by default.
2. No need to mention username while defining with crontab tool
Friday, April 19, 2013
Installing PHP on Linux (CentOS release 6.4 Final)
Mount the DVD go to the Packages directory and install the packages manually with rpm command.
You can do this task with yum too, for that you will have to setup YUM repository.
[root@cluster1 Packages]# rpm -ivh php-common-5.3.3-22.el6.x86_64.rpm
warning: php-common-5.3.3-22.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [100%]
1:php-common ########################################### [100%]
[root@cluster1 Packages]# rpm -ivh php-cli-5.3.3-22.el6.x86_64.rpm
warning: php-cli-5.3.3-22.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [100%]
1:php-cli ########################################### [100%]
[root@cluster1 Packages]# rpm -ivh php-5.3.3-22.el6.x86_64.rpm
warning: php-5.3.3-22.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [100%]
1:php ########################################### [100%]
[root@cluster1 Packages]# php -v
PHP 5.3.3 (cli) (built: Feb 22 2013 02:51:11)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
Thanks!
Thursday, April 11, 2013
Useful One liners.
Excellent example of appending the "/home/" in front of all the users name in a file
which has 3222 records.
%s/^/\/home\//g
----------------------------------------------
df -hl | awk '{ print $1 "; " "\t" $5}' | sort -n
------------------------------------------
AUTOENV=/opt/CA/WorkloadAutomationAE/autouser.PRD/autosys.sh.trs20
--------------------------------------------
Following command will create 1 GB File system
dd if=/dev/zero of=test.iso2 bs=1024 count=1000000
--------------------------------------------
Following command will count the file size in GB/MB i.e. in human readable form:
for i in `du -sh * |sort -n |cut -f2`; do du -sh $i; done
--------------------------------------------
# tar -xvf etc.tar -C test/ ---> Untar the tarball in test directory.
# tar -tvf etc.tar ---> To view the tarball contents without actually extracting.
--------------------------------------------
Use dd command to create an ISO image
# if=/dev/cdrom of=/datacdimg.iso
thats it!
--------------------------------------------
# cut -d: '' -f1 passwd ---> Will print first column
# cut -d: -f1,6 passwd ---> will extract user & home directory.
--------------------------------------------
awk:bash
awk -F':' '{print $1}' passwd ---> This will get the first column separated by : ex. passwd file.
How
to create shortcut: For DOS command on
the desktop
Note: Not a good idea for security conscious people!
Putty root@11.11.11.11 -pw %$#ytYGH77
Follow the screen shots:
1. right click the desktop ---> New ---> Shortcut
2. Type the command you want to create a shortcut:
3. Lets say you want to create a shortcut for putty command to login with saved passwd
4. Name the shortcut
5. You will see the shortcut on the desktop click it and login
Thats it!
Friday, April 5, 2013
VSFTPD server setup
How to set up vsftpd on RHEL 6
[root@cluster1 Packages]# rpm -ivh ftp-0.17-53.el6.x86_64.rpm
warning: ftp-0.17-53.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [100%]
1:ftp ########################################### [100%]
# rpm -ivh vsftpd-2.2.2-11.el6_3.1.x86_64.rpm
[root@cluster1 mnt]# service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]
edit /etc/vsftpd/vsftpd.conf
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES
# You may fully customise the login banner string:
ftpd_banner=Welcome to Rajftpd FTP service.
# Uncomment this to allow local users to log in.
local_enable=YES
C:\Users\raj>ftp 164.87.119.22
Connected to 144.77.109.90.
220 Welcome to Rajftpd FTP service.
User (144.77.109.90:(none)): joe
331 Please specify the password.
Password:
230 Login successful.
ftp> dir
200 PORT command successful. Consider us
150 Here comes the directory listing.
226 Directory send OK.
ftp> bye
221 Goodbye.
C:\Users\raj>ftp 164.87.119.22
Connected to 144.77.109.90.
220 Welcome to Rajftpd FTP service.
User (144.77.109.90:(none)): raj
331 Please specify the password.
Password:
230 Login successful.
Wednesday, February 27, 2013
Create a dummy file in Linux.
This is a one liner to create a dummy file in Linux/Unix for testing purpose:
dd if=/dev/zero of=dummyfile1.txt bs=1234567801 count=1
-rw-r--r-- 1 root root 1234567801 Feb 25 05:16 dummyfile1.txt
[root@RHEL5 ~]# du -sh dummyfile1.txt
1.2G dummyfile1.txt
dd if=/dev/zero of=dummyfile1.txt bs=1234567801 count=1
-rw-r--r-- 1 root root 1234567801 Feb 25 05:16 dummyfile1.txt
[root@RHEL5 ~]# du -sh dummyfile1.txt
1.2G dummyfile1.txt
Creating RAID 5 with LVM and testing the disk failure.
Create 4 disks of same size. scan the bus, run the fdisk -l command to view the newly created partitions
and follow the blog for the next steps.......
[root@RHEL5 ~]# echo "- - -" > /sys/class/scsi_host/host0/scan
[root@RHEL5 ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 382 3068383+ 83 Linux
/dev/sda2 383 1019 5116702+ 83 Linux
/dev/sda3 1020 1503 3887730 83 Linux
/dev/sda4 1504 2610 8891977+ 5 Extended
/dev/sda5 1504 1885 3068383+ 83 Linux
/dev/sda6 1886 2076 1534176 82 Linux swap / Solaris
/dev/sda7 2077 2203 1020096 83 Linux
/dev/sda8 2204 2241 305203+ 83 Linux
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
Disk /dev/sdd: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdd doesn't contain a valid partition table
[root@RHEL5 ~]#
------------------------------------------------------------
[root@RHEL5 ~]# mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sdb /dev/sdc /dev/sdd
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 64K
mdadm: size set to 1048512K
mdadm: array /dev/md0 started.
------------------------------------------------------------
[root@RHEL5 ~]# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Mon Feb 25 04:13:51 2013
Raid Level : raid5
Array Size : 2097024 (2048.22 MiB 2147.35 MB)
Device Size : 1048512 (1024.11 MiB 1073.68 MB)
Raid Devices : 3
Total Devices : 3
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Mon Feb 25 04:13:51 2013
State : clean, degraded, recovering
Active Devices : 2
Working Devices : 3
Failed Devices : 0
Spare Devices : 1
Layout : left-symmetric
Chunk Size : 64K
Rebuild Status : 83% complete
UUID : a1ed8a09:8b0a0913:c2f6d8b1:5c67dfeb
Events : 0.1
Number Major Minor RaidDevice State
0 8 16 0 active sync /dev/sdb
1 8 32 1 active sync /dev/sdc
3 8 48 2 spare rebuilding /dev/sdd
------------------------------------------------------------
[root@RHEL5 ~]# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Mon Feb 25 04:13:51 2013
Raid Level : raid5
Array Size : 2097024 (2048.22 MiB 2147.35 MB)
Device Size : 1048512 (1024.11 MiB 1073.68 MB)
Raid Devices : 3
Total Devices : 3
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Mon Feb 25 04:14:29 2013
State : clean
Active Devices : 3
Working Devices : 3
Failed Devices : 0
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 64K
UUID : a1ed8a09:8b0a0913:c2f6d8b1:5c67dfeb
Events : 0.2
Number Major Minor RaidDevice State
0 8 16 0 active sync /dev/sdb
1 8 32 1 active sync /dev/sdc
2 8 48 2 active sync /dev/sdd
------------------------------------------------------------
[root@RHEL5 ~]# pvcreate /dev/md0
Physical volume "/dev/md0" successfully created
[root@RHEL5 ~]# vgcreate lvm-raid /dev/md0
Volume group "lvm-raid" successfully created
------------------------------------------------------------
[root@RHEL5 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
lvm-raid 1 0 0 wz--n- 2.00G 2.00G
[root@RHEL5 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/md0 lvm-raid lvm2 a- 2.00G 2.00G
------------------------------------------------------------
Free PE / Size 511 / 2.00 GB
[root@RHEL5 ~]# lvcreate -L 511 lvm-raid -n lvm0
/dev/cdrom: open failed: Read-only file system
Rounding up size to full physical extent 512.00 MB
Logical volume "lvm0" created
------------------------------------------------------------
[root@RHEL5 /]# mke2fs -j /dev/lvm-raid/lvm0
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
131072 inodes, 524288 blocks
26214 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67633152
64 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
------------------------------------------------------------
[root@RHEL5 /]# mount /dev/lvm-raid/lvm0 /data/
[root@RHEL5 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 2.9G 262M 2.5G 10% /
tmpfs 506M 0 506M 0% /dev/shm
/dev/sda8 289M 11M 264M 4% /home
/dev/sda2 4.8G 138M 4.4G 4% /opt
/dev/sda7 965M 18M 898M 2% /tmp
/dev/sda5 2.9G 2.2G 531M 81% /usr
/dev/sda3 3.6G 124M 3.3G 4% /var
/dev/mapper/lvm--raid-lvm0
496M 19M 452M 4% /data
------------------------------------------------------------
Take the /dev/sdb out of the raid array.
[root@RHEL5 /]# mdadm /dev/md0 -f /dev/sdb
mdadm: set /dev/sdb faulty in /dev/md0
[root@RHEL5 /]# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Mon Feb 25 04:13:51 2013
Raid Level : raid5
Array Size : 2097024 (2048.22 MiB 2147.35 MB)
Device Size : 1048512 (1024.11 MiB 1073.68 MB)
Raid Devices : 3
Total Devices : 3
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Mon Feb 25 04:35:37 2013
State : clean, degraded
Active Devices : 2
Working Devices : 2
Failed Devices : 1
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 64K
UUID : a1ed8a09:8b0a0913:c2f6d8b1:5c67dfeb
Events : 0.4
Number Major Minor RaidDevice State
0 0 0 0 removed
1 8 32 1 active sync /dev/sdc
2 8 48 2 active sync /dev/sdd
3 8 16 - faulty spare /dev/sdb
--------------------------------------------------------------
[root@RHEL5 /]# echo "- - -" > /sys/class/scsi_host/host0/scan
[root@RHEL5 /]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 382 3068383+ 83 Linux
/dev/sda2 383 1019 5116702+ 83 Linux
/dev/sda3 1020 1503 3887730 83 Linux
/dev/sda4 1504 2610 8891977+ 5 Extended
/dev/sda5 1504 1885 3068383+ 83 Linux
/dev/sda6 1886 2076 1534176 82 Linux swap / Solaris
/dev/sda7 2077 2203 1020096 83 Linux
/dev/sda8 2204 2241 305203+ 83 Linux
Disk /dev/md0: 2147 MB, 2147352576 bytes
2 heads, 4 sectors/track, 524256 cylinders
Units = cylinders of 8 * 512 = 4096 bytes
Disk /dev/md0 doesn't contain a valid partition table
Disk /dev/sdb: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
Disk /dev/sdc: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn't contain a valid partition table
Disk /dev/sdd: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdd doesn't contain a valid partition table
Disk /dev/sde: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sde doesn't contain a valid partition table
Noe lets add the newly created device in the array.
--------------------------------------------------------------
[root@RHEL5 /]# mdadm /dev/md0 -a /dev/sde
mdadm: added /dev/sde
See the output the device is seen:
[root@RHEL5 /]# mdadm --detail /dev/md0
/dev/md0:
Version : 00.90.03
Creation Time : Mon Feb 25 04:13:51 2013
Raid Level : raid5
Array Size : 2097024 (2048.22 MiB 2147.35 MB)
Device Size : 1048512 (1024.11 MiB 1073.68 MB)
Raid Devices : 3
Total Devices : 4
Preferred Minor : 0
Persistence : Superblock is persistent
Update Time : Mon Feb 25 04:41:01 2013
State : clean
Active Devices : 3
Working Devices : 3
Failed Devices : 1
Spare Devices : 0
Layout : left-symmetric
Chunk Size : 64K
UUID : a1ed8a09:8b0a0913:c2f6d8b1:5c67dfeb
Events : 0.6
Number Major Minor RaidDevice State
0 8 64 0 active sync /dev/sde
1 8 32 1 active sync /dev/sdc
2 8 48 2 active sync /dev/sdd
3 8 16 - faulty spare /dev/sdb
--------------------------------------------------------------
Thanks.
Subscribe to:
Posts (Atom)