easy turn on ls colors for root

April 22nd, 2010

in order to turn on the ls colors on your debian server for root user, just edit the /root/.bashrc file and uncomment there the following lines:
export LS_OPTIONS=’–color=auto’
eval “`dircolors`”
alias ls=’ls $LS_OPTIONS’

save and apply the new settings:

source ~/.bashrc

that’s all :)

tunning swappiness

March 9th, 2010

if you want Linux machine to use less swap you can tune it by changing the value of:

/proc/sys/vm/swappiness

by default it’s set to ’60′, you can decrease it to make it use less swap memory, this means that swap memory will be more used “when needed only”.

Change the value using this command:

echo 30 > /proc/sys/vm/swappiness

howto: check disk utilization

December 7th, 2009

Disk IO and usage can be checked very easily via ssh, currently the bandwidth usage is 82mbit. IO wait can be checked using the ‘vmstat 1‘ command and looking on the pre-last column called ‘wa’:

procs ———–memory———- —swap– —–io—- –system– —–cpu——

 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st

 1  1    476 8209760  17060 6923844    0    0   550    22    1    0 10  6 78  7  0

 2  2    476 8176176  17152 6934184    0    0  5552     0 7435 2960 26  5 61  8  0

 2  0    476 8198232  17160 6938080    0    0  2788     0 6260 2412 14  2 83  1  0

 1  1    476 8189900  17184 6947160    0    0  3500     0 7751 2857 22  3 72  3  0

 2  0    476 8147572  17192 6963164    0    0  3188   264 10083 3223 24  4 69  3  0

 1  0    476 8171132  17208 6966848    0    0  2924     0 5948 2234 18  2 78  2  0

 1  1    476 8166708  17220 6972064    0    0  1960     0 6731 2774 15  3 80  2  0

 2  1    476 8133964  17236 6982200    0    0  3164     0 8228 3292 18  5 73  4  0

 1  0    476 8128256  17252 6986012    0    0  3716     0 5876 2995 21 12 65  3  0

 1  2    476 8102740  17336 6990420    0    0  2420   636 6364 3884 22 12 59  8  0

 

As you can see, its varies from 0-8 which is normal, when IO more than 20-30 for long time means IO is in moderate usage, when its over 50 it is high.

 

Another command to check disk utilization is ‘iostat –dx 5‘, it calculates 5 seconds disk resources utilization:

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

sda              18.60     9.80 114.00  8.00  8777.60   142.40    73.11     1.65   13.78   5.44  66.32

sda1              0.00     0.00  0.00  0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00

sda2             18.60     9.80 114.00  8.00  8777.60   142.40    73.11     1.65   13.78   5.44  66.32

dm-0              0.00     0.00 131.80 17.80  8696.00   142.40    59.08     1.95   13.27   4.43  66.34

dm-1              0.00     0.00  0.00  0.00     0.00     0.00     0.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              27.40     5.00 110.20  7.20  8624.00    97.60    74.29     2.06   17.53   5.88  69.02

sda1              0.00     0.00  0.00  0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00

sda2             27.40     5.00 110.20  7.20  8624.00    97.60    74.29     2.06   17.53   5.88  69.02

dm-0              0.00     0.00 138.40 12.20  8648.00    97.60    58.07     2.96   19.65   4.58  69.00

dm-1              0.00     0.00  0.00  0.00     0.00     0.00     0.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              21.16     5.79 122.36  6.39  9203.99    97.41    72.25     1.88   14.63   5.23  67.33

sda1              0.00     0.00  0.00  0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00

sda2             21.16     5.79 122.36  6.39  9203.99    97.41    72.25     1.88   14.63   5.23  67.33

dm-0              0.00     0.00 142.71 12.18  9180.04    97.41    59.90     2.36   15.25   4.35  67.31

dm-1              0.00     0.00  0.00  0.00     0.00     0.00     0.00     0.00    0.00   0.00   0.00

the last column says about 57-65% utilization of the disks, which is normal at 100mbit (the current bandwidth is 100mbit now).

Another test can be done at rush hours to check the utilization, usually SATA disks in RAID 1 configuration can handle 150-250mbit (depends on number of concurrent connections).

Kayako API extension: CreateUser, UpdatePassword, DeleteUser

September 16th, 2009

I’ve played with the nice and clear Craig Brass Kayako API, and added some extensions to allow the following remote functions:

CreateUser, UpdatePassword, DeleteUser

get the patch from here: http://interhost.co.il/api.class.patch
installation: patch -p0 < api.class.patch

and also apply this patch:

http://interhost.co.il/wsdl.patch
install:
patch -p0 < wsdl.patch
location: integrationapi/lib

and I also extended the example (api client), get it from here:
http://www.interhost…ako.api.php.txt

usage example:

http://api.caller.com/kayako.api.php?cmd=updateEmailAddress&oldEmail=old@email.com&newEmail=new@email.com&api_password=cleartext

interface: GET/POST
usage: kayako.api.php?cmd=<command>..args..&api_password=<api_password>
Availble commands:
cmd=updateEmailAddress
a1=oldEmail
a2=newEmail

cmd=changePassword
a1=email
a2=newpassword

cmd=deleteUser
a1=email

cmd=registerUser
a1=email
a2=userpassword
a3=fullname

any comments will be appriciated.
p.s its a proof of concept example, use on your own responsibility only.

thanks

lighttpd burst aka “faststart” patch

September 1st, 2009

I’ve created this patch for Lighttpd 1.4.19 (tested and compiled on Debian Lenny amd64). This patch adds configuration option:

‘connection.burst’

You should use it only with:

‘connection.kbytes-per-second’ setting.

Example:
connection.kbytes-per-second = 100
connection.burst        = 50

In this example user will get 50 seconds fast-start and will be throttled down to 100KBp/s after fast start “burst” download of first 50sec.

It’s very useful for letting fast speed for downloading small files or for usage for FLV streaming when you like to give fast buffer burst speed and then throttle down.

I wrote this patch after looked long time in Google and had unfortune expirience with LARTC ‘s tools.

I hope this will be useful for you, for any comments, questions or bugs please write me a note.

Download:

http://www.debian.co.il/2009/09/lighttpd-burst-aka-faststart-patch/lighttpd-1419-burst/

Installation on Debian:

cd /usr/local/src/

apt-get source lighttpd

cd lighttpd-1.4.19

wget http://www.debian.co.il/wp-content/uploads/2009/09/lighttpd-1419-burst.patch

patch -p0 < lighttpd-1419-burst.patch

now compile and configure:

./configure

make

make install

preparing your debian lenny for work just after install!

August 31st, 2009

I want to talk about the first steps i do when i install a new clean debian lenny, well first thing i want to feel comfort that i can build anything i want therefore lets install some build essential package, but before lets edit our /etc/apt/sources.apt file, oups we need a vim with colors, but hell whats that creepy sound when i reach the start with delete. Ok ok, lets start from scratch.

List of packages that every lenny server should include for my opinion:

apt-get install vim build-essential fakeroot psmisc

now edit /etc/apt/sources.apt

change:
deb http://debian.co.il/debian/ lenny main
deb-src http://debian.co.il/debian/ lenny main

to:
deb http://debian.co.il/debian/ lenny main non-free
deb-src http://debian.co.il/debian/ lenny main non-free

now run:

apt-get update && apt-get upgrade

now:

apt-get install unrar

lets add some colors to vim now:

cat > ~/.vimrc

syntax on

^D

vim /etc/inputrc +21

uncomment “set bell-style none”

now lets add some colors to root:

vim /root/.bashrc

uncomment those:

export LS_OPTIONS=’–color=auto’
eval “`dircolors`”
alias ls=’ls $LS_OPTIONS’

and add: alias grep=’grep –color’

cool, now just exit and relogin back again.

updatedb

thats all for now.

Our mirror moved to a larger server, now AMD64 supported!

August 30th, 2009

Our mirror is fully updated and now also contains AMD64 repositories for debian packaged and Debian ISO mirror with i386 and amd64 aswell!

Now our mirror is running on Lighttpd backend with lua support for rewriting clean urls.

debian AMD64 DVD: http://www.debian.co.il/debian-cd/current/amd64/iso-dvd/

Enjoy!

Debian CD Lenny images mirror fully updated!

February 23rd, 2009

The sync from the primary Debian mirror ended today, grab your Lenny ISOs from:

http://debian.co.il/debian-cd/

Netinstall ISO:

http://debian.co.il/debian-cd/current/i386/iso-cd/debian-500-i386-netinst.iso

amd64 will be added soon.

Enjoy.

Cool linux tips

February 22nd, 2009

Useful and cool Linux tips collection:

1. Debian add ip address:

auto eth0:0
iface eth0:0 inet static

    address 192.168.1.41
    netmask 255.255.255.0
    broadcast 192.168.1.255

2. Find modified lately file:

find . -mtime -1 -print

3. Find information about memory slots, speed, type etc’ (requires package lshw):

lshw | grep *-memory -A 40

4. Find DDOS! Find and sort connections by source ip:

netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

5. Remove annoying system bell:

echo ‘set bell-style none’ >> ~/.inputrc

6. Trying to rm and getting ‘list too long’ ? try this:

 find . | xargs rm

7. Extract only numbers from a string:

xxxxx/545454/xxxxx —> 545454
cat list.txt | sed  ‘s/.*\/\([0-9]*\)*\/.*/\1/g’

8. Use colors in vim:

cat > ~/.vimrc

syntax on

^D

To be updated!

Debian Lenny 5.0 is out!!!

February 22nd, 2009

Lenny is out!!!

Debian Lenny is officially out !

Syncing mirrors in progress…

 

Debian GNU/Linux 5.0 released
February 14th, 2009The Debian Project is pleased to announce the official release of Debian GNU/Linux version 5.0 (codenamed Lenny) after 22 months of constant development. Debian GNU/Linux is a free operating system which supports a total of twelve processor architectures and includes the KDE, GNOME, Xfce, and LXDE desktop environments. It also features compatibility with the FHS v2.3 and software developed for version 3.2 of the LSB.

Debian GNU/Linux runs on computers ranging from palmtops and handheld systems to supercomputers, and on nearly everything in between. A total of twelve architectures are supported: Sun SPARC (sparc), HP Alpha (alpha), Motorola/IBM PowerPC (powerpc), Intel IA-32 (i386), IA-64 (ia64), HP PA-RISC (hppa), MIPS (mips, mipsel), ARM (arm, armel), IBM S/390 (s390), and AMD64 and Intel EM64T (amd64).

Debian GNU/Linux 5.0 Lenny adds support for Marvell’s Orion platform which is used in many storage devices. Supported storage devices include the QNAP Turbo Station series, HP Media Vault mv2120, and Buffalo Kurobox Pro. Additionally, Lenny now supports several Netbooks, in particular the Eee PC by Asus. Lenny also contains the build tools for Emdebian which allow Debian source packages to be cross-built and shrunk to suit embedded ARM systems.

Debian GNU/Linux 5.0 Lenny includes the new ARM EABI port, armel. This new port provides a more efficient use of both modern and future ARM processors. As a result, the old ARM port (arm) has now been deprecated.

 

Dedication

Debian GNU/Linux 5.0 Lenny is dedicated to Thiemo Seufer, a Debian Developer who died on December 26th, 2008 in a tragic car accident. Thiemo was involved in Debian in many ways. He has maintained several packages and was the main supporter of the Debian port to the MIPS architectures. He was also a member of our kernel team, as well as a member of the Debian Installer team. His contributions reached far beyond the Debian project. He also worked on the MIPS port of the Linux kernel, the MIPS emulation of qemu, and far too many smaller projects to be named here.

Thiemo’s work, commitment, broad technical knowledge and ability to share this with others will be missed. Thiemo’s contributions will not be forgotten. The high standards of his work make it hard to pick up.