Wednesday, February 19, 2014

Setup Java EE Project using MVN

# mkdir /var/tmp/AutomationFrameWork
# cd /var/tmp/AutomationFrameWork

Create pom.xml

# mvn -X archetype:generate -DgroupId=ca.goweekend.afw -DartifactId=AutomationFrameWork -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false

Customize pom.xml


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>ca.goweekend.afw</groupId>
    <artifactId>AutomationFrameWork</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>AutomationFrameWork</name>
    <url>http://maven.apache.org</url>
    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>3.2.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>3.2.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>3.2.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-mongodb</artifactId>
            <version>1.3.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-nop</artifactId>
            <version>1.7.5</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.5</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
            <version>1.7.5</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-jdk14</artifactId>
            <version>1.7.5</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.5</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <build>
        <finalName>AutomationFramework</finalName>
    </build>
</project>

Download dependencies


# mvn dependency:copy-dependencies -DoutputDirectory=libs

Wednesday, February 12, 2014

Setup SMB on Solaris 11 Journal

https://groups.google.com/forum/#!topic/comp.unix.solaris/RlBJMUnQmIM
http://www.oracle.com/technetwork/articles/servers-storage-admin/solaris-zfssmb-sharing-2390458.html

No following symlinks in shares, unless they are on the same filesystem.

Install SMB on Solaris 11
pkg install service/file-system/smb


How to Configure the SMB Server in Workgroup Mode

Enable the SMB service.
# svcadm enable -r smb/server

(Optional) Change the SMB server to operate in a different workgroup.

# smbadm join -w WORKGROUP

Edit the /etc/pam.conf file to support creation of an encrypted version of the user's password for SMB.
other    password required    pam_smb_passwd.so.1    nowarn

Specify the password for existing local users

# passwd feijiangnan
# cat /var/smt/smbpasswd


How to Create an SMB Share (zfs)
Create a ZFS pool and a mixed-case ZFS file system that supports cross-protocol locking.


# zpool create pool-name vdev
# zfs create -o nbmand=on fsname

Enable SMB sharing for the ZFS file system.
# zfs set sharesmb=on fsname

(Optional) Create an SMB share that has non-default property values or an SMB share for a directory other than the mount point of the dataset.
# zfs set share=name=myshare,path=/mntpnt/directory,prot=smb pool-name/fsname

(Optional) Specify additional SMB share properties.
# zfs set share=name=smb_share,path=/mntpnt/dir2,prot=smb,csc=auto rpool/export/horse

# zfs set share=name=smb_share,prot=smb rpool/export/horse

Verify how the file system is shared.
# cat /etc/dfs/sharetab

# zfs set sharesmb=on rpool/export/horse
# svcadm restart smb/server



# zfs get aclmode rpool/export/home/feijiangnan

NAME                    PROPERTY  VALUE        SOURCE

rpool/export/home/feijiangnan  aclmode   discard  default

# zfs set aclmode=passthrough rpool/export/home/feijiangnan

# zfs get aclmode rpool/export/home/feijiangnan

NAME                    PROPERTY  VALUE        SOURCE

rpool/export/home/feijiangnan  aclmode   passthrough  local

# chmod -R A+user:feijiangnan:read_data/write_data/execute:file_inherit/dir_inherit:allow testdir

# chmod -R A-user:feijiangnan:read_data/write_data/execute:file_inherit/dir_inherit:allow testdir

# chmod -R A+user:feijiangnan:full_set:file_inherit/dir_inherit:allow horse

Hide dot file

root@feifs:/export/horse# ls -a/c
total 16
drwxr-xr-x+  4 root     root           6 Feb  3 10:37 .
                {A------m----}
drwxr-x---   2 root     sys            3 Jan 31 11:02 .$EXTEND
                {AH-S---m----}
drwxr-xr-x   4 root     sys            4 Jan 31 10:45 ..
                {A------m----}
-rw-r--r--+  1 root     root          27 Feb  3 10:37 .profile
                {A------m----}
-rwx------+  1 feijiangnan     staff         15 Feb  3 10:36 abc.txt
                {A------m----}
drwx------+  2 feijiangnan     staff          3 Feb  3 10:37 testdir
                {A------m----}
root@feifs:/export/horse#
root@feifs:/export/horse# find . -name '\.*' -type f -exec chmod S+cH {} \;
root@feifs:/export/horse# ls -a/c
total 16
drwxr-xr-x+  4 root     root           6 Feb  3 10:37 .
                {A------m----}
drwxr-x---   2 root     sys            3 Jan 31 11:02 .$EXTEND
                {AH-S---m----}
drwxr-xr-x   4 root     sys            4 Jan 31 10:45 ..
                {A------m----}
-rw-r--r--+  1 root     root          27 Feb  3 10:37 .profile
                {AH-----m----}
-rwx------+  1 feijiangnan     staff         15 Feb  3 10:36 abc.txt
                {A------m----}
drwx------+  2 feijiangnan     staff          3 Feb  3 10:37 testdir
                {A------m----}


# idmap add -d "winuser:*@*" "unixuser:*"
add -d  winuser:*@*     unixuser:*




ZFC ACL Journal

Create Sub Folder
# mkdir acltest1
# ls -dv acltest1
drwxr-xr-x   2 root     root           2 Jan 22 12:42 acltest1
     0:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/read_xattr/write_xattr/execute/delete_child
         /read_attributes/write_attributes/read_acl/write_acl/write_owner
         /synchronize:allow
     1:group@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
     2:everyone@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow

#  chmod A+user:feijiangnan:read_data/write_data/execute:allow acltest1

# ls -dv acltest1
drwxr-xr-x+  2 root     root           2 Jan 22 12:42 acltest1
     0:user:feijiangnan:list_directory/read_data/add_file/write_data/execute:allow
     1:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/read_xattr/write_xattr/execute/delete_child
         /read_attributes/write_attributes/read_acl/write_acl/write_owner
         /synchronize:allow
     2:group@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
     3:everyone@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
# mkdir acltest1/subdir
# ls -dv acltest1/subdir
drwxr-xr-x   2 root     root           2 Jan 22 13:41 acltest/subdir
     0:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/read_xattr/write_xattr/execute/delete_child
         /read_attributes/write_attributes/read_acl/write_acl/write_owner
         /synchronize:allow
     1:group@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
     2:everyone@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow

Granting ACL Inheritance on Files and Directories
# mkdir acltest2
# ls -dv acltest2
drwxr-xr-x   2 root     root           2 Jan 22 13:44 acltest2
     0:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/read_xattr/write_xattr/execute/delete_child
         /read_attributes/write_attributes/read_acl/write_acl/write_owner
         /synchronize:allow
     1:group@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
     2:everyone@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
# chmod A+user:feijiangnan:read_data/write_data/execute:allow acltest2

# chmod A+user:feijiangnan:read_data/write_data/execute:file_inherit/dir_inherit:allow acltest2

chmod A+user:jlopez3:read_data/write_data/execute:file_inherit/dir_inherit:allow acltest2

# ls -dv acltest2
drwxr-xr-x+  2 root     root           2 Jan 22 14:10 acltest2
     0:user:feijiangnan:list_directory/read_data/add_file/write_data/execute
         :file_inherit/dir_inherit:allow
     1:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/read_xattr/write_xattr/execute/delete_child
         /read_attributes/write_attributes/read_acl/write_acl/write_owner
         /synchronize:allow
     2:group@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
     3:everyone@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow

# mkdir acltest2/subdir
# ls -dv acltest2/subdir
drwxr-xr-x+  2 root     root           2 Jan 22 14:13 acltest2/subdir
     0:user:feijiangnan:list_directory/read_data/execute:file_inherit/dir_inherit
         /inherited:allow
     1:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/read_xattr/write_xattr/execute/delete_child
         /read_attributes/write_attributes/read_acl/write_acl/write_owner
         /synchronize:allow
     2:group@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
     3:everyone@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow

# chmod A+user:feijiangnan:read_data/write_data:dir_inherit:allow acltest2
# mkdir acltest2/subdir
# ls -dv acltest2/subdir
drwxr-xr-x+  2 root     root           2 Jan 22 14:03 acltest2/subdir
     0:user:feijiangnan:list_directory/read_data:dir_inherit/inherited:allow
     1:owner@:list_directory/read_data/add_file/write_data/add_subdirectory
         /append_data/read_xattr/write_xattr/execute/delete_child
         /read_attributes/write_attributes/read_acl/write_acl/write_owner
         /synchronize:allow
     2:group@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow
     3:everyone@:list_directory/read_data/read_xattr/execute/read_attributes
         /read_acl/synchronize:allow

Owner inherit ACL from parents directory.
# zfs set aclmode=mask pond/whoville

# zfs set aclinherit=restricted pond/whoville

root@biserver:~# zfs get aclinherit rpool/export/home/feijiangnan
NAME                    PROPERTY    VALUE       SOURCE
rpool/export/home/feijiangnan  aclinherit  restricted  default
root@biserver:~# zfs get aclmode rpool/export/home/feijiangnan
NAME                    PROPERTY  VALUE    SOURCE
rpool/export/home/feijiangnan  aclmode   discard  default
root@biserver:~#

# chmod A+group:dba:modify_set:allow acltest1

# zfs get aclmode rpool/export/home/feijiangnan
NAME                    PROPERTY  VALUE        SOURCE
rpool/export/home/feijiangnan  aclmode   discard  default

# zfs set aclmode=passthrough rpool/export/home/feijiangnan

# zfs get aclmode rpool/export/home/feijiangnan
NAME                    PROPERTY  VALUE        SOURCE
rpool/export/home/feijiangnan  aclmode   passthrough  local

Friday, February 7, 2014

Install subversion client on Solaris

Install SVN Client on Solaris 11
# pkg install developer/versioning/subversion

Monday, February 3, 2014

MySQL Installation on SLES

1. Download MySQL binary from
http://dev.mysql.com/downloads/mysql/

2. Unzip the bunddle
MySQL-client-5.5.36-1.sles11.x86_64.rpm  MySQL-embedded-5.5.36-1.sles11.x86_64.rpm  MySQL-shared-5.5.36-1.sles11.x86_64.rpm         MySQL-test-5.5.36-1.sles11.x86_64.rpm
MySQL-devel-5.5.36-1.sles11.x86_64.rpm   MySQL-server-5.5.36-1.sles11.x86_64.rpm    MySQL-shared-compat-5.5.36-1.sles11.x86_64.rpm
3. Install Server and Client
# zypper install MySQL-server-5.5.36-1.sles11.x86_64.rpm MySQL-client-5.5.36-1.sles11.x86_64.rpm

4. Start up MySQL
# /usr/bin/mysqld_safe &


if you got error as below:
Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

Solution:
# mysql_install_db --user=mysql --ldata=/var/lib/mysql/