The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Upgrade AwStats to 5.9 [how-to]

Discussion in 'General Discussion' started by JackDcrack, Nov 5, 2003.

  1. JackDcrack

    JackDcrack Well-Known Member

    Joined:
    Aug 9, 2002
    Messages:
    52
    Likes Received:
    0
    Trophy Points:
    6
    For those of use who cant wait for the next release of Cpanel with AwStats version 5.9...

    Make sure you are logged in as root (su -)

    cd /usr/local/cpanel/3rdparty/bin
    wget http://jdcdesigns.com/stats/awstats-5.9.tar.gz
    tar -xzvf awstats-5.9.tar.gz
    ./upgrade_awstat-5.9.sh
    /scripts/runlogsnow

    THATS IT!
    additionally you can:
    chattr +i awstats.pl
    chattr +i lib/*
    chattr +i /usr/local/cpanel/etc/awstats.conf

    So that CPanel upgrades wont write over it.
     
    #1 JackDcrack, Nov 5, 2003
    Last edited: Nov 5, 2003
  2. JackDcrack

    JackDcrack Well-Known Member

    Joined:
    Aug 9, 2002
    Messages:
    52
    Likes Received:
    0
    Trophy Points:
    6
    For those of you that want to do it by hand, here are the instructions:

    First get the new awstats files :
    and untar into /usr/local/cpanel/3rdparty/bin

    PHP:
    All files listed in these instructions are located in:
    /
    usr/local/cpanel/3rdparty/bin

    BACKUP THE FOLLOWING FILES
    :
    awstats.pl
    all files in 
    /lib

    vi 
    or pico awstats.pl (the new 5.9 awstats.pl)

    FIND:
    sub Read_Config

    FIND
    :
    if (
    $configdir) { @PossibleConfigDir=("$configdir"); }
        else { @
    PossibleConfigDir=("$DIR","/etc/awstats","/etc/opt/awstats","/etc","/usr/local/etc/awstats"); }

    REPLACE WITH:
    if (
    $configdir) { @PossibleConfigDir=("$configdir"); }
        else { 
            
    my $homedir = (getpwuid($>))[7];
            
    my $awdir "$homedir"/tmp/awstats/";
            @
    PossibleConfigDir=("$DIR",$awdir,"/etc/opt/awstats","/etc/awstats","/etc","/usr/local/etc/awstats");
            }


    FIND:
    warning("$message");

    REPLACE WITH:
    #warning("$message");
    edit awstats.model.conf, set to the following variables
    (after editing move to /usr/local/cpanel/etc/awstats.conf
    PHP:
    LogFile="%LOGFILE%"
    SiteDomain="%DOMAIN%"
    HostAliases="%DOMAINS%"
    DNSLookup=%DNSLOOKUP%
    DirData="%AWSTATSDIR%"
    DirCgi="/tmp/awstats"
    DirIcons="/images/awstats"
    AllowToUpdateStatsFromBrowser=%BROWSERUPDATE%
    DNSStaticCacheFile="dnscache.%DOMAIN%.txt"
    DNSLastUpdateCacheFile="dnscachelastupdate.%DOMAIN%.txt"
     
    #2 JackDcrack, Nov 5, 2003
    Last edited: Nov 5, 2003
  3. Planet_Master

    Planet_Master Well-Known Member

    Joined:
    Apr 18, 2002
    Messages:
    233
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    New Yorker
    Excellent! Thx JDC
     
  4. WestBend

    WestBend Well-Known Member

    Joined:
    Oct 12, 2003
    Messages:
    173
    Likes Received:
    0
    Trophy Points:
    16
    Awesome :)

    THanks!!

    One question.. How can i have awstats show from a alias without them having to log into cpanel?
     
  5. JackDcrack

    JackDcrack Well-Known Member

    Joined:
    Aug 9, 2002
    Messages:
    52
    Likes Received:
    0
    Trophy Points:
    6
    As far as I know, the only way to do that securely, is to install AWstats seperately for each domain.
     
  6. WestBend

    WestBend Well-Known Member

    Joined:
    Oct 12, 2003
    Messages:
    173
    Likes Received:
    0
    Trophy Points:
    16
    Dumb Question.. What do you mean securely?
     
  7. JackDcrack

    JackDcrack Well-Known Member

    Joined:
    Aug 9, 2002
    Messages:
    52
    Likes Received:
    0
    Trophy Points:
    6
    Well...I am sure there is some way to create symbolic links to awstats.pl, but I don't know that it would work, and it could certainly cause security holes and other problems.

    Awstats comes with a seperate tool called:

    awstats_buildstaticpages.pl


    I think this merits some looking into.

    You could probably make a cron job to update the static pages every day or something
     
    #7 JackDcrack, Nov 6, 2003
    Last edited: Nov 6, 2003
  8. WestBend

    WestBend Well-Known Member

    Joined:
    Oct 12, 2003
    Messages:
    173
    Likes Received:
    0
    Trophy Points:
    16
    thats a GREAT link!!! Hadn't noticed it before under awstats tools (DOH!) thanks! this is exactly what I was looking for. Static Pages every 24 hours for end users
     
  9. WestBend

    WestBend Well-Known Member

    Joined:
    Oct 12, 2003
    Messages:
    173
    Likes Received:
    0
    Trophy Points:
    16
    I had a thought (rarely happens)

    I created a file called awstatsredirect.cgi
    cd /usr/local/cpanel/base/
    pico awstatsredirect.cgi

    Contents of file -----------------:

    PHP:
    #!/usr/bin/perl

    if ($ENV{'HTTP_HOST'ne "") {
            print 
    "Location: https://$ENV{'HTTP_HOST'}:2083/frontend/x/stats/awstats.html\n\n";
            exit;
    }

    print 
    "Location: https://$ENV{'REMOTE_ADDR'}:2083/frontend/x/stats/awstats.html\n\n";
    End Contents of file -----------------:

    chmod 755 awstatsredirect.cgi
    chown root:wheel awstatsredirect.cgi

    I then added to httpd.conf in the ScriptAlias section

    ScriptAlias /awstats /usr/local/cpanel/base/awstatsredirect.cgi

    Save the file. restart httpd

    now when i goto the http://www.domain.com/awstats it will automatically throw me to the exact same link cPanel would and force it to be SSL. The server then prompts for the same info cPanel would and voila..

    Now... do you think this opens a security hole anymore than if i had first logged into cPanel and then clicked the link that would throw me to the same url path as the redirect does?



    Also.. I was looking into this error awstats throws out because the HostAliases variable is blank when cPanel creates it.
    I see in your "manual" update method that you alter this variable with HostAliases="%DOMAINS%". Will the %DOMAINS% fill out the list of that vhost accounts domain names? Because the /usr/local/cpanel/etc/awstats.conf file that is already there has the same exact syntax you show (i havent upgraded yet) however the confs that are created in the vhost account areas do NOT have a list of their own domains..
     
    #9 WestBend, Nov 6, 2003
    Last edited: Nov 6, 2003
  10. JackDcrack

    JackDcrack Well-Known Member

    Joined:
    Aug 9, 2002
    Messages:
    52
    Likes Received:
    0
    Trophy Points:
    6
    No.

    Yes, it will fill out each domains .conf file to look something that looks like this:
    HostAliases="admin.domain.com www.domain.com"

    to look more at what is happening when you run
    /scripts/runweblogsnow
    take a look at the script:
    /usr/local/cpanel/cpanellogd

    (then do a search for awstats)
    and you will see how Cpanel puts the correct values into the variables.
     
  11. WestBend

    WestBend Well-Known Member

    Joined:
    Oct 12, 2003
    Messages:
    173
    Likes Received:
    0
    Trophy Points:
    16
    Ahh ok so it overwrites it everytime?

    That would explain why clicking the Update Now button in the awstats page gives that error i guess
     
  12. WestBend

    WestBend Well-Known Member

    Joined:
    Oct 12, 2003
    Messages:
    173
    Likes Received:
    0
    Trophy Points:
    16
    I ran the runweblogs script and get the same error.

    Update for config "/home/westbend/tmp/awstats/awstats.westbendweb.com.conf"
    With data in log file "/usr/local/apache/domlogs/westbendweb.com"...
    Warning: HostAliases parameter is not defined, awstats choose "westbendweb.com localhost 127.0.0.1".
     
  13. JackDcrack

    JackDcrack Well-Known Member

    Joined:
    Aug 9, 2002
    Messages:
    52
    Likes Received:
    0
    Trophy Points:
    6
    try deleting
    /home/westbend/tmp/awstats/awstats.westbendweb.com.conf
    then run:
    /scripts/runweblogs westbend
     
  14. WestBend

    WestBend Well-Known Member

    Joined:
    Oct 12, 2003
    Messages:
    173
    Likes Received:
    0
    Trophy Points:
    16
    same error.. i dont understand it
     
  15. JackDcrack

    JackDcrack Well-Known Member

    Joined:
    Aug 9, 2002
    Messages:
    52
    Likes Received:
    0
    Trophy Points:
    6
    Look at:
    /home/westbend/tmp/awstats/awstats.westbendweb.com.conf

    what is the value for HostAliases?
     
  16. WestBend

    WestBend Well-Known Member

    Joined:
    Oct 12, 2003
    Messages:
    173
    Likes Received:
    0
    Trophy Points:
    16
    SiteDomain="westbendweb.com"
    HostAliases=""
     
  17. JackDcrack

    JackDcrack Well-Known Member

    Joined:
    Aug 9, 2002
    Messages:
    52
    Likes Received:
    0
    Trophy Points:
    6
    What version of Cpanel/WHM?
    What version of AwStats?

    (it may be that you need to upgrade)
     
  18. WestBend

    WestBend Well-Known Member

    Joined:
    Oct 12, 2003
    Messages:
    173
    Likes Received:
    0
    Trophy Points:
    16
    WHM 8.5.4 cPanel 8.5.4-R7
    RedHat - WHM X v2.1.1

    Awstats 5.7 (havent done your howto yet :) )
     
  19. JackDcrack

    JackDcrack Well-Known Member

    Joined:
    Aug 9, 2002
    Messages:
    52
    Likes Received:
    0
    Trophy Points:
    6
    hmm...
    Well i dont know what to tell you...
    I had not allowed updates from within Awstats, until after I upgraded, So i dont know and it works fine for me.

    I would suggest backing up your files, then try upgrading to 5.9.

    If you are still having the same problem, then you know it is most likely a problem with 1 of these 2 scripts:
    /scripts/runweblogsnow
    /usr/local/cpanel/cpanellogd
     
  20. WestBend

    WestBend Well-Known Member

    Joined:
    Oct 12, 2003
    Messages:
    173
    Likes Received:
    0
    Trophy Points:
    16
    hmmm

    well i ran an update for the backend scripts.

    Still get the same stupid error.

    Any chance you can email me your runweblogs script so i can compare the two and see if the scripts are identical?
     
Loading...

Share This Page