- Obtain the package you need to install from CTAN (http://www.ctan.org/).
- Extract the downloaded package into a directory (say latex_source)
- Run latex against the .ins file available as part of the package.
- Copy the generated .sty and .cfg files to the directory where latex looks for the packages (In Cygwin one of the directory under which latex packages are searched under is : /usr/share/texmf).
- Update the tex filename database running mktexlsr (or texhash which is an alias to mktexlsr)
Below is an example that uses above steps to install listings package. The listings package is a source code printer and is useful to typeset code snippets in the documents.
Download listings package from CTAN
%unzip listings.zip
%cd listings
%ls
Makefile README listings.dtx listings.ind listings.ins listings.pdf lstdrvrs.dtx
%latex listings.ins
[…]
**********************************************************
* This program converts documented macro-files into fast *
* loadable files by stripping off (nearly) all comments! *
**********************************************************
* No Configuration file found, using default settings. *
********************************************************
Generating file(s) ./listings.sty ./lstmisc.sty ./lstdoc.sty ./lstdrvrs.ins ./l
istings.cfg
[…]
* You probably need to move all created `.sty' and `.cfg'
* files into a directory searched by TeX.
*
* And don't forget to refresh your filename database
* if your TeX distribution uses such a database.
% mkdir /usr/share/texmf/tex/latex/listings
%mv *.sty /usr/share/texmf/tex/latex/listings
%mv *.cfg /usr/share/texmf/tex/latex/listings
%
$ mktexlsr
mktexlsr: Updating /home/…./.texmf/var/ls-R...
mktexlsr: Updating /usr/share/texmf/ls-R...
mktexlsr: Updating /var/cache/fonts/ls-R...
mktexlsr: Updating /var/lib/texmf/ls-R...
mktexlsr: Done.