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.