Newbie's desperate cry for help installing script



This is a plea for help installing AWstats. I have tried from the command line. I get this message:
“Do you want to continue setup from this NON standard directory [yN]” and answer Y but it aborts after not being able to create directory /ect/awstats. Perhaps that is due to skipping the web server configuation question (which I read I could do)?

I have opened the awstats.model.conf (per Mark’s instructions in a previous post) to manually edit but I get completely lost. I have read the install instructions and get lost. I’m not a perl programmer by any means but I’ve managed to squeak by and install perl scripts before. This one has me stumped. I really don’t like Analog and use AWstats on a different host where it’s the default stats program. I’ve been spoiled by it and really would like to install AWstats for my dreamhost sites. Can anyone please help me?



[quote]You won’t have permission to create a directory under /etc.

Somehow you’ll have to tell it to go somewhere under your home area.

Yes, please. I would love to do that. Would you be able to help me with that?



[quote]Have you tried all the instructions?


Yes, as I said in my initial post, I’m not a programmer and I end up getting confused. The installation instructions are for someone who understands much more than I do.

[quote]* Step 0-2:

Once a config file has been automatically created (by, by your package installer or just by a manual copy of awstats.model.conf), it’s important to edit it manually and change the “MAIN PARAMETERS” to match all your needs

Yes…but if I only knew how and/or what to change the main parameters to. And, as I said previously, the aborts so the file is not automatically created.

[quote]This post might also be helpful.

Yes, that was Mark’s post I referred to in my first post.

[quote]Good luck,


Thanks, Bob. Looks like I’m really going to need it.

I guess I wasn’t clear enough in my first post. To any others reading this. I do web design and have gotten some scripts to run on other servers. So, though I might know a little of this or that, when I’m confronted with something like awstats installation, it’s like another language. I could probably do it if I had someone directing me or step-by-step instructions for installing on a DH server (which seems to throw the off). On my own - no way. That’s why I’m making this plea for help.

Is there anyone out there who can help step me through the set up, please?



I’ve installed it twice before just fine… but an upgrade might be good to have anyway. I’ll reinstall it later (give me a couple of hours - at work right now) and write down the steps for you :slight_smile:


Alright, here goes. Keep in mind this is just my way of installing AwStats and may not be exactly the setup you’re looking for. Works for me, though!

For the purpose of this guide, I’ll assume your username is myusername and your domain is :slight_smile:

  1. Create a directory inside your domain folder. We’ll call it “statistics”, but it can be anything you like - this is where you’ll go to look at your stats later.

  2. Grab the latest stable build of AwStats from, and upload it to your webspace.

  3. Make a directory called “awstats” in your home folder (/home/yourusername). Unpack the files into that directory - you should have a folder structure like this:

/home/yourusername/awstats/ /home/yourusername/awstats/tools/ /home/yourusername/awstats/wwwroot/and so on.

  1. Create a directory “data” inside /home/yourusername/awstats/ .

  2. Move the files in the /home/yourusername/awstats/wwwroot/cgi-bin/ directory into /home/yourusername/awstats/ .

  3. Move the icon, css, and js directories inside awstats/wwwroot into your output directory (/home/yourusername/ .

  4. Back into the awstats directory inside your home directory - copy awstats.model.conf to . Then open the new file for editing (or download it and open it).

  5. Make the following changes to the parameters:

  • Set LogFile to "/home/yourusername/logs/
  • Set SiteDomain to “
  • Set HostAliases to “
  • Set DNSLookup to 0
  • Set DirData to “./data/”
  • Set DirIcons to “icon”
  • Set SaveDatabaseFilesWithPermissionsForEveryone to 0
  • Set DefaultFile to “index.php index.html”
  1. Save (or save and reupload) the file.

  2. Now let’s see if everything is working. Enter this command:

perl /home/yourusername/awstats/tools/ -update -awstatsprog=/home/yourusername/awstats/ -dir=/home/yourusername/ on one line - I split it because it caused major horizontal scrolling!) It should happily work away for a couple of seconds.

  1. Now check the output folder (/statistics/) in your browser. Look at the file - does everything look good? Great! Then let’s setup a cron job to do this automatically.

  2. I like Pico for editing the crontab - type export EDITOR=pico12) Edit the crontab with crontab -eInsert this line:

0 3 * * * perl /home/yourusername/awstats/tools/ -update -awstatsprog=/home/yourusername/awstats/ -dir=/home/yourusername/ on one line again - important! Save and close - it should say something like “installing new crontab”. Now the script should run once a day at 3 am.

  1. You might want to put a .htaccess file with this line into your output directory:

DirectoryIndex will show the stats overview as the default index when you open that directory. You might also want to password protect it via the Dreamhost control panel.

Um, that’s it, I think! Of course you can make any other changes you deem useful to the config file, it’s decently commented. Also, if your log files are very large (you get lots of hits), you’ll probably have to run awstats more than once daily to put less strain on the server. There are some guidelines for that on the AwStats website. You’d have to change the logfile location in that case too, to use the current log (with my setup it picks the last rotated one).

Let me know if anything is unclear or doesn’t work!



Hi Skybly,

Thank you so much for the above steps. I feel like I’m really moving forward on this. I followed your directions and ran the command. The statistics directory is filled up with about 20 files now. The last line via telenet after running the command said: Main HTML page is ‘’. yet when I type that into browser I get the message: sh: /home/myusername/awstats/ /usr/bin/perl: bad interpreter: Permission denied
so I take it that’s not the way to view the stats file or something is wrong. :slight_smile:

I haven’t run the cron job yet. Can you tell from the error above what I might have done wrong?

Thanks again.




Hmm, I guess the script might not have the right permissions… can you check that all the .pl files in the awstats directory are chmodded to 755? Then execute the command again - it’s not showing you the error when you’re looking at the files, it actually wrote that error into the files.


I chmodded all the .pl files to 755 in the awstats directory. Now when trying to view the file I get the following: [i]Error: AWStats database directory defined in config file by ‘DirData’ parameter (./data/) does not exist or is not writable.

Setup (’/home/domain/awstats/’ file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in ‘docs’ directory). [/i]

I checked the config file and the DirData="./data/". I have a directory named “data” in the awstats folder. I just thought of something - when I did the chmod - I think I may have chmod the file to 755 as well. Do you think that could be the problem? Anyway, after I got the above error. I chmod the data directory to 777 thinking that might help but it didn’t. Any other thoughts as to what could be the problem? By the way, have I mentioned how much I appreciate your helping me? :slight_smile:


Aaah, my mistake! I just noticed that I gave you a bad DirData parameter! It should work if you set it to the full path, ie. “/home/yourusername/awstats/data” . After that, the script should hopefully work as expected! :slight_smile:


IT WORKS! It’s terrific! I also made the cron job. One more question. If I want to update the stats from the browser, I would just edit the conf file per the instructions, correct? Will this cause a problem with the cron job and/or are there any issues with updating the stats from the browser instead of the command line?

Thanks again. You’ve made my day!


Yay! You’re welcome, glad you got it working :slight_smile:

I haven’t set up AwStats to be updated from the browser before, but one thing you’d definitely have to do (apart from editing the config) is to move the awstats dir into a domain folder, so it’s accessible through the browser. However, I wouldn’t really recommend that for the following reasons:

  1. As pointed out in this thread, there’s a security hole in that could give people access to your website. This is not a problem if you keep the file out of the web directory (like in my setup above), but if it is inside the web directory and accessible to the public, it could be exploited.

  2. I may be wrong, but I believe updating through the browser causes a larger strain on the server than creating static pages does.

  3. There isn’t really a point in updating through the browser if you are using the same logfile that I do (access.log.0). That file always points to the latest rotated logfile, which should contain all log data of the previous day. Therefore, even if you update through the browser 5 times a day, you’ll only see fresh stats once daily.

You’d probably want to set up Awstats to use the current logfile for that purpose, but I believe - and I’m always getting confused about this! - that you might lose data this way. If you last updated your stats at 1 am, and the file gets rotated at 1:40 am, then I believe you’d be missing those 40 minutes from your stats.

I might be wrong about that, but that’s the impression I got. Corrections welcome :slight_smile:


Well, maybe I’ll just leave well enough alone. I’m happy I’ve now got awstats working and most grateful to you for helping me out. I suppose if I really wanted to update from the browser I could password protect the directory…would that solve the security issue? That’s the way it’s set up on the other host - I use a login to access it and it doesn’t seem to affect the data when I run it after it’s been run at night. However, I have no idea how they’ve set it up.

Anyway, thanks again!



Hi Skybly,
It looks like the cron job didn’t run. Here is what I have when I run pico:
0 3 * * * perl /home/username/awstats/tools/ -update-awstatsprog=/home/username/awstats/

Can you see anything I’ve done wrong?



Is all of that on one line? Pico tends to break the command into multiple lines, so you’ll have to move it back into one line when that happens.

Also, is there a space between “-update” and “-awstatsprog=[…]”? There should be one.

Apart from that, it looks ok to me… try copying & pasting the line out of Pico and onto the command line to see what happens :slight_smile:


Okay. I think it was because I didn’t have the space between -update and -awstatsprog.

By the way, how would I copy in pico? When I right click, select all, it only selects part of the command.

Also, it’s difficult to tell if it’s all on one line because no matter what I do it wraps the text due to the width of the editor window. I think I’ve got it all on one line though… :slight_smile:




Ah, it might depend on the program you are using, I guess? I use Putty and it shows the command on one line, you have to scroll to the right to see all of it. It copies the text just by selecting it… I have to do it in two steps too since it’s not all visible on the screen at the same time.


Ok. I use telnet. I didn’t realize there were different programs for that! Shows how little I know! lol
Selecting text via mouse doesn’t work very well but I’ll keep practising.


You can either copy / paste in the editor itself (pico, in this case) by cutting / marking text as per the help at the bottom of the screen, or you can copy / paste using the features available in the terminal emulator you’re using (this will vary).

To cut an entire line (in Pico) is ^K and to “uncut” (paste) is ^U (that’s control-k and control-u). I think that ^^ lets you set marks (that’s control-caret (^). I couldn’t get that to work right now, but maybe that’s a problem with not passing ^^ along.

I would definitely suggest PuTTY or SecureCRT on Windows over the default Windows telnet client (for a number of reasons).

By default, in PuTTY, you just highlight text to copy, and right mouse click or shift-insert (I think) to paste. You can change that to xterm style where middle-click pastes - that’s how I usually set it up.

The wrapping depends on the editor itself - pico handles long lines by wrapping to the width of the editor window, and providing a visual marker when the text goes past that on either side.


Thanks, Will! I will give that a try and I’ll look for PuTTY as well.



google. putty. “i feel lucky”