越来越觉得自己走测试这条路是对的,越来越觉得自己适合做测试,这么久以来兴趣一直在激发我前进,一直在寻找下一个站点,我相信测试路上我一定会走的很远,我的测试道路一定会很宽阔,努力就有收获,也希望还在测试路口迷惘的朋友,不要再犹豫了,因为你的犹豫不决,会使你错过很多~~~~~喜欢就去just do it ,因为只有尝试了才知道自己适不适合,喜不喜欢。如果一味的问别人,永远找不到最终的答案。因为每个人的感觉不一样,每个人的情况不一样,每个人的前提条件都不一样,你会得到不同的答案,这样只能会使你更迷茫~~~~

cygwin 类linux开发环境的配置

上一篇 / 下一篇  2011-09-14 16:29:36 / 个人分类:测试相关资料

花了半天配置好了cygwin的界面, 下面做一纪录,以备下次查阅

1. 关于term的问题, 如果嫌安装的term不够pp,可以使用putty,那就需要安装openssh包,以便可以使用putty, openssh的安装过程参阅http://pigtail.net/LRP/printsrv/cygwin-sshd.html 里面介绍的很详细。下面挑几个关键点记录如下:

(2b)gDownload cygwin's setup.exe fromhttp://www.cygwin.com/and savesetup.exein c:/cygwin
Click Start...Run...and typec:/cygwin/setup.exe

If you are asked about "Just Me" or "All Users", choose "All Users"

When it asks for "Local Package Directory", typec:/cygwin
When a selection screen comes up, (you can resize the windows to see better)
click the little View button for "Full" view g,
find the package "openssh", click on the word "skip" so that anxappears in Column B,
seethis illustration.

Clicknextto start installing cygwin and ssh.
Size of the basic cygwin system is about 40 Meg, this may take a while.

Take a coffee break. g

(3)Right click My Computer, Properties, Advanced, Environment Variables
Seethis illustration (red dots)
Click the "New"newbutton to add a new entry to system variables:
variable name isCYGWIN
variable value is ntsec

(4)Right click My Computer, Properties, Advanced, Environment Variables
Seethis illustration (green dots)
Select the Path variable and click the "Edit"editbutton:
append ;c:/cygwin/bin  to the end of the existing variable string.

(5)Open a cygwin window (by double clicking thegicon), a black screen pops open, type
ssh-host-config     (on slower computers, it may take several minutes to generate the dsa keys)
When the script. asks you about "privilege separation", answeryes
When the script. asks about "create local user sshd", answeryes
When the script. asks you about "install sshd as a service", answeryes
When the script. asks you for "CYGWIN="     your answer isntsec

See Note 5 below if you need to run ssh-host-config again.

(6)While you are still in the (black) cygwin screen,start the sshd service
net start sshd
or
cygrunsrv  --start  sshd

Note: if you need to stop the sshd service, pop open agcygwin window
net stop sshd  or  cygrunsrv  --stop  sshd

(7)Make sureevery Windows userhas a password set, if not, 
go to gControl Panel....User Accountsandcreatea password.

(8)importantPop a cygwingwindow, harmonize Windows user information with cygwin, otherwise they cannot login
mkpasswd   --local   >   /etc/passwd
mkgroup   --local    >   /etc/group


Test to see if sshd is working, pop a cygwingwindow (note: the command below iscase sensitive)
whoami
ssh    localhost

or
ssh    "$USERNAME@127.0.0.1"

If you get a prompt without error messages, type
ls  -lh  /cygdrive/c
if you see a directory listing,success!gg g
(typeexitto end the cygwin ssh session) 

If you have a Windows username that contain space, expand the space into / [space],
e.g. if the Windows login name is  mickey mouse
ssh  mickey/  mouse@127.0.0.1

2. Putty现在可以连接到本机上了,界面的字体pp多了吧:)  接下来是几个个性化的设置。

首先是 shell的设置

修改 $HOME/.bashrc文件,找到修改或者添加如下部分:

# Use the command line history just as in linux
 set -o vi

# Interactive operation...
 alias rm='rm -i'
 alias cp='cp -i'
 alias mv='mv -i'
 alias more='less'

# Misc :)
 alias less='less -r'                          # raw control characters
# alias whence='type -a'                        # where, of a sort
 alias grep='grep --color'                     # show differences in colour

# Some shortcuts for different directory listings
 alias ls='ls -hF --color=tty'                 # classify files in colour
# alias dir='ls --color=auto --format=vertical'
# alias vdir='ls --color=auto --format=long'
 alias ll='ls -l'                              # long list
# alias la='ls -A'                              # all but . and ..
# alias l='ls -CF'                              #

这样你的shell就可以显示pp的目录颜色了。

3. 接下来是vim的设置

在$HOME/目录下建立.vimrc文件,内容如下:


""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Download:  http://napali.ch/stotz/config/vim.tgz
" File:   $HOME/.vimrc
" Version:  1.0.4
" Date:         2004-07-11
" Author:  Urs Stotz <stotz@gmx.ch>
" Comment:  Please send me suggestion for improvement
"               Tested on: Debian and Sun Solaris.
"               For vim and gvim you will need only .vimrc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Changelog
" 1.0.4         tests templates for perl and perlmodules
" 1.0.3         new perl dictionary
" 1.0.2         smale changes
" 1.0.1         fix ttyscroll it was slowly
" 1.0.0         Init Version
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" vim settings "
""""""""""""""""
" version 6.0
" set autoindent   
" the same as |:set backspace=indent,eol,start|
set backspace=2   
" keyword completion with dictionary the command is: |i_CTRL-X_CTRL-K|

" xterm backspace settings
if &term == "xterm"
  set t_kb=^?
  fixdel
endif

if &term == "xterm"
  set t_kD=^[[3~
endif

set dict=~/.vim/dict/perl,~/.vim/dict/programming,~/.vim/dict/american  
set formatoptions=tcqr
" by a compressed helpfile
" set helpfile=$VIMRUNTIME/doc/help.txt.gz
set incsearch
" always show status line
set laststatus=2
" use extended regular expressions
set magic
set nobackup
" use Vim features
set nocompatible
" quiet and peaceful (your colleges thanks you)
set noerrorbells
" exrc is a potential security leak
set noexrc
" I don't like hlsearch
set nohlsearch
set nonumber
set wrap
" show the cursor position all the time
set ruler
" Show (partial) command in status line.
set showcmd
set showmode
set smartindent
" create new window below current one
set splitbelow
set suffixes=.bak,~,.swp,.o,.info,.aux,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
" Don't wrap words by default
set textwidth=0
" For terminals where scrolling is very slow and redrawing is not slow.
" set ttyscroll=3
set viminfo=/"200,%,'200,/100,:100,@100,f1,h,n~/.vim/viminfo
" wildmenu : command-line completion operates in an enhanced mode
set wildmenu

"""""""""""
" tabstop "
"""""""""""
" see :help 'tabstop'
set shiftwidth=4
set tabstop=4
set smarttab
set expandtab         

""""""""""""""
" c settings "
""""""""""""""
set cindent
set cinoptions=:0,p0,t0
set cinwords=if,else,while,do,for,switch,case

""""""""""""""""""
" color settings "
""""""""""""""""""
if !has ("gui_running")
    " if vim in a terminal
    """"""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""
  
  " set the colors for vim on "xterm" - not necessary on all systems    "
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    if &term =~ "xterm-debian" || &term =~ "xterm-xfree86" || &term =~ "xterm"
      set t_Co=16
      set t_Sf=[3%dm
      set t_Sb=[4%dm
    endif
    "http://www-2.cs.cmu.edu/~maverick/VimColorSchemeTest/index-perl.html
    colorscheme default
    set background="/dark"
    " hi Normal  ctermfg=white ctermbg=black
    " hi PreProc ctermfg=gray  ctermbg=black
else
    "set guifont=fixed
    "set guifont=Monospace/ 10
    "http://www-2.cs.cmu.edu/~maverick/VimColorSchemeTest/index-perl.html
    colorscheme blackbeauty
    set background="/dark"
    " colorscheme default

    " set background="/light"
    " hi PreProc guifg=#c0c0c0 guibg=#000040
    " hi Normal  guifg=black   guibg=white
endif

if has("syntax") && &t_Co > 2
  syntax on
endif

""""""""""
" maping "
""""""""""
" useful for changelog the Dateformat is in ISO8601
" map #log mq:r!date +"/%Y-/%m-/%d /%H:/%M:/%S $ <$@$>"`qJ
map #log mq:r!date +"/%Y/%m/%dT/%k/%M/%S Urs Stotz <stotz@gmx.ch>"`qJ
" map CTRL-] to // (useful by german keyboards)
map // 

""""""""""""""""""""""""""""""""""""""
" Additional settings and parameters "
""""""""""""""""""""""""""""""""""""""
filetype plugin on
filetype indent on

""""""""""""
" Plugins: "
""""""""""""
" set ctags for the plugin taglist command is |:Tlist| see |:help taglist|
let Tlist_Ctags_Cmd = '/usr/bin/ctags'
" open the tags file
map [I:let nr = input("Which one: ")exe "normal " . nr ."[/t"
noremap :cal VimCommanderToggle()

"http://www.vim.org/scripts/script.php?script_id=65
" au   BufEnter *   execute ":lcd " . expand("%:p:h")

""""""""""""""
" Templates: "
""""""""""""""
":set verbose=9
" :command! -nargs=1 Templ :set ft=| :0r! ~/.vim/templates/perl %

""""""""""""""""""""""""""""
" Plugins in ~/.vim/plugin "
""""""""""""""""""""""""""""
" ~/.vim/plugin/DirDiff.vim
"   :DirDiff dir1 dir2
"   vim ~/.vim/plugin/DirDiff.vim
"
" ~/.vim/plugin/MakeDoxygenComment.vim
"   :Dox
"   vim ~/.vim/plugin/MakeDoxygenComment.vim
"
" ~/.vim/plugin/bufexplorer.vim
"   /be         - To start exploring in the current window
"   /bs         - To start exploring in a newly split window
"   /bv         - To start exploring in a newly split window
"   :he bufexplorer
"
" ~/.vim/plugin/grep.vim
"   :Grep       - Grep for the specified pattern in the specified files
"   :Rgrep      - Run recursive grep
"   :GrepBuffer - Grep for a pattern on all open buffers
"   :GrepArgs   - Grep for a pattern on all the Vim argument filenames
"   :Fgrep      - Run fgrep
"   :Rfgrep     - Run recursive fgrep
"   :Egrep      - Run egrep
"   :Regrep     - Run recursive egrep
"   :Agrep      - Run agrep
"   :Ragrep     - Run recursive agrep
"   vim ~/.vim/plugin/grep.vim

"
" ~/.vim/plugin/info.vim
"   :Info info
"   vim ~/.vim/plugin/info.vim
"
" ~/.vim/plugin/manpageview.vim
"   :Man man
"   :he manpageview
"
" ~/.vim/plugin/matchit.vim
"   %           - Cycle forward through matching groups
"   g%          - Cycle backwards through matching groups
"   :he matchit
"
" ~/.vim/plugin/taglist.vim
"   :Tlist
"   :he taglist
"
" ~/.vim/plugin/tar.vim
"   :e foobar.tgz
"   vim ~/.vim/plugin/tar.vim


这可以使得vim能高亮显示代码,便于编辑文件。

只是不够满意的一点是vim的backspace 在putty里面变成了shift+backspace才好使。

可以用fixdel修复,但是好像不能保存

  If your delete key terminal code is wrong, but the
   code for backspace is alright, you can put this in
   your .vimrc:
    :fixdel
   This works no matter what the actual code for
   backspace is.

   If the backspace key terminal code is wrong you can
   use this:
    :if &term == "termname"
    :  set t_kb=^V
    :  fixdel
    :endif
   Where "^V" is CTRL-V and "" is the backspace key
   (don't type four characters!). Replace "termname"
   with your terminal name.

可以在vim编辑界面下输入 :h fixdel来参考详细的说明, 不过在cygwin的term下似乎vim是正常的。

 

4. 对于cygwin下没有more命令的问题,可以用less代替,用关了more,就在.bashrc里做一alias即可。


TAG:

笑遍世界的测试技术 引用 删除 smile665   /   2011-09-24 14:34:34
百合姐姐也在弄linux相关的环境啊。。。加油哦
我是常年在linux下工作
 

评分:0

我来说两句

Open Toolbar