Thursday, January 31, 2008

Install Cygwin, Linux Commands and GVim with Windows Vista

  • Download the "setup.exe" program from Cygwin (http://www.cygwin.com/setup.exe) then install it.
  • At the time of installing cygwin, select modules to install as you wish, such as cron, zip, unzip, shutdown, wget, openssh, perl.
  • Download the self-installing-on-windows executable GVim program from vim online (ftp://ftp.vim.org/pub/vim/pc/gvim71.exe) then install it.
  • Put vim installation path into the windows environment variable "PATH".
  • To set the colorscheme of GVim, create a .gvimrc file into home directory, say c:\Users\your_user_name\ with a line "colorscheme your_scheme", my favorite is murphy.
  • Open cygwin program, click "Properties" on the left top menu to set cygwin with your favorite color scheme and font.
  • To improve bash of cygwin, put a .bashrc file into home directory, but there are two tricks. Firstly cygwin may somehow ignore the .bashrc (I don't know why), the solution to this problem is to put an executable string in the bottom of /etc/profile:
. "$HOME/.bashrc"
  • Secondly if the format of .bashrc is pc not unix, this file may not be executed correctly. I use EditPlus to transfer the format to unix.
  • My .bashrc file is like this:
##################################################
# .bashrc file
##################################################
# PATH
#=================================================
# Add "." and "~/bin" to PATH varible:
# export PATH=.:/home/user_name/bin:`printenv PATH`

# Aliases
#=================================================
alias more=less
alias up='cd ..'
alias ll='ls -la'
alias ls='ls -F'
alias ps='ps -Wl'
alias home='cd $HOME'
alias which='type -path'
alias unix2dos='recode lat1:ibmpc'
alias dos2unix='recode ibmpc:lat1'
alias h='history 30'
alias rmf='rm -Rf'
alias v='vim'
alias su='su -'
alias tails='tail -f -n 100'

# Shell Prompt customization (cygwin or unix version)
#=================================================
export PS1="\n[xb@dell:\w]\$ "

##################################################
# END .bashrc
##################################################
  • Use SSH ssh-keygen2 to generate public and private keys, scp public key to remote server's .ssh directory, cat public key to authorized_keys. Open file hosts at C:\Windows\System32\drivers\etc to add the ip address and a brief hostname for your remote server. Use ssh username@remote_hostname to login in the future.

No comments: