Skip to content


Download all files of certain extension from website using wget

Issue this command in a terminal to download all mp3s linked to on a page using wget

wget -r -l1 -H -t1 -nd -N -np -A.mp3 -erobots=off [url of website]

OR if you want to download all linked mp3s from multiple pages then make a text file containing each url on a separate line, then issue:


wget -r -l1 -H -t1 -nd -N -np -A.mp3 -erobots=off -i ~/mp3blogs.txt

If the site is behind basic http authentication you can use something like:


wget --http-user [username] --http-passwd [passwd] -r 

Posted in Linux.


Linux Tricks and Useful Commands

pwd -P # Print path to the dir you are in, converting any symlinks in the path into their real/(P)hysical directory name.
grep -ril inactive /etc # Show matching files(-l) with the string “inactive” regardless of case(-i) in all subdirs of /etc (-r)

for i in {0..365};do date -d “Jan 1 2012 + $i day” +”*%B %_d – “; done # Generate days of the year list with some formatting. Req. GNU date

sox song.wav -t wav – pitch 1200 | play - # Play a song an octave higher without saving an intermediary file. 1200 cents == 1 octave

ascii || man ascii # Quick access to the ASCII character table either through the ascii program or the man page if you don’t have the prog.

ionice -c 3 cp vm1.img vm1-clone.img # Copy a file using “ionice -c 3″ to give it idle IO priority to reduce load on the system.

mv somedata{,-20120720} # This is the same as mv somedata somedata-20120720 but is shorter. You don’t have to type somedata twice.

foremost # Foremost is a file recovery program that can extract files from disk images and more. http://bit.ly/MOyr30

http://bit.ly/LuT0Bq # GNU ddrescue is a good tool for copying/recovering disk images.

dd if=/dev/sdc of=sdc.img bs=100M conv=sync,noerror # Image a disk, sync,noerror will continue on read errors and pad missing parts.
kill -USR1 $( pidof dd ) # Tell each dd process to print its current status (blocks written, etc). dd interprets the USR1 signal this way.

ls -d */ # View only the directories in the current directory. The / at the end of the wildcard makes this work.

convert -rotate -90 sideways.jpg rightsideup.jpg # Rotate an image 90 degrees counterclockwise. The convert command is from ImageMagick

gzip -l largefile.gz # A fast way to get the size of the uncompressed gzip file. However the uncompressed value can’t be more than 4GB.

montage -geometry 800×600+4+4 pic1.jpg pic2.jpg pic3.jpg pic4.jpg -tile x2 combined.jpg # Make 2×2 800×600 montage with 4 px border.

echo “1-800-SHOWNUM” | tr A-Z a-z | tr ‘a-z’ ’22233344455566677778889999′ # Looks like a command that we could make shorter

[Ctrl-w] # Remove the previous word on the command line (before the cursor). This is highly useful when reusing old commands.

[Ctrl-l] # This is usually equivilent to running ‘clear’. Its usually quicker and doesn’t leave the command in your command line history.

[Ctrl-e] # Move your cursor to the end of the line. Faster than holding down right arrow

[Ctrl-a] # Move your cursor to the beginning of the line. Faster than holding down left arrow. In screen, you need to press

[Ctrl-r]string # Reverse search through your command history for ‘string’. Press Ctrl-r again to continue searching backwards. ESC when done

cd # Takes you back to your home directory.

cd - # Takes you back to the previous directory you were in. Good to know if you don’t already.

for d in /dev/sd? ; do sudo smartctl -H $d ; done # How are your drives doing? may need apt-get install smartmontools Thx

find dir1 dir2 dir3 | wc -l # Count the number of files in multiple directories.

echo “kernel.panic = 20″ | sudo tee -a /etc/sysctl.conf # so your headless Linux system reboots after a kernel panic (20 sec) Thx

getent services 993 # Look up in your services table to see what port 993 is. Can also look up by service name to get port.

ls -1 | tr A-Z a-z # List files and print them all in lowercase so you can copy and paste and compare with another list that got fatty.

getent passwd|while IFS=: read -r user n uid n n home n;do if [[ $uid -ge 500 ]];then printf “$user “;du -sh $home;fi;done # space per user

sleep 8h 30m 20 # In the GNU version of sleep you provide mixed time intervals to stack them together instead of just seconds.

sed -n ’1,10p’ # Probably your best option is to put something like this into a script called headnoclose.sh or whatever

ls -ltrah | sponge | pee head tail # This also works. sponge also comes with moreutils and kinda fits with the naming there.

ls -ltrah | pee “sed -n ’1,10p’” tail # Sorry, the last command suffers from head closing the input prematurely. So try this instead.

http://bit.ly/LzYDiY # iodine is a client and server that allow you to tunnel IP traffic over DNS, bypassing many firewalls, etc.

alias dnsip=’dig http://myip.opendns.com @resolver1.opendns.com +short’ # even gets your public ip behind pay hotspots.
df . # This is an easy way to find out what partition the current directory is on, regardless of symlinks.

curl “http://twitter.com/status/user_timeline/climagic.json” |python -mjson.tool |grep ‘”text”:’ # Reformat JSON data and get latest updates
identify -format “%f F:%[EXIF:Flash]\n” *.jpg | egrep ” F:(0|16|24|32)$” # Show photo filenames where no flash was used.

identify -format “%f F:%[EXIF:Flash]\n” *.jpg | egrep ” F:(0|16|24|32)$” # Show photo filenames where no flash was used.
/usr/lib/xscreensaver/skyrocket # More fireworks! GUI output, but many CLI options. You need the rss-glx screensavers package.

date -d “$(grep finish /proc/mdstat |sed -e ‘s/^.*finish=//;s/ .*$//;s/\..*$//’)min” # Figure out when your md-raid will finish.

todo(){ cd ~/.todo||return 1&& l=$(ls -1t|head -n1)&&t=$(date +%Y%m%d);[[ "$1" == "last" ]]&&cp $l $t; ${EDITOR:-vi} $t;cd -;} # Todo list.

ls -l |sed ‘s/^/ /’ # Ever have one of those situations in console mode where you can’t read the first characters? This intents the output.

fsck -y /dev/sda1 || echo “You’re fscked!” | mail -s alert admin@x.com # Use || when you want to run a command only if the first one failed

service network start && service httpd start # Use && when you want to run a command after another only if the first one is successful

sleep 30m ; killall tcpdump # Use a ; in a statement if you want to run a command after another, but don’t care about the exit status of 1st
ssh-copy-id ‘user@remotehost’ # Automatically installs your public key to the remote host (this actually is included in the openssh package)

xargs -n1 -0 < /proc/$(pidof firefox| cut -d’ ‘ -f1)/environ # Print the environment of a running process (ie. firefox) awk ‘{if (a[$1]) { print; } else { a[$1]=1 }}’ md5sums.txt # And here is a way to print only duplicates using just awk. sort md5sums.txt | uniq -d -w 32 # Print only duplicate md5sums by looking only at first 32 chars for uniqueness. head -5 file1 |cat – file2 >combofile # One way of putting the first 5 lines of file1 before the contents of file2 and writing to combofile

last |awk ‘BEGIN {f=0;u=”YOURUSER”;} {if ($1==u && f==0){f=1; print $0;}else if(f==1 && $1!=u) {print $0;exit;}}’ # Display prev. user b4 u

grep -B2 Subj: maildrop.log | grep -v ^From: | grep -v ^– | xargs -d$’\n’ -n 2 # Join the Date and Subj line together in procmail log.

find . -type f | egrep -o “[^\.]+$” | tr A-Z a-z | sort | uniq -c # Show a count of all the file extensions in use below current directory.

awk ‘{a[$1] += $10} END {for (h in a) print h ” ” a[h]}’ access_log | sort -k 2 -nr | head -10 # Display top bandwidth hogs on website.

curl -s ‘blenderartists.org/forum/forumdis…’ |grep -q ‘#500′ && echo “500 ready”|mail -s 500 you # site watcher
-
- ssh-keygen -R servername # Remove the host key for ‘servername’ from your known_hosts file. This is now the proper way to do it.

Next I’ll be showing 4+ different ways of doing the same thing, printing out the partition table entries for use in snmpd.conf.

df -TP | grep -E ” ext[34] ” | awk {‘print $NF’} | sed ‘s/.*/disk & 5%/’ # Print out the partition table and format it for snmpd.conf

df -TP | awk ‘$2=/ext[34]/ {print “disk ” $NF ” 5%”}’ # snmpd disk entries, same thing but let awk do most of the processing work.

df -P -t ext3 -t ext4 | grep / | awk ‘{print “disk ” $NF ” 5%”}’ # snmpd disk entries, Let df select the filesystems directly.

ethtool -p eth0 # Blink eth0′s LED so you can find it in the rat’s next of server cables. Ctrl-C to stop. Thanks

ls / fake 2>&1 > /dev/null | grep “cannot” # Redirect stdout to /dev/null, and make stderr go through the pipe.

df -TP | grep -E ” ext[34] ” | rev | cut -d’ ‘ -f1 | rev | while read -r fs ; do echo “disk $fs 5%” ; done # Disk entries. The Crazy Way!

ps aux | awk ‘/firefox/ {sum += $6} END { printf “%dMB\n”, sum/1024 }’ # Show the total memory used by Firefox processes (Probably a lot)

Tip ~ To test Internet connection speed from console over SSH command line:
## Download speed
lftp -e ‘pget http://example.com/file.iso; exit; ‘

## Upload speed
lftp -u userName ftp.example.com -e ‘put largecd1.avi; bye’

## Get network throughput rate between two Linux or Unix servers:
iperf -s -B serverIP
iperf -c serverIP -d -t 60 -i 10

See for more info – http://www.cyberciti.biz/faq/linux-unix-test-internet-connection-download-upload-speed/

* More tips and howtos from our /faq/ section *
Debian / Ubuntu: Console Based Network Load Monitor http://www.cyberciti.biz/faq/slurm-debian-ubuntu-linux-network-load-monitor/ or see a quick video demo – http://youtu.be/milkEwy-8yg

Debian / Ubuntu Python: Set Planet Venus To Combine Two Or More RSS Feeds http://www.cyberciti.biz/faq/combine-rss-feed-to-create-an-aggregate-using-planet-venus/

OpenBSD: Boot / Install Using PXE (Preboot Execution Environment) http://www.cyberciti.biz/faq/openbsd-boot-install-using-pxe-preboot-execution-environment/

HowTo: Bash Extract Filename And Extension In Unix / Linux http://www.cyberciti.biz/faq/unix-linux-extract-filename-and-extension-in-bash/

HowTo: Bash Shell Split String Into Array http://www.cyberciti.biz/faq/unix-linux-bash-split-string-into-array/

Sed: Find and Replace The Whole Line [ Regex ] http://www.cyberciti.biz/faq/unix-linux-sed-match-replace-the-entire-line-command/

Bash Script: Find Out In What Directory Script Is Stored Under Unix Or Linux http://www.cyberciti.biz/faq/unix-linux-appleosx-bsd-bash-script-find-what-directory-itsstoredin/

find . -newerBt “24 hours ago” # Find files created in the last 24 hours. Note: This won’t work on all filesystems.

Posted in Linux.


Important Linux Commands

To get the list of username with its user ID in formatted way:-

awk -F":" '{ print "username: " $1 "\t\tuid:" $3 }' /etc/passwd

Find the particular string from the list of files in current directory:-

cd /etc
for i in $(find -type f); do grep -iH nfsnobody $i; done
Or
grep -iH nfsnobody *

Get the number of occurrences of particular word in file:-

awk '/ServerName/ {i=i+1} END {print i}' /etc/httpd/conf/httpd.conf
grep ServerName /etc/httpd/conf/httpd.conf

To delete resources of semaphore arrays from memory:-

ipcs -s | grep apache | perl -e 'while () { @a=split(/\s+/); print`ipcrm sem $a[1]`}'

To get the list of IP addresses in the server:-

ifconfig | grep -vw inet6 | grep -w inet | cut -d : -f 2 | cut -d \ -f 1

Find list of IP address along with eth device and network mask:-

ifconfig | cut -d " " -f1,12,16 | grep -A 1 eth | tr -d - | tr -s "\n" |sed -e :a -e N -e 's/\n/ /'

Change the device address as per your servers configuration:-

hdparm -Tt /dev/sda

To get the listing of directories:-

ls -F $1 | grep \/ | sed -e 's/\/$/4/g'

To Get Real Time Network Activity Examples:-

watch -d "netstat -nalp |grep -v DGRAM |grep -v STREAM |grep -v LISTEN"
watch "netstat -nalp"|grep ":TCP PORT Number"
watch "netstat -nalp"|grep ":22"

The details of the present http connections can be found by using:-

netstat -plan | grep ":80 " | awk {'print $5'} |awk -F: {'print $1'}|sort
cat /proc/net/ip_conntrack | grep "port=80" | wc -l

Number of connection from perticular IP address:-

netstat -ntu | awk '{print $5}'| cut -d: -f1 | sort | uniq -c | sort -nr | more

Posted in Linux.


Solaris Jumpstart Server

Solaris JumpStart installation is method of network installation of Solaris OS. Below the steps that we need to follow:

  • Configure the JumpStart Installation Server
  • Create the Client profile files
  • Share the Installation directory and Configuration files
  • Create the client boot files using tftpboot
  • Configure the DHCP server with TFTPBOOT files

Final Silent Installation

First of all let me give you the details about our setup. We have one jumpstart server and two clients. IP and hostname details are given below:

Jumstart_Boot_Server:

IP address: 192.168.101.31

Mac ID: 00:0c:29:42:ed:ff

Client 1:

IP address: 192.168.101.32

Mac ID: 01:00:50:56:11:1A:BB

Client 2:

IP address: 192.168.101.33

Mac ID: 01:00:50:56:11:1A:CC

1. JumpStart installation server:

First of all download the DVD or ISO file of solaris-10u9. If you have downloaded the ISO file then you have to mount it localy using the below commands.

 

# lofiadm sol-10-u9-ga1-sparc-dvd.iso /dev/lofi/1
# mount -o ro -F hsfs /dev/lofi/1 /mnt

Now create an installation directory on the server:

# mkdir -p /export/install

Put the Solaris 10 OS for x86/x64 platforms DVD in the DVD player on the server. Create the installation server by going to the Solaris_10/Tools directory on the DVD and running the setup_install_server command. The Solaris software is copied to the newly created directory. Specify the absolute path name as the argument.

# cd /cdrom/cdrom0/Solaris_10/Tools
  # ./setup_install_server /export/install
  Verifying target directory...
  Calculating the required disk space for the Solaris_10 product
  \|/-\|/-
  Calculating space required for the installation boot image
  \|/-\|/-
  Copying the CD image to disk...
  \|/-\|/-
  Copying Install Boot Image hierarchy...
  \|/-\|/-
  Copying /boot x86 netboot hierarchy...
  \|/-\|/-
  Install Server setup complete

2. Create the Client Configuration Files:
Create a configuration directory where the files will reside:

# mkdir /export/config

Create the sysidcfg file:
Note: Each client can have its own sysidcfg file, or multiple clients can use the same sysidcfg file.
Below are the two Sysidcfg files that I have created for Jumpstart_Client1 and Jumpstart_Client2

# cd /export/config
# mkdir sysidcfg1
# cd sysidcfg1
# vi sysidcfg
keyboard=US-English
system_locale=en_US.ISO8859-1
timezone=US/Pacific
timeserver=localhost
terminal=xterms
service_profile=open
name_service=NONE
security_policy=NONE
root_password=Ax1sT8ZVkPzaM
auto_reg=disable
network_interface=e1000g0 {primary
                          hostname=client1
		  netmask=255.255.255.0
                          protocol_ipv6=no
                          default_route=192.168.101.1}
nfs4_domain=dynamic
:wq
# cd ../
# mkdir sysidcfg2
# cd sysidcfg2
# vi sysidcfg


keyboard=US-English
system_locale=en_US.ISO8859-1
timezone=US/Pacific
timeserver=localhost
terminal=xterms
service_profile=open
name_service=NONE
security_policy=NONE
root_password=Ax1sT8ZVkPzaM
auto_reg=disable
network_interface=e1000g0 {primary
                                      hostname=client2
   netmask=255.255.255.0
   protocol_ipv6=no
                          default_route=192.168.101.1}
nfs4_domain=dynamic

:wq

Create the rules file:

# cd /export/config
  # vi rules

  hostname client1 begin1 profile1 finish1
  hostname client2 begin2 profile2 finish2

  :wq

Create the begin file:

# cd /export/config
  # vi begin1

  #!/bin/sh
  echo "Begin Script for JumpStart client1..."

  :wq

  # vi begin2

  #!/bin/sh
  echo "Begin Script for JumpStart client2..."

  :wq

# chmod 755 begin*

Create the finish file:

# cd /export/config
  # vi finish1

  #!/bin/sh
  echo "Finish Script for JumpStart client1..."
  echo "Get rid of the nfs prompt during the initial boot"
  touch /a/etc/.NFS4inst_state.domain

  :wq

  # vi finish2

  #!/bin/sh
  echo "Finish Script for JumpStart client2..."
  echo "Get rid of the nfs prompt during the initial boot"
  touch /a/etc/.NFS4inst_state.domain

  :wq

  # chmod 755 finish*

Create the profile file:

# cd /export/config
  # vi profile1

  # install_type MUST be first
  install_type      initial_install

  # start with the minimal required number of packages
  cluster           SUNWCXall
  cluster           SUNWCapache delete
  cluster           SUNWCpcmc   delete
  cluster           SUNWCpcmcx  delete
  cluster           SUNWCthai   delete
  cluster           SUNWClp     delete
  cluster           SUNWCnis    delete
  cluster           SUNWCppp    delete

  # format the entire disk for Solaris
  fdisk   all   solaris all

  # define how the disk is partitioned
  partitioning      explicit
  filesys           rootdisk.s0 6144  /
  filesys           rootdisk.s1 1024  swap
  filesys           rootdisk.s7 free  /state/partition1

  # install systems as standalone
  system_type standalone

##### Below are the configuration for Patches and Packages installation
# specify patches to install
patch 119281-06 nfs 192.168.101.31:/export/patches

# specify packages to install
package SPROcc add nfs 192.168.101.31:/export/packages


  :wq

# vi profile2

  # install_type MUST be first
  install_type      initial_install

  # start with the minimal required number of packages
  cluster           SUNWCXall
  cluster           SUNWCapache delete
  cluster           SUNWCpcmc   delete
  cluster           SUNWCpcmcx  delete
  cluster           SUNWCthai   delete
  cluster           SUNWClp     delete
  cluster           SUNWCnis    delete
  cluster           SUNWCppp    delete

  # format the entire disk for Solaris
  fdisk   all   solaris all

  # define how the disk is partitioned
  partitioning      explicit
  filesys           rootdisk.s0 6144  /
  filesys           rootdisk.s1 4096  swap
  filesys           rootdisk.s7 free  /state/partition1

  # install systems as standalone
  system_type standalone

##### Below are the configuration for Patches and Packages installation
# specify patches to install

patch 119281-06 nfs 192.168.101.31:/export/patches

# specify packages to install

package SPROcc add nfs 192.168.101.31:/export/packages
  :wq

Create the check script:
The check script is used to validate that the rules and profile files are correctly set up. First copy the check script to the local directory, that is, /export/config, as shown:

 # cd /export/config
  # cp /export/install/Solaris_10/Misc/jumpstart_sample/check .
Run the check script:
  # ./check
  Validating rules...
  Validating profile profile1...
  Validating profile profile2...
  The custom JumpStart configuration is ok.

3. Share the Installation and Configuration Directories

Modify dfstab to share the JumpStart directories.
Edit the /etc/dfs/dfstab file:

# vi /etc/dfs/dfstab

  #       Place share(1M) commands here for automatic execution
  #       on entering init state 3.
  #
  #       Issue the command 'svcadm enable network/nfs/server' to
  #       run the NFS daemon processes and the share commands, after
  #       adding the very first entry to this file.
  #
  #       share [-F fstype] [ -o options] [-d ""] 
  #       [resource]
  #       for example,
  #       share  -F nfs  -o rw=engineering  -d "home dirs"  /export/home2

  share -F nfs -o ro,anon=0 /export/install
  share -F nfs -o ro,anon=0 /export/config
  share -F nfs -o ro,anon=0 /export/patches  ## Share the patches folder on Boot server
  share -F nfs -o ro,anon=0 /export/packages ## Share the Packages Folder on boot Server

  :wq

Start the NFS server:
  # /etc/init.d/nfs.server start
Share the directories:
  # shareall
  # share
       -       /export/install   ro,anon=0   ""
/export/config   ro,anon=0   ""
/export/patches   ro,anon=0   ""
/export/packages   ro,anon=0   ""
  
Verify file sharing.
  # showmount -e localhost
  export list for localhost:
  /export/install  (everyone)
  /export/config   (everyone)
  /export/patches   (everyone)
  /export/packages   (everyone)

4. Create the Client tftpboot Files
Run the add_install_client script for each client.
Go to the location of the add_install_client script:

  # cd /export/install/Solaris_10/Tools

Run the add_install_client script for each client on the network that performs a JumpStart installation.

# ./add_install_client \
      -d \
      -e 00:01:00:50:56:11:1A:BB \
      -s 192.168.101.31:/export/install \
      -c 192.168.101.31:/export/config \
      -p 192.168.101.31:/export/config/sysidcfg1 i86pc

  enabling tftp in /etc/inetd.conf
  Converting /etc/inetd.conf
  enabling network/tftp/udp6 service
  copying boot file to /tftpboot/pxegrub.I86PC.Solaris_10-1

  If not already configured, enable PXE boot by creating
  a macro named 01005056111ABB with:
    Boot server IP (BootSrvA) : 192.168.101.31
    Boot file      (BootFile) : 01005056111ABB


# ./add_install_client \
      -d \
      -e 00:01:00:50:56:11:1A:CC \
      -s 192.168.101.31:/export/install \
      -c 192.168.101.31:/export/config \
      -p 192.168.101.31:/export/config/sysidcfg1 i86pc

  enabling tftp in /etc/inetd.conf
  Converting /etc/inetd.conf
  enabling network/tftp/udp6 service
  copying boot file to /tftpboot/pxegrub.I86PC.Solaris_10-1

  If not already configured, enable PXE boot by creating
  a macro named 01005056111ACC with:
    Boot server IP (BootSrvA) : 192.168.101.31
    Boot file      (BootFile) : 01005056111ACC

5. Configure and Run the DHCP Server

Run dhcpmgr:
  # /usr/sadm/admin/bin/dhcpmgr
  Java Accessibility Bridge for GNOME loaded.

NOTE: Its pretty straight forward from the GUI. But just make sure that you configured the tftpboot files as well for your clients.

6. Final Silent Installation

With the above setup you still need human intervention at two places in Solaris installation.
1. First is at Installation type selection where it shows you the 6 option menu like 1 for interactive installation,2 for jumpstart etc..
2. Second you need to fill the registration details manually. Registration page is been included in recent releases of the Solaris OS.

Actually both are because of the bug in Jumpstart installation. Though first one have the solution to tweak the kernel parameters in menu.lst.macid file under /tftpboot/ directory. You need to add
– install dhcp parameter to kernel line.

Default  menu.lst.macid file would be:

default=0
timeout=30
title Solaris_10 Jumpstart
    kernel /I86PC.Solaris_10-1/multiboot kernel/unix -B \
install_config=172.16.64.194:/export/config, \
sysid_config=172.16.64.194:/export/config/sysidcfg1, \
install_media=172.16.64.194:/export/install, \
install_boot=172.16.64.194:/export/install/boot
    module /I86PC.Solaris_10-1/x86.miniroot

You have to change it to

default=0
timeout=0
title Solaris_10 Jumpstart
    kernel /I86PC.Solaris_10-1/multiboot kernel/unix - install dhcp -B \
install_config=172.16.64.194:/export/config, \
sysid_config=172.16.64.194:/export/config/sysidcfg1, \
install_media=172.16.64.194:/export/install, \
install_boot=172.16.64.194:/export/install/boot
    module /I86PC.Solaris_10-1/x86.miniroot

Though I have modified the timeout value as well. I have set it to 0 which will not show you the OS selection page. By default it was 30 sec.

Now boot the clients via network card you are good to go.
NOTE: If you have need any alteration or modification or you think it needs some brief then please let me know.

Posted in UNIX.


Yum local repository

1.Copy Red Hat Enterprise Linux 5 DVD ISO RHEL5-Client-20070208.0-i386-DVD.iso from Red Hat Network and create a local repository on the local Repository server.

#mkdir -p /var/www/html/cdrom/iso
       #mount -o loop /RHEL5-Client-20070208.0-i386-DVD.iso
       /var/www/html/cdrom/iso
       #cd /var/www/html/cdrom
       #createrepo .
       #yum clean all

Created a file /etc/yum.repos.d/file.repo as follows:

#cat /etc/yum.repos.d/file.repo
       [RHEL 5 Repository]
       baseurl=file:///cdrom
       enabled=1

2. Share with httpd:

# vi /etc/httpd/conf/httpd.conf
       ServerAdmin root@10.65.6.141
       DocumentRoot /var/www/html
       ServerName 10.65.6.141

NOTE: Where 10.65.6.141 is the local Repository server

 # httpd -t
 # service httpd start

3. Client side configuration:

vi /etc/yum.repos.d/my.repo
       ----
       [RH51-Server]
       name= RHEL 5.1 Server Repository
       baseurl=http://10.65.6.141/cdrom
       enabled=1
       ----

4. Verify from client:

# yum list
       Loading "installonlyn" plugin
       Setting up repositories
       Reading repository metadata in from local files
       Available Packages
       Deployment_Guide-as-IN.noarch 5.0.0-19
       RH51-Server Deployment_Guide-bn-IN.noarch
       5.0.0-19 RH51-Server
       Deployment_Guide-de-DE.noarch 5.0.0-19
       RH51-Server Deployment_Guide-en-US.noarch
       5.0.0-19 RH51-Server
       Deployment_Guide-es-ES.noarch 5.0.0-19
       RH51-Server Deployment_Guide-fr-FR.noarch
       5.0.0-19 RH51-Server ========
       OR
       # yum update

Posted in Linux, Open Source.


LAMP Optimization Tips

Below are couple of good points about LAMP optimization. I have figured that out after doing some googling and reading some PDF..

Disable unwanted Apache Modules:

  • Disable all the apache modules like perl,python,proxy etc except php,mysql which are required for your application.
  • Enable only mod_php and mod_rewrite
  • Disable everything else (java, python)

Tune MaxClients

  • Too low: you can’t serve a traffic spike
  • Too high: your memory cannot keep up with the load, and you start swapping (server dies!)

KeepAlive

  • 5 to 10 seconds
  • More than that, it ties up procesess

AllowOverrides

  • You can set to None and move Drupal’s .htaccess contents to vhosts
  • Less filesystem accesses
  • mod_gzip/mod_deflate

Compromise of CPU usage vs. Bandwidth usage

  • nginx
  • use Nginx if possible, its very fast and stable.

Mysql

  • USE MyISAM Engine wherever is possible – Its has good read speed

Query cache

  • Probably the most important thing to tune
  • Table cache
  • Also important Key buffer

PHP

  • Use a recent version
  • Install an Op­code cache / Accelerator
  • eAccelerator
  • APC
  • Xcache
  • Zend (commerical)

Op­code cache Benefits

  • Dramatic speed up of applications, specially complex ones like Drupal
  • Significant decrease in CPU utilization
  • Considerable decrease in memory utilization
  • The biggest impact on a busy site
  • Drawbacks:
  • May crash often
  • Use logwatcher to auto restart Apache

Note: eAccelerator uses the least memory and provides the most speed

Hope above point helps you in understanding what is important for your environment.

Posted in Linux.


Install and Configure Bandwidthd – IP Bandwidth Monitor

It is important to know traffic usage of your client if you’re a Linux network administrator.

You can monitor your client in text mode, graphic mode or html exported like mrtg, cacti

but bandwidthd is very good bandwidth monitoring tool…………..

You don’t need any database or snmp connection to monitor all of your client on bandwidthd,

all you need just libcap, libpng, libgd and apache installed on your Linux system. And other

good news is bandwidthd monitor all of your connected client per IP and per connection protocol.

Link to the download area on SourceForge: Download BandwidthD

[root@Ryan]# tar xvfz bandwidthd-2.0.1.tgz

[root@Ryan]# cd bandwidthd

Configure and install the Bandwidthd source:

[root@Ryan]# ./configure && make install

Please make sure you have:
libpcap from http://www.tcpdump.org/
libpng from http://www.libpng.org/
libgd from http://www.boutell.com/gd/

Or

# yum install libbap Or # apt-get install libcap

# yum install libpng Or # apt-get install libpng

# yum install apache Or # apt-get install apache2

Edit /usr/local/bandwidthd/etc/bandwidthd.conf

to suit your network environment. …..
Save your config and start bandwidthd using /usr/local/bandwidthd/bandwidthd.

Point your Apache Virtual Host to

/usr/local/bandwidthd/htdocs for browse
the bandwidthd graph

Alias /bandwidthd “/usr/local/bandwidthd/htdocs”

Order Allow,Deny
Allow from All

Save your work and restart apache. Next open your browser and point to http://yourserverip/bandwidth.

Posted in Linux.


Ten Qualities of an Effective Team Player

If you were choosing team members for a business team in your organization, who would the best team players be? Assuming that people have the right technical skills for the work to be done, what other factors would you use to select your team members?
Teams need strong team players to perform well. But what defines such people? Read on. (Also, check out How to Hire the Best Brains for the Best Team for some tips on putting a team together.)
Demonstrates reliability
You can count on a reliable team member who gets work done and does his fair share to work hard and meet commitments. He or she follows through on assignments. Consistency is key. You can count on him or her to deliver good performance all the time, not just some of the time.
Communicates constructively
Teams need people who speak up and express their thoughts and ideas clearly, directly, honestly, and with respect for others and for the work of the team. That’s what it means to communicate constructively. Such a team member does not shy away from making a point but makes it in the best way possible — in a positive, confident, and respectful manner.
Listens actively
Good listeners are essential for teams to function effectively. Teams need team players who can absorb, understand, and consider ideas and points of view from other people without debating and arguing every point. Such a team member also can receive criticism without reacting defensively. Most important, for effective communication and problem solving, team members need the discipline to listen first and speak second so that meaningful dialogue results.
Functions as an active participant
Good team players are active participants. They come prepared for team meetings and listen and speak up in discussions. They’re fully engaged in the work of the team and do not sit passively on the sidelines.
Team members who function as active participants take the initiative to help make things happen, and they volunteer for assignments. Their whole approach is can-do: “What contribution can I make to help the team achieve success?”
Shares openly and willingly
Good team players share. They’re willing to share information, knowledge, and experience. They take the initiative to keep other team members informed.
Much of the communication within teams takes place informally. Beyond discussion at organized meetings, team members need to feel comfortable talking with one another and passing along important news and information day-to-day. Good team players are active in this informal sharing. They keep other team members in the loop with information and expertise that helps get the job done and prevents surprises.
Cooperates and pitches in to help
Cooperation is the act of working with others and acting together to accomplish a job. Effective team players work this way by second nature. Good team players, despite differences they may have with other team members concerning style and perspective, figure out ways to work together to solve problems and get work done. They respond to requests for assistance and take the initiative to offer help.
Exhibits flexibility
Teams often deal with changing conditions — and often create changes themselves. Good team players roll with the punches; they adapt to ever-changing situations. They don’t complain or get stressed out because something new is being tried or some new direction is being set.
In addition, a flexible team member can consider different points of views and compromise when needed. He or she doesn’t hold rigidly to a point of view and argue it to death, especially when the team needs to move forward to make a decision or get something done. Strong team players are firm in their thoughts yet open to what others have to offer — flexibility at its best.
Shows commitment to the team
Strong team players care about their work, the team, and the team’s work. They show up every day with this care and commitment up front. They want to give a good effort, and they want other team members to do the same.
Works as a problem-solver
Teams, of course, deal with problems. Sometimes, it appears, that’s the whole reason why a team is created — to address problems. Good team players are willing to deal with all kinds of problems in a solutions-oriented manner. They’re problem-solvers, not problem-dwellers, problem-blamers, or problem-avoiders. They don’t simply rehash a problem the way problem-dwellers do. They don’t look for others to fault, as the blamers do. And they don’t put off dealing with issues, the way avoiders do.
Team players get problems out in the open for discussion and then collaborate with others to find solutions and form action plans.
Treats others in a respectful and supportive manner
Team players treat fellow team members with courtesy and consideration — not just some of the time but consistently. In addition, they show understanding and the appropriate support of other team members to help get the job done. They don’t place conditions on when they’ll provide assistance, when they’ll choose to listen, and when they’ll share information. Good team players also have a sense of humor and know how to have fun (and all teams can use a bit of both), but they don’t have fun at someone else’s expense. Quite simply, effective team players deal with other people in a professional manner.
Team players who show commitment don’t come in any particular style or personality. They don’t need to be rah-rah, cheerleader types. In fact, they may even be soft-spoken, but they aren’t passive. They care about what the team is doing and they contribute to its success — without needing a push.
Team players with commitment look beyond their own piece of the work and care about the team’s overall work. In the end, their commitment is about winning — not in the sports sense of beating your opponent but about seeing the team succeed and knowing they have contributed to this success. Winning as a team is one of the great motivators of employee performance. Good team players have and show this motivation.

Read more: http://www.dummies.com/how-to/content/ten-qualities-of-an-effective-team-player.html#ixzz1SqYRjXga

Posted in Soldier of Fortune.


How to Upgrade SugarCRM-5.2.0 to 6.2.0

Introduction

Pre-Requistes:
Apache-2.2.x
PHP-5.2.x
Mysql-5.x

SugarCRM can not be upgraded directly from version 5.2.x to 6.2.x. Its a multistep process. You have to upgrade SugarCRM to version 5.5.zx then from 5.5.x to 6.2.x. Below is the outlined procedure for that.

Step1: Check the server for Apache,PHP and MySQL version. (My server was having lower versions so I had to upgrade php and mysql before upgrading SugarCRM)
Step2: Login to SugarCRM with admin user or same access level user.
Step3: Click on Admin link
Step4: Scroll down and Click on Upgrade Wizard
Step5: Click Next, Next, when it asked for upload upgrade file go to http://www.sugarforge.org/frs/?group_id=6 website and download the suitable file according to your current version. I have download all the below files once as to avoid download them again and again.

http://www.sugarforge.org/frs/download.php/6547/SugarCE-5.2.0l.zip
http://www.sugarforge.org/frs/download.php/6589/SugarCE-Upgrade-5.2.0-to-5.5.1.zip
http://www.sugarforge.org/frs/download.php/6591/SugarCE-Upgrade-5.5.1RC-to-5.5.1.zip
http://www.sugarforge.org/frs/download.php/8046/SugarCE-Upgrade-5.5.1-to-6.0.4.zip
http://www.sugarforge.org/frs/download.php/8163/SugarCE-Upgrade-6.0.x-to-6.2.0.zip

Step6: After upload the suitable file complete the steps and on last step it will give you link of “DONE”. Click on that and logout
Step7: Repeat the step4 to step6 again for upgrade to 5.5.1 to 6.0.4 and one more time for 6.0.4 to 6.2.0

Posted in Linux.


Vsftpd with SSL

Introduction:
Few days back one of customer asked to have more security on their data transfer via ftp. I have heard of encryption,SSL and all. I know how to build the CA and create the certificates but don’t know how to integrate it with VSFTPD or alternatively I can say that I did not get such requirement. Vsftpd with SSL is pretty straight forward and very easy to configure just create the self sign certificate just like i did, if you can not buy the trusted certificate from registered CA. Procedure to configure the vsftpd with SSL supports is as given below:

vsftpd is the default FTP server supplied with CentOS. It should be installed by default (?) If it isn’t you may install it by one of these methods:
Using yum (if you’ve installed yum):
Install VSFTPD:

[root@Gladiator]#yum install vsftpd

Generate a Certificate:
You use OpenSSL to generate a certificate for vsftpd. The certificate is store on your server, in a location of your choice. Here I choose to put it in the /etc/vsftpd directory. As well, you specify a ‘lifetime’ for the certificate; here’s it set for a year (“-days 365″).
Note that the backslashes only signify line breaks. You should be able to copy/paste & run it as it is, or remove the backslashes and the line breaks. You may need to create this directory first (mkdir /etc/vsftpd).

[root@Gladiator]#openssl req -x509 -nodes -days 365 -newkey rsa:1024 \
 -keyout /etc/vsftpd/vsftpd.pem \
 -out /etc/vsftpd/vsftpd.pem

You will be prompted with a series of question, which you answer as they appear. When done the certificate will be installed in the /etc/vsftpd directory.
Configure vsftpd:
To configure vsftpd you edit the file /etc/vsftpd/vsftpd.conf and add the following lines:

ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=NO
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
rsa_cert_file=/etc/vsftpd/vsftpd.pem

Restart vsftpd for these settings to take effect:

[root@Gladiator]#/etc/rc.d/init.d/vsftpd restart

”’NOTE:”’If you set “force_local_logins_ssl=YES” then your clients will be required to use an FTP client that supports AUTH TLS/SSL in order to connect. If you leave it at “NO” then people can connect securely or insecurely.

Posted in Linux.




I'm happy to use Increase Sociability.