Deluge: Ultimate Linux / UNIX / Mac / Windows GUI Bittorrent Client ( bt Client )

Posted on in Categories CentOS, Debian Linux, Download of the day, Gentoo Linux, GNU/Open source, Linux, Linux desktop, OS X, Ubuntu Linux, UNIX, Windows last updated January 13, 2008

A long time ago I wrote about Linux command line bittorrent client. Recently I switched from command line client to a GUI based client called Deluge.

Deluge is a lightweight, open source free software and cross-platform BitTorrent client (bt client). A Bittorrent client written in Python/PyGTK which offers following benefits:

[a] Full Encryption – To avoid ISP’s bandwidth throttling system (note encryption is not here to protect you from other users)

[b] Plugin System – Just like Firefox it has features rich plugin collection; in fact, most of Deluge’s functionality is available in the form of plugins.

[c] In built RSS support to grab latest and greatest stuff.

[d] Global and per bittorrent bandwidth control.

[e] Support for selective file downloading – For example, it allows to grab a single file from 100 of files

[f] Ability to create torrent with Torrent Creator plugin

[g] Proxy support

[h] Network activity graph

[i] Network Health Monitor

[j] And much more

Quick Deluge Installation

Use apt-get command,
$ sudo apt-get install deluge-torrent
You can start Deluge by visiting Application > Internet > Deluge Bittorrent Client
Linux / MAC / WIndows / UNIX - Deluge Bittorrent client written in Python/PyGTK
(Fig. 01: Deluge Bittorent Client in Action)

Change port settings

The official ports for BitTorrent are 6881-6889, but most ISPs block or at least throttle those ports, so I recommend to use a port range of something between 50000 and 65535 or any other random range. You can change port range from Preference > Select Network tab > Setup new range > Close
Change port settings
(Fig. 02: Change Port Settings [ Image Credit Official Project])

Download Deluge Bittorrent Client

=> Visit Official Deluge Bittorrent Client project web site to grab latest version.

Lighttpd / Apache : Run Xcache in Chrooted Jail

Posted on in Categories CentOS, Debian Linux, Gentoo Linux, Howto, lighttpd, Linux, php, RedHat/Fedora Linux last updated November 26, 2007

Recently I wrote about installing and running Xcache under Red hat enterprise Linux and CentOS Linux. By default Xcache use /dev/zero for caching. All you have to do is create /dev/zero in chrooted jail. Type the following command (assuming that your jail is located at /lighttpd.jail directory):
# mkdir -p /lighttpd.jail/dev
# mknod -m 666 /lighttpd.jail/dev/zero c 1 5

Just restart your web server and xcache should work under chrooted lighttpd web server.

Testing Connectivity with fping and send mail if any hosts are unreachable

Posted on in Categories CentOS, Debian Linux, Gentoo Linux, Hardware, Howto, Linux, Networking, Shell scripting, Sys admin, Tips, Ubuntu Linux, UNIX last updated November 21, 2007

fping is one my favorite network profiling / scripting tool. It uses the Internet Control Message Protocol (ICMP) echo request to determine if a target host is responding or not.

Unlike ping , fping is meant to be used in scripts, so its output is designed to be easy to parse.

You can easily write perl / shell script to check a list of hosts and send mail if any are unreachable.

fping command example

Just type the following command to see if we can reach to router:
$ fping router

router is alive

You can read list of targets (hosts / servers) from a file. The -f option can only be used by the root user. Regular users should pipe in the file via
I/O redirectors (stdin). For example read all host names from ~/.ping.conf file
$ fping < ~/.ping.conf

You can also netmask to ping the entire network i.e generate a target list from a supplied IP netmask. For example, ping the class C 192.168.1.x:
$ fping -g
$ fping -g

Sample shell script to send email if host is down

HOSTS="router sun printer laptop sony-laptop xbox backup-server"
for h in $HOSTS
  fping -u $h >& /dev/null
  if [ $? -ne 0 ]; then
          echo ${h} host is down send email
          # mail -s "Host ${h} down" [email protected] </dev/null

Another good example is when you want to perform an action only on hosts that are currently reachable.

$myHosts = ‘cat /etc/hosts.backup | fping -a‘;
foreach $host (split(/\n/,$myHosts)) {
        # take action or call other function

Linux find the memory used by a program / process using pmap command

Posted on in Categories CentOS, Debian Linux, FreeBSD, Gentoo Linux, Hardware, Howto, Linux, Monitoring, RedHat/Fedora Linux, Tips last updated November 20, 2007

You can find the memory used by a program (process) by looking into /proc directory or using standard command such as ps or top. However, you must calculate all memory usage by hand i.e. add Shared Memory + mapped file + total virtual memory size of the process + Resident Set Size + non-swapped physical memory used by process.

So how do you find the memory used by a process or program under Linux? Continue reading “Linux find the memory used by a program / process using pmap command”

How to: Linux configure fingerprint reader

Posted on in Categories CentOS, Gentoo Linux, Hardware, Howto, Linux, Linux desktop, Linux distribution, RedHat/Fedora Linux, Suse Linux, Troubleshooting, UNIX last updated November 16, 2007

Recently I was looking information about getting the integrated fingerprint reader to work under Linux. I found this site. It describes the process of getting the integrated fingerprint reader to work under Linux, using bioapi and binary-only drivers. It is based on experiences in Ubuntu on a IBM Thinkpad T43. The same works on Fedora Core 4 and 5, RHEL4, SuSE 9.3, SuSE 10, and Gentoo.

=> How to enable the fingerprint reader

Reboot Linux box after a kernel panic

Posted on in Categories CentOS, Debian Linux, Gentoo Linux, Hardware, Howto, Linux, RedHat/Fedora Linux, Tips, Troubleshooting, Tuning last updated November 16, 2007

If you want the server to get rebooted automatically after kernel hit by a pain error message, try adding panic=N to /etc/sysctl.conf file.

It specify kernel behavior on panic. By default, the kernel will not reboot after a panic, but this option will cause a kernel reboot after N seconds. For example following boot parameter will force to reboot Linux after 10 seconds.
Continue reading “Reboot Linux box after a kernel panic”

Linux Save the output of a command in a logfile

Posted on in Categories CentOS, Gentoo Linux, Howto, Linux, RedHat/Fedora Linux, Shell scripting, Suse Linux, Sys admin, Tips, Ubuntu Linux, UNIX last updated November 11, 2007

You can use logsave command to save the output of a command in a logfile. General syntax is as follows:
logsave /path/to/logfile command-name argument(s)

The logsave program will execute command-name with the specified argument(s), and save a copy of its output to logfile. If the containing directory for logfile does not exist, logsave will accumulate the output in memory until it can be written out. A copy of the output will also be written to standard output. If command-name is a single hyphen (-), then instead of executing a program, logsave will take its input from standard input and save it in logfile

logsave is useful for saving the output of initial boot scripts until the /var partition is mounted, so the output can be written to /var/log. For example, save output of ls command to output.log file:
logsave /tmp/output.txt ls
For example run lftp and save remote server file list to /tmp/filelist.txt for other scripts:
logsave /tmp/filelist.txt 'lftp -u -e "cd pub;ls;quit;" admin,mypassword '

How to: Migrate Linux Printer Configuration to Another System

Posted on in Categories CentOS, Debian Linux, Gentoo Linux, Hardware, Howto, Linux, Linux desktop last updated June 9, 2017

I’ve already outlined the detailed steps for migrating users, home directories and email to a new Linux server. I received a couple of emails asking about migrating printer configuration. From my mail bag:

Is it possible to migrate the printer configuration from one machine to another, just like user migration?

Yes, it is possible since Linux uses CUPS i.e. the common unix printing system. It is a modular printing system for Unix-like computer operating systems that allows a computer to act as a print server. A computer running CUPS is a host that can accept print jobs from client computers, process them, and send them to the appropriate printer.

Migrate Linux Printer Configuration

CUPS stores its configuration at /etc/cups directory, so all you have to do is copy /etc/cups to a new computer. Open terminal and type the commands on old Linux computer:
# tar -cvzf /tmp/cups-$(hostname).tar.gz /etc/cups
Copy /tmp/cups* to new system using SCP or use USB pen driver:
# scp /tmp/cups*

Now login to new system and type the following commands:
# mv /etc/cups /etc/cups.backup
# cd /
# tar -zxvf /tmp/cups*

Finally, restart the cups service:
# /etc/init.d/cupsys restart

VIM as an IDE for writing programs under Linux / UNIX

Posted on in Categories C Programming, Gentoo Linux, Howto, Linux, Tips, Ubuntu Linux, UNIX last updated October 12, 2007

I’m already using few tips described here. From the article:

So I like vim a lot, and I’ve been using it on and off for a few years, but recently I’ve been using it full-time to code in Python. I learned a few things along the way and I made vim a better IDE for myself. Here’s how.

You can follow along or go straight to author’s .vimrc file. Place the .vimrc file in your home folder and enjoy the goodies.

The first step is to make sure you have the equivalent power of jedit, textpad, gedit and the like.

How Do I Enable remote access to PostgreSQL database server?

Posted on in Categories CentOS, Debian Linux, Gentoo Linux, Howto, Linux, Networking, Postgresql, Ubuntu Linux, UNIX last updated October 9, 2007

By default, PostgreSQL database server remote access disabled for security reasons. However, some time you need to provide the remote access to database server from home computer or from web server.

Step # 1: Login over ssh if server is outside your IDC

Login over ssh to remote PostgreSQL database server:
$ ssh [email protected]

Step # 2: Enable client authentication

Once connected, you need edit the PostgreSQL configuration file, edit the PostgreSQL configuration file /var/lib/pgsql/data/pg_hba.conf (or /etc/postgresql/8.2/main/pg_hba.conf for latest 8.2 version) using a text editor such as vi.

Login as postgres user using su / sudo command, enter:
$ su - postgres
Edit the file:
$ vi /var/lib/pgsql/data/pg_hba.conf
$ vi /etc/postgresql/8.2/main/pg_hba.conf
Append the following configuration lines to give access to network:
host all all trust
Save and close the file. Make sure you replace with actual network IP address range of the clients system in your own network.

Step # 2: Enable networking for PostgreSQL

You need to enable TCP / IP networking. Use either step #3 or #3a as per your PostgreSQL database server version.

Step # 3: Allow TCP/IP socket

If you are using PostgreSQL version 8.x or newer use the following instructions or skip to Step # 3a for older version (7.x or older).

You need to open PostgreSQL configuration file /var/lib/pgsql/data/postgresql.conf or /etc/postgresql/8.2/main/postgresql.conf.
# vi /etc/postgresql/8.2/main/postgresql.conf
# vi /var/lib/pgsql/data/postgresql.conf
Find configuration line that read as follows:
Next set IP address(es) to listen on; you can use comma-separated list of addresses; defaults to ‘localhost’, and ‘*’ is all ip address:
Or just bind to and IP address
Save and close the file. Skip to step # 4.

Step #3a – Information for old version 7.x or older

Following configuration only required for PostgreSQL version 7.x or older. Open config file, enter:
# vi /var/lib/pgsql/data/postgresql.conf
Bind and open TCP/IP port by setting tcpip_socket to true. Set / modify tcpip_socket to true:
tcpip_socket = true
Save and close the file.

Step # 4: Restart PostgreSQL Server

Type the following command:
# /etc/init.d/postgresql restart

Step # 5: Iptables firewall rules

Make sure iptables is not blocking communication, open port 5432 (append rules to your iptables scripts or file /etc/sysconfig/iptables):

iptables -A INPUT -p tcp -s 0/0 --sport 1024:65535 -d  --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s --sport 5432 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT

Restart firewall:
# /etc/init.d/iptables restart

Step # 6: Test your setup

Use psql command from client system. Connect to remote server using IP address and login using vivek username and sales database, enter:
$ psql -h -U vivek -d sales

Further readings:

=> man page: pgsql and configuration file