Tuesday, January 17, 2012

php installation

Steps to install php APC
  1. # yum install pcre-devel
  2. # pecl install apc
Build process completed successfully
Installing '/usr/lib64/php/modules/apc.so'
Installing '/usr/include/php/ext/apc/apc_serializer.h'
install ok: channel://pecl.php.net/APC-3.1.9
configuration option "php_ini" is not set to php.ini location
You should add "extension=apc.so" to php.ini
 

Monday, January 9, 2012

Opsview

Install solr_check  with sudo cpan -i XML::XPath fail

which make
cpan> o conf make /usr/bin/make
    make               /usr/bin/make

cpan> o conf commit
commit: wrote /etc/perl/CPAN/Config.pm
 
https://github.com/rbramley/Opsview-solr-checks
http://johnbokma.com/mexit/2010/09/22/cpan-writing-makefile-not-ok.html

Friday, September 30, 2011

How to start Tomcat at boot time on CentOS

If you use Tomcat for you Java app, you will most probably encouter a situation where Tomcat doesn't load  after reboot.

This due to, as at the time of writing ,Tomcat doesn't have its built-in or default startup script included.
As usual, after some googling, found out the script below creates a custom Tomcat service and load tomcat automatically at startup.

#!/bin/bash
#
# Tomcat Server
#
# chkconfig: 345 96 30
# description:  Start up the Tomcat servlet engine.

# Source function library.
. /etc/init.d/functions


RETVAL=$?
 CATALINA_HOME="/opt/tomcat"

start() {
        if [ -f $CATALINA_HOME/bin/startup.sh ];
          then
            echo $"Starting Tomcat"
            /bin/su tomcat $CATALINA_HOME/bin/startup.sh
        fi
        sleep 2
}
stop() {
        if [ -f $CATALINA_HOME/bin/shutdown.sh ];
          then
            echo $"Stopping Tomcat"
            /bin/su tomcat $CATALINA_HOME/bin/shutdown.sh
        fi

}

case "$1" in
 start)
        start
        ;;
 stop)
        stop
        ;;
 restart)
        stop
        sleep 2
        start
        ;;

 *)
        echo $"Usage: $0 {start|stop|restart}"
        exit 1

        ;;
esac

exit $RETVAL



 In order to support chkconfig, an init script must:
1.  Be located in /etc/rc.d/init.d (which /etc/init.d is a symlink to)
2.  Have a commented out line that contains “chkconfig: <default  runlevels for this service> <start priority> <stop priority>”
3.  Have a commented out line that contains “description: <a description of the service>”
4.  Upon successful service startup, place a lock file in  /var/lock/subsys that matches the name of the service script.  Upon  successful service shutdown, the lockfile must be removed.
5. If the avove doesn't wotk. Add symbolic link for /etc/init.d/tomcat to  etc/rc.d/rc2.d/S96tomcat, /etc/rc.d/rc1.d/K99tomcat 

Reference:
http://adityo.blog.binusian.org/?tag=redhat-run-level-and-how-to-make-tomcat-service-to-run-on-boot-time-in-centos

Update: If you install Tomcat from Yum, init script is already included, just run /etc/init.d/tomcat7 start/stop/restart

Thursday, September 29, 2011

Windows Active Directory (AD)

Port 389 and 3289 need to be opened.

Do check firewall outbound rule, spent more than a week to configure a remote office to join domain.
Endup discovered that remote office firewal blocked outgoing traffic for those ports!  

Friday, September 23, 2011

Linux - mySQL

 Grant Remote Access
CREATE USER 'joe.soh'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'joe.soh'@'%' WITH GRANT OPTION;

update user set password=PASSWORD("NEW-PASSWORD-HERE") where User='tom';

Thursday, September 15, 2011

Linux - Apache

Passworded Apache site

Password file location - /var/httpd/conf/.htpasswd
command - htpasswd -c /home/doe/public_html/.htpasswd jane

http://httpd.apache.org/docs/2.0/programs/htpasswd.html


# add password on access
AuthUserFile conf/.htpasswd
AuthGroupFile /dev/null
AuthName "Authorization Required"
Authtype Basic
require valid-user
or any other location as you want

Tuesday, November 23, 2010

Windows Server - grant the Logon as a batch job privilege

Question: How do I grant the Logon as a batch job privilege to my user account?
Answer: On Windows, this privilege is granted through the Local or Domain Security Policy. To do this using the Local Security Policy, follow these steps.
  1. In the Control Panel, open Administrative Tools, then Local Security Policy.
  2. Beneath Security Settings, open Local Policies and highlight User Rights Assignment.
  3. Locate Log on as a batch job. Open the properties and add any users that need this right.
  4. When finished, save your changes and close the Local Security Settings window.
Your changes should take effect immediately. To make changes to the Domain Security Policy, on a domain controller, use the Domain Security Policy utility in the Control Panel.

Source: http://www.brooksnet.com/faq/117-02.html