Information and Links

Join the fray by commenting, tracking what others have to say, or linking to it from your blog.


Other Posts

Install Urchin on Ensim RHEL 3 or 4

Posted by plattapuss on November 19th, 2005

UPDATE: Since EV1 has merged (for better or worse) with The Planet, the forums have also merged. This means that all those fantastic links we used to have are now gone from EV1. So I have found the original post for this how to from Foggy at The Planet forums and updated it here. Hope that helps someone.

UPDATE 2: I am using this script on RHEL4 boxes with no issues. Though I do see the scheduler not running error all the time on one box. Despite that message, Urchin runs quite happily.

Here is a simple and extemely useful How-To to help you get Urchin running smoothly on RHEL 3 and 4 with Ensim 3.x and 4.x. This How-To is based on projectandrews now defunct unofficialsupport.com website with some minor updates. You can also find this How-To posted at The Planet.

Login as root

PHP:
  1. cd /usr/local/src
  2. mkdir urchin
  3. cd urchin

Download and extract Urchin

PHP:
  1. wget http://www.urchin.com/download/urch...500_redhat73.sh
  2. sh urchin5500_redhat73.sh

Install Urchin

PHP:
  1. ./install.sh
  2. Select 1 for english language
  3. Select 1 if this is a new install (select 2 for upgrade)
  4. Accept the default location of /usr/local/urchin (just press enter)
  5. Select 1 to create the directory
  6. Choose port number (preferably use a different one from the default i.e. 9899)
  7. leave user as 'nobody' (just press enter)
  8. leave group as 'nobody' (just press enter)
  9. Select 2 to not start urchin
  10. Select 1 to continue the install

Remove the download folder

PHP:
  1. cd /usr/local/src
  2. rm -Rf urchin

Open port 9899 in your firewall (or whatever port you used.)

For APF

PHP:
  1. pico -w /etc/apf/conf.apf
  2. CTRL-x then y

Restart the firewall

PHP:
  1. service apf restart

Setting up the Logformat to use UTM

PHP:
  1. cd /etc/httpd/conf/

Make a backup copy of the apache config file first.

PHP:
  1. cp httpd20_app.conf httpd20_app.conf.bak
  2. pico -w /etc/httpd/conf/httpd.conf

Search for 'logformat'

CTRL-w (then type in "logformat")

Replace this line:

CODE:
  1. LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

With this line:

CODE:
  1. LogFormat "%h %v %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{Cookie}i\"" combined

CTRL-x then y to save

Restart Apache

CODE:
  1. /etc/init.d/httpd configtest

If you get response of Syntax OK, then proceed to restart apache. If you get errors, DO NOT try to restart apache, as it will fail. Fix the errors first, then try the configtest again.

CODE:
  1. /etc/init.d/httpd restart

Change logrotate to rotate daily

CODE:
  1. pico -w /etc/logrotate.conf

(change the line that reads "weekly" to "daily" (no quotes))

CTRL-x then y to save

Make urchin startup on reboot

CODE:
  1. cp /usr/local/urchin/util/urchin_daemons /etc/rc.d/init.d/urchin
  2. chmod 755 /etc/rc.d/init.d/urchin

Open this file

CODE:
  1. pico -w /etc/rc.d/rc.local

Add to the bottom this line

CODE:
  1. /etc/rc.d/init.d/urchin start

CTRL-x then y to save

Now we will create the auto add scripts for ensim. So each time you add a new site, urchin will be enabled for that site. And we will add urchin to all the sites that already exist.

CODE:
  1. cd /etc/appliance/customization/
  2. pico -w add-all.sh

Copy paste the following code:

CODE:
  1. #! /bin/sh
  2. DOMAINS=`/usr/local/bin/sitelookup -a domain`
  3. SITERETVAL=$?
  4. if [ $SITERETVAL -eq 0 ]; then
  5. for DOMAIN in $DOMAINS
  6. do
  7. USER=`/usr/local/bin/sitelookup -d $DOMAIN site_admin`
  8. /etc/appliance/customization/urchin-add.sh $DOMAIN $USER
  9. done
  10. fi

ctrl x then y to save

pico -w urchin-add.sh

Add this code to urchin-add.sh

CODE:
  1. #! /bin/sh
  2.  
  3. URCHINPATH="/usr/local/urchin"
  4. OUTPUT="/tmp/urchin-temp.conf"
  5.  
  6. DOMAIN=$1
  7. USER=$2@$1
  8. PASSWORD="urchin"
  9.  
  10. echo "<profile Name="$DOMAIN">"> $OUTPUT
  11. echo " ct_name=$DOMAIN">> $OUTPUT
  12. echo " ct_affiliation=(NONE)">> $OUTPUT
  13. echo " ct_website=http://www.$DOMAIN">> $OUTPUT
  14. echo " ct_reportdomains=www.$DOMAIN,$DOMAIN">> $OUTPUT
  15. echo " cs_llist=$DOMAIN-access-log,$DOMAIN-access-log.[1-4]">> $OUTPUT
  16. echo " ct_defaultpage=index.html">> $OUTPUT
  17. echo " cs_vmethod=0">> $OUTPUT
  18. echo " cs_ulist=$USER">> $OUTPUT
  19. echo "</profile>">> $OUTPUT
  20. echo>> $OUTPUT
  21. echo "<task Name="$DOMAIN">">> $OUTPUT
  22. echo " ct_name=$DOMAIN">> $OUTPUT
  23. echo " ct_affiliation=(NONE)">> $OUTPUT
  24. echo " cr_frequency=4">> $OUTPUT
  25. echo " cr_minute=0">> $OUTPUT
  26. echo " cr_runnow=0">> $OUTPUT
  27. echo " cr_enabled=off">> $OUTPUT
  28. echo "</task>">> $OUTPUT
  29. echo>> $OUTPUT
  30. echo "<logfile Name="$DOMAIN-access-log">">> $OUTPUT
  31. echo " ct_name=$DOMAIN-access-log">> $OUTPUT
  32. echo " ct_affiliation=(NONE)">> $OUTPUT
  33. echo " ct_loglocation=/home/virtual/$DOMAIN/var/log/httpd/access_log">> $OUTPUT
  34. echo " cs_logformat=ncsa">> $OUTPUT
  35. echo " cr_type=local">> $OUTPUT
  36. echo " cs_rlist=$DOMAIN">> $OUTPUT
  37. echo "</logfile>">> $OUTPUT
  38. echo>> $OUTPUT
  39. echo "<logfile Name="$DOMAIN-access-log.[1-4]">">> $OUTPUT
  40. echo " ct_name=$DOMAIN-access-log.[1-4]">> $OUTPUT
  41. echo " ct_affiliation=(NONE)">> $OUTPUT
  42. echo " ct_loglocation=/home/virtual/$DOMAIN/var/log/httpd/access_log.[1-4]">> $OUTPUT
  43. echo " cs_logformat=ncsa">> $OUTPUT
  44. echo " cr_type=local">> $OUTPUT
  45. echo " cs_rlist=$DOMAIN">> $OUTPUT
  46. echo "</logfile>">> $OUTPUT
  47. echo>> $OUTPUT
  48. echo "<user Name="$USER">">> $OUTPUT
  49. echo " ct_affiliation=(NONE)">> $OUTPUT
  50. echo " ct_fullname="$DOMAIN"">> $OUTPUT
  51. echo " ct_name=$USER">> $OUTPUT
  52. echo " ct_password=$PASSWORD">> $OUTPUT
  53. echo " cs_rlist=$DOMAIN">> $OUTPUT
  54. echo "</user>">> $OUTPUT
  55.  
  56. $URCHINPATH/util/uconf-import -f $OUTPUT

CTRL-x then y to save

CODE:
  1. pico -w virtDomain.sh

Add this code to virtDomain.sh

CODE:
  1. IP=`/bin/hostname -i`
  2. /etc/appliance/customization/urchin-add.sh $1 $2

If there is already code in virtDomain.sh, then simply append this code to the end of virtDomain.sh instead:

CODE:
  1. /etc/appliance/customization/urchin-add.sh $1 $2

Then make all three files executable

CODE:
  1. chmod 755 virtDomain.sh urchin-add.sh add-all.sh

Now simply add the current sites to urchin profiles by running add-all.sh like so

CODE:
  1. ./add-all.sh

Now start or restart Urchin

CODE:
  1. service urchin start

Final Configuration of Urchin
Open Urchin in your browser and follow the configuration instructions. The license number will be in the email that you received from EV1 Servers.

Go to

CODE:
  1. http://IPADDRESS:8080/

Enter your username and password into Urchin.
Username: admin
Password: urchin

If you purchase or received your license from EV1 Servers, then click on "Activate Pre-Purchased License"

Enter the license in the window that opened then click continue.

Add your contact information and click 'register' then click the link to install the license.

You will now be automatically taken back to Urchin on your own server.

Click continue, leave the admin settings as default and click next. Enter a new password and click next.

Congratulations! You are now finished installing Urchin.

Miscellaneous info about Urchin

  • Urchin stats update on the hour.
  • Your clients can access them via
  • https://IPADDRESS:9899/
  • User: username@domain.com
  • Pass: urchin (should be changed)


Reader Comments

I have used urchin for quite some time using what I believe to be this exact script to configure urchin profiles upon creating new hosting accounts on my ensim servers…

Unfortunately after RHEL 4 came out I discovered a number of troubles in installing urchin… More specifically even after fixing problems related to the installation I have been unnable to use this script due to problems in importing configs using the importer script that urchin comes with (which is relied on to add to the urchin profiles).

Does anyone use urchin on rhel4 with this script to automate things??

Thanks

Michael, I am using Urchin for a few clients on RHEL4 with no problems at all. Though my script above does seem to be munged a bit since I did some mods in this WP install.

Unfortunately the EV1 forums are not there anymore, but they do exist through the Planet.

I have updated this post so the code should work correctly now, and I have posted the correct link to The Planet for the original post.