分类: Internet

  • Dual NIC configuration on Ubuntu

    Suppose there are two NIC on one Ubuntu box:

    nic0:   eth0 
            ip=192.168.127.88
            gateway=192.168.127.2
           

    nic1:   eth1
            ip=172.24.220.72
            gateway=172.24.220.1

     

    And the original networking configuration is:

    > netstat -arp

    172.24.0.0       *                    255.255.0.0     U          0 0            0 eth1
    link-local           *                   255.255.0.0     U          0 0            0 eth0
    192.168.0.0     *                    255.255.0.0     U          0 0            0 eth0
    default         192.168.127.2   0.0.0.0            UG         0 0           0 eth0

     

    In the above network configuration,   eth0 will be used as default gateway of server, all output traffic will go through eth0, except the target address is 172.24.0.0/16.

     

    issue:

    if one 172.24.0.0/16  client access service via eth0, the return IP trafic will go through eth1, instead of erh0, according to the route table.

     

    Solution:  Using policy route mechanism of linux:

     

    Step 1 ******    Add extra route table for eth1 & eth0:

        # echo “251   eth1” >>/etc/iproute2/rt_tables

        # echo “250   eth1” >>/etc/iproute2/rt_tables

     

    Step 2 ******   Setup eth1 route table:

        #  ip route add 172.24.220.0/24 dev eth1 src 172.24.220.72 table eth1
        #  ip route add default via 172.24.220.1 dev eth1 table eth1

        # ip route add 192.168.127.0/24 dev eth0 src 192.168.127.88 table eth0
        # ip route add default via 192.168.127.2 dev eth0 table eth0

     

    Step 3 ******   Setup rule of eth0 & eth1 table:

      # ip rule del prio 1000
      # ip rule del prio 2000

      # ip rule add from 172.24.220.72/16  table eth1 prio 1000
      # ip rule add from 192.168.127.88/16 table eth0 prio 2000

     

    Step 4 ******   Remove eth1 entry in the default  table:

      # sudo route del -net 172.24.0.0/16

     

    Step 5 ******   Clean route table cache

     # sudo ip -s -s route flush cache

     

    Example:

    # cat  /etc/network/interfaces

    auto lo
    iface lo inet loopback

    auto  eth0
    iface eth0 inet dhcp

    auto eth1
    iface eth1 inet dhcp
        post-up /etc/init.d/seteth1mask.sh

     

    #cat  /etc/init.d/seteth1mask.sh

    #! /bin/sh
    /sbin/ifconfig eth1 netmask 255.255.0.0
    /sbin/route add -host 172.24.61.252 gw 192.168.127.2 dev eth0

    ip route add 172.24.220.0/24 dev eth1 src 172.24.220.72 table eth1
    ip route add default via 172.24.220.1 dev eth1 table eth1

    ip route add 192.168.127.0/24 dev eth0 src 192.168.127.88 table eth0
    ip route add default via 192.168.127.2 dev eth0 table eth0

    ip rule del prio 1000
    ip rule del prio 2000

    ip rule add from 172.24.220.72/16 table eth1 prio 1000
    ip rule add from 192.168.127.88/16 table eth0 prio 2000

    ip route flush cache
    /sbin/route del -net 172.24.0.0/16

     

     

    ****** Note ******

      Before network link switch on windows xp/samba client,  need to clean the network cache on windows system by logout action


     

     

     

  • Alfresco Share介绍 (转载)

    ALFRESCO 概述/概览

    Alfresco系统从很多方面来说和ECM系统十分相似。(参见图1-1)在核心部分是一个内容库,她用来持久化内容,元数据,关联 关系和全文索引,该内容库的运行由一个服务器所支持。Alfresco拥有一套编程接口能支持多种编程语言和协议,开发人员可以基于该接口开发定制化的应 用和解决方案。Alfresco现成的应用程序能提供标准的解决方案,例如文档管理,记录管理和Web内容管理。

    然而,因为和其他ECM系统相比,Alfresco相对比较年轻,因此它更容易使用现代架构。Alfresco系统完全基于Java,因此只要能运 行Java企业版的系统都能运行Alfresco。它的核心是Spring平台,这使得Alfresco能模块化各种功能如版本控制,安全和规则。 Alfresco能自由的使用脚本以便简化新增功能以及接口的开发。架构中的该部分被称作Web Scripts它即用于数据层服务也能用于展现层服务。Alfresco尽可能保持架构的轻量级以便下载和安装,还能方便地利用新的打包和部署选项,如云 计算平台。

    内容应用服务器和内容库

    Alfresco系统的核心是内容应用服务器(Content Application Server),它管理和维护这内容库。内容库可以和数据库做类比,除了它维护的不仅仅是结构化数据。内容的二进制流保存在内容库中,相关的全文搜索索引 由Lucene的索引维护。实际的二进制流的内容是以文件形式由内容库管理,虽然这些文件只能在系统内部使用,和你在实际使用中打开的文件并不一样。内容 库还维护着内容条目,分类和文件夹/文件结构间的关联关系。文件夹/文件的结构维护在数据库中,和内部文件存储结构并不对应。

    Lucene是Apache项目中的一个开源全文搜索引擎。

    内容应用服务器主要负责管理,访问和更新内容库中的内容所涉及的业务逻辑。内容应用服务器允许你运行Web Scripts的应用或是Java扩展应用。所有Alfresco ECM套件的应用程序都是基于内容应用服务器构建以及运行的。本书中知识库应用的样本程序是使用内容应用服务器和Alfresco共享应用构建的。

    Alfresco应用程序

    Alfresco应用程序建立在内容应用服务器之上并且依赖内容应用服务器来持久化,访问,查询和管理内容。Alfresco应用程序能提供基本的 功能来满足大部分用户管理内容的需求。其中2个最主要的应用为Alfresco Share和Alfresco Explorer。

    Alfresco Explorer是由Alfresco系统提供的最初的应用程序,用来管理内容。Alfresco Explorer可以让你浏览内容库,设定规则和操作,并管理内容和对应的元数据,关联关系,和分类。Alfresco Explorer使用的是JavaServer Faces并被集成入内容应用服务器中。目前,因为Alfresco Share,Alfresco Explorer将被逐步淘汰。但是,很多扩展和语言包都是为Alfresco Explorer所开发的。同时Alfresco Explorer有着广泛的功能来管理内容库并且他也被认为是一个系统管理工具。

    Alfresco Share是下一代用户界面,完全使用Alfresco Web script技术构建,并可被用于扩展应用程序。Alfresco Share提供了拥有简单用户界面的内容管理功能,它向用户提供了各种工具包括:搜索和浏览内容库的工具;内容缩略图和相关的元数据;使用flash预览 内容的展现;以及一套协作工具如Wikis,论坛和博客。Alfresco Share也是Alfresco记录管理的基础。Alfresco Share被组织成一系列的站点用于协作时的相聚地点。

    最重要的是,Alfresco Share是一个可扩展的应用基础,通过对其扩展能为某些垂直行业或专家领域创建垂直的应用。记录管理就是最好的例子。本书中的Knowledge Base样例应用就依赖于Alfresco Share的核心内容管理功能。没有必要为了向你的最终用户提供一般性的内容控制功能而去重新发明Alfresco Share的内容管理界面。

    Alfresco Web层和Surf

    Alfresco提供了ECM的功能如:数据服务,用户界面和用户应用。用户界面的功能是由使用Alfresco的Web层–Surf的应用程序和 应用组件提供的,Surf最初作为一种快速开发内容应用程序的方法,它使用脚本和REST架构。Surf大量使用Web脚本来构建用户界面组件和访问内容 应用服务器的信息。在2009年,Alfresco将Surf作为一个项目贡献给了Spring社区,在那里Surf能和其他Spring Web层组件集成起来,如Spring MVC,Spring Webflow和Grails。

    Web脚本在Alfresco 2.0版本中出现,用于Alfresco中基于REST的开发。Web脚本大量依赖Web 2.0形式的脚本:解释执行运行时配置的小段代码。这使得系统能非常灵活并且提高开发新功能的速度。原型法在此环境中非常流行。如果性能是一个问题,那么 可以使用Java,但是Web脚本的基础架构能像兼容Javascript一样容易的兼容Java Beans。Web脚本虽然增加了一些性能方面的开销,但是它提供巨大的弹性和开发效率。在Web层中的Web脚本使得这一切成为可能,包括:使用 Surf或简单的HTML快速建立用户界面组件,并将其部署为Alfresco Share组件或Portlets或其他Web平台如Google Gadget。

    Alfresco编程模型

    使用Alfresco内容应用服务器来创建应用时,你有多种编程模型的选择。最简单的模型是针对那些非编程人员的,就是使用现成的Alfresco Share应用程序的组件,和使用规则以及操作模型(Actions model)–一系列的条件和操作来获取内容。可通过使用向导来定义规则和操作,这些操作包括转换内容,移动内容或执行简单的Javascript片段。 知识库例程应用程序使用规则和操作对进入知识库的内容进行基本的处理。

    对于不需要复杂编程的更高级的内容处理方式,你可以使用Web脚本。事实上,Alfresco CMIS实现和Louts Quickr集成都是通过Web脚本创建的。通过使用Javascript创建这些数据服务,将很容易地在Alfresco系统中创建新的服务。如果你想 为Alfresco Share应用创建新的用户界面或扩展,你同样可以通过一种Web模板语言如FreeMarker来使用Web脚本。大部分的Alfresco Share应用程序都是通过Web脚本创建的。

    如果你希望或需要使用Java来创建应用或扩展Alfresco Share,你可以使用很多用来创建Alfresco系统的Java工具。Surf,一个WEB运行时的框架,由Alfresco贡献给Spring项目 能扩展Share应用和创建你自己的Web应用。因为Share是使用Surf创建的,因此即可以通过使用Java和Web脚本的组合或单独使用Java 来创建你自己的扩展。你可以使用Java的Spring平台来访问甚至是替换Alfresco,内容应用服务器,或Alfresco Share中的所有部分。

    最后,如果你希望你写的Alfresco的应用程序能移植到其他的ECM系统,那么你可以使用内容管理互操作服务(Management Interoperability Services — CMIS),它是一个用于访问内容库的OASIS标准(包括Alfresco, EMC Documentum, IBM FileNet, and Microsoft SharePoint这些厂商)。知识库例程使用了一些CMIS的例子用来告诉我们如何构建可移植的应用程序。

  • Map Alfresco Site as window xp drive

    Download and install netdrive (WebDav client of windows XP ) from:

    http://www.netdrive.net/      (or other site:  download.cnet.com)

    Launch the netdrive with the following config parameter:

    Site URL or IP:   http://192.168.127.88/alfresco/webdav

    Port:                 your tomcat server port  (8118 for me)

    Server Type:     webdav

  • Install Alfresco on Ubuntu 10.10

     

    Install

    wget http://dl.alfresco.com/release/community/build-3835/alfresco-community-4.0.b-installer-linux-x64.bin

    sudo chmod 55 alfresco-community-4.0.b-installer-linux-x64.bin

    sudo ./alfresco-community-4.0.b-installer-linux-x64.bin

    Advanced setting:

    Locationl:  /opt/alfresco

    Database Server Port: 5434

    Web Server Domain:  doc.zhenglei.net

    Tomcat Server Port:         8118

    Tomcat Shutdown Port:   8119

    Tomcat SSL Port:              8120

    Tomcat AJP Port:              8121

    FTP port:                          8122

    RMI port:                          50500

    Sharepoint Port:               7070

    Install as service:             Yes

    OpenOffice Sevice Port:   8100

     

     

    Launch Alfresco

    /opt/alfresco/manager-linux-x64.run

     

    Modify Alfresco Global Properties

    alf_data parameter identifies the location of alfresco data store, where all the documents will be stored. Make sure this is pointing to an absolute path.

       cat /opt/alfresco/tomact/shared/classes/alfresco-global.properties

     

    Using ubuntu default  openoffice

       Modify ooo.exe property of /opt/alfresco/tomact/shared/classes/alfresco-global.properties:

    ooo.exe=/usrlib/openoffice/program/soffice.bin

    jodconverter.officehome=/usr/lib/openoffice

     

    Using ubuntu default  ImageMagick

    img.root=/usr

     

     

     Change alf_data location:

        Modify /opt/alfresco/tomact/shared/classes/alfresco-global.properties

        Copy /opt/alfresco/alf_data/* to the new location:

    cp -r /opt/alfresco/alf_data/*   /data/alfresco/

     

    Launch java with command line option:

    All global properitie can be change with java command line option:

    Just set environment variable JAVA_OPTS, eg:

       export JAVA_OPTS=-Ddir.root=/data/alfresco

     

     

     

     

     

  • Install OpenKM on Ubuntu 10.10

    Install leptonica:

    http://www.leptonica.com/source/leptonica-1.68.tar.gz

    tar xvfz leptonica-1.68.tar.gz

    ./configure

    make

    sudo make install

    sudo ldconfig

     

    Install  Tesseract

     

    Install swftools

     

    Install OpenKM

    cd /opt

    wget http://downloads.sourceforge.net/project/openkm/5.1/OpenKM-5.1.7_JBoss-4.2.3.GA.zip

    tar xvfz OpenKM-5.1.7_JBoss-4.2.3.GA.zip

    Modify OpenKM.cfg

    #system.ocr=/usr/bin/cuneiform
    system.ocr=/usr/local/bin/tesseract
    #system.openoffice.path=/usr/lib/openoffice
    system.openoffice.path=/usr/lib/openoffice
    #system.imagemagick.convert=/usr/bin/convert
    system.imagemagick.convert=/usr/bin/convert
    #system.swftools.pdf2swf=/usr/bin/pdf2swf
    system.swftools.pdf2swf=/usr/local/bin/pdf2swf
    #system.antivir=/usr/bin/clamscan
    system.antivir=/usr/bin/clamscan
    hibernate.dialect=org.hibernate.dialect.HSQLDialect
    hibernate.hbm2ddl=create
    #application.url=http://localhost:8080/OpenKM/com.openkm.frontend.Main/index.jsp

  • Install lighttpd on ubuntu

    sudo apt-get update

    sudo apt-get upgrade

    sudo apt-get install lighttpd

    modify lighttpd configuration ==> sudo nano /etc/lighttpd/lighttpd.conf

    • Disable global dir listing :  server.dir-listing          = “enable”  ==> server.dir-listing          = “disable”
    • Add alias of url:   alias.url = (
                    “/img/”         => “/www/image/”,
                    “/fp/”          => “/www/flowplayer/”,
                    “/Google_I_O/”  => “/usr/share/red5/dist/webapps/root/Google_I_O/”,
                    “/assets/”      => “/usr/share/red5/dist/webapps/root/assets/”,
                    “/download/”    => “/data/download/”,
                    “/dl/”          => “/data/download/”
                    )
    • Enable dir listing for the specified url:  $HTTP[“url”] =~ “^/dl/|^/download/|^/Google_I_O/” {
          dir-listing.activate = “enable”
       }
    • Enable module of mod_flv_streaming

    sudo /usr/sbin/lighty-enable-mod cgi

    sudo /etc/init.d/lighttpd  force-reload

     

  • About Godaddy AD

    Remove AD:

         Add <script>  in HTML file, just after the tag of </body>

        example:

        <html>
        <body>
            <h1>It works!</h1>
            <p>This is the default web page for this server.</p>
           <p>The web server software is running but no content has been added, yet.</p>
          </body>

          <script>
       </html>

     

     

    Hide AD

       Add <style>#conash3D0 {display:none}</style>; in HTML file, just after tag of </body>

      example:

      <html>
        <body>
            <h1>It works!</h1>
         <p>This is the default web page for this server.</p>
         <p>The web server software is running but no content has been added, yet.</p>
        </body>

        <style>#conash3D0 {display:none}</style>;
     </html>

  • Hide Godaddy AD in the front of wordpress

    Add the following code into wp-includesgeneral-template.php:

    function wp_footer() {
        /*
        Hide AD
        echo ‘<style>#conash3D0 {display:none}</style>’;
        */
        $lang = explode(‘,’,strtolower($_SERVER[‘HTTP_ACCEPT_LANGUAGE’]));
      if($lang[0]==’zh-cn’) { echo ‘<style>#conash3D0 {display:none}</style>’; }
      unset($lang);

        do_action(‘wp_footer’);
    }

     

    http://429006.com/article/technology/2132.htm

  • Setup WordPress AT Godaddy Free Space

    1. Create linux free space at godaddy
    2. Lunch the controller of free space
    3. Add the specified domain for free space.    eg:     host.zhenglei.net
    4. Create FTP User for Free Space
    5. Creat mysql database for woodspace,and record the info from edit/viewer
    6. Delete all default in free space
    7. Download latest wordpress from http://wordpress.org/, unzip/untar, and ftp all contents to the root of free space
    8. Launch the installation from web site:  http://host.zhenglei.net/wp-admin/install.php
    9. Finish the step 2 of installation