Install DenyHosts on Linux VPS

#!/bin/bash
PKG_VER=2.10
PKG_DIR=denyhosts-${PKG_VER}
PKG_TAR=${PKG_DIR}.tar.gz
PKG_URL=https://sourceforge.net/projects/denyhosts/files/denyhosts/${PKG_VER}

rm ${PKG_TAR}
rm -rf ${PKG_DIR}
wget –no-check-certificate  ${PKG_URL}/${PKG_TAR}
tar xvfz ${PKG_TAR}

sudo mv ${PKG_DIR}/ /usr/share/denyhosts

cd /usr/share/denyhosts/
sudo cp denyhosts.conf /etc

CFG=/etc/denyhosts.conf
sudo sed -i “s/DENY_THRESHOLD_ROOT = 1/DENY_THRESHOLD_ROOT = 8/” ${CFG}
sudo sed -i “s/ADMIN_EMAIL = root@localhost/ADMIN_EMAIL = /” ${CFG}

sudo cp denyhosts.py /usr/sbin/denyhosts
sudo mv daemon-control-dist daemon-control

cd /etc/init.d
sudo ln -s /usr/share/denyhosts/daemon-control denyhosts
sudo touch /var/log/auth.log
sudo update-rc.d denyhosts start
sudo /etc/init.d/denyhosts start

 

 

setup git server on centos 5

# Install Git on git.zhenglei.net
yum install expat-devel zlib-devel gettext-devel openssl-devel
unzip git-1.7.2.5.zip
cd git-1.7.2.5
make prefix=/usr/local install

## Create empty repository of test.git in /repo of git.zhenglei.net
mkdir /repo
cd /repo
GIT_DIR=test.git git init
cd test.git
git –bare update-server-info
cp hooks/post-update.sample hooks/post-update

## Access git.zhenglei.net via port XXXX over ssh
# Config ssh on workstation
echo “Host git.zhenglei.net” >>~/.ssh/config
echo “hostname git.zhenglei.net”>>~/.ssh/config
echo port XXXX >>~/.ssh/config

## Clone test.git
git clone ssh://root@git.zhenglei.net/repo/test.git

## Add README in local
cd test
touch README
git add README
git commit -m “add readme”

## Push back to server
git push origin master

VPS Ubuntu 10.04 config (1)

1. 新增日常管理的用户:   myname

           adduser  myname

2. 将用户加入sudo组:

      gpasswd -a myname sudo

3.  启用sudo功能:   visudo在/etc/sudoers文件里root那行后面添加入新加的管理用户:

      root ALL=(ALL) ALL
     myname ALL=(ALL) ALL

4.  重新以 myname 账户登入, 并测试 sudo 功能

         sudo myname

5. 禁用root账户

         sudo passwd -l root

6.  修改ubuntu的软件更新源:  

        sudo nano /etc/apt/sources.list

          deb     http://us.archive.ubuntu.com/ubuntu lucid main restricted universe multiverse
          deb     http://us.archive.ubuntu.com/ubuntu lucid-security main restricted universe multiverse
          deb     http://us.archive.ubuntu.com/ubuntu lucid-updates main restricted universe multiverse
          deb     http://us.archive.ubuntu.com/ubuntu lucid-proposed main restricted universe multiverse
          deb     http://us.archive.ubuntu.com/ubuntu lucid-backports main restricted universe multiverse
          deb-src http://us.archive.ubuntu.com/ubuntu lucid main restricted universe multiverse
          deb-src http://us.archive.ubuntu.com/ubuntu lucid-security main restricted universe multiverse
          deb-src http://us.archive.ubuntu.com/ubuntu lucid-updates main restricted universe multiverse
          deb-src http://us.archive.ubuntu.com/ubuntu lucid-proposed main restricted universe multiverse
          deb-src http://us.archive.ubuntu.com/ubuntu lucid-backports main restricted universe multiverse

7.  更新系统:

            sudo apt-get update

            sudo apt-get upgrade

8.  安装需要软件:

        sudo apt-get install language-pack-en language-pack-zh

        sudo apt-get install bash-completion

        sudo apt-get install vim ctags vim-doc vim-scripts

        sudo apt-get install screen byobu

        #安装压缩解压缩软件

        sudo apt-get install bzip2 unzip unrar p7zip

#安装基本的语言环境和开发包

       sudo apt-get install perl python python-dev ruby ruby-dev sqlite sqlite3 openssl

 #安装编译环境和开发包

       sudo apt-get install gcc g++ make autoconf automake patch gdb libtool cpp build-essential libc6-dev libncurses-dev expat

#安装第三方类库的开发包

      sudo apt-get install libbz2-dev libexpat1-dev libssl-dev libdb-dev libgmp3-dev   liblzo2-dev

#安装版本控制工具

      sudo apt-get install git-core subversion mercurial

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

 

 

VPS Ubuntu 10.10 config (1)

1. 新增日常管理的用户:   myname

           adduser  myname

2. 将用户加入sudo组:

      gpasswd -a myname sudo

3.  启用sudo功能:   visudo在/etc/sudoers文件里root那行后面添加入新加的管理用户:

      root ALL=(ALL) ALL
     myname ALL=(ALL) ALL

4.  重新以 myname 账户登入, 并测试 sudo 功能

         sudo myname

5. 禁用root账户

         sudo passwd -l root

6.  修改ubuntu的软件更新源:  

        sudo namo /etc/apt/sources.list

          deb     http://us.archive.ubuntu.com/ubuntu maverick main restricted universe multiverse
          deb     http://us.archive.ubuntu.com/ubuntu maverick-security main restricted universe multiverse
          deb     http://us.archive.ubuntu.com/ubuntu maverick-updates main restricted universe multiverse
          deb     http://us.archive.ubuntu.com/ubuntu maverick-proposed main restricted universe multiverse
          deb     http://us.archive.ubuntu.com/ubuntu maverick-backports main restricted universe multiverse
          deb-src http://us.archive.ubuntu.com/ubuntu maverick main restricted universe multiverse
          deb-src http://us.archive.ubuntu.com/ubuntu maverick-security main restricted universe multiverse
          deb-src http://us.archive.ubuntu.com/ubuntu maverick-updates main restricted universe multiverse
          deb-src http://us.archive.ubuntu.com/ubuntu maverick-proposed main restricted universe multiverse
          deb-src http://us.archive.ubuntu.com/ubuntu maverick-backports main restricted universe multiverse

7.  更新系统:

            sudo apt-get update

            sudo apt-get upgrade

8.  安装需要软件:

        sudo apt-get install language-pack-en language-pack-zh

       sudo apt-get install bash-completion

       sudo apt-get install vim ctags vim-doc vim-scripts

       sudo apt-get install screen byobu

      #安装压缩解压缩软件

       sudo apt-get install bzip2 unzip unrar p7zip

       #安装基本的语言环境和开发包

       sudo apt-get install perl python python-dev ruby ruby-dev sqlite sqlite3 openssl 

       #安装编译环境和开发包

       sudo apt-get install gcc g++ make autoconf automake patch gdb libtool cpp build-essential libc6-dev libncurses-dev expat

      #安装第三方类库的开发包

      sudo apt-get install libbz2-dev libexpat1-dev libssl-dev libdb-dev libgmp3-dev   liblzo2-dev

 

     #sudo apt-get install libcurl-dev
     #sudo apt-get install libcurl4-gnutls-dev

     #sudo apt-get install libpng12-dev
     #sudo apt-get install libxml2-dev
     #sudo apt-get install libjpeg-dev
     #sudo apt-get install libtiff-dev libfreetype6-dev libxslt1-dev
     #sudo apt-get install libssh-dev libssh2-1-dev
     #sudo apt-get install libpcre3-dev libpcre++-dev libssl-dev libgmp3-dev
     #sudo apt-get install libmhash-dev libmcrypt-dev libltdl7-dev mcrypt libiconv-hook-dev libsqlite-dev

 

     sudo apt-get install git-core subversion mercurial