Cygwin/Notes

From Omnia
Jump to navigation Jump to search

setup.exe command line options

C:\cygwin\install> setup.exe -h
Starting cygwin install, version 2.697
Current Directory: C:\cygwin\install

Command Line Options:
 -D --download                          Download from internet
 -L --local-install                     Install from local directory
 -s --site                              Download site
 -O --only-site                         Ignore all sites except for -s
 -R --root                              Root installation directory
 -P --packages                          Specify packages to install
 -C --categories                        Specify entire categories to install
 -p --proxy                             HTTP/FTP proxy (host:port)
 -q --quiet-mode                        Unattended setup mode
 -M --package-manager                   Semi-attended chooser-only mode
 -h --help                              print help
 -l --local-package-dir                 Local package directory
 -r --no-replaceonreboot                Disable replacing in-use files on next
                                        reboot.
 -X --no-verify                         Don't verify setup.ini signatures
 -n --no-shortcuts                      Disable creation of desktop and start
                                        menu shortcuts
 -N --no-startmenu                      Disable creation of start menu shortcut
 -d --no-desktop                        Disable creation of desktop shortcut
 -K --pubkey                            Path to extra public key file (gpg
                                        format)
 -S --sexpr-pubkey                      Extra public key in s-expr format
 -u --untrusted-keys                    Use untrusted keys from last-extrakeys
 -U --keep-untrusted-keys               Use untrusted keys and retain all
 -A --disable-buggy-antivirus           Disable known or suspected buggy anti
                                        virus software packages during
                                        execution.

cygrunsrv help

$ cygrunsrv.exe  -h

Usage: cygrunsrv [OPTION]...

Main options: Exactly one is required.
  -I, --install <svc_name>  Installes a new service named <svc_name>.
  -R, --remove <svc_name>   Removes a service named <svc_name>.
  -S, --start <svc_name>    Starts a service named <svc_name>.
  -E, --stop <svc_name>     Stops a service named <svc_name>.
  -Q, --query <svc_name>    Queries a service named <svc_name>.
  -L, --list [server]       Lists services that have been installed
                            with cygrunsrv.
  <svc_name> can be a local service or "server/svc_name" or "server\svc_name".

Required install options:
  -p, --path <app_path>     Application path which is run as a service.

Miscellaneous install options:
  -P, --crs-path <path>     Path to cygrunsrv. This is useful for testing or
                            when installing a service on a remote machine.
  -a, --args <args>         Optional string with command line options which
                            is given to the service application on startup.
  -c, --chdir <directory>   Optional directory which will be used as working
                            directory for the application.
  -e, --env <VAR=VALUE>     Optional environment strings which are added
                            to the environment when service is started.
                            You can add up to 255 environment strings using
                            the `--env' option.
                            Note: /bin is always added to $PATH to allow all
                            started applications to find at least cygwin1.dll.
  -d, --disp <display name> Optional string which contains the display name
                            of the service. Defaults to service name.
  -f, --desc <description>  Optional string which contains the service
                            description.
  -t, --type [auto|manual]  Optional start type of service. Defaults to `auto'.
  -u, --user <user name>    Optional user name to start service as.
                            Defaults to SYSTEM account.
  -w, --passwd <password>   Optional password for user. Only needed
                            if a user is given. If a user has an empty
                            password, enter `-w '. If a user is given but
                            no password, cygrunsrv will ask for a password
                            interactively.
  -s, --termsig <signal>    Optional signal to send to service application
                            when service is stopped.  <signal> can be a number
                            or a signal name such as HUP, INT, QUIT, etc.
                            Default is TERM.
  -z, --shutsig <signal>    Optional signal to send to service application
                            when shutdown has been initiated.  Default is the
                            same signal as defined as termination signal.
  -y, --dep <svc_name2>     Optional name of service that must be started
                            before this new service.  The --dep option may
                            be given up to 16 times, listing another dependent
                            service each time.
  -0, --stdin <file>        Optional input file used for stdin redirection.
                            Default is /dev/null.
  -1, --stdout <file>       Optional output file used for stdout redirection.
                            Default is /var/log/<svc_name>.log.
  -2, --stderr <file>       Optional output file used for stderr redirection.
                            Default is /var/log/<svc_name>.log.
  -x, --pidfile <file>      Optional path for .pid file written by application
                            after fork().
                            Default is that application must not fork().
  -n, --neverexits          Service should never exit by itself.
  -O, --preshutdown         Stop service application during system preshutdown.
  -o, --shutdown            Stop service application during system shutdown.
                            (Only one of --preshutdown and --shutdown is
                             accepted.  Preshutdown is preferred, but only
                             available since Windows Vista/Longhorn.  On earlier

                             OS versions it's silently converted to --shutdown).

  -i, --interactive         Allow service to interact with the desktop
                            (No effect since Windows Vista/Longhorn).
  -j, --nohide              Don't hide console window when service interacts
                            with desktop.

Informative output:
  -V, --verbose             When used with --query or --list, causes extra
                            information to be printed.
  -h, --help                print this help, then exit.
  -v, --version             print cygrunsrv program version number, then exit.

Report bugs to <cygwin@cygwin.com>.

Default Pacakges

Most Default Packages are in the "Base" category:

Base - *

Devel - gettext
Devel - libgcc1
Devel - libstdc++6

Doc - cygwin-doc
Doc - man
Doc - textinfo

Interpreters - gawk

Libs - *several*

Math - libgmp3

Shells - bash
Shells - dash

System - man
System - rebase
System - tzcode

Text - groff
Text - less
Text - textinfo

Utils - bzip2
Utils - cygutils
Utils - rebase
Utils - which

Recommended Additional Packages

Recommended Additional Packages: (ordered by "Category")

Admin - cron        # for crond services
Admin - cygrunsrv   # to make windows services
Admin - shutdown    # to shutdown/reboot system
Admin - syslog-ng   # syslog service

Archive - sharutils # shar utilities
Archive - unzip     # unzip tool
Archive - zip       # zip tool

Devel - binutils?
Devel - gcc?
Devel - make?
Devel - patch?
Devel - subversion?

Editors - vim

Graphics - ImageMagick?
Graphics - gd?
Graphics - ghostscript?

Interpreters - Perl    # Perl
Interpreters - Python  # Python

Math - bc
Math - units

Net - apache*
Net - apache2*

Net - autossh*
Net - bind             # bind DNS libraries and utilities suite
Net - curl
Net - lightpd*
Net - netcat
Net - nfs-server*
Net - openssh
Net - ping
Net - proftpd*
Net - pure-ftpd*
Net - rsync
Net - stunnel*         # Universal SSL Wrapper
Net - whois
Net - xinetd*

Perl - ipcalc

Security - pwgen*      # Automatic Password generation

System - chkconfig*    # manage symbolic links in /etc/rc[0-6].d
System - initscripts*  # System-V like initialization scripts
System - util-linux    # has logger

Text - boxes?

Utils - cdrkit?     # mkisofs?
Utils - cpio        # backup and archiving utility
Utils - diffutils+
Utils - gnupg       # GPG
Utils - ipcalc
Utils - genisoimage # Create ISO9660/Joliet/HFS filesystem images
Utils - mkisofs     # Create ISO filesystem images (symlink to genisoimage)
Utils - patch*
Utils - patchutils*
Utils - rpm?
Utils - rpm-build?
Utils - screen
Utils - time
Utils - units

Web - apache*
Web - apache2*
Web - curl
Web - links
Web - lynx
Web - wget

cron-config output

$ cron-config
Do you want to install the cron daemon as a service? (yes/no) yes
Enter the value of CYGWIN for the daemon: [ ]

You must decide under what account the cron daemon will run.
If you are the only user on this machine, the daemon can run as yourself.
   This gives access to all network drives but only allows you as user.
Otherwise cron should run under the local system account.
  It will be capable of changing to other users without requiring a
  password, using one of the three methods detailed in
  http://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-nopasswd1
Do you want the cron daemon to run as yourself? (yes/no) yes

Please enter the password for user 'kenneth':
Reenter:
Running cron_diagnose ...
WARNING: You do not currently have a crontab file.

... no problem found.

Do you want to start the cron daemon as a service now? (yes/no) yes
OK. The cron daemon is now running.

In case of problem, examine the log file for cron,
/var/log/cron.log, and the Windows event log (using /usr/bin/cronevents)
for information about the problem cron is having.

Examine also any cron.log file in the HOME directory
(or the file specified in MAILTO) and cron related files in /tmp.

If you cannot fix the problem, then report it to cygwin@cygwin.com.
Please run the script /usr/bin/cronbug and ATTACH its output
(the file cronbug.txt) to your e-mail.

WARNING: PATH may be set differently under cron than in interactive shells.
         Names such as "find" and "date" may refer to Windows programs.

crond registry service

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\cron]
"Type"=dword:00000010
"Start"=dword:00000002
"ErrorControl"=dword:00000001
"ImagePath"=hex(2):44,00,3a,00,5c,00,63,00,79,00,67,00,77,00,69,00,6e,00,5c,00,\
  62,00,69,00,6e,00,5c,00,63,00,79,00,67,00,72,00,75,00,6e,00,73,00,72,00,76,\
  00,2e,00,65,00,78,00,65,00,00,00
"DisplayName"="Cron daemon"
"ObjectName"=".\\kenneth"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\cron\Parameters]
"AppPath"="/usr/sbin/cron"
"AppArgs"="-n"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\cron\Parameters\Environment]
"CYGWIN"=" "

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\cron\Security]
"Security"=hex:01,00,14,80,90,00,00,00,9c,00,00,00,14,00,00,00,30,00,00,00,02,\
  00,1c,00,01,00,00,00,02,80,14,00,ff,01,0f,00,01,01,00,00,00,00,00,01,00,00,\
  00,00,02,00,60,00,04,00,00,00,00,00,14,00,fd,01,02,00,01,01,00,00,00,00,00,\
  05,12,00,00,00,00,00,18,00,ff,01,0f,00,01,02,00,00,00,00,00,05,20,00,00,00,\
  20,02,00,00,00,00,14,00,8d,01,02,00,01,01,00,00,00,00,00,05,0b,00,00,00,00,\
  00,18,00,fd,01,02,00,01,02,00,00,00,00,00,05,20,00,00,00,23,02,00,00,01,01,\
  00,00,00,00,00,05,12,00,00,00,01,01,00,00,00,00,00,05,12,00,00,00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\cron\Enum]
"0"="Root\\LEGACY_CRON\\0000"
"Count"=dword:00000001
"NextInstance"=dword:00000001

ssh-host-config output

$ ssh-host-config
*** Info: Generating /etc/ssh_host_key
*** Info: Generating /etc/ssh_host_rsa_key
*** Info: Generating /etc/ssh_host_dsa_key
*** Info: Creating default /etc/ssh_config file
*** Info: Creating default /etc/sshd_config file
*** Info: Privilege separation is set to yes by default since OpenSSH 3.3.
*** Info: However, this requires a non-privileged account called 'sshd'.
*** Info: For more info on privilege separation read /usr/share/doc/openssh/READ
ME.privsep.
*** Query: Should privilege separation be used? (yes/no) no
*** Info: Updating /etc/sshd_config file


*** Warning: The following functions require administrator privileges!

*** Query: Do you want to install sshd as a service?
*** Query: (Say "no" if it is already installed as a service) (yes/no) yes
*** Query: Enter the value of CYGWIN for the daemon: []

*** Info: The sshd service has been installed under the LocalSystem
*** Info: account (also known as SYSTEM). To start the service now, call
*** Info: `net start sshd' or `cygrunsrv -S sshd'.  Otherwise, it
*** Info: will start automatically after the next reboot.

*** Info: Host configuration finished. Have fun!

syslog-ng-config output

$ syslog-ng-config
Creating default /etc/syslog-ng.conf file


Warning: The following function requires administrator privileges!

Do you want to install syslog-ng as service?
(Say "no" if it's already installed as service) (yes/no) yes

The service has been installed under LocalSystem account.
To start the service, call `net start syslog-ng' or `cygrunsrv -S syslog-ng'.

Check /etc/syslog-ng.conf first, if it suits your needs.

Configuration finished. Have fun!

syslog-ng.conf default

$ cat /etc/syslog-ng.conf
@version: 3.0
options {
  keep_hostname(yes);
  owner("system");
  group("root");
  perm(0664);
  flush_lines(0);
};

source applications {
  unix-dgram("/dev/log");
  internal();
};

source kernel {
  file("/dev/kmsg", program_override("kernel: "));
};

destination messages {
  file("/var/log/messages");
};

log {
  source(applications);
  destination(messages);
};

log {
  source(kernel);
  destination(messages);
};

syslog-ng.conf alternative

options {
  keep_hostname(yes);
  chain_hostnames(no);
  owner("system");
  group("root");
  perm(0664);
  sync(0);
};

source applications {
  unix-dgram("/dev/log");
  internal();
};

source kernel {
  file("/dev/kmsg", log_prefix("kernel: "));
};

destination messages {
  file("/var/log/messages");
};

log {
  source(applications);
  destination(messages);
};

log {
  source(kernel);
  destination(messages);
};