Thursday, May 26, 2011

problems in installing TOR + Polipo on Centos

I did install TOR+Polipo on my Centos machine, however, the following problems came out during the installation process:

- TOR and POLIPO don't add themselves as Daemon to /etc/init.d/ directory; therefore it should be done manually as follows:

1- make "polipo" in /etc/init.d/ directory and give it excecution permission:
$ su
password:...
# vim polipo
---save polipo and exit (:wq)
# chmod +x polipo
2- insert the following code in polipo:


#!/bin/sh
#
# Polipo     This shell script takes care of starting and stopping
#               the Polipo
#

# chkconfig: 2345 98 1
# description: polipo daemon


# Source function library
. /etc/rc.d/init.d/functions


Daemon='/usr/local/bin/polipo daemonise=true logFile="/tmp/polipo.log"'

# Do preliminary checks here, if any
#### START of preliminary checks #########


##### END of preliminary checks #######


# Handle manual control parameters like start, stop, status, restart, etc.

case "$1" in
  start)
    # Start daemons.

    echo -n $"Starting Polipo daemon: "
    echo
    daemon $Daemon
    echo
    ;;

  stop)
    # Stop daemons.
    echo -n $"Shutting down Polipo: "
    killproc $Daemon
    echo

    # Do clean-up works here like removing pid files from /var/run, etc.
    ;;
  status)
    status $Daemon

    ;;
  restart)
    $0 stop
    $0 start
    ;;

  *)
    echo $"Usage: $0 {start|stop|status|restart}"
    exit 1
esac

exit 0


3- make "tor" in /etc/init.d/ directory and give it excecution permission:
# vim tor
---save tor and exit (:wq)
# chmod +x tor

4- insert the following code in polipo:
#!/bin/sh
#
# TOR     This shell script takes care of starting and stopping
#               the TOR
#

# chkconfig: 2345 99 1
# description: tor daemon


# Source function library
. /etc/rc.d/init.d/functions


Daemon='/usr/local/bin/tor > /tmp/tor.log &'

# Do preliminary checks here, if any
#### START of preliminary checks #########


##### END of preliminary checks #######


# Handle manual control parameters like start, stop, status, restart, etc.

case "$1" in
  start)
    # Start daemons.

    echo -n $"Starting TOR daemon: "
    echo
    daemon $Daemon
    echo
    ;;

  stop)
    # Stop daemons.
    echo -n $"Shutting down TOR: "
    killproc $Daemon
    echo

    # Do clean-up works here like removing pid files from /var/run, etc.
    ;;
  status)
    status $Daemon

    ;;
  restart)
    $0 stop
    $0 start
    ;;

  *)
    echo $"Usage: $0 {start|stop|status|restart}"
    exit 1
esac

exit 0


5- add polipo and tor to be run at boot time:

# /sbin/chkconfig --add polipo
# /sbin/chkconfig --add tor

6- reboot the system

No comments: