In my previous post, I provided some information about how to add swap space on Linux.
Recently, I installed an application on my Sun Ultra 10 machine (quite old but still usable) and this application requires a decent amount of memory. To meet this requirement, I only added swap space.
Here's how to add swap on Solaris:
1. Create a swap file. Let's say I need 2GB of swap on a partition that has a lot of available disk space (e.g. /export/home).
# mkfile 2g /export/home/swap_file
2. Add the file to the swap area.
# swap -a /export/home/swap_file
Check the swap space info to verify.
# swap -l
swapfile dev swaplo blocks free
/dev/dsk/c0t0d0s1 136,1 16 4195280 4195280
/export/home/swap_file - 16 4194288 4194288

A lot of IT admins are good at setting up IT infrastructure, fixing hardware and software related issues, securing the network, and other IT stuff. However, writing documentation is the lasting thing most techie persons want to do.
As a result, maintaining these IT assets can be a pain due to poor or lack of documentation.
No one knows where to find the hardware that hosts the company's services, who is the owner of such device, and what softwares are installed on which machine, and whether the softwares are patched or not. To add to this pain, if the IT admin leaves the company, it would require a lot of time for the new hire to get familiarized with the IT infrastructure. This results to loss of productivity, and worse, long downtime in case of service outtage, which costs some money.
Two free open source tools, OCS Inventory NG and GLPI, help IT admins to manage their IT assets. There can be more products that do the same thing, but these two are the best candidate so far as they are free. Combining these two provides a very powerful IT asset management system.
Open Computer and Software Inventory Next Generation (OCS Inventory NG) is a free open source software that enables IT admins to create an inventory of their IT assets and manage them through a web interface. This allows IT admins to know the devices that are connected to their network and which software and hardware component are installed on a computer, and to deploy softwares on their computers.
"GLPI is the Information Resource-Manager with an additional Administration- Interface. You can use it to build up a database with an inventory for your company (computer, software, printers...). It has enhanced functions to make the daily life for the administrators easier, like a job-tracking-system with mail-notification and methods to build a database with basic information about your network-topology." (source http://glpi-project.org )
Preparing the system that hosts OCS and GLPI
Preparing the system that hosts OCS and GLPI
Virtualization is the best way to test softwares without needing additional hardware. In this setup, I used the free VMWare Server to run SUSE Enterprise Linux Server 10 that hosts OCS and GLPI. You can also use other Linux distribution that you are most comfortable with. When installing Linux, make sure to install Development Libraries and Tools package because this is needed for installing the required perl modules.For the web host, I used Apache MySQL PHP Perl bundle called XAMPP (available at http://www.apachefriends.org). These are the components needed to run the OCS Inventory Server and GLPI.
Installing XAMPP is quite easy as doing the following:
tar xvfz xampp-linux-1.7.1.tar.gz -C /opt
To start XAMPP:
/opt/lampp/lampp start
There are required Perl modules that are not included in XAMPP which you need to install. To install these modules, use the following commands:
/opt/lampp/bin/perl -MCPAN -e 'install Apache::DBI'
/opt/lampp/bin/perl -MCPAN -e 'install XML::Simple'
/opt/lampp/bin/perl -MCPAN -e 'install Net::IP'
/opt/lampp/bin/perl -MCPAN -e 'install SOAP::Lite'
/opt/lampp/bin/perl -MCPAN -e 'install XML::Entities'
After installing the Perl modules, restart XAMPP.
/opt/lampp/lampp restart
Setting Up OCS Inventory NG
To setup OCS, download OCS Inventory NG Management server for Unix/Linux from http://www.ocsinventory-ng.org and install it as:sles10sp1:/tmp # tar xvfz OCSNG_UNIX_SERVER-1.02.tar.gz
sles10sp1:/tmp # export PATH=$PATH:/opt/lampp/bin
sles10sp1:/tmp # cd OCSNG_UNIX_SERVER-1.02
sles10sp1:/tmp/OCSNG_UNIX_SERVER-1.02 #
sles10sp1:/tmp/OCSNG_UNIX_SERVER-1.02 # ./setup.sh
+----------------------------------------------------------+
| |
| Welcome to OCS Inventory NG Management server setup ! |
| |
+----------------------------------------------------------+
CAUTION: If upgrading Communication server from OCS Inventory NG 1.0 RC2 and
previous, please remove any Apache configuration for Communication Server!
Do you wish to continue ([y]/n)?y
Assuming Communication server 1.0 RC2 or previous is not installed
on this computer.
Starting OCS Inventory NG Management server setup from folder /tmp/OCSNG_UNIX_SERVER-1.02
Storing log in file /tmp/OCSNG_UNIX_SERVER-1.02/ocs_server_setup.log
+----------------------------------------------------------+
| Checking for database server properties... |
+----------------------------------------------------------+
Your MySQL client seems to be part of MySQL version 5.1.
Your computer seems to be running MySQL 4.1 or higher, good ;-)
Which host is running database server [localhost] ?
OK, database server is running on host localhost ;-)
On which port is running database server [3306] ?
OK, database server is running on port 3306 ;-)
+----------------------------------------------------------+
| Checking for Apache web server daemon... |
+----------------------------------------------------------+
Where is Apache daemon binary [/opt/lampp/bin/httpd] ?
OK, using Apache daemon /opt/lampp/bin/httpd ;-)
+----------------------------------------------------------+
| Checking for Apache main configuration file... |
+----------------------------------------------------------+
Where is Apache main configuration file [/opt/lampp/etc/httpd.conf] ?
OK, using Apache main configuration file /opt/lampp/etc/httpd.conf ;-)
+----------------------------------------------------------+
| Checking for Apache user account... |
+----------------------------------------------------------+
Which user account is running Apache web server [User] ?nobody
OK, Apache is running under user account nobody ;-)
+----------------------------------------------------------+
| Checking for Apache group... |
+----------------------------------------------------------+
Which user group is running Apache web server [nogroup] ?
OK, Apache is running under users group nogroup ;-)
+----------------------------------------------------------+
| Checking for Apache Include configuration directory... |
+----------------------------------------------------------+
Setup found Apache Include configuration directory in
.
Setup will put OCS Inventory NG Apache configuration in this directory.
Where is Apache Include configuration directory [] ?/opt/lampp/etc/extra
OK, Apache Include configuration directory /opt/lampp/etc/extra found ;-)
+----------------------------------------------------------+
| Checking for PERL Interpreter... |
+----------------------------------------------------------+
Found PERL Intrepreter at ;-)
Where is PERL Intrepreter binary [/usr/bin/perl] ?/opt/lampp/bin/perl
OK, using PERL Intrepreter /opt/lampp/bin/perl ;-)
Do you wish to setup Communication server on this computer ([y]/n)?y
+----------------------------------------------------------+
| Checking for Make utility... |
+----------------------------------------------------------+
OK, Make utility found at ;-)
+----------------------------------------------------------+
| Checking for Apache mod_perl version... |
+----------------------------------------------------------+
Checking for Apache mod_perl version 1.99_22 or higher
Found that mod_perl version 1.99_22 or higher is available.
OK, Apache is using mod_perl version 1.99_22 or higher ;-)
+----------------------------------------------------------+
| Checking for Communication server log directory... |
+----------------------------------------------------------+
Communication server can create detailled logs. This logs can be enabled
by setting interger value of LOGLEVEL to 1 in Administration console
menu Configuration.
Where to put Communication server log directory [/var/log/ocsinventory-server] ?
OK, Communication server will put logs into directory /var/log/ocsinventory-server ;-)
+----------------------------------------------------------+
| Checking for required Perl Modules... |
+----------------------------------------------------------+
Checking for DBI PERL module...
Found that PERL module DBI is available.
Checking for Apache::DBI PERL module...
Found that PERL module Apache::DBI is available.
Checking for DBD::mysql PERL module...
Found that PERL module DBD::mysql is available.
Checking for Compress::Zlib PERL module...
Found that PERL module Compress::Zlib is available.
Checking for XML::Simple PERL module...
Found that PERL module XML::Simple is available.
Checking for Net::IP PERL module...
Found that PERL module Net::IP is available.
+----------------------------------------------------------+
| Checking for optional Perl Modules... |
+----------------------------------------------------------+
Checking for SOAP::Lite PERL module...
Found that PERL module SOAP::Lite is available.
Checking for XML::Entities PERL module...
Found that PERL module XML::Entities is available.
+----------------------------------------------------------+
| OK, looks good ;-) |
| |
| Configuring Communication server Perl modules... |
+----------------------------------------------------------+
Checking if your kit is complete...
Looks good
Writing Makefile for Apache::Ocsinventory
+----------------------------------------------------------+
| OK, looks good ;-) |
| |
| Preparing Communication server Perl modules... |
+----------------------------------------------------------+
+----------------------------------------------------------+
| OK, prepare finshed ;-) |
| |
| Installing Communication server Perl modules... |
+----------------------------------------------------------+
+----------------------------------------------------------+
| OK, Communication server Perl modules install finished;-)|
| |
| Creating Communication server log directory... |
+----------------------------------------------------------+
Creating Communication server log directory /var/log/ocsinventory-server.
Fixing Communication server log directory files permissions.
Configuring logrotate for Communication server.
Removing old communication server logrotate file /etc/logrotate.d/ocsinventory-NG
Writing communication server logrotate to file /etc/logrotate.d/ocsinventory-server
+----------------------------------------------------------+
| OK, Communication server log directory created ;-) |
| |
| Now configuring Apache web server... |
+----------------------------------------------------------+
To ensure Apache loads mod_perl before OCS Inventory NG Communication Server,
Setup can name Communication Server Apache configuration file
'z-ocsinventory-server.conf' instead of 'ocsinventory-server.conf'.
Do you allow Setup renaming Communication Server Apache configuration file
to 'z-ocsinventory-server.conf' ([y]/n) ?y
./setup.sh: line 878: [: y: integer expression expected
./setup.sh: line 878: [: y: integer expression expected
OK, using 'ocsinventory-server.conf' as Communication Server Apache configuration file
Removing old communication server configuration to file /opt/lampp/etc/extra/ocsinventory.conf
Writing communication server configuration to file /opt/lampp/etc/extra/ocsinventory-server.conf
+----------------------------------------------------------+
| OK, Communication server setup sucessfully finished ;-) |
| |
| Please, review /opt/lampp/etc/extra/ocsinventory-server.conf
| to ensure all is good. Then restart Apache daemon. |
+----------------------------------------------------------+
Do you wish to setup Administration Server (Web Administration Console)
on this computer ([y]/n)?y
+----------------------------------------------------------+
| Checking for Administration Server directories... |
+----------------------------------------------------------+
CAUTION: Setup now install files in accordance with Filesystem Hierarchy
Standard. So, no file is installed under Apache root document directory
(Refer to Apache configuration files to locate it).
If you're upgrading from OCS Inventory NG Server 1.01 and previous, YOU
MUST REMOVE (or move) directories 'ocsreports' and 'download' from Apache
root document directory.
If you choose to move directory, YOU MUST MOVE 'download' directory to
Administration Server writable/cache directory (by default
/var/lib/ocsinventory-reports), especialy if you use deployement feature.
Do you wish to continue ([y]/n)?y
Assuming directories 'ocsreports' and 'download' removed from
Apache root document directory.
Where to copy Administration Server static files for PHP Web Console
[/usr/share/ocsinventory-reports] ?
OK, using directory /usr/share/ocsinventory-reports to install static files ;-)
Where to create writable/cache directories for deployement packages and
IPDiscover [/var/lib/ocsinventory-reports] ?
OK, writable/cache directory is /var/lib/ocsinventory-reports ;-)
+----------------------------------------------------------+
| Checking for required Perl Modules... |
+----------------------------------------------------------+
Checking for DBI PERL module...
Found that PERL module DBI is available.
Checking for DBD::mysql PERL module...
Found that PERL module DBD::mysql is available.
Checking for XML::Simple PERL module...
Found that PERL module XML::Simple is available.
Checking for Net::IP PERL module...
Found that PERL module Net::IP is available.
+----------------------------------------------------------+
| Installing files for Administration server... |
+----------------------------------------------------------+
Creating PHP directory /usr/share/ocsinventory-reports/ocsreports.
Copying PHP files to /usr/share/ocsinventory-reports/ocsreports.
Fixing permissions on directory /usr/share/ocsinventory-reports/ocsreports.
Creating database configuration file /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php.
Creating IPDiscover directory /var/lib/ocsinventory-reports/ipd.
Fixing permissions on directory /var/lib/ocsinventory-reports/ipd.
Creating packages directory /var/lib/ocsinventory-reports/download.
Fixing permissions on directory /var/lib/ocsinventory-reports/download.
Configuring IPDISCOVER-UTIL Perl script.
Installing IPDISCOVER-UTIL Perl script.
Fixing permissions on IPDISCOVER-UTIL Perl script.
Writing Administration server configuration to file /opt/lampp/etc/extra/ocsinventory-reports.conf
+----------------------------------------------------------+
| OK, Administration server installation finished ;-) |
| |
| Please, review /opt/lampp/etc/extra/ocsinventory-reports.conf
| to ensure all is good and restart Apache daemon. |
| |
| Then, point your browser to http://server//ocsreports
| to configure database server and create/update schema. |
+----------------------------------------------------------+
Setup has created a log file /tmp/OCSNG_UNIX_SERVER-1.02/ocs_server_setup.log. Please, save this file.
If you encounter error while running OCS Inventory NG Management server,
we can ask you to show us his content !
DON'T FORGET TO RESTART APACHE DAEMON !
Enjoy OCS Inventory NG ;-)
sles10sp1:/tmp/OCSNG_UNIX_SERVER-1.02 #
sles10sp1:/tmp/OCSNG_UNIX_SERVER-1.02 # cd /opt/lampp/etc
sles10sp1:/opt/lampp/etc # echo "Include etc/extra/ocs*.conf" >> httpd.conf
sles10sp1:/opt/lampp/etc # /opt/lampp/lampp restart
The OCS is ready and it's time to do the initial configuration by accessing http://yourserver_ip/ocsreports/install.php .
Enter "root" as MySQL login and without a password. If you want to use a password, you have to modify the MySQL admin account (see MySQL documentation for instructions).
After successful OCS configuration, go to http://yourserver_ip/ocsreports to access the GUI and use "admin" as username and password.
This will issue a message to edit the php.ini in order for OCS to deploy packages that are more than 8MB.
Set the following in /opt/lampp/etc/php.ini file and restart XAMPP:
post_max_size = 100M
upload_max_filesize = 100M
Setting Up GLPI
Download the GLPI installer from http://www.glpi-project.org and install it as:tar xvfz glpi-0.71.5.tar.gz -C /opt/lampp/htdocs
chown -R nobody:nogroup /opt/lampp/htdocs/glpi
GLPI is ready and it's time to configure it by accessing http://yourserver_ip/glpi .
When the configuration wizard issues a warning message about Allocated memory, set the following in /opt/lampp/etc/php.ini file and restart XAMPP:
memory_limit = 64M
Use the following settings when ask for database connection setup:
MySQL server: localhost
MySQL user: root
MySQL pass:
You can also create a new MySQL account for GLPI with less privileges instead of root. Please refer to MySQL documentation for instructions. When prompted to select a database, choose to create a new one. Remember the following default logins:
glpi/glpi for the administrator account
tech/tech for the technician account
normal/normal for the normal account
post-only/post-only for the postonly account
Now, go to Setup menu->General and on Restrictions tab select OCSNG mode to yes.
Then, go Setup menu->OCSNG mode, click localhost, and chnage the Name from "localhost" to say "OCS Server 1". The defaults should be fine. Password is "ocs".
Installing OCS NG Agent on Linux
OCS NG agent collects information about the system and sends it to the OCS Server. To this job, the agent has to be installed on each computer.Let's install the first agent on the server that hosts the OCS and GLPI. To do this, download the Unix Unified Agent from http://www.ocsinventory-ng.org, and do the following:
sles10sp1:/tmp # tar xvfz OCSNG_UNIX_AGENT-1.02.tar.gz
sles10sp1:/tmp # cd Ocsinventory-Agent-1.0.1
sles10sp1:/tmp/Ocsinventory-Agent-1.0.1 # /opt/lampp/bin/perl -MCPAN -e 'install Digest::MD5'
sles10sp1:/tmp/Ocsinventory-Agent-1.0.1 # /opt/lampp/bin/perl -MCPAN -e 'install XML::Simple'
sles10sp1:/tmp/Ocsinventory-Agent-1.0.1 # /opt/lampp/bin/perl -MCPAN -e 'install NET::IP'
sles10sp1:/tmp/Ocsinventory-Agent-1.0.1 # /opt/lampp/bin/perl Makefile.PL
sles10sp1:/tmp/Ocsinventory-Agent-1.0.1 # make
sles10sp1:/tmp/Ocsinventory-Agent-1.0.1 # make install
.
.
Do you want to configure the agent Please enter 'y' or 'n'?> [y] Where do you want to write the configuration file?
0 -> /etc/ocsinventory
1 -> /usr/local/etc/ocsinventory
2 -> /etc/ocsinventory-agent
?> 2
Do you want to create the directory /etc/ocsinventory-agent? Please enter 'y' or 'n'?> [y]
What is the address of your ocs server?> [ocsinventory-ng] 10.13.9.217 <-- change this to the right IP of OCS server
Do you need credential for the server? (You probably don't) Please enter 'y' or 'n'?> [n]
Do you want to apply an administrative tag on this machine Please enter 'y' or 'n'?> [y]
tag?> OCS Server
ocsinventory agent presents: /opt/lampp/bin/ocsinventory-agent Do yo want to install the cron task in /etc/cron.d Please enter 'y' or 'n'?> [y]
Where do you want the agent to store its files? (You probably don't need to change it)?> [/var/lib/ocsinventory-agent]
Do you want to create the /var/lib/ocsinventory-agent directory? Please enter 'y' or 'n'?> [y]
New settings written! Thank you for using OCS Inventory Should I remove the old linux_agent Please enter 'y' or 'n'?> [n]
Do you want to use OCS-Inventory software deployment feature? Please enter 'y' or 'n'?> [y]
Do you want to send an inventory of this machine? Please enter 'y' or 'n'?> [y]
[info] Accountinfo file doesn't exist. I create an empty one. -> Success!
Login to GLPI GUI, go to Tools menu->OCSNG, and click "Import new computers" and import the computer that you've just added. You should be able to see the name of this computer when you click the Inventory menu.
Installing OCS NG Agent on Solaris
Installing OCS Agent on Solaris is a bit challenging. You need to install an updated Perl version (not the Solaris default), and GCC compiler in order to install the required perl modules.Before installing GCC compiler, make sure that the following Solaris packages are installed:
SUNWcpp
SUNWbtool
SUNWsprot
SUNWtoo
SUNWhea
SUNWarc
SUNWlibm
SUNWlibms
SUNWdfbh
SUNWcg6h
SUNWxwinc
Now, install the following GCC packages and newer version of Perl (available at http://www.sunfreeware.com).
gcc-xxx.local.gz
libconv-xxx.local.gz
perl-xxx.local.gz
Add or set the following lines in ~/.profile file:
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/ccs/bin:/usr/sfw/bin
LD_LIBRARY_PATH=/usr/local/lib
Change the link of /usr/sbin/perl and point it to /usr/local/bin/perl.
# cd /usr/bin
# mv perl perl.orig
# ln -s /usr/local/bin/perl perl
To install the perl modules required by OCS Agent, you need the following additional SUN packages (available at www.sunfreeware.com):
libidn
wget
libintl
readline
openssl
expat
gnupg
After that, install the required perl modules as:
perl -MCPAN -e 'install Digest::MD5'
And then, download the Unix Unified Agent from http://www.ocsinventory-ng.org, unpack the installer, and install it as:
perl Makefile.pl
make
make install
Login to GLPI GUI, go to Tools menu->OCSNG, and click "Import new computers" and import the computer that you've just added. You should be able to see the name of this computer when you click the Inventory menu.
I have been checking the traffic statistics of my blog lately using statcounter.com and something caught my attention. Firefox is the on top spot among the browsers used to visit my blog. This is followed by Google Chrome.

My Pinnacle Showcenter 200 has recently stopped working. It turned on using the power button, but it did not respond to the remote control. At first, I though it was remote control's fault, so I decided to change the batteries which did not help.
I was thinking of returning the device to the vendor. But, the warranty has already expired.
After searching Google, I found some information from users which had similar problem. Pinnacle told him that the device was out of warranty and they will repair the device for a fee, and they will gladly help dispose it properly if it cannot be repaired. Another user said that his device was repaired by simply replacing the capacitors.So, I opened the device and found two bulging capacitors on the PSU (power supply unit). Bulging at the top of a capacitor is a sign of failure.
When I went home, I opened the Showcenter 200 right away, desolder the two defective capacitors, and replace them with the new ones.
After that, I powered up the device and bingo! It worked!
Caching of DNS queries avoids re-querying of hostname from the DNS server, and therefore improves the performance of the system.
This instruction enables Solaris system to cache DNS query results.
1. Edit the file /etc/nscd.conf and change the following line:
From:
# enable-cache hosts no
To:
enable-cache hosts yes
2. Restart the nscd daemon.
# /etc/init.d/nscd stop
# /etc/init.d/nscd start
I always setup Solaris with minimum packages installed (Core Installation) for security reason, and oftentimes I encounter package dependency problem on a lot of applications I install.
The challenge is, how to know what packages the application requires? This is where the "pkgchk" command comes in handy.
First, you have to check what libraries the binaries of the application requires by using "ldd" command.
e.g.
# ldd file1
This command displays several files that are required by file1.
Next, check which which Solaris package the files belong to by using "pkgchk" command. You need to run this command on a Solaris machine that has all the packages installed (Entire Distribution).
For example, to check which package "truss" file is found:
-----
# pkgchk -l -p /usr/bin/truss
Pathname: /usr/bin/truss
Type: linked file
Source of link: ../../usr/lib/isaexec
Referenced by the following packages:
SUNWtoo
Current status: installed
-----
These commands can be add in a shell script to automate the package dependency check.
A lot of Linux applications are available only as source code. Redhat, SUSE, and other Linux distributions uses RPM package management which makes it easier to distribute and keep track of installed applications through the RPM database.
To create an RPM database, you need to install a Linux package called checkinstall. This is available from the Redhat or SUSE installation CD.
Then, do the following:
1. Unpack the source code of the application.
2. Compile it.
3. After compiling, execute
# checkinstall
That's it. An RPM package is created.


