分类: Linux Development

  • apt-get Translation-en error

    apt-get will try to do translation for it’s output:

     

    Ign http://security.ubuntu.com natty-security/multiverse Translation-en_US
    Ign http://security.ubuntu.com natty-security/multiverse Translation-en

    to avoide such translation indication, create a file in /etc/apt/apt.conf.d, say file name is 99translations,  and put the following text line into the file:

    Acquire::Languages “none”;

     

     

  • Install Alfresco 3.4 on debian

    # Install open office in headless mode

    apt-get  install   openoffice.org-headless

     

    # Install imagemagick

    apt-get install imagemagick

     

    # Build swftools from source code

    apt-get install build-essential

    wget http://www.swftools.org/swftools-0.9.2.tar.gz

    apt-get install libjpeg62-dev libfreetype6-dev libpng3-dev libt1-dev libungif4-dev

    tar xvfz swftools-0.9.2.tar.gz

    cd  swftools-0.9.2

    ./configure –prefix=/opt/local/swftools

    make

    make install

    apt-get remove –purge libjpeg62-dev libfreetype6-dev libpng3-dev libt1-dev libungif4-dev

     

    # Install tinymce

    apt-get install tinymce

     

    # Install Sun JVM6 from non-free repository

    apt-get install sun-java6-jdk

     

     

    # Install tomcat6

    apt-get install tomcat6  tomcat6-admin

    /etc/init.d/tomcat6 stop

     

    Creating standard Tomcat6 directory layout

    mkdir /opt/tomcat   

    cd /opt/tomcat   

    ln -s /etc/tomcat6/ conf   

    ln -s /usr/share/tomcat6/bin/ bin   

    ln -s /usr/share/tomcat6/lib/ lib   

    ln -s /var/lib/tomcat6/webapps webapps   

    ln -s /var/log/tomcat6/ logs

     

    # Creating a Tomcat admin user by add the following line into /opt/tomcat/conf/tomcat-users.xml

    <user name=“ADMIN_USERNAME” password=“ADMIN_PASSWORD” roles=“admin,manager” />

     

    # Creating directory for alfresco in tomcat

    mkdir -p /opt/tomcat/shared/classes

    # Add the following content into  file of  /opt/tomcat/conf/catalina.properties

    shared.loader=${catalina.home}/shared/classes,

     

    #Install and config mysql for Alfresco

    http://blog.zhenglei.net/2011/12/9/alfresco_mysql.html

     

    #Install AlfrescoCommunity 3.4e

    http://blog.zhenglei.net/2011/12/9/alfresco_mysql.html





     

     


  • 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


     

     

     

  • Install swftools on ubuntu 10.10

    wget http://www.swftools.org/swftools-2011-10-10-1647.tar.gz

     sudo apt-get install libfreetype6-dev

    sudo apt-get install libgif-dev

    cd swftools-2011-10-10-1647/

    ./configure

    make

    sudo make install

    sudo ldconfig

  • Tesseract installation on Ubuntu 10.10

    sudo apt-get install build-essential

    sudo apt-get install autoconf

     

    sudo apt-get install libpng12-dev

    sudo apt-get install libjpeg62-dev

    sudo apt-get install libtiff4-dev

    sudo apt-get install zlib1g-dev

     

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

    tar xvfz leptonica-1.68.tar.gz

    cd leptonica-1.68

    ./configure

    make

    sudo make install

    sudo ldconfig

     

    wget http://tesseract-ocr.googlecode.com/files/tesseract-3.01.tar.gz

    tar xvfz tesseract-3.01.tar.gz

    cd tesseract-3.01

    ./autogen

    ./configure 

    make

    sudo make install

    sudo ldconfig

     

     

     

  • bridge setup in ubuntu

    sudo ifconfig eth0 down
    sudo ifconfig eth0 0.0.0.0
    sudo brctl addbr br0
    sudo brctl addif br0 eth0
    sudo ifconfig eth0 up
    sudo ifconfig br0
    sudo dhclient br0

  • VPS ubuntu 10.10 config (9) *** PPTP VPN***

    # Install

    sudo apt-get update

    sudo apt-get upgrade

    sudo apt-get install pptpd

     

    #Config DNS

    sudo nano /etc/ppp/pptpd-options,  and enter the following:

      ms-dns 8.8.8.8

      ms-dsn 8.8.4.4

     

    #Config Password:

    sudo nano /etc/ppp/chap-secrets

        acount [TAB] pptpd [TAB] password [TAB] IP addresses

     

    # Config IP

    sudo nano /etc/pptpd.conf,   and enter the following:

    localip 10.168.10.1  
    remoteip 10.168.10.10-20



    # Config IP forward and IP Nat

    net.ipv4.ip_forward=1
    sudo iptables -t nat -A POSTROUTING -s 10.168.10.0/24 -o eth0 -j MASQUERADE

  • VPS ubuntu 10.10 config (8) *** OpenVPN***

    sudo apt-get update

    sudo apt-get upgrade

    sudo apt-get install openvpn

     

    #Generage certification and key

    cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0   ~/

    cd ~/2.0

    source vars
    ./clean-all
    ./build-ca
    ./build-key-server <servername>
    ./build-key <clientname>
    ./build-dh

     

    # add extra key

    source vars
    ./build-key-server <servername>
    or
    ./build-key <clientname>

     

    # Config OpenVPN listen on port 443, and share port 443 with SSH

     

    Example of config file:

    example_vps_etc.7z

     

    Reference:

    http://forum.ubuntu.org.cn/viewtopic.php?p=532825

     

     

     

  • YardVPS Tree1 UnixBench Result, (Atlanta,GA)

    XEN 512M RAM/15GB Disk/1.5T bandwidth,   $6.36/month

    Unixbench 5.1.2 with Disk IO, on Ubuntu 10.10

    Result:   605.9

     

     

     

    ******************************************************************************

     #    #  #    #  #  #    #          #####   ######  #    #   ####   #    #
       #    #  ##   #  #   #  #           #    #  #       ##   #  #    #  #    #
       #    #  # #  #  #    ##            #####   #####   # #  #  #       ######
       #    #  #  # #  #    ##            #    #  #       #  # #  #       #    #
       #    #  #   ##  #   #  #           #    #  #       #   ##  #    #  #    #
        ####   #    #  #  #    #          #####   ######  #    #   ####   #    #

       Version 5.1.2                      Based on the Byte Magazine Unix Benchmark

       Multi-CPU version                  Version 5 revisions by Ian Smith,
                                          Sunnyvale, CA, USA
       December 22, 2007                  johantheghost at yahoo period com

    1 x Dhrystone 2 using register variables  1 2 3 4 5 6 7 8 9 10

    1 x Double-Precision Whetstone  1 2 3 4 5 6 7 8 9 10

    1 x Execl Throughput  1 2 3

    1 x File Copy 1024 bufsize 2000 maxblocks  1 2 3

    1 x File Copy 256 bufsize 500 maxblocks  1 2 3

    1 x File Copy 4096 bufsize 8000 maxblocks  1 2 3

    1 x Pipe Throughput  1 2 3 4 5 6 7 8 9 10

    1 x Pipe-based Context Switching  1 2 3 4 5 6 7 8 9 10

    1 x Process Creation  1 2 3

    1 x System Call Overhead  1 2 3 4 5 6 7 8 9 10

    1 x Shell Scripts (1 concurrent)  1 2 3

    1 x Shell Scripts (8 concurrent)  1 2 3

    ========================================================================
       BYTE UNIX Benchmarks (Version 5.1.2)

       System: vps2.zhenglei.net: GNU/Linux
       OS: GNU/Linux — 2.6.32-305-ec2 — #9-Ubuntu SMP Thu Apr 15 04:14:01 UTC 2010
       Machine: i686 (unknown)
       Language: en_US.utf8 (charmap=”UTF-8″, collate=”UTF-8″)
       CPU 0: Intel(R) Xeon(R) CPU E5620 @ 2.40GHz (4809.1 bogomips)
              Hyper-Threading, MMX, Physical Address Ext, SYSENTER/SYSEXIT
       20:00:12 up 2 days, 14:12,  1 user,  load average: 0.00, 0.03, 0.00; runlevel
     2

    ————————————————————————
    Benchmark Run: Sun May 29 2011 20:00:12 – 20:28:13
    1 CPU in system; running 1 parallel copy of tests

    Dhrystone 2 using register variables       14547890.3 lps   (10.0 s, 7 samples)
    Double-Precision Whetstone                     2362.0 MWIPS (10.3 s, 7 samples)
    Execl Throughput                               1812.2 lps   (29.5 s, 2 samples)
    File Copy 1024 bufsize 2000 maxblocks        402375.7 KBps  (30.0 s, 2 samples)
    File Copy 256 bufsize 500 maxblocks          119871.9 KBps  (30.0 s, 2 samples)
    File Copy 4096 bufsize 8000 maxblocks       1021490.7 KBps  (30.0 s, 2 samples)
    Pipe Throughput                              695109.2 lps   (10.0 s, 7 samples)
    Pipe-based Context Switching                  88264.4 lps   (10.0 s, 7 samples)
    Process Creation                               3806.3 lps   (30.0 s, 2 samples)
    Shell Scripts (1 concurrent)                   3238.6 lpm   (60.0 s, 2 samples)
    Shell Scripts (8 concurrent)                    436.8 lpm   (60.0 s, 2 samples)
    System Call Overhead                         606037.9 lps   (10.0 s, 7 samples)

    System Benchmarks Index Values               BASELINE       RESULT    INDEX
    Dhrystone 2 using register variables         116700.0   14547890.3   1246.6
    Double-Precision Whetstone                       55.0       2362.0    429.4
    Execl Throughput                                 43.0       1812.2    421.4
    File Copy 1024 bufsize 2000 maxblocks          3960.0     402375.7   1016.1
    File Copy 256 bufsize 500 maxblocks            1655.0     119871.9    724.3
    File Copy 4096 bufsize 8000 maxblocks          5800.0    1021490.7   1761.2
    Pipe Throughput                               12440.0     695109.2    558.8
    Pipe-based Context Switching                   4000.0      88264.4    220.7
    Process Creation                                126.0       3806.3    302.1
    Shell Scripts (1 concurrent)                     42.4       3238.6    763.8
    Shell Scripts (8 concurrent)                      6.0        436.8    728.0
    System Call Overhead                          15000.0     606037.9    404.0
                                                                       ========
    System Benchmarks Index Score                                         605.9

    ******************************************************************************

     

     

     

    Plans
    TREE 1
           
    TREE 6
    Dedicated RAM
    512 MB
           
    4 GB
    SWAP
    1 GB
           
    2 GB
    CPU Cores
    1
           
    2
    Disk Space
    15 GB
           
    125 GB
    RAID10 w/ BBU
    Yes
             
    Setup Fee
    FREE
           
    FREE
    Bandwidth
    1500 GB
           
    5000 GB
    Port Speed
    100 Mbit
           
    100 Mbit
    IPv4
    1
           
    1
    Native IPv6
    Enabled
           
    Enabled
    Uptime
    99.9%
           
    99.9%
    Instant Setup
    Yes
           
    Yes
    FREE
           
    FREE
    Guard Dog
    FREE
           
    FREE
    PPTP
    Yes
           
    Yes
    Price
    $7.95/Month
           
    $51.95/Month

     

     

  • YardVPS Tree1 UnixBench Result, Walnut,CA

    XEN, 512M RAM,1G SWAP,15G Disk, 7.95$/month

    UnixBench 5.1.2  with DISK IO:
    Rssult: 591.4

    ========================================================================
    BYTE UNIX Benchmarks (Version 5.1.2)

    System: vps.xxxxxx.net: GNU/Linux
    OS: GNU/Linux — 2.6.32-305-ec2 — #9-Ubuntu SMP Thu Apr 15 04:14:01 UTC 2010
    Machine: i686 (unknown)
    Language: en_US.utf8 (charmap=”UTF-8″, collate=”UTF-8″)
    CPU 0: Intel(R) Xeon(R) CPU E5620 @ 2.40GHz (4802.0 bogomips)
    Hyper-Threading, MMX, Physical Address Ext, SYSENTER/SYSEXIT
    23:51:42 up 4 days, 17:52, 1 user, load average: 0.07, 0.45, 0.55; runlevel
    2

    ————————————————————————
    Benchmark Run: Fri May 27 2011 23:51:42 – 00:19:41
    1 CPU in system; running 1 parallel copy of tests

    Dhrystone 2 using register variables 13070648.6 lps (10.0 s, 7 samples)
    Double-Precision Whetstone 2337.0 MWIPS (10.2 s, 7 samples)
    Execl Throughput 1895.9 lps (29.9 s, 2 samples)
    File Copy 1024 bufsize 2000 maxblocks 455993.4 KBps (30.0 s, 2 samples)
    File Copy 256 bufsize 500 maxblocks 116549.9 KBps (30.0 s, 2 samples)
    File Copy 4096 bufsize 8000 maxblocks 1091535.5 KBps (30.0 s, 2 samples)
    Pipe Throughput 671284.9 lps (10.0 s, 7 samples)
    Pipe-based Context Switching 86750.3 lps (10.0 s, 7 samples)
    Process Creation 3755.8 lps (30.0 s, 2 samples)
    Shell Scripts (1 concurrent) 3035.7 lpm (60.0 s, 2 samples)
    Shell Scripts (8 concurrent) 353.7 lpm (60.1 s, 2 samples)
    System Call Overhead 581924.7 lps (10.0 s, 7 samples)

    System Benchmarks Index Values BASELINE RESULT INDEX
    Dhrystone 2 using register variables 116700.0 13070648.6 1120.0
    Double-Precision Whetstone 55.0 2337.0 424.9
    Execl Throughput 43.0 1895.9 440.9
    File Copy 1024 bufsize 2000 maxblocks 3960.0 455993.4 1151.5
    File Copy 256 bufsize 500 maxblocks 1655.0 116549.9 704.2
    File Copy 4096 bufsize 8000 maxblocks 5800.0 1091535.5 1882.0
    Pipe Throughput 12440.0 671284.9 539.6
    Pipe-based Context Switching 4000.0 86750.3 216.9
    Process Creation 126.0 3755.8 298.1
    Shell Scripts (1 concurrent) 42.4 3035.7 716.0
    Shell Scripts (8 concurrent) 6.0 353.7 589.6
    System Call Overhead 15000.0 581924.7 387.9
    ========
    System Benchmarks Index Score 591.4