| Copyright 2001 MBARI Kent Headley MBARI provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of the Monterey Bay Aquarium Research Institute to assist in its use, correction, modification, or enhancement. This information should not be published or distributed to third parties without specific written permission from MBARI. |
The Cygwin utilities are used to provide a means of using a Windows based PC to host the OASIS data download and processing software with a minimal porting effort. The open source Cygwin tools provide a very complete suite of UNIX tools and services, enabling the user to create a UNIX environment in which to run shell scripts and applications, and provide familiar UNIX shell interfaces to the PC, even under DOS shells. Many services, like cron and the inetd networking daemons, are also available, as are programming tools like gcc, make gdb, perl, and tcl, to name a few.
Cygwin, formerly maintained by Cygnus Systems, is now maintained by Red Hat. The Cygwin website at http://www.cygwin.com provides good support for this product.
This HOWTO describes how to install Cygwin and configure several services for use with the OASIS download software.
Table of Contents
Introduction
Hardware Requirements
Installarion Overview
Installation
Installing Cygwin
Setting Up Environment Variables
Setting Up Userscron
inetd
ssmtp
mutt
anonymous ftp
sshd
minicom
This HOWTO covers the installation of Cygwin, a Windows port of the UNIX
tools and services. Cygwin provides the software infrastructure for oasisnt,
PC software to perform
real time scheduled data downloads from drifters and tethered moorings.
The Cygwin tools are downloaded from the Cygwin website using a setup program available there. The setup tool also acts as a package manager to help you incrementally update your installation. Cygwin components are grouped together as software packages; Since there dependencies between packages, it is recommended that you initially download all packages.
Packages may be installed as binaries or source. Unless you have a specific
need to build a package yourself (for example, certain contributed packages
like minicom don't have binary distributions), it will be easier and conserve
disk space to install everything as binaries.
The installation procedure consists of these steps:
Several environment variables need to be set to allow the Cygwin to work correctly. The Cygwin /bin directory (and other directories containing Cygwin executables) should be put into the DOS Path variable. There is also a CYGWIN environment variable that is used to configure Cygwin.
name: CYGWIN_PATH
value: c:\cygwin\bin;c:\cygwin\usr\sbin;/usr/bin
<your path>;%CYGWIN_PATH%
name: CYGWIN
value: tty ntsec
It is often convenient (and for installing some contributed packages, required) to have a local user named root who is a member of the administrators group in the PC's local domain. If you wish to do so, use the Administrative Tools to create and the root user and add them to the Administrators group.
If you will be setting up anonymous ftp, you will also need to create a user named ftp; ftp must belong to the Users group and have a blank password (allowing blank passwords may be enabled under the User Manager Policies menu option).
For login to work correctly, use the Policies>>User Rights menu option (select the Show Advanced option) to add the following user rights for Administrators ONLY:
Note that these rights are not given even to administrators by default and should be granted with care.
Add any users that will need to login remotely and administer the system to the Telnet Access Group.
mkpasswd -l > /etc/passwd
mkpasswd -d | grep username >> /etc/passwd
U-LAGOON\smith
or for a local user (e.g. jones)
U-jones
quark::1796:513:Steve Quark uber geek,U-LAGOON\quark,S-1-5-21-...-1796:/home/quark:/bin/bash
quark::435:544:Steve Quark uber geek,U-LAGOON\quark,S-1-5-21-...-1796:/home/quark:/bin/bash
Here, 1796 is the UID assigned by the local domain, 513 is the local Users group; they have been changed to 435 (UID elsewhere in the LAGOON domain) and 544 (local Administrators group) respectively.
Note that the encrypted password field is not used on Windows NT, 2000 and XP.
If you are installing oasisnt, create a local user called oasis and add it to the local Administrators group.
mkgroup -l >> /etc/group
There are a number of UNIX services made available by Cygwin that you may wish use. Of those presented here, only the cron service is required by oasisnt to schedule downloads and processing scripts. Cygwin allows many applications to be run as Windows services using the program cygrunsrv. Programs that run as services can remain active as long as the PC is on, even when no one is logged in.
Type cygrunsrv --help and consult the Cygwin documentation for more information.
cron works very much like its UNIX counterpart; care must be taken to install it correctly. It is very important that users are set up in the manner prescribed. The following procedure may be used to set up cron:
cygrunsrv -I cron -p /usr/sbin/cron -a -D -e CYGWIN="tty ntsec"
cygrunsrv -S cron
ps -ef should indicate that the service is running. The directories /var/cron and /var/log should have been created.
crontab may now be used to create, edit, install and remove crontabs:
usage: crontab [-u user] file
crontab [-u user] { -e | -l | -r }
(default operation is replace, per 1003.2)
-e (edit user's crontab)
-l (list user's crontab)
-r (delete user's crontab)
cygrunsrv -E cron
The inetd service comprises a number of network daemons, including telnet and ftp. Use the following procedure to install inetd:
iu-config
(This creates /etc/inetd.conf, /etc/shells, /etc/ftpusers, /etc/ftpwelcome, /etc/motd)
inetd --install-as-service
net start inetd
(ps -ef will indicate more than one process; this is 'normal')
net stop inetd
inetd --remove-as-service
ssmtp is an optional Cygwin package. oasisnt uses the ssmtp MTA to send email to a list of users when a download fails. If you do not want this capability, you may comment it out of get<mooring>, and skip this section.
config-ssmtp
to create the ssmtp configuration file. You will be prompted for the
host name (e.g., fish.shore.mbari.org)
mail name (e.g. mbari.org)
smtp server host name (e.g., cirrus.shore.mbari.org)
smtp server port (e.g., 25).
Note: The Cygwin ash package must be installed for this script to run,
Mutt is an optional Cygwin package. oasisnt uses the mutt mail client to send email to a list of users when a download fails. If you do not want this capability, you may comment it out of get<mooring>, and skip this section. Note: The Cygwin ncurses and gettext packages must be installed for this mutt to run.
set sendmail = "/usr/sbin/ssmtp"
At this writing, anonymous ftp required the use of a special developer's snapshot of the Cygwin main dll that caused other things (most noteably cron) to break. If this has been fixed, you may create an anonymous ftp site as follows:
passwd
group
motd
ftpusers
ftpwelcome
bash.exe
cygwin1.dll
false
ls.exe
It should now be possible to ftp anonymously to the system, using ftp as the username and your email address as the password. At this writing, the FTP client used could not properly execute the ls command under some circumstances; using nlist did work as an alternative.
sshd is a secure remote login alternative to rlogin. The sshd daemon handles incoming ssh login requests.
ssh-host-config (create config files and server keys)
ssh-user-config (create user keys)
cygrunsrv -I ssh -p /usr/sbin/sshd -a -D -e CYGWIN="binmode tty ntsec"
sftp is a secure remote login alternative to ftp. Install the sshd (above) and in /etc/sshd_config, uncomment Subsytem sftp /usr/sbin/sftp-server.
Note: At this writing, the sftp subsystem did not work correctly. It may have since been fixed.
minicom is a serial terminal program, similar to Telix and Procomm. It has the advantage of being able to be used from a text based terminal session, like telnet. It is a third-party contributed package and is a little bit buggy and tricky to install, but it may be worth the trouble if you need a remote serial terminal.
cd /cygwin/contrib/minicom
tar zxvf minicom...
patch -p1 < minicom-cygwin.patch
cd /minicom-1.83.1/src
make
If errors related to long lines occur, the source code may have lines that
are too long for the compiler. If this happens, edit the source code and
break the lines up into smaller lines and make again.
add .exe to minicom
change root to admins
change uucp to none
run make install
copy /doc/minirc.dfl to /etc
chown root minicom.exe
chmod 777 /usr/local/*
chown root /usr/local/*
chgrp none /usr/local/*
Read the documentation and man page for more information about using minicom.
The documentation under /usr/doc and /usr/doc/Cygwin contains a wealth of useful
information
about setting up and using Cygwin services and applications
There are man pages available for almost all of the software in the Cygwin packages