Http://blog.cong.co/cygwin.html#%E5%AE%9A%E4%B9%89%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F Configuring a service program in Cygwin
Reference [Http://www.cnblogs.com/clarkchen/archive/2011/02/21/1960217.html]
- Configure Apache HTTPD2 Service
- Configuring the PROFTPD Service
- Configure the Application
- Configure RXVT
- Custom-Featured Prompts
- Defining environment variables
- Bash configuration file
Configuring the service program in Cygwin ^
For more information read /usr/share/doc/Cygwin/cygserver.README
, to make an Apache httpd or proftpd run successfully, under WinXP:
- The
/bin/cygrunsrv
LocalSystem
simplest way to set up the identity as a system service is to run the script /usr/bin/cygserver-config
. This will bring up a service item called "Control Panel > Admin Tools > Services" CYGWIN cygserver
.
- Then set the environment variables
CYGWIN
, the simplest way is to cygwin.bat
add a sentence:Set Cygwin=server
Before you configure a service or application, read the documentation listed in =/usr/share/doc=
Configure Apache HTTPD2 Service ^
Configuring the HTTPD2 is simple, install HTTPD2 directly with Setup's installation program. Then run the following command:
apachectl2 start
If you can't find apachectl2
it, see if you can /usr/sbin
join PATH
in.
Configuring the PROFTPD service ^
Read /usr/share/doc/proftpd-1.2.10/*
a bunch of documents, follow the configuration, first Test.
Configuring the application ^ configuration rxvt^
Win's cmd is too difficult to use, and I do not Cygwin x system, so RXVT became my best choice, here is my color configuration, write ~/.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
Write down this paragraph cygwin.bat
:
@echo offset Cygwin=serverset home=d:\mydocd:chdir d:\cygwin\binrxvt-title "CYGWIN-RXVT"-SR-SL 2000-tn cygwin-fn "bit Stream Vera sans mono-19 "-e/bin/bash-login
Custom-Featured prompts ^
~/.bashrc
~/.bash_profile
Prompt for custom features in or
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
Defining Environment Variables ^
Set locale as the default locale for Windows, otherwise the Chinese file name will be garbled:
Lc_ctype=zh_cn.gbkcharset=gbkexport lc_ctype CHARSET
Bash configuration file ^~/.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 C Haractersalias whence= ' type-a ' # where, of a sortalias grep= ' grep--color ' # s How differences in colour# Some shortcuts for different directory Listingsalias ls= ' LS-HF--color=tty--show-control-char S ' # 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 ' # # Add Clear screen processing alias clear= ' Clearn ' Alias clr= ' Clearn ' # add Whereis aliases alias whereis= ' which ' Alias Autoexec=autoexec.bat
~/.inputrc^
The main is to add some Chinese encoding support
#-*-CODING:CHINESE-GBK-*-# base-files version 3.6-1# Insert Key "e[2~":p aste-from-clipboard# equivalent to "C-?": Delet E-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# Close bash command line 8 Byte character escape conversion set Convert-meta off# make bash command line support 8 Byte character input set Input-meta on# Enables the Bash command line to support 8-byte character output set Output-meta on
Cygwin personalized Configuration