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

Yamane's 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



Note:

This particular formula has been called Slovin's formula here in the Philippines but I kind of doubt the attribution.  I still cannot find the actual work of Slovin but Taro Yamane's work is set out clearly in his book referred below (I got a copy but this is already out of print) including the derivations of the formula.  So while a lot of Statisticians here in the Philippines calls this Slovin's formula, I continue to assert that it is Yamane's formula until I can see the actual work of Slovin. 



--------------------
Reference

Yamane, Taro. 1967.  Statistics:  An Introductory Analysis, 2nd Edition, New York.  Harper and Row.

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

Compiling PostgreSQL on Windows

The following compilation procedure has been tested on MS Windows XP Professional using PostgreSQL 8.4.0, MinGW 5.1.4 and MSYS 1.0.11.rc-1.

Steps

1. Download MinGW and MSYS from http://www.mingw.org
2. Download PostgreSQL source code from http://www.postgresql.org
3. Download the zlib compression library from http://www.zlib.org
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 (;).

7. Install the zlib library:

a) Unpack the zlib in MSYS (c:\msys\home\{username}\zlib)
b) Run MSYS by typing the msys.bat file in c:\msys\1.0
c) At the MSYS terminal, type the following:

$ cd /home/{username}/zlib
$ make -f win32/Makefile.gcc


d) Copy the zlib1.dll to c:\mingw\bin
e) Copy the libzdll.a and libz.a to c:\mingw\lib
f) Copy the zlib.h and zconf.h to c:\mingw\include


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

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 PostgreSQL source code directory and run the compile commands as follows:

$ cd /home/{username}/postgresql
$ ./configure
$ make
$ make install


This will create the PostgreSQL binaries in the following directory c:\msys\1.0\local\pgsql

10. Create the default data directory for PostgreSQL as "c:\msys\1.0\local\pgsql\data"

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

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

Monday, June 29, 2009

Web-based Administration of PostgreSQL

The web-based administration tool for PostgreSQL is the "phppgadmin" software. The software is freely downloadable at the "http://phppgadmin.sourceforge.net" website.

To install the phppgadmin on Ubuntu 9.04, issue the command:

# apt-get install phppgadmin

Afterwards, the phppgadmin is now accessible using the browser at the localhost address of "http://localhost/phppgadmin".


Common Problem

1. You cannot access the database using the "postgres" user.

Solution:

login as postgres user and create another administrator user as follows:

# su postgres
$ psql
$ createuser myadmin

When prompted if the user will be "administrator", choose "yes" as follows:

postgres@asus:/home/clemrasul$ createuser
Enter name of role to add: myadmin
Shall the new role be a superuser? (y/n) y

Then, use the new administrator username and password to login into the phppgadmin web interface.



GUI Administration of PostgreSQL

The graphical user interface (GUI) administration tool for PostgreSQL is "pgadmin". To install "pgadmin" on Ubuntu 9.04, issue the command:

#apt-get install pgadmin3

This will install the "pgadmin" software under "Applications -> Programming -> PgAdmin III".

Accessing PostgreSQL on CLI

The command line interface (CLI) of PostgreSQL is called "psql". To access the PostgreSQL server, issue the following commands:

# su postgres
$ psql

The first command is to shift from the "root" user to the "postgres" user. PostgreSQL does not allow "root" login. Instead, it uses the "postgres" user as the default administrator of the system.

The second command is to invoke the "psql" CLI under the user "postgres".

The following is the screen example of the above-mentioned command.

root@asus:/etc/init.d# su postgres
postgres@asus:/etc/init.d$ psql
Welcome to psql 8.3.7, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

postgres=#


Given the psql, you can now create databases and users.

Installing PostgreSQL on Ubuntu

What is PostgreSQL?

PostgreSQL is a production-grade multi-platform SQL database system. The database system is ANSI SQL92/99 compliant. The software is freely downloadable at http://www.postgresql.org website and is licensed under the BSD open source license.


Installation

To install PosgreSQL on Ubuntu 9.04, issue the command:

# apt-get install postgresql


To start PostgreSQL, issue the command:

#/etc/init.d/postgresql-8.3 start

To restart PostgreSQL, issue the command:

#/etc/init.d/postgresql-8.3 restart

To stop PostgreSQL, issue the command:

#/etc/init.d/postgresql-8.3 stop


More Notes

a) Default port of PostgreSQL is "5342"
b) Default database administrator username is "postgres"
c) Default database template is "template1"


Limits


According to the PostgreSQL website, the following are PostgreSQL 8.3 limits:


LimitValue
Maximum Database SizeUnlimited
Maximum Table Size32 TB
Maximum Row Size1.6 TB
Maximum Field Size1 GB
Maximum Rows per TableUnlimited
Maximum Columns per Table250 - 1600 depending on column types
Maximum Indexes per TableUnlimited




License Text

License

PostgreSQL is released under the BSD license.

PostgreSQL Database Management System
(formerly known as Postgres, then as Postgres95)

Portions Copyright (c) 1996-2008, The PostgreSQL Global Development Group

Portions Copyright (c) 1994, The Regents of the University of California

Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies.

IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.

Wednesday, June 24, 2009

Restricting Access of Local Users to SSHD

How to restrict access of local users to the OpenSSH services?

Step 1: Assuming you want to restrict the user "myfriend", edit the "/etc/ssh/sshd_config" file:

# vi /etc/ssh/sshd_config

Step 2: Insert the following line in the file:

DenyUsers myfriend

Step 3: Save and restart your SSH server:

# /etc/rc.d/init.d/sshd restart


Tested

I have tested the above procedure on CentOS 5.3 with OpenSSH as the SSH server software.


Furthermore

(a) For two or more users, the format of the "DenyUsers" directive is as follows:

DenyUsers user1 user2 user3 user4

(b) To restrict groups, the directive is "DenyGroups". The format is as follows:

DenyGroups group1 group2 group3 group4

Monday, June 22, 2009

Installing DenyHosts

What is DenyHosts?

DenyHosts is a small python program created by Phil Schwartz which is intended to stop SSH attacks by adding an entry to the /etc/hosts.deny file on UNIX/LINUX systems based on the number of failed logins.


Software License

The program is licensed under the General Public License (GPL) version 2.


Download

The program can be downloaded from http://denyhosts.sourceforge.net/


Installing DenyHosts

Using an rpm package of DenyHost, issue the command as "root" user:

# rpm -Uvh DenyHosts-2.6-python2.4.noarch.rpm


DenyHost Files

/usr/bin/denyhosts.py
/usr/lib/python2.4/site-packages/DenyHosts/__init__.py
/usr/lib/python2.4/site-packages/DenyHosts/__init__.pyc
/usr/lib/python2.4/site-packages/DenyHosts/allowedhosts.py
/usr/lib/python2.4/site-packages/DenyHosts/allowedhosts.pyc
/usr/lib/python2.4/site-packages/DenyHosts/constants.py
/usr/lib/python2.4/site-packages/DenyHosts/constants.pyc
/usr/lib/python2.4/site-packages/DenyHosts/counter.py
/usr/lib/python2.4/site-packages/DenyHosts/counter.pyc
/usr/lib/python2.4/site-packages/DenyHosts/daemon.py
/usr/lib/python2.4/site-packages/DenyHosts/daemon.pyc
/usr/lib/python2.4/site-packages/DenyHosts/deny_hosts.py
/usr/lib/python2.4/site-packages/DenyHosts/deny_hosts.pyc
/usr/lib/python2.4/site-packages/DenyHosts/denyfileutil.py
/usr/lib/python2.4/site-packages/DenyHosts/denyfileutil.pyc
/usr/lib/python2.4/site-packages/DenyHosts/filetracker.py
/usr/lib/python2.4/site-packages/DenyHosts/filetracker.pyc
/usr/lib/python2.4/site-packages/DenyHosts/lockfile.py
/usr/lib/python2.4/site-packages/DenyHosts/lockfile.pyc
/usr/lib/python2.4/site-packages/DenyHosts/loginattempt.py
/usr/lib/python2.4/site-packages/DenyHosts/loginattempt.pyc
/usr/lib/python2.4/site-packages/DenyHosts/old-daemon.py
/usr/lib/python2.4/site-packages/DenyHosts/old-daemon.pyc
/usr/lib/python2.4/site-packages/DenyHosts/plugin.py
/usr/lib/python2.4/site-packages/DenyHosts/plugin.pyc
/usr/lib/python2.4/site-packages/DenyHosts/prefs.py
/usr/lib/python2.4/site-packages/DenyHosts/prefs.pyc
/usr/lib/python2.4/site-packages/DenyHosts/purgecounter.py
/usr/lib/python2.4/site-packages/DenyHosts/purgecounter.pyc
/usr/lib/python2.4/site-packages/DenyHosts/python_version.py
/usr/lib/python2.4/site-packages/DenyHosts/python_version.pyc
/usr/lib/python2.4/site-packages/DenyHosts/regex.py
/usr/lib/python2.4/site-packages/DenyHosts/regex.pyc
/usr/lib/python2.4/site-packages/DenyHosts/report.py
/usr/lib/python2.4/site-packages/DenyHosts/report.pyc
/usr/lib/python2.4/site-packages/DenyHosts/restricted.py
/usr/lib/python2.4/site-packages/DenyHosts/restricted.pyc
/usr/lib/python2.4/site-packages/DenyHosts/sync.py
/usr/lib/python2.4/site-packages/DenyHosts/sync.pyc
/usr/lib/python2.4/site-packages/DenyHosts/util.py
/usr/lib/python2.4/site-packages/DenyHosts/util.pyc
/usr/lib/python2.4/site-packages/DenyHosts/version.py
/usr/lib/python2.4/site-packages/DenyHosts/version.pyc
/usr/share/denyhosts/CHANGELOG.txt
/usr/share/denyhosts/LICENSE.txt
/usr/share/denyhosts/README.txt
/usr/share/denyhosts/daemon-control-dist
/usr/share/denyhosts/denyhosts.cfg-dist
/usr/share/denyhosts/plugins/README.contrib
/usr/share/denyhosts/plugins/shorewall_allow.sh
/usr/share/denyhosts/plugins/shorewall_deny.sh
/usr/share/denyhosts/plugins/test_deny.py
/usr/share/denyhosts/scripts/restricted_from_invalid.py
/usr/share/denyhosts/scripts/restricted_from_passwd.py
/usr/share/denyhosts/setup.py


Tested

The installation of the program is fairly easy. I have tested it under CentOS 5.3 with Python 2.4 installation.


Installation Instruction

Read the README.txt file. The README.txt files contains a clear installation instruction for the program. This file is reproduced below:


DenyHosts is a utility developed by Phil Schwartz which aims to
thwart sshd (ssh server) brute force attacks.

Please refer to http://www.denyhosts.net/faq.html

INSTALLATION:
=============

SOURCE DISTRIBUTION
===================

If you downloaded the source distribution file (DenyHosts-#.#.#-tar.gz)
then:

$ tar zxvf DenyHosts-#.#.#-tar.gz (Where #.#.# is the version)

$ cd DenyHosts-#.#.#

as root:

# python setup.py install

This will install the DenyHosts modules into python's site-packages
directory.

BINARY DISTRIBUTION (rpm, deb, etc)
===================

It is assumed that you are familiar with installing a binary package
on your particular operating system. If you are unsure how to do
this, you may wish to install from souce instead.


ALL DISTRIBUTIONS
=================

Once you have installed DenyHosts, by default the directory
/usr/share/denyhosts will be created and a sample configuration
file will be copied into it. A sample daemon-control script will
also be copied into the /usr/share/denyhosts directory.

DenyHosts requires that a configuration file be created before
it can function. The sample configuration file denyhosts.cfg-dist
contains most of the possible settings and should be copied and
then edited as such:

# cp denyhosts.cfg-dist denyhosts.cfg

# denyhosts.cfg

(where is your preferred text editor such as emacs, vi, etc)

The sample configuration file contains informational comments that
should help you quickly configure DenyHosts. After you have
edited your configuration file, save it.

Next, if you intend to run DenyHosts in daemon mode (recommended)
copy the sample daemon-control.dist script as such:

# cp daemon-control-dist daemon-control

Edit the daemon-control file. You should only need to edit this section
near the top:

###############################################
#### Edit these to suit your configuration ####
###############################################

DENYHOSTS_BIN = "/usr/bin/denyhosts.py"
DENYHOSTS_LOCK = "/var/lock/subsys/denyhosts"
DENYHOSTS_CFG = "/usr/share/denyhosts/denyhosts.cfg"


These defaults should be reasonable for many systems. You
should customize these settings to match your particular
system.

Once you have edited the configuration and daemon control files
make sure that the daemon control script it executable (by root).

# chown root daemon-control

# chmod 700 daemon-control


STARTING DENYHOSTS MANUALLY
===========================

Assuming you have configured DenyHosts to run as a daemon, you
can use the daemon-control script to control it:

# daemon-control start

You should refer to the daemon log (typically /var/log/denyhosts)
to ensure that DenyHosts is running successfully. If you
notice any problems you may wish to consult the FAQ at
http://www.denyhosts.net/faq.html

If you wish to run DenyHosts from cron rather than as a
daemon, please refer to the FAQ.


STARTING DENYHOSTS AUTOMATICALLY
================================

METHOD 1 (preferred)
====================

Create a symbolic link from /etc/init.d such as:

# cd /etc/init.d

# ln -s /usr/share/denyhosts/daemon-control denyhosts

If you have chkconfig installed you can then use it to
ensure that DenyHosts runs at boot time:

# chkconfig --add denyhosts


If you do not have chkconfig (or similar) installed you can either manually
create the symlinks in /etc/rc2.d, /etc/rc3.d, /etc/rc5.d but that is beyond
the scope of this document.

METHOD 2
========

Add an entry into the /etc/rc.local file:

/usr/share/denyhosts/daemon-control start


Monday, May 4, 2009

Installing PHP on Ubuntu

To install PHP on Ubuntu 8.10, issue the following command:

#apt-get install php5
#apt-get install libapache2-mod-php5

Friday, May 1, 2009

Disallow Root Login on SSHD

To disallow root login access on ssh, open the file "/etc/ssh/sshd_config" and edit or add the line:

PermitRootLogin no

Then restart your sshd server:

#/etc/rc.d/init.d/sshd restart

Installing Dovecot on CentOS

To install the Dovecot on your CentOS 5.2 server, issue the command:

#yum install dovecot

If you are installing the RPM package that comes with the CD, the command to install dovecot is:

#rpm -Uvh dovecot-1.0.7-2.el5.i386.rpm

What is port 111 on my CentOS box?

Port 111 on my CentOS 5.2 box is the "portmap" service. You can turn this off by issuing the following command:

#/etc/rc.d/init.d/portmap stop

By default, this is turned on my machine. So upon reboot of your machine, expect that is again turned on. If you want to set the default execution to off, issue the command:

#chkconfig --levels 2345 portmap off

Sunday, April 26, 2009

Home Directory of Solaris

The default home directory of Solaris 2008.11 is "/export/home". This location is different from all distributions of Linux which places the user's home directories under "/home".

Installing Flash Player on Firefox under Solaris 2008.11

The following are the steps on how to install the flash player in Firefox under Solaris 2008.11:

1. Download the flash player package at the www.adobe.com website (flash_player_10_solaris_x86.tar.bz2)

2. Unpack the package by clicking on the file and clicking the "extract" button

3. On the extracted directory, copy the file (libflashplayer.so) and place it under the directory "/usr/lib/firefox/plugins"

4. Restart Firefox

Review of Solaris 2008.11

If you are like me who enjoys testing various operating systems, then you must have heard about Solaris. Solaris is an industrial-grade server operating system published by Sun Microsystems. I've always wanted to test drive Solaris but I don't have the resources to do so, up still recently when Sun placed Solaris under open source. Now I can test drive the system.

I tried downloading the latest Solaris version that comes under the name OpenSolaris 2008.11. Here are my notes:

Desktop

Solaris now sports a pretty GNOME desktop interface. So if you are an old Linux hand like me, you will feel at home with the graphical user interface.



RAM


Solaris 2008.11 requires a huge memory to effectively install it. On my machine, it required 512MB of RAM. Anything lower, the system will not install.


Home Directory


To my surprise, the user's home directory is not located in "/home" unlike in all distributions of Linux. It is located in "/export/home".


User Name


Solaris still does not support long usernames. So you will have to make do with an 8-letter username.


Internet Browser


The default Internet browser is Mozilla Firefox. However, you cannot view "youtube" since flash has to be manually installed. Fortunately, there is a flash player available for Solaris which you can download from www.adobe.com.

To install the flash player, download and unpack the flash player package (flash_player_10_solaris_x86.tar.bz2). The package only contains one file (libflashplayer.so) and does not contain any instructions on how to install it. So I tried experimenting with it given my knowledge of Firefox. Here is what I did:

a) I copied the file (libflashplayer.so) to the Firefox plugin directory at "/usr/lib/firefox/plugins"
b) Then, I restarted Firefox.

I went immediately to youtube to test if the flash player will work. To my delight, it did!


Office Suite


OpenOffice is not part of the installer CD. But my guess is, it can easily be installed since it is published by Sun Microsystems.



Network Card


Solaris 2008.11 still got limited network card support unlike Linux. I tried installing it on three other desktops, it did not work. There was no driver support for the network card.


Sound


On all three desktops and 1 laptop I installed Solaris 2008.11 on, none of the built-in sound card was supported. I did not investigate any further as all distributions of Linux do not have problems with the sound card on all of those machines. My guess is, Solaris 2008.11 still needs some polishing in terms of its driver support.

Saturday, April 25, 2009

Installing VirtualBox

VirtualBox is a software package that allows you to install Windows in a virtual environment. Under Ubuntu 8.10 and 9.04, VirtualBox can be installed by issuing the following command:

#apt-get install virtualbox

Friday, April 17, 2009

Adjusting Image Sizes in GIMP

To adjust image sizes in GIMP, click on "Image"->"Scale".

Installing Squid on Ubuntu

Squid is an industrial grade web proxy server cache. To install squid on Ubuntu 8.10, issue the following command:

#apt-get install squid

Thursday, April 16, 2009

Installing Squirrelmail on Ubuntu

To install the Squirrelmail web interface software on Ubuntu 8.10, issue the command:

#apt-get install squirrelmail

Installing BIND on Ubuntu

To install BIND on Ubuntu 8.10, issue the command:

#apt-get install bind9

Installing ISC's DHCP Server on Ubuntu

To install ISC's DHCP server on Ubuntu 8.10, issue the following command:

#apt-get install dhcp

The configuration file of the ISC's DHCP server (dhcpd.conf) is located in the director "/etc/dhcp3".

The server can be started by issuing the command:

#/etc/dhcp3-server start

GIMP Commands for Slicing Images

Why do you want to slice images? Well, for most web designers, slicing images into smaller image files tend to make the images load faster when using a browser. GIMP allows you to easily slice images and create the corresponding HTML fragment file which you can copy and paste to your web page. Here is how:

1. Go to the menu "Image"->"Guides"->"New Guide"
2. Then select the preferred guide. Usually you either choose horizontal or vertical. Choosing horizontal will give you a horizontal guide rule which you can transfer to the part of the image you want sliced.
3. To slice, click on the menu "Filter"->"Web"->"Slice"

Installing Dovecot IMAP4 and POP3 Mail Delivery Agent on Ubuntu

Dovecot is a secured IMAP4 and POP3 mail delivery agent (MDA). To install, issue the following command:

#apt-get install dovecot-imapd
#apt-get install dovecot-pop3d

The configuration file of Dovecot (dovecot.conf) can be found in the directory "/etc/dovecot".

The package usually works in tandem with the Postfix SMTP mail transfer agent (MTA). I've tested the above commands under Ubuntu 8.10.

Installing the Postfix SMTP Mail Server on Ubuntu

To install the Postfix SMTP mail server on Ubuntu 8.10, issue the command:

#apt-get install postfix

Installing MySQL on Ubuntu

As always, various distributions of Linux have different ways of naming their software packages. In the case of Ubuntu 8.10 Linux, the software packages for MySQL database system are: "mysql-client" and "mysql-server". To install MySQL on Ubuntu, issue the following commands:

#apt-get install mysql-client
#apt-get install mysql-server

Wednesday, April 15, 2009

Installing Apache on Ubuntu

Ubuntu is one of the Linux distributions that grew out of the Debian Linux distribution. Unlike the RedHat-based distributions (RedHat, Fedora, CentOS and Mandrake), installation under Ubuntu does not use the "yum" command. Instead it uses the "apt-get" command. Variation also exists between the package names under Ubuntu and those of the RedHat-based distributions.

Installing the Apache web server under Ubuntu uses the following command:

#apt-get install apache2

As you may have noticed, the package name for the Apache web server is "apache2" instead of "httpd" under RedHat-based distributions.

You can also install the accompanying PHP scripting engine by issuing the following commands:

#apt-get install php5
#apt-get install libapache2-mod-php5

The home directory of the Apache web server is located in "/var/www" directory instead of "/var/www/html" directory under RedHat-based distributions.

I've tested the above procedure under Ubuntu 8.10.

Thursday, March 5, 2009

What is Port 898 on my CentOS box?

What is port 898 on my Linux CentOS box? Using the #nmap program, I was able to verify that on my system port 898 is open and the service name is "sun-manageconsole". Since I do not know what sun-manageconsole is, I issued the #lsof command to verify what open file is associated with it:

#lsof | grep 898

This gave me the information that its "rpc.statd". I did a quick google search on what rpc.statd is. Accordingly, this is run by the service "nfslock". Since on the server, you will not be using nfs, I quickly deactivated the service and remove it in my startup:

# /etc/rc.d/init.d/nfslock stop
# chkconfig --levels 2345 nfslock off

The next #nmap command no longer shows port 898, which gave a sigh of relief knowing no server process that I don't know about is running.

By the way, researching a bit further, I found out that "nfslock" may also run on other ports besides 898.

What process is running on the port?

Have you wondered what process is running on the port of your Linux box? The command to know the process that is running on the port is:

#lsof

This command comes handy with the #nmap program that identifies what ports are open. The command however tries to list all open files and therefore expect a long list to run through your screen. If you just want to investigate a particular port say port 898, use #lsof with grep:

#lsof | grep 898

This will list the open files with the particular port 898.

Knowing What Ports Are Open on Linux?

On Linux, it is easy to know what ports are open. You just need to use the program "nmap". If you don't have it on your system, download and install it using the command:

#apt-get install nmap

on your Ubuntu or using the yum for Fedora/RedHat/CentOS as follows:

#yum install nmap


Once installed, issue the command:

#nmap localhost

to know which ports are open in your computer.

Tuesday, February 17, 2009

PHP Support in the Apache Webserver

The following are my notes on PHP support in the Apache Webserver. The Linux box I am using runs on CentOS 5.0 operating system. The following steps assumes that the Linux box is connected to the Internet:


# yum install httpd
# yum install php
# yum install php-mysql
# yum install php-pgsql
# yum install php-mbstring
# yum install php-xmlrpc
# yum install php-gd


Among others, the above commands installs Apache and PHP with support for the MySQL and PostgreSQL databases.

Virtual Hosting in Apache

Virtual hosting is the ability of webserver to host more than one domain. The Apache webserver supports virtual hosting. Here are the steps on how to do it.

Considerations:
The web pages will be stored in the home folder of the user such as "/home/bse/www/html". Normally, Apache locates the web pages under the directory "/var/www/html".

I am using CentOS 5.0 (http://www.centos.org) as my operating system of choice.

This setup assumes that you are connected to the Internet.

Here are the steps...

Step 1:
Download the Apache software as follows:


#yum install httpd


Step 2:
Create the virtual file "virtual.conf" under the directory "/etc/httpd/conf.d". The "virtual.conf" file should read as follows:



ServerName idep01.bse.deped.gov.ph

< Directory /home >
Order Deny,Allow
Allow from all
DirectoryIndex index.html index.htm index.php index.phtml
< /Directory >

NameVirtualHost *:80

< VirtualHost *:80 >
ServerName www.bse.deped.gov.ph
DocumentRoot /home/bse/www/html
ErrorLog /home/bse/www/logs/error_log
TransferLog /home/bse/www/logs/access_log
< /VirtualHost >



Step 3:
Create the user and folders for the web pages as follows:


# adduser bse
# mkdir /home/bse/www
# mkdir /home/bse/www/html
# mkdir /home/bse/www/logs
# touch /home/bse/www/logs/error_log
# touch /home/bse/www/logs/access_log


Step 4:
Change the ownership and permissions of the "bse" user and its home folders. I assume that Apache is owned by the user "apache" and group "apache". Here are the commands:


# chown -R bse.apache /home/bse
# chmod -R 755 /home/bse


Step 5:
Copy a test page with the filename "index.html" to the directory "/home/bse/www/html".

Step 6:
Start the Apache web server as follows:


# /etc/rc.d/init.d/httpd start


Verify if you got it right by pointing your browser to the web address of the Apache webserver.

Setting up a Master DNS Server

These are my notes on setting up a master DNS server. DNS is short for Domain Name System. The DNS is responsible for translating computer addresses in the form of numbers into human understandable convention like "www.google.com".

First, my system. The operating system that I am installing to is a CentOS 5.0 Linux box. If you are not familiar with the CentOS Linux distribution, CentOS is generally a "Red Hat Enterprise Product" distribution intended for production deployments without the branding and support of Red Hat. It is in many ways the same as the Red Hat Enterprise Linux product and is related to the Fedora distribution.

Setting up the master DNS server requires the following steps:

Step 1:
Download and install the BIND software. BIND is short for Berkeley Internet Name Domain. I am assuming that you are connected to the Internet. The command to do that is:


# yum install bind
# yum install bind-utils



Step 2:
Create the configuration file "named.conf" in the directory "/etc". The file "named.conf" should read as follows:



zone "0.0.127.in-addr.arpa" {
type master;
file "mylocalhost";
};

zone "bse.deped.gov.ph" {
type master;
notify no;
file "bse.deped.gov.ph";
};

zone "126.126.222.in-addr.arpa" {
type master;
notify no;
file "222.126.126";
};



Step 3:
Create the file "mylocalhost" in the directory "/var/named". The "mylocalhost" file should read as follows:



$TTL 3D
@ IN SOA ns.bse.deped.gov.ph. hostmaster.bse.deped.gov.ph. (
1 ; serial
8H ; Refresh
2H ; Retry
4W ; Expire
1D) ; Minimum TTL

NS ns.bse.deped.gov.ph.

1 PTR localhost.




Step 4:
Create the zone file for the domain like "bse.deped.gov.ph" in the directory "/var/named". The file "bse.deped.gov.ph" should read as follows:




$TTL 3D
@ IN SOA ns.bse.deped.gov.ph. hostmaster.bse.deped.gov.ph. (
19980214 ; serial
8H ; refresh
2H ; retry
4W ; expire
1D) ; minimum TTL

NS ns
MX 10 mail01.bse.deped.gov.ph.
20 mail02.bse deped.gov.ph.

localhost A 127.0.0.1
www A 222.126.126.211

ns A 222.126.126.211
mail01 A 222.126.126.211
mail02 A 222.126.126.212



Step 5:
Create the reverse domain file such as "222.126.126" in the directory "/var/named". The file "222.126.126" should read as follows:



$TTL 3D
@ IN SOA ns.bse.deped.gov.ph. hostmaster.bse.deped.gov.ph. (
19980214 ; serial
8H ; Refresh
2H ; Retry
4W ; Expire
1D ) ; Minimum TTL

NS ns.bse.deped.gov.ph.

211 PTR www.bse.deped.gov.ph.



Step 6:
Start the server as follows:



# /etc/rc.d/init.d/named start
Starting named: [ OK ]


If there are no errors proceed to the next step. If there are errors, double check on the contents of the setup files.

Step 7:
Check the name resolution functionality of your server by using the "nslookup" utility that comes with the "bind-utils" package as follows:



# nslookup www.bse.deped.gov.ph
Server: 127.0.0.1
Address: 127.0.0.1#53

Name: www.bse.deped.gov.ph
Address: 222.126.126.211

# nslookup 222.126.126.211
Server: 127.0.0.1
Address: 127.0.0.1#53

211.126.126.222.in-addr.arpa name = www.bse.deped.gov.ph.