轉載:http://w.gdu.me/wiki/cygwin/index.html
html
Update: 2013-01-04python
#wget http://apt-cyg.googlecode.com/svn/trunk/apt-cyg
wget http://w.gdu.me/wiki/files/shell/apt-cyg
chmod +x apt-cyg
mv apt-cyg /usr/local/bin/
apt-cyg --help
cygcheck --help
# 修改軟件源
apt-cyg --mirror http://mirrors.163.com/cygwin
# ftp://mirror.mcs.anl.gov/pub/cygwin
# http://mirrors.163.com/cygwin
# ftp://ftp.ges.redhat.com/private/releng/cygwin-1.8
vim /usr/loccal/bin/apt-cyg
# 將:
wget -N $mirror/setup.bz2
wget -N $mirror/setup.ini
# 改成:
wget -N $mirror/x86/setup.bz2
wget -N $mirror/x86/setup.ini
# 或:
wget -N $mirror/x86_64/setup.bz2
wget -N $mirror/x86_64/setup.ini
diff apt-cyg apt-cyg.bak
353,358c353
< echo $file | grep ".xz$" >/dev/null 2>&1
< if [ "$?" = "0" ];then
< cat $file | xz -d | tar > "/etc/setup/$pkg.lst" xvf - -C /
< else
< cat $file | bunzip2 | tar > "/etc/setup/$pkg.lst" xvf - -C /
< fi
---
> cat $file | bunzip2 | tar > "/etc/setup/$pkg.lst" xvf - -C /
# apt-cyg install man cygwin-doc
apt-cyg install vim screen wget subversion openssh pwgen gzip bzip2 curl rsync bash-completion \
lftp nc tree p7zip connect-proxy util-linux bind-utils inetutils
apt-cyg install python python-crypto
wget http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg
sh setuptools-0.6c11-py2.6.egg
easy_install pip
pip install moin
BoldAsFont=no
Font=YaHei Consolas hybrid
FontHeight=12
#BackgroundColour=0,43,53
BackgroundColour=11,22,33
ForegroundColour=191,191,191
FontSmoothing=full
背景顏色:(RGB)0,40,51;或11,22,33(就是這個Wiki頁面的背景色) 字體顏色:(RGB)31,148,150(較暗);或191,191,191 目錄顏色:(RGB)255,128,128 壓縮文件顏色:(RGB)128,128,0 字體:Consolas,Courier New,Fixedsys,YaHei Consolas hybrid
alias grep='grep --color' # show differences in colour
alias egrep='egrep --color=auto' # show differences in colour
alias fgrep='fgrep --color=auto' # show differences in colour
alias ls='ls -hF --color=tty' # classify files in colour
alias ll='ls -la' # long list
alias la='ls -A' # all but . and ..
alias l='ls -CF' #
alias ssh="ssh -S none"
PS1="[\w]$"
#彩色的PS1會形成命令編輯時光標定位錯誤
#PS1="\e[0;32m[\u@\h \W]\$ \e[m"
#
# ~/.screenrc
#
# 啓動時不顯示歡迎屏幕
startup_message off
# 定義screen的功能鍵爲Ctrl-A。向終端輸入Ctrl-A時應按 Ctrl-A a。
#escape ^Aa
# 屏幕緩衝區 1024 行。
defscrollback 1024
# 顯示窗口列表
caption always "%-w%{= BW}%50>%n %t%{-}%+w%<"
# 按 Ctrl-A w 或 Ctrl-A Ctrl-W 顯示窗口列表
bind w windowlist -b
#bind ^w windowlist -b
#在使用screen過程當中,常常會遇到「閃屏」的問題,這是能夠關掉的。
#快速關掉:也就是先輸入CTRL + a,再輸入CTRL + g。
#永久關閉:修改/etc/screenrc 加入
vbell off
cd /usr/share/vim && cp vim74/vimrc_example.vim vimrc
詳見:vimrclinux
" ~/.vimrc
set mouse=c
set nobackup
" set paste
set fileformats=unix,dos,mac
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
set encoding=utf-8
" set termencoding=cp936
let &termencoding = &encoding
language messages en_US.UTF-8
"language messages zh_CN.UTF-8
" colo murphy
" tab
set tabstop=4
set cindent shiftwidth=4
set autoindent shiftwidth=4
" TAB -> Space
set expandtab
#ssh_config
#~/.ssh/config
IdentitiesOnly yes
ServerAliveInterval 60
GSSAPIAuthentication no
Host m*
Port 22
User root
ControlMaster auto
ControlPath ~/.ssh/master-%r@%h:%p
#ProxyCommand connect-proxy -S 127.0.0.1:2223 %h %p
Host mNagios
Hostname 172.16.16.150
# 如下代碼沒測試過,慎用
cd /; chmod -R og-w .
chmod og+w /tmp
touch /var/log/sshd.log
chown system:system /var/log/sshd.log /var/empty /etc/ssh_h*
chmod 755 /var/empty
ssh-host-config
Should privilege separation be used? (yes/no) :yes Should this script create a local user 'sshd' on this machine? (yes/no) :yes Do you want to install sshd as service? (yes/no) :yes Default is "ntsec" . CYGWIN=ntsec tty
cygrunsrv -S sshd
cygrunsrv -I cron -p /usr/sbin/cron -a -D
cygrunsrv -S cron
這在 Cygwin 下建立的文件,其餘管理員不可寫,是所謂的 ntsec 在起做用。經過 NTFS 的權限設置,模擬 UNIX 的權限。能夠經過 CYGWIN 環境變量修改。如:ios
export CYGWIN="nontsec nosmbntsec"
**若存在中文問題才進行如下設置。**shell
export SVN_EDITOR=vim
# Redhat Cygwin中未作如下設置,中文正常
alias ls='ls --color --show-control-chars'
export LESSCHARSET=latin1
alias less='/bin/less -r'
#export LC_ALL=zh_CN.UTF-8
#export LC_CTYPE=zh_CN.UTF-8
#export LANG=zh_CN.UTF-8
#export OUTPUT_CHARSET="GBK"
#stty cs8 -istrip
#stty pass8
export CYGWIN="nontsec nosmbntsec"
# Allow 8-bit input/output
set meta-flag on
set convert-meta off
set input-meta on
set output-meta on
cygcheck -c cygwin
cygcheck -h #幫助
cygcheck -s #sysinfo
cygcheck -l #已安裝包列表
cygcheck -c #列出並校驗已安裝的包
cygcheck -p vim #從cygwin.com源查詢包
cygpath -d -m "`pwd`"
curl http://curl.haxx.se/ca/cacert.pem > /usr/ssl/certs/ca-bundle.crt
mkpasswd -l > /etc/passwd
mkgroup -l > /etc/group
# 若是有Domain的話,須要加上-d domainname
~/.minttyrc
,添加如下設置: BoldAsFont=no #Font=Courier New Font=YaHei Consolas hybrid FontHeight=12
apt-cyg install util-linux
apt-cyg install inetutils
bind-utils
包:apt-cyg install bind-utils
ipconfig /all
-bash: fork: retry: Resource temporarily unavailable
-bash-4.1$ wc m1.txt 3 [main] bash 2216 child_info_fork::abort: data segment start: parent(0x26D000) != child(0x38D000) -bash: fork: retry: Resource temporarily unavailable 2013930 4027950 74968256 m1.txt
rkosegi's Answer seems to be working for everyone (myself included). But, just so you don't have to follow the daisy chain of links: (assuming Cygwin is installed at C:\cygwin): 1.Open Task Manager and close any processes that look to be Cygwin related. 2.Open C:\Cygwin\bin in Windows Explorer 3.Verify that dash.exe, ash.exe, rebase.exe, and rebaseall exist in this folder - If any of them are missing, re-run Cygwin setup and select the dash, ash, and rebase packages 4.right-click your C:\Cygwin folder, uncheck Read-only (if its checked), and press OK. - When an error about not being able to switch some files comes up, select "Ignore All". Wait for this process to complete. 5.Browse to C:\Cygwin\bin in Windows Explorer 6.Right click dash.exe and click "Run as Administrator". A command Prompt should appear with nothing but a $ 7.Type /usr/bin/rebaseall -v, hit enter, and wait for the process to complete. - If you get errors about Cygwin processes running, try Step 1 again. If that still doesn't work, Restart your computer into safe mode and try these steps again. 8.Try opening Cygwin again. This process worked for me. I hope it works for you guys too. Source: http://cygwin.wikia.com/wiki/Rebaseall