Installing Lusca On Ubuntu 10.04/10.10/11.04

Introduction

Lusca is a fork of the Squid 2 project. It is a caching web-proxy / reverse proxy. If you would like to read more about the project check out their project site.

This tutorial will show you how to achieve a functioning proxy server using Lusca on Ubuntu 10.04/10.10/11.04, it may work on other versions but these are the versions it was tested on.

Step 1 : Download Source for Lusca-HEAD

http://lusca-cache.googlecode.com/files/LUSCA_HEAD-r14809.tar.gz

Step 2 : Extract Source

tar xzvf LUSCA_HEAD-r14809.tar.gz

Step 3 : Satisfy Dependencies

sudo apt-get update
sudo apt-get install gcc build-essential sharutils ccze libzip-dev automake1.9

Step 4 : Configure and Compile Source

cd LUSCA_HEAD-r14809
./configure --prefix=/usr/local/squid
sudo make all
sudo make install

Step 5 : Create squid user and group

sudo useradd squid
sudo groupadd squid

*note you will not likely need to create the group it should already be created.

Step 6 : Editing squid.conf

sudo nano /usr/local/squid/etc/squid.conf

add the following lines

cache_effective_user squid
cache_effective_group squid
include /usr/local/squid/etc/tuning.conf

Step 7 : Editing tuning.conf

sudo nano /usr/local/squid/etc/tuning.conf

paste the following into the file and save

cache_dir aufs /usr/local/squid/var/cache 10000 16 256
cache_effective_user squid
cache_effective_group squid
client_persistent_connections off
server_persistent_connections on
half_closed_clients off
strip_query_terms off
quick_abort_min 0 KB
quick_abort_max 0 KB
quick_abort_pct 100
vary_ignore_expire on
reload_into_ims on
pipeline_prefetch on
read_timeout 30 minutes
client_lifetime 6 hours
negative_ttl 30 seconds
positive_dns_ttl 6 hours
negative_dns_ttl 60 seconds
pconn_timeout 15 seconds
request_timeout 1 minute
store_avg_object_size 13 KB
log_icp_queries off
ipcache_size 16384
ipcache_low 98
ipcache_high 99
log_fqdn off
fqdncache_size 16384
memory_pools off
forwarded_for on
cachemgr_passwd none all
client_db off
max_filedescriptors 4096
n_aiops_threads 24
load_check_stopen on
load_check_stcreate on
download_fastest_client_speed on
maximum_object_size 3 GB

Step 8 : Create directory for caching and set correct permissions

sudo mkdir /usr/local/squid/var/cache
sudo chown squid:squid /usr/local/squid/var/cache

Step 9 : Create a caching folder

sudo /usr/local/squid/sbin/squid -z

Step 10 : Run Lusca

sudo su
su squid
/usr/local/squid/sbin/squid
Comments
  1. husnixs says:

    hi…
    I have a question…
    after installing squid lusca, in directory squid, I’m cannot find file tunning.conf,
    what’s wrong sir…??

    • dangertux says:

      You will have to manually create it touch , nano , vi , etc. It is included in the squid.conf file, so you could in theory just make the changes to squid.conf if you want. Hope that helps

  2. husnixs says:

    thanks for your quick reply sir…
    and it’s allready resolved

    but one again sir…
    at the step 9 I got error like this sudo /usr/local/squid/sbin/squid -z
    FATAL: Unable to find configuration file: /usr/local/squid/etc/tuning.conf: (2) No such file or directory
    Squid Cache (Version LUSCA_HEAD-r14809): Terminated abnormally.
    CPU Usage: 0.000 seconds = 0.000 user + 0.000 sys
    Maximum Resident Size: 10576 KB
    Page faults with physical i/o: 0

    thanks sir

  3. dangertux says:

    Did you include tuning.conf in your squid.conf file?

    If so is your tuning.conf set with proper permissions to be read by squid? If not

    sudo chown squid:squid tuning.conf
    sudo chmod 750 tuning.conf
    

    Should fix the error.

  4. husnixs says:

    If I’m using ubuntu server 11.04 amd64bit, and follow your tutorial.
    does the lusca will work sir..??

    • dangertux says:

      I saw you post on Ubuntu forums did the configuration files help you at all?

      Also — this tutorial was tested on 32 bit 11.04 , I would imagine it should work on amd64 as well, however it’s not tested. This is not a piece of software I use on a regular basis, I posted the tutorial once when I was helping someone else with Lusca under Ubuntu 10.04. To be honest this particular piece of software isn’t that well known or well supported for Ubuntu. In favor of the actual squid. However if this helps my reply on Ubuntu Forums to you was this

      Hi

      Did you edit the squid.conf file? To include proper ACL’s for those you want accessing the proxy?

      
      acl local_net src 192.168.1.0/24
      http_access allow local_net
      http_access allow localhost
      
      where 192.168.1.0/24 is your local network
      

      Also you might consider adding

      
      acl Safe_ports port 80
      acl Safe_ports port 443
      

      etc..

  5. mahiralkhoir says:

    i am just confuse with your setup… on squid.conf you put this

    include /usr/local/squid/etc/tuning.conf

    but you create tuning.conf with different directory

    sudo nano /usr/local/squid/var/cache/tuning.conf

    • dangertux says:

      Oh hey thank you , it was an error in how I wrote it. They should be the same whether it is /usr/local/squid/var/cache/tuning.conf or /usr/local/squid/etc/tuning.conf just make sure the include line and file location match up and squid:squid has permissions to read in that directory.

      Thanks again for the feedback it’s always appreciated.

  6. ObeOne says:

    hi i new to this lusca..
    when finish as directed.. restart ubuntu and at login there are 2 login.. ubuntu and squid.. ubuntu i can access with my password and to squid, i dont know what the password.
    from client what ip and port i need to use to connect to this squid..

    hope you can solved my problem.. thks

    • dangertux says:

      By default the squid account is only used for running squid. You don’t have to log in to it. If you want to proxy your traffic through lusca/squid you need to configure your application to use a Proxy. If you’re running it locally which it seems like you are the host should be 127.0.0.1 default port is 3128.

      Hope this helps.

  7. joel says:

    when i try to run LUSCA On step 10, with comand ” su squid ” the answer is “Cannot execute /dev/null: Permission denied ”

    hope you can solved my problem.. thks

    • dangertux says:

      Verfiy that you completed step 5 properly. If you did and it still doesn’t work you may wish to define a shell for squid in /etc/passwd

      Hope this helps.

      • joel says:

        step 5 already complete sir but it still doesn’t work.

        i’m sorry, what do you mean with ” you may wish to define a shell for squid in /etc/passwd ”

        thanks

      • dangertux says:

        The /dev/null error is coming from the fact that you don’t have a shell assigned. You can alternatively give it this command to start squid

        su -c squid ‘/usr/local/sbin/squid’

        Hope that helps.

  8. kim says:

    newbie here. just wanna ask how to cache dynamic streaming site with lusca? thanks

    • dangertux says:

      If you’re referring to things like Youtube, the cache will still cache it. However you need to make sure the following parameter in squid.conf

      maximum_object_size 20480 KB

      Is set large enough to accomodate the content you want cached. This is only 20MB and would not really be large enough for a youtube video.

  9. kim says:

    yup. im referring to youtube and other streaming site. i would like to setup this in net cafe so that i can save bandwidth when users stream same video. can you advise me with the best settings regarding this. do you add the storeurl.pl file, i stumble some sites and they add this for dynamic streaming caching.

  10. kjshoot2ill says:

    hi..

    i got stuck in step 4
    i already did line 1 and 2
    but when i type “sudo make all”
    an error will occur
    make: *** No rule to make target ‘all’. Stop.

    how to resolve this? tia

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s