配置 cygwin 中的服务程序
详细情况阅读 /usr/share/doc/Cygwin/cygserver.README
,要让一个apache httpd或者 proftpd成功运行,在winxp下:
- 需要把
/bin/cygrunsrv
以LocalSystem
的身份设置为系统服务,最简单的方法就是运行 脚本/usr/bin/cygserver-config
。这将在 "Control Panel > Admin Tools > Services" 里边出现一个名为CYGWIN cygserver
的服务项目。 - 然后设置环境变量
CYGWIN
,最简单的方法就是在cygwin.bat
中添加一句:set CYGWIN=server
配置服务或应用程序之前,阅读 =/usr/share/doc= 中罗列的文档
配置 apache httpd2 服务
配置 httpd2 很简单,直接用 setup 的安装程序安装好 httpd2。然后运行如下命令即可:
apachectl2 start
要是找不到 apachectl2
,看看 /usr/sbin
有没有加入到 PATH
中。 配置 proftpd 服务
阅读 /usr/share/doc/proftpd-1.2.10/*
下的一堆文档,按照配置来,先test。
配置应用程序
配置rxvt
win的cmd实在太难用了,而我又不用cygwin的X系统,所以rxvt成了我最好的选择,这里是 我的颜色配置,写入 ~/.Xdefaults
即可:
Rxvt*title: Cygwin-RxvtRxvt*geometry: 90x40-10+30Rxvt*background: #BFDF74Rxvt*foreground: #001123Rxvt*scrollBar_right: trueRxvt*colorBD: 1Rxvt*font: courier newRxvt*blodFont: Courier NewRxvt*saveLines: 2000Rxvt.backspacekey: ^?Rxvt*loginShell: True!! VIM-like colorsRxvt*color0: #000000!Rxvt*color1: #FFFFFFRxvt*color1: #911B08Rxvt*color2: #00A800Rxvt*color3: #DD0000Rxvt*color4: #0000A8Rxvt*color5: #A800A8Rxvt*color6: #00A8A8Rxvt*color7: #D8D8D8Rxvt*color8: #B5613BRxvt*color9: #966BEBRxvt*color10: #00A800Rxvt*color11: #FFFF00Rxvt*color12: #0000A8Rxvt*color13: #A800A8Rxvt*color14: #00A8A8Rxvt*color15: #B5613B
把下边这段写入 cygwin.bat
:
@echo offset CYGWIN=serverset HOME=d:\MyDocd:chdir d:\cygwin\binrxvt -title "Cygwin-Rxvt" -sr -sl 2000 -tn Cygwin -fn "bitstream vera sans mono-19" -e /bin/bash -login
定制特色的提示符
在 ~/.bashrc
或者 ~/.bash_profile
中定制特色的提示符
PS1="`whoami`@`hostname | sed 's/..*//'`"PS1="[e[32;1m]${PS1}[e[0m]:[e[31;1m]w[e[0m]n"case `id -u` in0) PS1="${PS1}# ";;*) PS1="${PS1}$ ";;esac
定义环境变量
设置locale为Windows的默认locale,否则中文文件名会显示乱码:
LC_CTYPE=zh_CN.gbkCHARSET=GBKexport LC_CTYPE CHARSET
bash配置文件
~/.bashrc
# -*- coding: chinese-gbk -*LC_CTYPE=zh_CN.gbkCHARSET=GBK #glib2需要使用找个环境变量确定文件名的编码export LC_CTYPE CHARSETexport LESSCHARSET=latin1export INPUTRC=$HOME/.inputrcexport TERM=rxvt# aliasalias rm='rm -i'alias cp='cp -i'alias mv='mv -i'alias df='df -h'alias du='du -h'# Misc :)alias less='less -r --raw-control-chars' # raw control charactersalias whence='type -a' # where, of a sortalias grep='grep --color' # show differences in colour# Some shortcuts for different directory listingsalias ls='ls -hF --color=tty --show-control-chars' # classify files in colouralias dir='ls --color=auto --format=vertical --show-control-chars'alias vdir='ls --color=auto --format=long --show-control-chars'alias ll='ls -la --show-control-chars' # long listalias la='ls -A --show-control-chars' # all but . and ..alias l='ls -lF --show-control-chars' ## 添加清屏处理alias clear='clearn'alias clr='clearn'# 添加whereis的别名alias whereis='which'alias autoexec=autoexec.bat
~/.inputrc
主要是加入一些中文编码支持
# -*- coding: chinese-gbk -*-# base-files version 3.6-1# Insert Key"e[2~":paste-from-clipboard# equivalent to "C-?": delete-char"e[3~": delete-char# VT"e[1~": beginning-of-line"e[4~": end-of-line# kvt"e[H": beginning-of-line"e[F": end-of-line# rxvt and konsole (i.e. the KDE-app...)"e[7~": beginning-of-line"e[8~": end-of-line# VT220"eOH": beginning-of-line"eOF": end-of-line# Allow 8-bit input/outputset meta-flag on# 关闭bash命令行8字节字符转义符的转换set convert-meta off# 使bash命令行支持8字节字符输入set input-meta on# 使bash命令行支持8字节字符输出set output-meta on 我的配置文件E:\cygwin\home\zpc\.bashrc export LANG="zh_CN.UTF-8" alias ls="ls --color=auto" alias ll="ls --color=auto -l" alias l="ls --color=auto -l" alias ..="cd .." alias ...="cd ..." export PS1="\[\e[33m\]\w\[\e[0m\]\$ "