Friday, June 17, 2011

How to Clear the Memory Cache for Debian 6.0

In Linux Server, it's normal that your RAM is growing rapidly from time to time. That's why "reboot" is the answer by most of the people from time to time. LOL!

This is how to clear the linux cache memory.

sync; echo 3 > /proc/sys/vm/drop_caches

How to install SARG on Debian 6.0

SARG is not included in the default apt sources of Debian Squeeze. To solve this problem, you need to add the "squeeze-backports" apt source in your "/etc/apt/sources.list".

1. Open your apt source file.
$nano /etc/apt/sources.list

2. Add the "squeeze-backports" at the end of the file. Add the following line and save.

deb squeeze-backports main

3. Update your system.
$apt-get update

4. Install SARG
$apt-get install sarg

5. Go to http://yourserver/sarg and enjoy SARG!

Note: You need to install Apache on your linux system for this to work. You also need to create a symbolic link if you have a different path of your web server.

ln -s /var/lib/sarg/ /srv/www/

Tuesday, June 14, 2011

How to change the hostname of your Debian 6.0 server?

1. Edit the file "/etc/hostname" and change the name to hostname that you want.


Hostname is asteriskserver1 and you want to change it to asteriskserver2

In your debian console:

$nano /etc/hostname

Change it to:

$nano /etc/hostname

2. Save the file.
3. Run "/etc/init.d/ start" to refresh the hostname of your server.
$/etc/init.d/ start

Monday, June 13, 2011

How to change timezone in Debian 6.0

1. Type the following to change your timezone.

$dpkg-reconfigure tzdata

- Choose your geographic and your city/region.


Geographic Area: Asia
City/Region: Manila

Tuesday, June 7, 2011

Linux Memory Explanation

I'm going to use the linux command "free" in our example.

$free -m

2025 is your total memory. 1425 is used and 599 is free.

The most important line here is the "-/+ buffers/cache" which determines your physical memory and "Swap".

169 used and 1856 free. Total is 2025.


"Linux divides its physical RAM (random access memory) into chucks of memory called pages. Swapping is the process whereby a page of memory is copied to the preconfigured space on the hard disk, called swap space, to free up that page of memory. The combined sizes of the physical memory and the swap space is the amount of virtual memory available."

- credits to Gary Sims on this link

Wednesday, June 1, 2011

How to check CPU and Memory Leaks on Debian 6?

1. Memory Leak Check:
#top 10 applications
$ps -A --sort -rss -o comm,pmem | head -n 11

#Check All
$ps -A --sort -rss -o comm,pmem | less

2. CPU Leak Check
#top 10 applications
$ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10

#check all
$ps -eo pcpu,pid,user,args | sort -r -k1 | less

Note: In using command "less", you can exit by pressing "q".

How to install phpmyadmin on Debian 6?

1. Install phpmyadmin by apt-get.
$apt-get install phpmyadmin

2. Search for the phpmyadmin configuration directory and look for apache.conf
#Use "updatedb" to update the slocate database. We need to use "locate" to search for the file.
#Search for "apache.conf"
$locate apache.conf

3. Edit the file /etc/apache2/apache2.conf and include the phpmyadmin apache.conf.
$nano /etc/apache2/apache2.conf
# add the line below at the end of the file and save it.
Include /etc/phpmyadmin/apache.conf

4. Restart Apache2
$/etc/init.d/apache2 restart

5. Go to http://yourdomain/phpmyadmin to see if it works.