INSTALL revision 167612
155714Skris 255714Skris INSTALLATION ON THE UNIX PLATFORM 355714Skris --------------------------------- 455714Skris 5160814Ssimon [Installation on DOS (with djgpp), Windows, OpenVMS, MacOS (before MacOS X) 6160814Ssimon and NetWare is described in INSTALL.DJGPP, INSTALL.W32, INSTALL.VMS, 7160814Ssimon INSTALL.MacOS and INSTALL.NW. 8160814Ssimon 9109998Smarkm This document describes installation on operating systems in the Unix 10109998Smarkm family.] 1155714Skris 1255714Skris To install OpenSSL, you will need: 1355714Skris 1479998Skris * make 1555714Skris * Perl 5 1655714Skris * an ANSI C compiler 1779998Skris * a development environment in form of development libraries and C 1879998Skris header files 1955714Skris * a supported Unix operating system 2055714Skris 2155714Skris Quick Start 2255714Skris ----------- 2355714Skris 2455714Skris If you want to just get on with it, do: 2555714Skris 2655714Skris $ ./config 2755714Skris $ make 2855714Skris $ make test 2955714Skris $ make install 3055714Skris 3155714Skris [If any of these steps fails, see section Installation in Detail below.] 3255714Skris 3355714Skris This will build and install OpenSSL in the default location, which is (for 3455714Skris historical reasons) /usr/local/ssl. If you want to install it anywhere else, 3555714Skris run config like this: 3655714Skris 3755714Skris $ ./config --prefix=/usr/local --openssldir=/usr/local/openssl 3855714Skris 3955714Skris 4055714Skris Configuration Options 4155714Skris --------------------- 4255714Skris 4359191Skris There are several options to ./config (or ./Configure) to customize 4459191Skris the build: 4555714Skris 4655714Skris --prefix=DIR Install in DIR/bin, DIR/lib, DIR/include/openssl. 4755714Skris Configuration files used by OpenSSL will be in DIR/ssl 4855714Skris or the directory specified by --openssldir. 4955714Skris 5055714Skris --openssldir=DIR Directory for OpenSSL files. If no prefix is specified, 5155714Skris the library files and binaries are also installed there. 5255714Skris 5355714Skris no-threads Don't try to build with support for multi-threaded 5455714Skris applications. 5555714Skris 5655714Skris threads Build with support for multi-threaded applications. 5755714Skris This will usually require additional system-dependent options! 5855714Skris See "Note on multi-threading" below. 5955714Skris 60109998Smarkm no-zlib Don't try to build with support for zlib compression and 61109998Smarkm decompression. 62109998Smarkm 63109998Smarkm zlib Build with support for zlib compression/decompression. 64109998Smarkm 65109998Smarkm zlib-dynamic Like "zlib", but has OpenSSL load the zlib library dynamically 66109998Smarkm when needed. This is only supported on systems where loading 67109998Smarkm of shared libraries is supported. This is the default choice. 68109998Smarkm 6968651Skris no-shared Don't try to create shared libraries. 7068651Skris 7168651Skris shared In addition to the usual static libraries, create shared 7268651Skris libraries on platforms where it's supported. See "Note on 7368651Skris shared libraries" below. 7468651Skris 7555714Skris no-asm Do not use assembler code. 7655714Skris 7755714Skris 386 Use the 80386 instruction set only (the default x86 code is 78160814Ssimon more efficient, but requires at least a 486). Note: Use 79160814Ssimon compiler flags for any other CPU specific configuration, 80160814Ssimon e.g. "-m32" to build x86 code on an x64 system. 8155714Skris 82160814Ssimon no-sse2 Exclude SSE2 code pathes. Normally SSE2 extention is 83160814Ssimon detected at run-time, but the decision whether or not the 84160814Ssimon machine code will be executed is taken solely on CPU 85160814Ssimon capability vector. This means that if you happen to run OS 86160814Ssimon kernel which does not support SSE2 extension on Intel P4 87160814Ssimon processor, then your application might be exposed to 88160814Ssimon "illegal instruction" exception. There might be a way 89160814Ssimon to enable support in kernel, e.g. FreeBSD kernel can be 90160814Ssimon compiled with CPU_ENABLE_SSE, and there is a way to 91160814Ssimon disengage SSE2 code pathes upon application start-up, 92160814Ssimon but if you aim for wider "audience" running such kernel, 93160814Ssimon consider no-sse2. Both 386 and no-asm options above imply 94160814Ssimon no-sse2. 95160814Ssimon 9655714Skris no-<cipher> Build without the specified cipher (bf, cast, des, dh, dsa, 9755714Skris hmac, md2, md5, mdc2, rc2, rc4, rc5, rsa, sha). 9855714Skris The crypto/<cipher> directory can be removed after running 9955714Skris "make depend". 10055714Skris 101160814Ssimon -Dxxx, -lxxx, -Lxxx, -fxxx, -mxxx, -Kxxx These system specific options will 10255714Skris be passed through to the compiler to allow you to 10355714Skris define preprocessor symbols, specify additional libraries, 10455714Skris library directories or other compiler options. 10555714Skris 10655714Skris 10755714Skris Installation in Detail 10855714Skris ---------------------- 10955714Skris 11055714Skris 1a. Configure OpenSSL for your operation system automatically: 11155714Skris 11255714Skris $ ./config [options] 11355714Skris 11455714Skris This guesses at your operating system (and compiler, if necessary) and 11555714Skris configures OpenSSL based on this guess. Run ./config -t to see 11659191Skris if it guessed correctly. If you want to use a different compiler, you 11759191Skris are cross-compiling for another platform, or the ./config guess was 11859191Skris wrong for other reasons, go to step 1b. Otherwise go to step 2. 11955714Skris 12055714Skris On some systems, you can include debugging information as follows: 12155714Skris 12255714Skris $ ./config -d [options] 12355714Skris 12455714Skris 1b. Configure OpenSSL for your operating system manually 12555714Skris 12655714Skris OpenSSL knows about a range of different operating system, hardware and 12755714Skris compiler combinations. To see the ones it knows about, run 12855714Skris 12955714Skris $ ./Configure 13055714Skris 13155714Skris Pick a suitable name from the list that matches your system. For most 13255714Skris operating systems there is a choice between using "cc" or "gcc". When 13355714Skris you have identified your system (and if necessary compiler) use this name 13455714Skris as the argument to ./Configure. For example, a "linux-elf" user would 13555714Skris run: 13655714Skris 13755714Skris $ ./Configure linux-elf [options] 13855714Skris 13955714Skris If your system is not available, you will have to edit the Configure 14055714Skris program and add the correct configuration for your system. The 14159191Skris generic configurations "cc" or "gcc" should usually work on 32 bit 14259191Skris systems. 14355714Skris 144160814Ssimon Configure creates the file Makefile.ssl from Makefile.org and 14555714Skris defines various macros in crypto/opensslconf.h (generated from 14655714Skris crypto/opensslconf.h.in). 14755714Skris 14855714Skris 2. Build OpenSSL by running: 14955714Skris 15055714Skris $ make 15155714Skris 15255714Skris This will build the OpenSSL libraries (libcrypto.a and libssl.a) and the 15355714Skris OpenSSL binary ("openssl"). The libraries will be built in the top-level 15455714Skris directory, and the binary will be in the "apps" directory. 15555714Skris 15668651Skris If "make" fails, look at the output. There may be reasons for 15779998Skris the failure that aren't problems in OpenSSL itself (like missing 15868651Skris standard headers). If it is a problem with OpenSSL itself, please 15968651Skris report the problem to <openssl-bugs@openssl.org> (note that your 160100936Snectar message will be recorded in the request tracker publicly readable 161109998Smarkm via http://www.openssl.org/support/rt2.html and will be forwarded to a 162109998Smarkm public mailing list). Include the output of "make report" in your message. 163100936Snectar Please check out the request tracker. Maybe the bug was already 164100936Snectar reported or has already been fixed. 16555714Skris 16655714Skris [If you encounter assembler error messages, try the "no-asm" 16759191Skris configuration option as an immediate fix.] 16855714Skris 16955714Skris Compiling parts of OpenSSL with gcc and others with the system 17055714Skris compiler will result in unresolved symbols on some systems. 17155714Skris 17255714Skris 3. After a successful build, the libraries should be tested. Run: 17355714Skris 17455714Skris $ make test 17555714Skris 17668651Skris If a test fails, look at the output. There may be reasons for 17768651Skris the failure that isn't a problem in OpenSSL itself (like a missing 17868651Skris or malfunctioning bc). If it is a problem with OpenSSL itself, 179111147Snectar try removing any compiler optimization flags from the CFLAG line 180160814Ssimon in Makefile.ssl and run "make clean; make". Please send a bug 18168651Skris report to <openssl-bugs@openssl.org>, including the output of 182100936Snectar "make report" in order to be added to the request tracker at 183109998Smarkm http://www.openssl.org/support/rt2.html. 18455714Skris 18555714Skris 4. If everything tests ok, install OpenSSL with 18655714Skris 18755714Skris $ make install 18855714Skris 18955714Skris This will create the installation directory (if it does not exist) and 19055714Skris then the following subdirectories: 19155714Skris 19255714Skris certs Initially empty, this is the default location 19355714Skris for certificate files. 19459191Skris man/man1 Manual pages for the 'openssl' command line tool 19559191Skris man/man3 Manual pages for the libraries (very incomplete) 19655714Skris misc Various scripts. 19755714Skris private Initially empty, this is the default location 19855714Skris for private key files. 19955714Skris 20059191Skris If you didn't choose a different installation prefix, the 20155714Skris following additional subdirectories will be created: 20255714Skris 20355714Skris bin Contains the openssl binary and a few other 20455714Skris utility programs. 20555714Skris include/openssl Contains the header files needed if you want to 20655714Skris compile programs with libcrypto or libssl. 20755714Skris lib Contains the OpenSSL library files themselves. 20855714Skris 20955714Skris Package builders who want to configure the library for standard 21055714Skris locations, but have the package installed somewhere else so that 21155714Skris it can easily be packaged, can use 21255714Skris 21355714Skris $ make INSTALL_PREFIX=/tmp/package-root install 21455714Skris 21555714Skris (or specify "--install_prefix=/tmp/package-root" as a configure 21655714Skris option). The specified prefix will be prepended to all 21755714Skris installation target filenames. 21855714Skris 21955714Skris 22055714Skris NOTE: The header files used to reside directly in the include 22155714Skris directory, but have now been moved to include/openssl so that 22255714Skris OpenSSL can co-exist with other libraries which use some of the 22355714Skris same filenames. This means that applications that use OpenSSL 22455714Skris should now use C preprocessor directives of the form 22555714Skris 22655714Skris #include <openssl/ssl.h> 22755714Skris 22855714Skris instead of "#include <ssl.h>", which was used with library versions 22955714Skris up to OpenSSL 0.9.2b. 23055714Skris 23155714Skris If you install a new version of OpenSSL over an old library version, 23255714Skris you should delete the old header files in the include directory. 23355714Skris 23455714Skris Compatibility issues: 23555714Skris 23655714Skris * COMPILING existing applications 23755714Skris 23855714Skris To compile an application that uses old filenames -- e.g. 23955714Skris "#include <ssl.h>" --, it will usually be enough to find 24055714Skris the CFLAGS definition in the application's Makefile and 24155714Skris add a C option such as 24255714Skris 24355714Skris -I/usr/local/ssl/include/openssl 24455714Skris 24555714Skris to it. 24655714Skris 24755714Skris But don't delete the existing -I option that points to 24855714Skris the ..../include directory! Otherwise, OpenSSL header files 24955714Skris could not #include each other. 25055714Skris 25155714Skris * WRITING applications 25255714Skris 25355714Skris To write an application that is able to handle both the new 25455714Skris and the old directory layout, so that it can still be compiled 25555714Skris with library versions up to OpenSSL 0.9.2b without bothering 25655714Skris the user, you can proceed as follows: 25755714Skris 25855714Skris - Always use the new filename of OpenSSL header files, 25955714Skris e.g. #include <openssl/ssl.h>. 26055714Skris 26155714Skris - Create a directory "incl" that contains only a symbolic 26255714Skris link named "openssl", which points to the "include" directory 26355714Skris of OpenSSL. 26455714Skris For example, your application's Makefile might contain the 26555714Skris following rule, if OPENSSLDIR is a pathname (absolute or 26655714Skris relative) of the directory where OpenSSL resides: 26755714Skris 26855714Skris incl/openssl: 26955714Skris -mkdir incl 27055714Skris cd $(OPENSSLDIR) # Check whether the directory really exists 27155714Skris -ln -s `cd $(OPENSSLDIR); pwd`/include incl/openssl 27255714Skris 27355714Skris You will have to add "incl/openssl" to the dependencies 27455714Skris of those C files that include some OpenSSL header file. 27555714Skris 27655714Skris - Add "-Iincl" to your CFLAGS. 27755714Skris 27855714Skris With these additions, the OpenSSL header files will be available 27955714Skris under both name variants if an old library version is used: 28055714Skris Your application can reach them under names like <openssl/foo.h>, 28155714Skris while the header files still are able to #include each other 28255714Skris with names of the form <foo.h>. 28355714Skris 28455714Skris 28555714Skris Note on multi-threading 28655714Skris ----------------------- 28755714Skris 28855714Skris For some systems, the OpenSSL Configure script knows what compiler options 28955714Skris are needed to generate a library that is suitable for multi-threaded 29055714Skris applications. On these systems, support for multi-threading is enabled 29155714Skris by default; use the "no-threads" option to disable (this should never be 29255714Skris necessary). 29355714Skris 29455714Skris On other systems, to enable support for multi-threading, you will have 29555714Skris to specify at least two options: "threads", and a system-dependent option. 29655714Skris (The latter is "-D_REENTRANT" on various systems.) The default in this 29755714Skris case, obviously, is not to include support for multi-threading (but 29855714Skris you can still use "no-threads" to suppress an annoying warning message 29955714Skris from the Configure script.) 30055714Skris 30168651Skris 30268651Skris Note on shared libraries 30368651Skris ------------------------ 30468651Skris 305167612Ssimon Shared libraries have certain caveats. Binary backward compatibility 306167612Ssimon can't be guaranteed before OpenSSL version 1.0. The only reason to 307167612Ssimon use them would be to conserve memory on systems where several programs 308167612Ssimon are using OpenSSL. 309100928Snectar 31068651Skris For some systems, the OpenSSL Configure script knows what is needed to 31168651Skris build shared libraries for libcrypto and libssl. On these systems, 31268651Skris the shared libraries are currently not created by default, but giving 31368651Skris the option "shared" will get them created. This method supports Makefile 31468651Skris targets for shared library creation, like linux-shared. Those targets 31568651Skris can currently be used on their own just as well, but this is expected 31668651Skris to change in future versions of OpenSSL. 317109998Smarkm 318109998Smarkm Note on random number generation 319109998Smarkm -------------------------------- 320109998Smarkm 321109998Smarkm Availability of cryptographically secure random numbers is required for 322109998Smarkm secret key generation. OpenSSL provides several options to seed the 323109998Smarkm internal PRNG. If not properly seeded, the internal PRNG will refuse 324109998Smarkm to deliver random bytes and a "PRNG not seeded error" will occur. 325109998Smarkm On systems without /dev/urandom (or similar) device, it may be necessary 326109998Smarkm to install additional support software to obtain random seed. 327109998Smarkm Please check out the manual pages for RAND_add(), RAND_bytes(), RAND_egd(), 328109998Smarkm and the FAQ for more information. 329111147Snectar 330111147Snectar Note on support for multiple builds 331111147Snectar ----------------------------------- 332111147Snectar 333160814Ssimon OpenSSL is usually built in its source tree. Unfortunately, this doesn't 334111147Snectar support building for multiple platforms from the same source tree very well. 335111147Snectar It is however possible to build in a separate tree through the use of lots 336111147Snectar of symbolic links, which should be prepared like this: 337111147Snectar 338111147Snectar mkdir -p objtree/"`uname -s`-`uname -r`-`uname -m`" 339111147Snectar cd objtree/"`uname -s`-`uname -r`-`uname -m`" 340111147Snectar (cd $OPENSSL_SOURCE; find . -type f) | while read F; do 341111147Snectar mkdir -p `dirname $F` 342111147Snectar rm -f $F; ln -s $OPENSSL_SOURCE/$F $F 343111147Snectar echo $F '->' $OPENSSL_SOURCE/$F 344111147Snectar done 345111147Snectar make -f Makefile.org clean 346111147Snectar 347111147Snectar OPENSSL_SOURCE is an environment variable that contains the absolute (this 348111147Snectar is important!) path to the OpenSSL source tree. 349111147Snectar 350111147Snectar Also, operations like 'make update' should still be made in the source tree. 351