Installing WordPress-Website for Dummies

[tweetmeme source=”mrnitishkumar” only_single=”false”]

I have already written over this once, but even that time, I mentioned that “I am not expecting anyone to learn from this article that “How to make A Website out of WordPress” by this website, as my approach was kind of naïve and nursery kid’s learning”, but this topic was something that kept on tempting me and today I am back.

In fact, I was to design a website for my workplace for internal requirements, so I thought to revisit the instructions and pen them down for once, so that people wishing to do something like that could get the job done in one shot without much R & D.


Why a WordPress?

Reasons might be plenty.. from a Company to even a Coffee shop now days wanna have a site and their wordpressopinions on it. Yes!! blogs are here and they get recognition too, but a site is a little different thing look-wise and even bloggers wish to have their full control over their blogs, which online hosting like WordPress and Blogger couldn’t afford to provide for their right reasons.

Reasons are plenty for a WordPress based website. You may want to have a website to show off between your friends on the same LAN in some college like MNNIT, IIT, IIIT or some IIM or you may want to bring a community or even official platform for company insiders.

WordPress because, it seems to be the best solution against its competitors for Installation, Management, controls, scaling and even backup/ migration. In just few mins, even a Layman get a strongest of website running and he wonders that he never knew a single line of HTML.

Simplicity is power” That’s why WordPress. Otherwise technically speaking ..

WordPress is an open source CMS, often used as a blog publishing application powered by PHP and MySQL. It has many features including plugin architecture and a templating system (supports various themes that way). Used by over 300 of the 10,000 biggest websites, WordPress is the most popular blog software in use today.


My requirements this time ..

The purpose was be to build a one-stop website to provide a common platform for sharing information, internal news and more importantly a mean to interact with groups and individuals across the company (via group/ private chat solutions). The additional scope of the website was integrating all of our web modules running for different purposes mostly via web links only (easy way).

Additional features asked for were …

  1. All of the content needs to be secured via passwords and login would be required for access any of the content on website.
  2. Different pages required for different department/ groups, which will host posts from their side only (though all of the content would be subjected to moderation).
  3. Different levels and roles would be required to post/ modify the content like Administrator, Editor, Author, Contributor and reader with their controlled set of privileges.
  4. Intranet Chat facility requires having group/ private messaging support.
  5. Email facility would be limited to contact form that one could use to submit some query to any department and it will be mailed to designate email ID directly without being post on Website. (provided Internet facility available on server).
  6. News flash system that will show significant information scrolling on sidebars all the time.
  7. Integration with our other services (mostly via hyperlinks opening in tab or new windows) like Ticketing system, Training Modules, Monitoring System etc. The target would be to implement a single-sign-on for the similar web services like Training, Helpdesk etc.
  8. There might be possibly different sites for different networks that would be kept in sync5 by end of day or twice a week (based on feasibility).
  9. Optional Documents hosting that could allow viewing Doc, XLS and PDF documents online without converting them into HTML This feature could be utilized for hosting various policy documents or similar things.

I guess very generic yet professional kind of requirements these are, though one can always find what they want with a WordPress.


Installation requirements

You know that installation requirements always vary around what you need and what you could put in. In itself, WordPress isn’t a huge software package that you might be thinking about this side, but yes.. what platform you are going to use, matter more. You can make use of XAMP installation to bring Apache, MySQL and PHP at a place on Windows or you may like to use the natural Linux Platform.

Here I am going to use WordPress MU (separate project build for multi user environment) in place of normal WordPress though requirements and instructions would be the same.

Hardware requirements

RAM Required: Minimum 512 MB (In favour of OS nto WordPress)
Disk space: Installation doesn’t take even 50 MB, but it’s suggested to keep 1-2 GB space at least.

Software Requirements

Operating System: Linux\ Windows (We are using CentOS here)
System Software: Apache with Mod_Rewrite, PHP , MySQL and related components.
WordPress-MU: WordPress-MU package from http://mu.wordpress.org/latest.zip

Note: Internet required for easy Installation of packages and plug-ins, though all the packages could be installed and managed offline as well.

The Basic Installation

halo_wordpress

The way is as simplest as it could be, but still sometimes, people unknown from Linux terms bring mess for them, so even if longer list of steps, I am trying to bring a completely detailed set of instructions .. (obviously assuming though that you got your OS installed right ways)

  1. Type on console yum install httpd php mysql mysql-server mysql-devel php-gd php-mysql
  2. Start the web service, if not started. On server console type service httpd start followed by chkconfig httpd on
  3. Start MySQL service, if not started. On server console type service mysqld start followed by chkconfig mysqld on
  4. Edit /etc/httpd/conf/httpd.conf and search for AllowOverride None and replace the second occurrence of the same with AllowOverride All (essential step for Permalink structure, you will know later on). Restart the httpd service by service httpd restart.
  5. On Server Console type mysql and then on MySQL prompt type create database wordpress to create a blank database to host WordPress database in next steps. You can chose any other name than wordpress as well.
  6. Install FTP by command yum install vsftpd, then chkconfig vsftd on followed by service vsftpd start
  7. Edit /etc/vsftp/ftpusers and /etc/vsftp/user_list to comment out root entry in both. By default root is not allowed to login into ftp.
  8. Download the zip file from http://mu.wordpress.org/latest.zip
  9. Extract the same and rename the folder wordpress-mu to something suitable to the name you wish to have in url (e.g. We have atstoday in our case). We also could install the same in web root but in that case, it might have issues in other web app installations.
  10. Copy the same folder in web root directory /var/www/html and provide appropriate modifications rights the same folder and /tmp folder. (Hint: use WinSCP)
  11. Open http://IP_Address/Folder_Name in any browser, where IP_Address is IP Address of the server, you are installing and Folder_Name is name of the folder, you copied into web root.
  12. If everything is fine, then it will provide you the installation page and will ask for Database Connection details. First select radio button for Sub-directories in Blog Addresses option, then in next keep Database Name as wordpress as we given the same in step 4, User Name will be root, password would be blank or if any password you given for MySQL user named root, Database Host would be localhost, Server Address would be the IP_Address, Site Title would be the text you want to be displayed on title bar and then it requires to give an email id essential for password recovery.
  13. If everything goes fine, then it will show success message and will provide a generated33 password for admin user. Note down the password or copy it.
  14. Press the login button, login into the site, go to users in left pane, edit the user and then change the password as per your convenience.

Customizations – Themes and Plug-ins

The above procedure creates the basic install of WordPress-MU. For customization as per needs, you have to go through themes and various plug-ins available for WordPress.

Theme: If online, then we could use the search facility under Appearance->Theme to search, preview and download themes available on WordPress Database. Once downloaded, it will be available in offline install. There is option for uploading themes as well that could be used if Server not connected to Internet. We are using theme named Atahualpa with a few advanced customizations in code here and there.

Plug-ins: Plug-ins provides extension of capabilities for basic WordPress Install though depends on many factors. Currently we are using a few crucial plug-in like: My Category Order, Announcement ticker highlighter scroller, WP-UserOnline, Dagon Design Form Mailer, WP Customized Login, Members Only, PHPFreeChat, WordPress Database Backup and User Access Manager.

Backup and Restore

wordpress-must-dos

Post/ Categories/ Tags/ Comments Backup/ Restore: For taking backup of these contents, there is option to export all these in form of .xml file, in Tools->Export.

Similar way, Tools->Import could be used for importing the same.

Settings Backup/ Restore: Inclusion of WordPress Database Backup plugin makes the job little easy. As per settings, it could keep on mailing core database files in zipped format (*.bz2) to designated email ID (provided the server is on Internet) or there are options for taking manual backups by pressing button. For restoring from backup, you need to unzip the backup file first that would be some blog.bak.sql and then needed to restore it via command line in following manner.

mysql -h mysqlhostserver -u mysqlusername -p databasename < blog.bak.sql

Enter password: (enter your mysql password)

 

Migration from one server to another

That’s the toughest part of the work and not suggested to be performed by someone having not proper idea about MySQL, Apache, PHP etc. I am trying to put all the steps in some easy way here. Though there are better ways around to do this and its not suggested to follow these steps for some online site.. I am talking about local installs only. (In fact, only this part of instruction is something I think needs much enhancement as this way is prone to be buggy in complex environment)

Our assumptions are,

  • You have a completely configured and working WordPress based website at one server.
  • You got another server with fresh installation.

First of all, you need to perform the first six steps of basic installation as those are preparing steps. Now, you will have a blank database named wordpress ready in MySQL.

First use core backup file from original server and use the steps mentioned in Settings Backup/ Restore to place the same database (including settings/ post/ username/ passwords everything) in new server. In next, copy all the wordpress files that would be in /var/www/html/Folder_Name, in the similar location at new server.

After the same, you need to edit a few options in /var/www/html/Folder_Name/wp-config.php as per the new environment. Then, you need to manually update the new IP Address inside many tables of new database, provided you always used absolute links in your website all the time.

Here is a list of few crucial tables and values to edit.

  • siteurl value in wp_1_options table (provided you have only one blog under WordPress-MU otherwise change accordinly)
  • domain value in wp_blogs table
  • domain value in wp_site table

So, this is whole thing.. any further question.. you can always come up here and ask. I really miss that while studying, I wasn’t aware of this great thing, neither do I was in my starting job days.. hope many of you starting earlier than me.. good luck..

Now you can read updates from this blog delivered directly to your Nokia Smart Phone, download it here

Advertisement

Zabbix Server: Some issues and some tips

In addition to the implementation details, I wrote few days back, I would like the add up some precautions and resolution to some issues, which would sure make life with Zabbix little easier for newbie .


Keep the date time configuration correct: I really faced much trouble over this one. Before installation of any new server, make sure that you have chosen correct Timezone settings. For most of the version of Linux, you need to type setup on console and then go to timezone configuration and set as per yours (e.g. Asia/Kolkata) and then make the same entry in /etc/php.ini for variable date.timezone as well (e.g. data.timezone=Asia/Kolkata).

This is really an irritating bug at Zabbix side as client and server both the sides should use Server Timezone entry. But its not resolved till now and might be reason for trouble to many.

Problem I faced with it: I went really a lot of trouble with time settings with one of my zabbix servers. While all others were working fine, one was not giving any data on graphs. Although resolution worked in some other way, but I would like to give a few basics —

1. Verify all the settings like agents are referencing the right server or not

2. Check that whether ports are open or not.

The Server listens on 10051 and client listens on 10050. Now, How to Check open Ports in Linux? Although there are many ways to do the same, but simpler is using netstat

# netstat –ntulp

It will show all open ports and also that which process is using them. You must find 10051 port opened on Server.

3. Check the latest data under monitoring tab (My case) This provides you info about clients that when you last moment received data from them and what data. In my case, I found that my clients received data in future time that’s why there was nothing on the graph as it was checking data in past time.

I struggled a lot, but found only one solution that was to delete all the clients from Zabbix and then import the same configuration again. When you delete one host, then it delete all the logs related to it and that’s why when you re-import the configuration then it will start-a-fresh. Thats why I insist on making a backup of all configuration once, coz after then for recreating whole thing, you need just an import and then recreating screens. 🙂


Increase the upload size in php.ini: For using the above feature, its a necessary step as  many times the size of xml file might exceed the default 2mb. Find the maximum_upload_size and increase to be at least 8mb from 2mb (default).


Copying Configuration is better in place of creating new: For Linux Servers, copy all the  configurations/ items/ graphs etc from the Linux Based Zabbix Server itself, while for Windows, you need to configure one first and then copying all the entry to other in similar manner as was in Linux Servers.


Replace CPU Utilization Screen with Memory Utilization: Although it depends on your requirements, but for me in general, its better to replace CPU Utilization screen with a custom made Memory Utilization screen made of items Total Memory and Free Memory as CPU Load data is sufficient to monitor CPU Health in most of the cases.


Make a configuration backup once you are done with adding your servers: This is the most important thing as it helps you out in quickly restoring the things, if want to migrate the whole thing to new server in case of any problem in original server. You need to use Export feature of existing server to export a xml file (might be >2 mb) and then import it once you done with installing a fresh server or existing server. Then you will be needed to change the Server IP in all client’s zabbix agent configurations (/etc/zabbix/zabbix_agentd.conf in Linux and c:\program files\zabbix agent\zabbix_agentd.conf in windows) and restarted their zabbix services.

Create a slideshow for all the servers: This is a feature, which makes it look more cool. Create a slideshow of all the screens, you create and it will keep it changing in specified time duration (default is 5 secs), which is quite better, comfortable and effective than changing the screens yourself to take a look. You could make very good use of a projector with this feature 😉

 

Making Zabbix Monitoring Server from Scratch: The Dummies Manual

[tweetmeme source=”mrnitishkumar” only_single=”false”]

Update: Wrote this post long back.. just was meant to show that how easy it could be…many things needs to be Add to Google Buzzupdated in reference to new features and UI.. will update soon. Recently I received a book over Zabbix from Packt Publicing. Amazing book and probably the only available for the same. Worth buying….

“ How we system administrators work in case of any trouble? If something goes down or anything wrong would have happened and we get asked about how it happened? We just run into logs or try to guess what would have been happened, was it high CPU, low disk space or tremendous network traffic? Sometimes we get our answers, sometime not and we keep on saying ourselves that we can’t be everywhere to monitor each and everything all the time. But it’s the time to update yourself and get optimized. I went through a few of monitoring solutions and with their pros and cons, finally I got settled with the Open Source Solution developed by Zabbix SIA. ”

 

What is Zabbix? Before the configuration and installation part, I am starting with a little history.zabbix1_thumb Zabbix is a network management system application created by Alexei Vladishev in 1998 (public release in 2001) to monitor and track the status of various network services, servers, and other network hardware. Zabbix uses MySQL, PostgreSQL, SQLite or Oracle to store data. Its backend is written in C and the web frontend is written in PHP and javascript.

Zabbix offers several monitoring options. Simple checks can verify the availability and responsiveness of standard services such as SMTP or HTTP without installing any software on the monitored host. A Zabbix agent can also be installed on UNIX and Windows hosts to monitor statistics such as CPU load, network utilization, disk space, etc. As an alternative to installing an agent on hosts, Zabbix includes support for monitoring via SNMP, TCP and ICMP checks, IPMI and custom parameters. Zabbix supports a variety of real-time notification mechanisms, including XMPP.


Installation and Configuration to monitor Windows\ Linux Servers:

Although I tried and found it extremely efficient , but even then I didn’t went along with the wonderful easy install procedure made by Brendon Baumgartner, not due to some fault in that one, but due to inherent problems with I guess not stable yet latest version of zabbix. But I sure be waiting for BB to write other magic scripts in the same way to make things one Enter only.

Here comes the way, I followed to install zabbix in manual way over the servers.

Step by Step Implementations with details:

Base machine: As for most of Linux Development I choose, even here I am choosing CentOS as the base system to build the solution upon. One should go for at least CentOS 5.x as there are a few options not available with older CentOS 4.x. As per recommendation for CentOS, machine should have at least 512 MB RAM and decent processor, LAN card etc. and although not kind of requirement but the machine should has ample space in it to store logs for as many days.

As usually I do, installation was customized with 1GB swap, 200 MB of boot partition, all PHP/ MySQL related packages checked, all libraries checked, SendMail package checked. In next, as the installation will pull updates, packages from internet directly, so Ethernet configurations should be ready and internet should be working fine over the same machine. Also note that it would be around 27-28 mb download size in total while installation.

Pre-requisites for the installation:

First of all, we need to finish installation/ update of all required packages in reference with zabbix installation.

yum install httpd php mysql mysql-server mysql-devel php-gd php-mysql php-bcmath gcc net-snmp net-snmp-libs net-snmp-utils net-snmp-devel curl-devel

Once finished with this, one need to check whether the crucial components are configured to start with the system and are working well.

# service httpd start
# chkconfig –add httpd
# chkconfig httpd on
# service mysqld start
# chkconfig –add mysqld
# chkconfig mysqld on

Possible issues and resolutions first:

Need to check whether things are working fine.

# mysql –u root

This should leave one to MySQL prompt, if not then need to check. In next, need to check whether httpd is working fine (Apache is properly installed and configured). Type the IP Address of the target Zabbix Installation Server in browser from some other computer, if you are able to see Apache page, then its fine otherwise you will be needed to check things like SELINUX.

How to check selinux status?

Execute the following command:

# sestatus

If its showing it enabled, then could disable it by

# setenforce 0

To permanently disabled the same, we need to do some editing in configuration file, otherwise it will be back with the next boot

# vi /etc/selinux/config

The file must look like (after setting SELINUX=disabled)

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing – SELinux security policy is enforced.
# permissive – SELinux prints warnings instead of enforcing.
# disabled – SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted – Only targeted network daemons are protected.
# strict – Full SELinux protection.
SELINUXTYPE=targeted

Check if the browser started opening apache page after this, if yes, then we are done, otherwise should look down in /var/log/httpd/error.log for other possible reasons.

Installation and configuration steps:

Here I am assuming that you are using CentOS 5.x as base, otherwise the configurations might be altered.

# cd /usr/src
#wget
http://internap.dl.sourceforge.net/sourceforge/zabbix/zabbix-1.4.5.tar.gz
# tar zxf zabbix-1.4.5.tar.gz
# cd zabbix-1.4.5
# mysql -u root
# mysql> create database zabbix;
# mysql> quit
# cat create/schema/mysql.sql | mysql -u root zabbix
# cat create/data/data.sql | mysql -u root zabbix
# cat create/data/images_mysql.sql | mysql -u root zabbix
# ./configure –enable-server –enable-agent –with-mysql –with-net-snmp –with-libcurl
# make install
# mkdir /etc/zabbix
# cp misc/conf/* /etc/zabbix
# groupadd zabbix
# useradd -g zabbix zabbix
# chown zabbix:zabbix /usr/local/sbin/zabbix*
# cp misc/init.d/redhat/8.0/zabbix* /etc/init.d
# vi /etc/init.d/zabbix_agentd

change BASEDIR=/opt/zabbix to BASEDIR=/usr/local/sbin

change FULLPATH=$BASEDIR/bin/$BINARY_NAME to FULLPATH=$BASEDIR/$BINARY_NAME

# vi /etc/init.d/zabbix_server

Make the same changes as above.

# chkconfig –add zabbix_agentd
# chkconfig –add zabbix_server
# chkconfig –level 3 zabbix_server on
# chkconfig –level 3 zabbix_agentd on

Now, installing the web application….

# mkdir /var/www/html/zabbix
# cp -R frontends/php/* /var/www/html/zabbix
# chown apache:apache /var/www/html/zabbix/conf
# vi /etc/php.ini

Find resource limits section and change max_execution_time to 300

;;;;;;;;;;;;;;;;;;; ; Resource Limits ; ;;;;;;;;;;;;;;;;;;;

max_execution_time = 300 ; Maximum execution time of each script, in seconds

Also make changes for date.timezone entry, it should be commented, uncomment it and set it accordingly like in case of India ..

date.timezone=ASIA/CALCUTTA

At the end, start zabbix services

# service zabbix_server start
# service zabbix_agentd start

Add zabbix ports to be listened to the configuration of services.

# vi /etc/services

And put the following two lines at the very end of the file.

zabbix_agent 10050/tcp # Zabbix ports
zabbix_trap 10051/tcp

Zabbix Server console installation is ready to and web installation is ready to go from here.

After finishing all the above steps, now go to url http://IP_ADDRESS/zabbix (Here IP_ADDRESS is what you have given to the server Ethernet port)

It should ask for installation steps, if you have followed my steps exactly, then it must go like next, next only. After finishing all the steps, you will get a login prompt, user name will be admin here and password is blank. After login, go to profile link and change the password to whatever suits to you. Logout and login again. Click monitoring and then go to screens in second row. You should get five screens on the same page for the zabbix server itself. One screen must be having map only. Check that rest all showing you graphs or not. If yes, then server side work is done and you are ready to move towards adding clients.

Zabbix Agent Installation over Linux Clients:

First part is to download the appropriate zabbix agent package from the official page. I assume, your clients (Servers to monitor) are updated and have kernel at least 2.6.x (If not then choose the suitable package).

# yum install net-snmp net-snmp-libs net-snmp-utils net-snmp-devel curl-devel (Optional)
# groupadd zabbix
# useradd -g zabbix zabbix
# cd /usr/src
#wget
http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/1.8/zabbix-1.8.tar.gz/download
# tar zxvf zabbix-1.8.tar.gz
# cd zabbix-1.8
# chmod 7555 *
# ./configure -enable-agent -with-mysql -with-net-snmp -with-libcurl
# make install
# chown zabbix:zabbix /usr/local/sbin/zabbix*
# mkdir /etc/zabbix
# cp misc/conf/* /etc/zabbix
# cp misc/init.d/redhat/8.0/* /etc/init.d
# chmod +x /etc/init.d/zabbix_*

Now, Change the binary location to /usr/local/sbin

# vi /etc/init.d/zabbix_agentd

In next, make the zabbix agent point to your Zabbix Server by putting Server’s IP Address in configuration file of agent

# vi /etc/zabbix/zabbix_agentd.conf

And as final step on client side, set up the services

# chkconfig –add zabbix_agentd
# chkconfig –level 3 zabbix_agentd on
# service zabbix_agentd start

Getting the graphs from data coming from agents:

You will see that Zabbix Server itself added in the WebUI. In place of creating a new monitoring scenario, first it’s easier to copy the same entries to the newly added Linux Servers.

Go to Hosts, create a new host with the name of your agent (whatever name you choose), select group as Linux Server, then put the right IP Address and set the tab below to it on IP Address and save.

After this, go to Items, from combo box at right top, select zabbix server, it will show up items already configured for zabbix server, you need to select all the items and press copy selected items to button at the bottom and then when it will show the list of all templates and hosts configured, choose the one, you just created.

From here, you have setup items to fetch data from agent, now how to use it. Go to graphs, from right top select zabbix server and copy all the graphs to newly created server. Graphs are ready from here.

Finally, make a screen to monitor. Make a screen of 2×2 and give it the name as per your choice. Once screen created, click edit. Then configure CPU Loads, CPU Utilization, Disk Space and Network Utilization graphs for the agent, you setup and you are ready to monitor your Linux Server.

Zabbix Agent Installation over Windows Clients:

I find Windows Installation easier in first part and little bit complicated in second part. First need to download the windows agent from here

http://www.zabbix.com/downloads/1.8/zabbix_agents_1.8.win.zip

Then install it and it will ask for server IP Address, give zabbix server’s IP Address. Now, go to WebUI of Zabbix Server, Create host/items/graphs/screens in similar ways and you are ready to go.

There are many features that are there in Linux Agent but nowhere in Windows one. One workaround is to use data fetched from Windows Performance Monitor (permon.exe).

For example: Network Utilization

Go to cmd, type typeperf –qx |find “Network” >c:\network.txt

Now, check the network.txt file created in C: drive, it would be containing the exact network resource/ variable name for bytes sent and bytes received.

Now, how to call it?

Go to C:\program files\zabbix agent\zabbix_agentd.conf

Add something like following lines at the end…

PerfCounter= Server1NetIn,"\Network Interface(Intel Pro Server Adapter)\Bytes Received/sec",60
PerfCounter= Server1NetOut,"\Network Interface(Intel Pro Server Adapter)\Bytes Sent/sec",60

Note that the value placed in inverted commas is exactly the same, which you must have obtained from that network.txt file. Restart the Zabbix Service from services.msc. Now, go to Zabbix Server WebUI, create an item in target Windows Server area with any name for Network and put Server1NetIn or Server1NetOut as key. Save item and you are ready to use it in your graphs 🙂

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

Sarg-The Layman Reporting Tool For Squid

So, you got your Squid Proxy Server up and running, got your management impressed and moved into a controlled scenario. But is that really make full sense, if you still don’t know what exactly going on under Squid? I mean who is accessing what and for how much time and in what way etc. etc. Only after this knowledge, you would be able to know what to block next or what to allow!

Yes! the basic way is to go through /etc/squid/access.log, but considering the huge size of this access log file, its not convenient at all, neither the format of access.log itself that pretty to read or present. What we require is a tool that could tell us things like who’s accessing what and how much traffic has been passed through squid like stuffs? Here is our simplest solution: SARG – Squid Analysis Report Generation

Here are a few screenshots to give you an idea that what it can do for you

Report link over a period

Users statistics

What users are downloading

Which sites are being accessed

The last screenshot tells us that which sites a particular user/ IP address is accessing and the first-n-second screenshots tells us that how much traffic is passing through Squid and what is the distribution? Probably much of what we actually wanna know.



Here it comes that how to get it in action in layman’s way:

Getting SARG Installed: First you need your apache running means you must be able to get your apache page on hitting http://localhost and then proceed to get the RPM for SARG first. As I am taking the case of CentOS, so the way is to do

wget http://dag.wieers.com/rpm/packages/sarg/sarg-2.2.1-1.el4.rf.i386.rpm

This will download this 306 kb rpm to your current directory and then you just need to do

rpm –i sarg-2.2.1-1.el4.rf.i386.rpm


Configuring SARG: It places a sarg.conf in /etc/httpd/conf.d to take care of sarg-reports web form, while the other sarg.conf places itself in /etc/squid, where you need to edit it and commenting the line deny from all, which actually enabling only localhost to see the reports and denying all others. After that you can either place allow from all or write lines for providing report access to certain defined IP addresses only. After that just type the below and you are ready to go:

service httpd restart


Running SARG: SARG automatically places its scripts in /etc/cron.daily,  /etc/cron.weekly, /etc/cron.monthly, which will keep on performing its job without any intervention required. You need not to do anything for it. Although if you want to generate a one-shot SARG report, then you can always use

sarg -ix


Hope you will like the way, it does the job of Squid reporting for you in most simplest yet most effective way. In next, I will try that how can these reports could be customized to make most of it.

photo of Nitish KumarNitish Kumar