Friday, August 24, 2012

Solr with Apache on Windows 7 and Windows Server 2008 R2

Download Apache7 Windows Service installer from the below location:
Install as a service by executing the exe
Download solr and unzip it on to disk
unzip it apache-solr-3.6.1
create c:\web\  and copy folder apache-solr-3.6.1\example to c:\web\
rename apache-solr-3.6.1\apache-solr-3.6.1\dist\apache-solr-3.6.1.war to solr.war
Now copy solr.war to C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\
Now create solr.xml file n C:\Program Files(x86)\Apache Software Foundation\Tomcat 7.0\conf\Catalina\localhost\
For Single Core:
Add the below content in solr.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="C:\Program Files(x86)\Apache Software Foundation\Tomcat 7.0\webapps\solr.war" debug="0" crossContext="true" >
    <Environment name="solr/home" type="java.lang.String" value="C:\web\example\solr" override="true" />
</Context>

Restart Apache and the single core will run
Note: DocBase and Solr/Home path should match your system drive and path
For Multicore:
add the below content in solr.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="C:\Program Files(x86)\Apache Software Foundation\Tomcat 7.0\webapps\solr.war" debug="0" crossContext="true" >
    <Environment name="solr/home" type="java.lang.String" value="C:\web\example\multicore" override="true" />
</Context>

By default it has two core but if you want to add one or many core then make copy of one core and rename it (say core2) then add the core name to the  C:\web\example\multicore\solr.xml add the below line for new core
<cores adminPath="/admin/cores">
    <core name="core0" instanceDir="core0" />
    <core name="core1" instanceDir="core1" />
    <core name="core2" instanceDir="core2" />
  
Restart Apache and you will get solr running with multiple core.

Thursday, June 7, 2012

Mount Windows Folder Share to the VMware ESX Service Console


Mount Windows Folder Share to the VMware ESX Service Console

Title:Mount Windows Folder Share to the VMware ESX Service Console
Author(s):Xtravirt (Gavin Jolliffe)
Target Audience:Technical - Intermediate
Current Revision:1.0 April 2008
First Published:1 April 2008
Products:VMware ESX Server 3.x
UID:XD10056

1.0 Overview

Guide to mounting a Windows folder share to the ESX Service Console.

2.0 Pre-Requisites

  1. An appropriate Windows local or domain account, and an available Windows file share
  2. Open firewall port for smbClient
  3. Create local mount point
  4. Ensure the Netfs service is started
  5. Modify Windows 2003 Local Security Policy (if required)

3.0 Tasks

From the local console or ssh session, eg:  Putty, open the ESX firewall port:
esxcfg-firewall -e smbClient
Create a new local mount point, eg:
mkdir /tmp/smbmnt
Enable netfs:
chkconfig netfs on
service netfs start
If connecting to a Windows 2003 Server share log on as local admins to the server and open Administrative Tools (within Control Panel or Start/Programs).  Open Local Security Policy, expand Local Policies -> Security Options, and set the following objects to Disabled if not already:
Microsoft network server: Digitally sign communications (always)
Microsoft network server: Digitally sign communications (if client agrees)
Go Start -> Run and enter gpupdate to refresh local policy.  Also check that domain group policy is not overriding local policy.
From the ESX console run:
mount -t smbfs -o username=<username>/<domain>,password=<password> //<server name>/<share> /tmp/smbmnt/
To unmount the share run:
umount /tmp/smbmnt

Installing VMware Server on Linux (CentOS CentOS release 5.7 (Final))

Installing VMware Server on Linux (CentOS CentOS release 5.7 (Final))

[root@miami vmware-server-distrib]# ./vmware-install.pl
Creating a new VMware Server installer database using the tar4 format.

Installing VMware Server.

In which directory do you want to install the binary files?
[/usr/bin]

What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc/rc.d]

What is the directory that contains the init scripts?
[/etc/rc.d/init.d]

In which directory do you want to install the daemon files?
[/usr/sbin]

In which directory do you want to install the library files?
[/usr/lib/vmware]

The path "/usr/lib/vmware" does not exist currently. This program is going to
create it, including needed parent directories. Is this what you want?
[yes] yes

In which directory do you want to install the manual files?
[/usr/share/man]

In which directory do you want to install the documentation files?
[/usr/share/doc/vmware]

The path "/usr/share/doc/vmware" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes] yes

The installation of VMware Server 2.0.2 build-203138 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: "/usr/bin/vmware-uninstall.pl".

Before running VMware Server for the first time, you need to configure it by
invoking the following command: "/usr/bin/vmware-config.pl". Do you want this
program to invoke the command for you now? [yes]



Do you accept? (yes/no) yes
Accept the EULA
Thank you.

The bld-2.6.18-8.el5-i686PAE-RHEL5 - vmmon module loads perfectly into the
running kernel.

The bld-2.6.18-8.el5-i686PAE-RHEL5 - vmci module loads perfectly into the
running kernel.

The bld-2.6.18-8.el5-i686PAE-RHEL5 - vsock module loads perfectly into the
running kernel.

Do you want networking for your virtual machines? (yes/no/help) [yes]


Configuring a bridged network for vmnet0.

Please specify a name for this network.
[Bridged]

The following bridged networks have been defined:

. vmnet0 is bridged to eth0

All your ethernet interfaces are already bridged.

Do you want to be able to use NAT networking in your virtual machines? (yes/no) no

All your ethernet interfaces are already bridged.

Do you want to be able to use NAT networking in your virtual machines? (yes/no)
[yes] no

Do you want to be able to use host-only networking in your virtual machines?
[no] no

The bld-2.6.18-8.el5-i686PAE-RHEL5 - vmnet module loads perfectly into the
running kernel.

Please specify a port for remote connections to use [902]

Please specify a port for standard http connections to use [8222]

Please specify a port for secure http (https) connections to use [8333]

The current administrative user for VMware Server  is ''.  Would you like to
specify a different administrator? [no]

Using root as the VMware Server administrator.

In which directory do you want to keep your virtual machine files?
[/var/lib/vmware/Virtual Machines]

The path "/var/lib/vmware/Virtual Machines" does not exist currently. This
program is going to create it, including needed parent directories. Is this
what you want? [yes] yes

Please enter your 20-character serial number.

Type XXXXX-XXXXX-XXXXX-XXXXX or 'Enter' to cancel:  A810T-P4507-0F5AN-4V2CW

Creating a new VMware VIX API installer database using the tar4 format.

Installing VMware VIX API.

In which directory do you want to install the VMware VIX API binary files?
[/usr/bin]


In which directory do you want to install the VMware VIX API library files?
[/usr/lib/vmware-vix/lib]

The path "/usr/lib/vmware-vix/lib" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes] yes

In which directory do you want to install the VMware VIX API document pages?
[/usr/share/doc/vmware-vix]

The path "/usr/share/doc/vmware-vix" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes] yes

The installation of VMware VIX API 1.6.2 build-203138 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: "/usr/bin/vmware-uninstall-vix.pl".

Enjoy,

--the VMware team

Starting VMware services:
  Virtual machine monitor                                 [  OK  ]
  Virtual machine communication interface                 [  OK  ]
  VM communication interface socket family:               [  OK  ]
  Virtual ethernet                                        [  OK  ]
  Bridged networking on /dev/vmnet0                       [  OK  ]
  VMware Server Authentication Daemon (background)        [  OK  ]
  Shared Memory Available                                 [  OK  ]
Starting VMware management services:
  VMware Server Host Agent (background)                   [  OK  ]
  VMware Virtual Infrastructure Web Access
Starting VMware autostart virtual machines:
  Virtual machines                                        [FAILED]

The configuration of VMware Server 2.0.2 build-203138 for Linux for this
running kernel completed successfully.

If you have iptables running on your CentOS installation and you wish to allow external users remote access to the VMware web console, you will need to modify your firewall to allow them access. Begin by editing your firewall rules:
nano /etc/sysconfig/iptables
Below is an example rule to allow 192.168.1.2 access to the web console over a SSL connection (i.e. HTTPS):
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8333 -j ACCEPT
/etc/init.d/iptables restart
[root@miami vmware-server-distrib]#

Note: Nevertheless, you can run setenforce permissive in a terminal to change SELinux from "enforce" to "permissive",  then restart VMware services with service vmware restart and test if it works.

[root@miami ~]#  setenforce permissive
[root@miami ~]# /etc/init.d/vmware restart
Stopping VMware autostart virtual machines:
  Virtual machines                                        [  OK  ]
Stopping VMware management services:
  VMware Virtual Infrastructure Web Access
  VMware Server Host Agent                                [  OK  ]
Stopping VMware services:
  VMware Authentication Daemon                            [  OK  ]
  VM communication interface socket family:               [  OK  ]
  Virtual machine communication interface                 [  OK  ]
  Virtual machine monitor                                 [  OK  ]
  Bridged networking on /dev/vmnet0                       [  OK  ]
  Host network detection                                  [  OK  ]
  Virtual ethernet                                        [  OK  ]
Starting VMware services:
  Virtual machine monitor                                 [  OK  ]
  Virtual machine communication interface                 [  OK  ]
  VM communication interface socket family:               [  OK  ]
  Virtual ethernet                                        [  OK  ]
  Bridged networking on /dev/vmnet0                       [  OK  ]
  VMware Server Authentication Daemon (background)        [  OK  ]
  Shared Memory Available                                 [  OK  ]
Starting VMware management services:
  VMware Server Host Agent (background)                   [  OK  ]
  VMware Virtual Infrastructure Web Access
Starting VMware autostart virtual machines:
  Virtual machines                                        [  OK  ]

  Now I was able to access through: https://miami:8333/

Note: I was having the issue of not opening up the Console, It was opening but getting hang so I open 902 port on firewall:
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 902 -j ACCEPT

  
Thanks

Friday, May 25, 2012

DAViCal Installation on Ubuntu Server (12.04 LTS)


Step1:
Installed Ubuntu Server and update it to latest
added to source list
vim /etc/apt/sources.list
deb http://debian.mcmillan.net.nz/debian lenny awm
then added the key
apt-key advanced --keyserver pgp.net.nz --recv-keys F6E0FA5CF0307507BB23A512EAFCFEBF8FEB8EBF
apt-get install update
apt-get install apache2
apt-get install davical

Configuring Database (Postgresql)

now added the Postgresql sersver to connect the machines
vim /etc/postgresql/9.1/main/pg_hba.conf

Connecting to the Database
Before your database has been created, you should edit your pg_hba.conf file (in /etc/postgresql/8.x/main/pg_hba.conf on Debian or derivatives) in order to grant access to the database for the 'davical_dba' user that will be created to 'own' the database and tables, and also for the 'davical_app' user which will be created for the web application fo connect as.

In a simple installation, where you do not have untrusted users on your database server, and your database is on the same computer as the web server, the following lines (at the very top of the pg_hba.conf file) should be enough:

local   davical    davical_app   trust
local   davical    davical_dba   trust
This means that anyone on the local computer (including the web application) will have rights to connect to the DAViCal database as the 'davical_app' or 'davical_dba' user. It will not allow remote access, or access as any user other than 'davical_app' or 'davical_dba'.

If you want to connect to the database over TCP/IP from your webserver on '192.168.59.231' (e.g. rather than unix sockets which will only work for access from the local machine), the lines in the pg_hba.conf file should look something like:

host davical davical_app 192.168.59.231/32 trust
host davical davical_dba 192.168.59.231/32 trust

Creating and Building the Database
To create the database itself, run the script:

This script expects to be running as a user who has rights to create a new database, so you may need to do this as the "postgres" user, for example:

su postgres -c /usr/share/davical/dba/create-database.sh

#####
su postgres -c /usr/share/davical/dba/create-database.sh
could not change directory to "/root"
could not change directory to "/root"
could not change directory to "/root"
could not change directory to "/root"
could not change directory to "/root"
could not change directory to "/root"
could not change directory to "/root"

could not change directory to "/root"

Supported locales updated.
Updated view: dav_principal.sql applied.
CalDAV functions updated.
RRULE functions updated.
Database permissions updated.
could not change directory to "/root"
could not change directory to "/root"
NOTE
====
*  The password for the 'admin' user has been set to 'ioMLrYKQ'
#########


Now configuring Apache:

cd /etc/apache2/sites-available/
make copy of default website
cp default mydavicalsite

vim mydavicalsite
<VirtualHost 192.168.1.195:80 >
  DocumentRoot /usr/share/davical/htdocs
  DirectoryIndex index.php index.html
  ServerName madrid.hcitec.com
  Alias /images/ /usr/share/davical/htdocs/images/
  <Directory /usr/share/davical/htdocs/>
      AllowOverride None
      Order allow,deny
      Allow from all
  </Directory>
  AcceptPathInfo On
  php_value include_path /usr/share/awl/inc
  php_value magic_quotes_gpc 0
  php_value register_globals 0
  php_value error_reporting "E_ALL & ~E_NOTICE"
  php_value default_charset "utf-8"
</VirtualHost>

sudo ln -s /etc/apache2/sites-available/mydavicalsite /etc/apache2/sites-enabled/mydavicalsite

/etc/init.d/apache2 restart

Recived error while restarting apache2
Invalid command 'php_value'
Then I did
sudo apt-get install libapache2-mod-php5

service apache2 restart
Now it give information about the product installation

DAViCal Configuration
The DAViCal configuration generally resides in /etc/davical/config.php and is a regular PHP file which sets (or overrides) some specific variables. if not then create this file and paste the below in the file

<?php
//  $c->domain_name  = 'davical.example.com';
//  $c->sysabbr     = 'davical';
//  $c->system_name = 'DAViCal CalDAV Server';

  $c->admin_email  = 'admin@example.com';
  $c->pg_connect[] = 'dbname=davical user=davical_app';
OR
<?php
  $c->admin_email = 'vaseemk@hcitec.com';
  $c->system_name = "DAViCal CalDAV Server";
  $c->enable_row_linking = true;
  $c->default_locale = 'en_US.UTF-8';

  $c->pg_connect[] = 'dbname=davical port=5432 user=davical_app';

Now you can get DAViCal running on your server
http://yourserver/
and log in

  Resources:
  http://www.davical.org/installation.php
  http://wiki.davical.org/w/Debian
  http://ubuntuguide.org/wiki/DAViCal_tips

Wednesday, May 9, 2012

Linux Directory Structure (File System Structure) Explained with Examples


Have you wondered why certain programs are located under /bin, or /sbin, or /usr/bin, or /usr/sbin?
For example, less command is located under /usr/bin directory. Why not /bin, or /sbin, or /usr/sbin? What is the different between all these directories?
In this article, let us review the Linux filesystem structures and understand the meaning of individual high-level directories.

1. / – Root

  • Every single file and directory starts from the root directory.
  • Only root user has write privilege under this directory.
  • Please note that /root is root user’s home directory, which is not same as /.

2. /bin – User Binaries

  • Contains binary executables.
  • Common linux commands you need to use in single-user modes are located under this directory.
  • Commands used by all the users of the system are located here.
  • For example: ps, ls, ping, grep, cp.

3. /sbin – System Binaries

  • Just like /bin, /sbin also contains binary executables.
  • But, the linux commands located under this directory are used typically by system aministrator, for system maintenance purpose.
  • For example: iptables, reboot, fdisk, ifconfig, swapon

4. /etc – Configuration Files

  • Contains configuration files required by all programs.
  • This also contains startup and shutdown shell scripts used to start/stop individual programs.
  • For example: /etc/resolv.conf, /etc/logrotate.conf

5. /dev – Device Files

  • Contains device files.
  • These include terminal devices, usb, or any device attached to the system.
  • For example: /dev/tty1, /dev/usbmon0

6. /proc – Process Information

  • Contains information about system process.
  • This is a pseudo filesystem contains information about running process. For example: /proc/{pid} directory contains information about the process with that particular pid.
  • This is a virtual filesystem with text information about system resources. For example: /proc/uptime

7. /var – Variable Files

  • var stands for variable files.
  • Content of the files that are expected to grow can be found under this directory.
  • This includes — system log files (/var/log); packages and database files (/var/lib); emails (/var/mail); print queues (/var/spool); lock files (/var/lock); temp files needed across reboots (/var/tmp);

8. /tmp – Temporary Files

  • Directory that contains temporary files created by system and users.
  • Files under this directory are deleted when system is rebooted.

9. /usr – User Programs

  • Contains binaries, libraries, documentation, and source-code for second level programs.
  • /usr/bin contains binary files for user programs. If you can’t find a user binary under /bin, look under /usr/bin. For example: at, awk, cc, less, scp
  • /usr/sbin contains binary files for system administrators. If you can’t find a system binary under /sbin, look under /usr/sbin. For example: atd, cron, sshd, useradd, userdel
  • /usr/lib contains libraries for /usr/bin and /usr/sbin
  • /usr/local contains users programs that you install from source. For example, when you install apache from source, it goes under /usr/local/apache2

10. /home – Home Directories

  • Home directories for all users to store their personal files.
  • For example: /home/john, /home/nikita

11. /boot – Boot Loader Files

  • Contains boot loader related files.
  • Kernel initrd, vmlinux, grub files are located under /boot
  • For example: initrd.img-2.6.32-24-generic, vmlinuz-2.6.32-24-generic

12. /lib – System Libraries

  • Contains library files that supports the binaries located under /bin and /sbin
  • Library filenames are either ld* or lib*.so.*
  • For example: ld-2.11.1.so, libncurses.so.5.7

13. /opt – Optional add-on Applications

  • opt stands for optional.
  • Contains add-on applications from individual vendors.
  • add-on applications should be installed under either /opt/ or /opt/ sub-directory.

14. /mnt – Mount Directory

  • Temporary mount directory where sysadmins can mount filesystems.

15. /media – Removable Media Devices

  • Temporary mount directory for removable devices.
  • For examples, /media/cdrom for CD-ROM; /media/floppy for floppy drives; /media/cdrecorder for CD writer

16. /srv – Service Data

  • srv stands for service.
  • Contains server specific services related data.
  • For example, /srv/cvs contains CVS related data.

Awesome Cron Job Examples


Awesome Cron Job Examples:


Linux Crontab Format

MIN HOUR DOM MON DOW CMD
Table: Crontab Fields and Allowed Ranges (Linux Crontab Syntax)
FieldDescriptionAllowed Value
MINMinute field0 to 59
HOURHour field0 to 23
DOMDay of Month1-31
MONMonth field1-12
DOWDay Of Week0-6
CMDCommandAny command to be executed.

1. Scheduling a Job For a Specific Time Every Day

The basic usage of cron is to execute a job in a specific time as shown below. This will execute the Full backup shell script (full-backup) on 10th June 08:30 AM.

Please note that the time field uses 24 hours format. So, for 8 AM use 8, and for 8 PM use 20.
30 08 10 06 * /home/ramesh/full-backup
  • 30 – 30th Minute
  • 08 – 08 AM
  • 10 – 10th Day
  • 06 – 6th Month (June)
  • * – Every day of the week

2. Schedule a Job For More Than One Instance (e.g. Twice a Day)

The following script take a incremental backup twice a day every day.

This example executes the specified incremental backup shell script (incremental-backup) at 11:00 and 16:00 on every day. The comma separated value in a field specifies that the command needs to be executed in all the mentioned time.
00 11,16 * * * /home/ramesh/bin/incremental-backup
  • 00 – 0th Minute (Top of the hour)
  • 11,16 – 11 AM and 4 PM
  • * – Every day
  • * – Every month
  • * – Every day of the week

3. Schedule a Job for Specific Range of Time (e.g. Only on Weekdays)

If you wanted a job to be scheduled for every hour with in a specific range of time then use the following.

Cron Job everyday during working hours

This example checks the status of the database everyday (including weekends) during the working hours 9 a.m – 6 p.m
00 09-18 * * * /home/ramesh/bin/check-db-status
  • 00 – 0th Minute (Top of the hour)
  • 09-18 – 9 am, 10 am,11 am, 12 am, 1 pm, 2 pm, 3 pm, 4 pm, 5 pm, 6 pm
  • * – Every day
  • * – Every month
  • * – Every day of the week

Cron Job every weekday during working hours

This example checks the status of the database every weekday (i.e excluding Sat and Sun) during the working hours 9 a.m – 6 p.m.
00 09-18 * * 1-5 /home/ramesh/bin/check-db-status
  • 00 – 0th Minute (Top of the hour)
  • 09-18 – 9 am, 10 am,11 am, 12 am, 1 pm, 2 pm, 3 pm, 4 pm, 5 pm, 6 pm
  • * – Every day
  • * – Every month
  • 1-5 -Mon, Tue, Wed, Thu and Fri (Every Weekday)