$ uname -a CYGWIN_NT-5.1 maruno 1.5.10(0.116/4/2) 2004-05-25 22:07 i686 unknown unknown Cygwin $ cygcheck -c cygwin postgresql Cygwin Package Information Package Version Status cygwin 1.5.10-3 OK postgresql 7.4.3-1 OK $ echo $CYGWIN $ export CYGWIN=server $ echo $CYGWIN server
$ cygserver-config Overwrite existing /etc/cygserver.conf file? (yes/no) yes Generating /etc/cygserver.conf file Warning: The following function requires administrator privileges! Do you want to install cygserver as service? (Say "no" if it's already installed as service) (yes/no) yes The service has been installed under LocalSystem account. To start it, call `net start cygserver' or `cygrunsrv -S cygserver'. Further configuration options are available by editing the configuration file /etc/cygserver.conf. Please read the inline information in that file carefully. The best option for the start is to just leave it alone. Please keep in mind, that a client application which wants to use the services provided by cygserver *must* have the environment variable CYGWIN set so that it contains the word "server". So, if you don't need any other special CYGWIN setting, just set it to "server". It is advisable to add this setting to the Windows system environment. Basic Cygserver configuration finished. Have fun!
登録の確認 $ cygrunsrv -Q cygserver Service cygserver exists Type : Own Process Current State : Stopped Controls Accepted :
$ /usr/sbin/cygserver & [1] 2324 $ jobs [1]- Running ipc-daemon2 & [2]+ Running /usr/sbin/cygserver & maruno@maruno /usr/local $ ps aux | grep cygserver 2324 3856 2324 504 con 1004 11:34:02 /usr/sbin/cygserver maruno@maruno /usr/local $ ipcs Message Queues: T ID KEY MODE OWNER GROUP Shared Memory: T ID KEY MODE OWNER GROUP Semaphores: T ID KEY MODE OWNER GROUP
$ ps aux | grep cygserver 2324 3856 2324 504 con 1004 11:34:02 /usr/sbin/cygserver maruno@maruno /usr/local $ kill 2324 cygserver: Shutdown finished. [2]+ Done /usr/sbin/cygserver
$ initdb --no-locale -D /var/postgresql/data The files belonging to this database system will be owned by user "maruno". This user must also own the server process. The database cluster will be initialized with locale C. creating directory /var/postgresql/data... ok creating directory /var/postgresql/data/base... ok creating directory /var/postgresql/data/global... ok creating directory /var/postgresql/data/pg_xlog... ok creating directory /var/postgresql/data/pg_clog... ok selecting default max_connections... 40 selecting default shared_buffers... 1000 creating configuration files... ok creating template1 database in /var/postgresql/data/base/1... ok initializing pg_shadow... ok enabling unlimited row size for system tables... ok initializing pg_depend... ok creating system views... ok loading pg_description... ok creating conversions... ok setting privileges on built-in objects... ok creating information schema... ok vacuuming database template1... ok copying template1 to template0... ok Success. You can now start the database server using: /usr/bin/postmaster -D /var/postgresql/data or /usr/bin/pg_ctl -D /var/postgresql/data -l logfile start
$ pg_ctl -D /var/postgresql/data -l /var/log/postmaster.log start postmaster successfully started
$ pg_ctl stop -D /var/postgresql/data waiting for postmaster to shut down......done postmaster successfully shut down
$ psql template1 Welcome to psql 7.4.3, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quit template1=# \q
$ initdb --no-locale -D /var/postgresql/data The files belonging to this database system will be owned by user "maruno". This user must also own the server process. The database cluster will be initialized with locale C. creating directory /var/postgresql/data... ok creating directory /var/postgresql/data/base... ok creating directory /var/postgresql/data/global... ok creating directory /var/postgresql/data/pg_xlog... ok creating directory /var/postgresql/data/pg_clog... ok selecting default max_connections... Signal 12 Signal 12 Signal 12 Signal 12 Signal 12 Signal 12 10 selecting default shared_buffers... Signal 12 Signal 12 Signal 12 Signal 12 Signal 12 Signal 12 Signal 12 Signal 12 Signal 12 Signal 12 Signal 12 50 creating configuration files... ok creating template1 database in /var/postgresql/data/base/1... Signal 12 initdb: failed initdb: removing data directory "/var/postgresql/data"