Friday, October 2, 2009

What is omserv running on port 764?

There is not much information on omserv running on port 764. By doing trial and error and using the lsof command, I found that omserv is actually nfslock. If you want to turn off this service (I surely do, since I don't know and use this service), issue the command:

chkconfig --levels 2345 nfslock off

This will remove the autoexecute of the nfslock. Afterwards, issue the command to stop the process:

/etc/rc.d/init.d/nfslock stop

To verify if you have stopped the service, type the command:

nmap localhost

Monday, August 3, 2009

Installing Squid as a Service

To install the Squid Proxy Cache Server as a service under Windows, issue the command:

c:\squid\sbin\>squid.exe -f c:\squid\etc\squid.conf -i -n Squid

The name of the service is "Squid". To verify, type the command "services.msc" and look up the name of "Squid" under the name services column.

Installing PostgreSQL as a Service

To install the PostgreSQL database as a Service under Windows, issue the command the the PostgreSQL directory as follows:

c:\pgsql\bin> pg_ctl -D c:\pgsql\data register -N PostgreSQL

In the above example, PostgreSQL is the name of the PostgreSQL service. Type the command "services.msc" to verify the name "PostgreSQL".

Sunday, July 19, 2009

Sample Size Formula

If you are at a lost as to how to determine your sample size, I suggest you use Taro Yamane's formula:

n = N /[1+N(e)^2]

where:

n = sample size
N = population size (the universe)
e = sampling error (usually .10, .05 and .01 acceptable error)
^ = raised to the power of

Blocking Sites Using Squid

Steps

1. Edit the squid.conf configuration file and add the following lines:

acl blocksites url_regex "c:\squid\etc\squid-block.acl"
http_access deny blocksites


2. Create the file "squid-block.acl" with the following pattern:

.playboy.com
.friendster.com
.facebook.com
porn
pornstars


This will block the sites with URL playboy.com, friendster.com, facebook.com and
pages with "porn" or "pornstars" entries.

3. Restart squid


Saturday, July 18, 2009

Compiling and Running Squid on Windows

The following compilation procedure has been tested on MS Windows XP Professional using Squid 3.0 STABLE 16, MinGW 5.1.4 and MSYS 1.0.11.rc-1, ActivePerl 5.1.

Steps

1. Download MinGW and MSYS from http://www.mingw.org
2. Download Squid source code from http://www.squid-cache.org
3. Download the Perl installer from http://www.activestate.com/activeperl/
4. Install MinGW under the directory c:\mingw
5. Install MSYS under the directory c:\msys. Indicate where mingw is located when prompted by MSYS.

6. Add the path to Windows for the following directories:

c:\msys\1.0\bin
c:\msys\1.0\mingw\bin
c:\msys\1.0\mingw\sbin
c:\mingw\bin



This is done by going to "Start->Settings->Control Panel->System icon->Advanced tab->Environment Variables button". Then under the "System Variables" grouping, Select the "Path" and choose "Edit" button. Add the above directories at the end by delimiting it with a semi-colon (;).

8. Unpack the Squid source code and copy it to the directory c:\msys\1.0\home\{username}\squid.

The source code is in tar.gz format. You can use the 7zip software from http://www.7-zip.org to unpack the source code.

9. At the MSYS terminal, go to the Squid source code directory and run the compile commands as follows:

$ cd /home/{username}/squid
$ ./configure --prefix=/usr/local/squid --enable-win32-service
$ make all
$ make install


This will create the Squid binaries in the following directory c:\msys\1.0\local\squid

10. You can now copy the folder of Squid binaries to your desired location like "c:\squid" or create an installer package for your other machines.

The MinGW and MSYS software are not needed by Squid once you are able to create its binaries under Windows.

11. Assuming that you have relocated the Squid binaries to c:\squid, edit the squid.conf configuration file to reflect the relative references to the file locations under Windows.

12. Initialize the cache by issuing the command:

c:\squid\sbin> squid.exe -z

The will create the cache folders and files under c:\squid\var\cache


13. Start the Squid server by issuing the command:

c:\squid\sbin\squid -f c:\squid\etc\squid.conf

This will start Squid and will load the configuration file squid.conf under the directory c:\squid\etc.

Sunday, July 12, 2009

Initializing, Starting, Stopping, and Accessing the PostgreSQL Server on Windows

This assumes that you have the PostgreSQL binaries for Windows and that you have placed it at "c:\pgsql" directory. To set up PostgreSQL, copy the "libpq.dll" file located in the directory "c:\pgsql\lib" to the "c:\windows\system32" directory as follows:

c:\pgsql\lib> copy libpq.dll c:\windows\system32


To initialize the database, create the data directory and initialize it by issuing the "initdb" command in the "c:\pgsql\bin" directory as follows:

c:\pgsql\bin>mkdir c:\pgsql\data
c:\pgsql\bin>initdb -D "c:\pgsql\data"


To start the database, type the "pg_ctl" command as follows:

c:\pgsql\bin> pg_ctl -D "c:\pgsql\data" -l logfile start

This will start the PostgreSQL database and create the database log file "logfile".

To stop the database, type the "pg_ctl" command as follows:

c:\pgsql\bin> pg_ctl -D "c:\pgsql\data" stop

To access the database at the DOS command prompt on Windows, type the command:

c:\pgsql\bin> cmd.exe /c chcp 1252
c:\pgsql\bin> psql