Install Squid 3.1 on Centos 5.X

February 28th, 2010

yum -y groupinstall “Development Tools”
yum -y install rpm-build openjade linuxdoc-tools openldap-devel pam-devel openssl-devel httpd rpm-devel expat-devel db4-devel libpcap-devel

For Centos : rpm -ihv http://www.jur-linux.com/rpms/el-updates/5Client/SRPMS/squid-3.1.0.15-2.el5.src.rpm
For Fedora : rpm -ihv http://www.jur-linux.com/rpms/el-updates/5Client/SRPMS/squid-3.1.0.15-2.fc13.src.rpm

cd /usr/src/redhat/SPECS
rpmbuild -bb squid.spec
rpm -Uhv /usr/src/redhat/RPMS/i386/squid-3.1.0.15-2.i386.rpm

Howto show email accounts and passwords in Plesk

October 4th, 2009

Login to mysql and :

use psa;
SELECT accounts.id, mail.mail_name, accounts.password, domains.name FROM domains LEFT JOIN mail ON domains.id = mail.dom_id LEFT JOIN accounts ON mail.account_id = accounts.id

It should print all emails that are created and their passwords.

Add swap on Linux

October 1st, 2009

[root@host ~]# dd if=/dev/zero of=/swapfile bs=1024 count=1048576
1048576+0 records in
1048576+0 records out
[root@host ~]# sync
[root@host ~]# mkswap /swapfile
Setting up swapspace version 1, size = 1073737 kB
[root@host ~]# swapon /swapfile
[root@host ~]# echo “/swapfile swap swap defaults 0 0″ >> /etc/fstab

Howto list installed packages sorted by size

October 1st, 2009

rpm -qa –queryformat ‘%{SIZE} %{NAME} %{VENDOR}\n’ | sort -n -r | head -10

Check :rpm –querytags for all the tags

Script to generate /etc/network/interfaces file on Ubuntu/Debian

September 30th, 2009

#!/bin/bash
ifile=/etc/network/interfaces
echo -n “Insert IPstart:”
read ipstart
echo -n “Insert IPend:”
read ipend
echo -n “Insert Gateway:”
read gw
#echo -n “Insert Subnet: ”
#read subnet
echo -n “Insert Netmask: ”
read net
echo -n “Insert aliast to start: ”
read ali

firstIp=`echo “${ipstart%.*}”`
lastIpStart=`echo “${ipstart##*.}”`
lastIpEnd=`echo “${ipend##*.}”`
dif=`echo $(($lastIpEnd-$lastIpStart))`

ip=$lastIpStart
for ((i=$ali;i<=$ali+$dif;i++)){
echo "auto eth0:$i" >>$ifile
echo “iface eth0:$i inet static” >>$ifile
echo “address $firstIp.$ip” >>$ifile
echo “network $subnet” >>$ifile
echo “netmask $net” >>$ifile
echo “gateway $gw” >> $ifile
echo ” ” >> $ifile
let ip++
}

Script to generate interface configs on Linux

September 16th, 2009

Generate ifcfg-eth1 307-366 configs.

touch ifcfg-eth1:{307..366}
for f in ifcfg-eth1:{307..366}; do cat origfile > “$f”; done
for f in eth1:{307..366}; do echo “DEVICE=$f” >> “ifcfg-$f”; done
for f in {307..366}; do echo “IPADDR=aaa.bbb.ccc.$((f-239))” >> “ifcfg-eth1:$f”; done

origfile contains:

GATEWAY=eee.fff.ggg.hhh
TYPE=Ethernet
BOOTPROTO=none
NETMASK=255.255.255.192

How do I find out Linux Disk utilization RHEL/Centos?

September 2nd, 2009

iostat syntax for disk utilization report

iostat -d -x interval count

-d : Display the device utilization report (d == disk)
-x : Display extended statistics including disk utilization

interval : It is time period in seconds between two samples . iostat 2 will give data at each 2 seconds interval.

count : It is the number of times the data is needed . iostat 2 5 will give data at 2 seconds interval 5 times

Display 3 reports of extended statistics at 5 second intervals for disk

Type the following command:

# iostat -d -x 5 3

Output:

[root@vari Desktop]# iostat -d -x 5 3

Linux 2.6.18-128.7.1.el5xen (vari.taashee.com) 08/26/2009 _i686_ (2 CPU)

Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util

sda 2.41 12.42 3.27 5.37 134.84 142.70 32.13 0.12 14.04 1.83 1.58

Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util

sda 0.00 1.60 0.00 0.40 0.00 16.00 40.00 0.00 0.00 0.00 0.00

Device: rrqm/s wrqm/s r/s w/s rsec/s wsec/s avgrq-sz avgqu-sz await svctm %util

sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

Where,

rrqm/s : The number of read requests merged per second that were queued to the hard disk
wrqm/s : The number of write requests merged per second that were queued to the hard disk
r/s : The number of read requests per second
w/s : The number of write requests per second
rsec/s : The number of sectors read from the hard disk per second
wsec/s : The number of sectors written to the hard disk per second
avgrq-sz : The average size (in sectors) of the requests that were issued to the device.
avgqu-sz : The average queue length of the requests that were issued to the device
await : The average time (in milliseconds) for I/O requests issued to the device to be served. This includes the time spent by the requests in queue and the time spent servicing them.

svctm : The average service time (in milliseconds) for I/O requests that were issued to the device
%util : Percentage of CPU time during which I/O requests were issued to the device (bandwidth utilization for the device). Device saturation occurs when this value is close to 100%.

How do I interpret the output result for optimization?

First you need to note down following values from the iostat output:

1. The average service time (svctm)
2. Percentage of CPU time during which I/O requests were issued (%util)
3. See if a hard disk reports consistently high reads/writes (r/s and w/s)

If any one of these are high, you need to take one of the following action:

Get high speed disk and controller for file system (for example move from SATA I to SAS 15k disk)
Tune software or application or kernel or file system for better disk utilization
Use RAID array to spread the file system

Update from phpBB 3.0.4 to 3.0.5

August 19th, 2009

To perform the update, either follow the instructions from the Administration Control Panel->System Tab – this should point out that you are running an outdated version and will guide you through the update – or follow the instructions listed below.

Go to the downloads page and download the latest update package listed there, matching your current version.
Upload the archives contents to your phpBB installation – only the install folder is required. Upload the whole install folder, retaining the file structure.
After the install folder is present, phpBB3 will go offline automatically.
Point your browser to the install directory, for example http://www.example.com/phpBB3/install/
Choose the “Update” Tab and follow the instructions

Installing perl audio converter

August 5th, 2009

Download the latest version of pacpl from:

Download PACPL from http://pacpl.sourceforge.net/

install cpan, either with yum,apt..

Install these cpan modules:

cpan install Ogg::Vorbis::Header
cpan install Inline::MakeMaker
cpan install MP3::Tag
cpan install Audio::FLAC::Header
cpan install MP4::Info
cpan install Audio::WMA
cpan install Audio::Musepack
cpan install CDDB_get

Untar the pacpl source and move the binary into /usr/bin and the share/pacpl files into /usr/share/pacpl, also the config file (pacpl.conf) should be in /etc/pacpl/

To convert from .caf to mp3 use:

pacpl –to mp3 file.caf

Joomla: Change Super Admin/Administrator password

July 30th, 2009

Login with your mysql client and issue either one of these:

UPDATE `jos_users` SET `password` =MD5(“getsmart”) WHERE usertype = “Super Administrator”;
or
UPDATE `jos_users` SET `password` =MD5(“getsmart”) WHERE usertype = “Administrator”;