How to bootstrap the debian system for Windows32 / Cygwin.
(Or, how to install dpkg..)
Prequisites:
You will need to have cygwin installed (run the setup from this page: http://www.cygwin.com
You will need to be running Cygwin's telnetd/rlogind, instead of Microsft's
telnetd. To install inetd under Windows 2000/XP, check out Adam Swann's HowTo
install Inetd
You will need to have the ability to run processes as userid root, with a uid=0
and a gid=0. For more information on this, check out the Security section
below.
Installing:
- be root, (id should show 'uid=0(root) gid=0(root)')
- If you want to keep cygwin's copy of md5sum, then you
will need to save it off somewhere/how, since dpkg installs a copy of
md5sum.
- grab the dpkg-???_w32.nondebbin.tar.gz from http://debian-cygwin.sourceforge.net/bootstrap
- unpack it into the appropriate directories.
- copy /usr/bin/dpkg.exe, /usr/bin/dpkg-deb.exe, into
some other directory that is called BEFORE /usr/bin. (This has to do with
a limitation of Windows. You can't replace/rename/touch an already opened
file.) I usually place mine in /sbin or /usr/sbin.
- get the latest of dpkg_*_w32.deb from http://debian-cygwin.sourceforge.net/bootstrap and make sure it is located in a
directory that is on a binary mounted volume
- dpkg -i dpkg_*_w32.deb
If you get an error message "can't open /var/lib/dpkg/available",
then do a
touch /var/lib/dpkg/available
touch /var/lib/dpkg/status
and rerun dpkg
- delete /sbin/dpkg.exe, /sbin/dpkg-deb.exe
- if you saved off cygwin's copy of md5sum, replace it now.
Security:
You must run dpkg as root, which means the userid and group need to be set to 0,
and the name needs to = root.
You can accomplish this by manipulating your /etc/passwd and /etc/group files to
change the administrator account to be root. Once you have done that, you have
to either telnet or rlogin back to your machine and login as root.
for information on creating a root/superuser under cygwin, first read and
understand the following:
http://cygwin.com/cygwin-ug-net/ntsec.html
Once you think you understand the document, then you should be able to create a
root user. Here's what I did under my Win2K box:
- mkpasswd -l > /etc/passwd
- mkgroup -l > /etc/group
- telnet and make sure that I can login as administrator, using
administrator and >admin password<. If that doesn't work, go back to
Prequisites, and get telnetd configured correctly.
- vi /etc/passwd, and find the row for administrator. Change the name to
root, uid to 0 and gid to 0.
Make sure that you update administrator, and that the SID for administrator is
unique
- vi /etc/group, find the row with SID = S-1-5-32-544. Change the name to
root, and the gid to 0
Continuing Steps:
After you have dpkg installed, then other packages can be installed.
However, you will need to investigate dpkg's flags to allow for installing
packages that have dependencies, but the cygwin equivalents are already
installed (PERL comes to mind readily).
Also, you might need to override the architecture, since most packages are for
i386(debian linux).
I am investigating how to create a proper debian archive structure to support
w32 on this sourceforge site (in order to have the proper entry in
/etc/apt/sources.list), but it's not there yet.