INSTALL revision 79998
155714Skris 255714Skris INSTALLATION ON THE UNIX PLATFORM 355714Skris --------------------------------- 455714Skris 559191Skris [Installation on Windows, OpenVMS and MacOS (before MacOS X) is described 659191Skris in INSTALL.W32, INSTALL.VMS and INSTALL.MacOS.] 755714Skris 855714Skris To install OpenSSL, you will need: 955714Skris 1079998Skris * make 1155714Skris * Perl 5 1255714Skris * an ANSI C compiler 1379998Skris * a development environment in form of development libraries and C 1479998Skris header files 1555714Skris * a supported Unix operating system 1655714Skris 1755714Skris Quick Start 1855714Skris ----------- 1955714Skris 2055714Skris If you want to just get on with it, do: 2155714Skris 2255714Skris $ ./config 2355714Skris $ make 2455714Skris $ make test 2555714Skris $ make install 2655714Skris 2755714Skris [If any of these steps fails, see section Installation in Detail below.] 2855714Skris 2955714Skris This will build and install OpenSSL in the default location, which is (for 3055714Skris historical reasons) /usr/local/ssl. If you want to install it anywhere else, 3155714Skris run config like this: 3255714Skris 3355714Skris $ ./config --prefix=/usr/local --openssldir=/usr/local/openssl 3455714Skris 3555714Skris 3655714Skris Configuration Options 3755714Skris --------------------- 3855714Skris 3959191Skris There are several options to ./config (or ./Configure) to customize 4059191Skris the build: 4155714Skris 4255714Skris --prefix=DIR Install in DIR/bin, DIR/lib, DIR/include/openssl. 4355714Skris Configuration files used by OpenSSL will be in DIR/ssl 4455714Skris or the directory specified by --openssldir. 4555714Skris 4655714Skris --openssldir=DIR Directory for OpenSSL files. If no prefix is specified, 4755714Skris the library files and binaries are also installed there. 4855714Skris 4955714Skris no-threads Don't try to build with support for multi-threaded 5055714Skris applications. 5155714Skris 5255714Skris threads Build with support for multi-threaded applications. 5355714Skris This will usually require additional system-dependent options! 5455714Skris See "Note on multi-threading" below. 5555714Skris 5668651Skris no-shared Don't try to create shared libraries. 5768651Skris 5868651Skris shared In addition to the usual static libraries, create shared 5968651Skris libraries on platforms where it's supported. See "Note on 6068651Skris shared libraries" below. 6168651Skris 6255714Skris no-asm Do not use assembler code. 6355714Skris 6455714Skris 386 Use the 80386 instruction set only (the default x86 code is 6555714Skris more efficient, but requires at least a 486). 6655714Skris 6755714Skris no-<cipher> Build without the specified cipher (bf, cast, des, dh, dsa, 6855714Skris hmac, md2, md5, mdc2, rc2, rc4, rc5, rsa, sha). 6955714Skris The crypto/<cipher> directory can be removed after running 7055714Skris "make depend". 7155714Skris 7255714Skris -Dxxx, -lxxx, -Lxxx, -fxxx, -Kxxx These system specific options will 7355714Skris be passed through to the compiler to allow you to 7455714Skris define preprocessor symbols, specify additional libraries, 7555714Skris library directories or other compiler options. 7655714Skris 7755714Skris 7855714Skris Installation in Detail 7955714Skris ---------------------- 8055714Skris 8155714Skris 1a. Configure OpenSSL for your operation system automatically: 8255714Skris 8355714Skris $ ./config [options] 8455714Skris 8555714Skris This guesses at your operating system (and compiler, if necessary) and 8655714Skris configures OpenSSL based on this guess. Run ./config -t to see 8759191Skris if it guessed correctly. If you want to use a different compiler, you 8859191Skris are cross-compiling for another platform, or the ./config guess was 8959191Skris wrong for other reasons, go to step 1b. Otherwise go to step 2. 9055714Skris 9155714Skris On some systems, you can include debugging information as follows: 9255714Skris 9355714Skris $ ./config -d [options] 9455714Skris 9555714Skris 1b. Configure OpenSSL for your operating system manually 9655714Skris 9755714Skris OpenSSL knows about a range of different operating system, hardware and 9855714Skris compiler combinations. To see the ones it knows about, run 9955714Skris 10055714Skris $ ./Configure 10155714Skris 10255714Skris Pick a suitable name from the list that matches your system. For most 10355714Skris operating systems there is a choice between using "cc" or "gcc". When 10455714Skris you have identified your system (and if necessary compiler) use this name 10555714Skris as the argument to ./Configure. For example, a "linux-elf" user would 10655714Skris run: 10755714Skris 10855714Skris $ ./Configure linux-elf [options] 10955714Skris 11055714Skris If your system is not available, you will have to edit the Configure 11155714Skris program and add the correct configuration for your system. The 11259191Skris generic configurations "cc" or "gcc" should usually work on 32 bit 11359191Skris systems. 11455714Skris 11555714Skris Configure creates the file Makefile.ssl from Makefile.org and 11655714Skris defines various macros in crypto/opensslconf.h (generated from 11755714Skris crypto/opensslconf.h.in). 11855714Skris 11955714Skris 2. Build OpenSSL by running: 12055714Skris 12155714Skris $ make 12255714Skris 12355714Skris This will build the OpenSSL libraries (libcrypto.a and libssl.a) and the 12455714Skris OpenSSL binary ("openssl"). The libraries will be built in the top-level 12555714Skris directory, and the binary will be in the "apps" directory. 12655714Skris 12768651Skris If "make" fails, look at the output. There may be reasons for 12879998Skris the failure that aren't problems in OpenSSL itself (like missing 12968651Skris standard headers). If it is a problem with OpenSSL itself, please 13068651Skris report the problem to <openssl-bugs@openssl.org> (note that your 13168651Skris message will be forwarded to a public mailing list). Include the 13268651Skris output of "make report" in your message. 13355714Skris 13455714Skris [If you encounter assembler error messages, try the "no-asm" 13559191Skris configuration option as an immediate fix.] 13655714Skris 13755714Skris Compiling parts of OpenSSL with gcc and others with the system 13855714Skris compiler will result in unresolved symbols on some systems. 13955714Skris 14055714Skris 3. After a successful build, the libraries should be tested. Run: 14155714Skris 14255714Skris $ make test 14355714Skris 14468651Skris If a test fails, look at the output. There may be reasons for 14568651Skris the failure that isn't a problem in OpenSSL itself (like a missing 14668651Skris or malfunctioning bc). If it is a problem with OpenSSL itself, 14768651Skris try removing any compiler optimization flags from the CFLAGS line 14868651Skris in Makefile.ssl and run "make clean; make". Please send a bug 14968651Skris report to <openssl-bugs@openssl.org>, including the output of 15068651Skris "make report". 15155714Skris 15255714Skris 4. If everything tests ok, install OpenSSL with 15355714Skris 15455714Skris $ make install 15555714Skris 15655714Skris This will create the installation directory (if it does not exist) and 15755714Skris then the following subdirectories: 15855714Skris 15955714Skris certs Initially empty, this is the default location 16055714Skris for certificate files. 16159191Skris man/man1 Manual pages for the 'openssl' command line tool 16259191Skris man/man3 Manual pages for the libraries (very incomplete) 16355714Skris misc Various scripts. 16455714Skris private Initially empty, this is the default location 16555714Skris for private key files. 16655714Skris 16759191Skris If you didn't choose a different installation prefix, the 16855714Skris following additional subdirectories will be created: 16955714Skris 17055714Skris bin Contains the openssl binary and a few other 17155714Skris utility programs. 17255714Skris include/openssl Contains the header files needed if you want to 17355714Skris compile programs with libcrypto or libssl. 17455714Skris lib Contains the OpenSSL library files themselves. 17555714Skris 17655714Skris Package builders who want to configure the library for standard 17755714Skris locations, but have the package installed somewhere else so that 17855714Skris it can easily be packaged, can use 17955714Skris 18055714Skris $ make INSTALL_PREFIX=/tmp/package-root install 18155714Skris 18255714Skris (or specify "--install_prefix=/tmp/package-root" as a configure 18355714Skris option). The specified prefix will be prepended to all 18455714Skris installation target filenames. 18555714Skris 18655714Skris 18755714Skris NOTE: The header files used to reside directly in the include 18855714Skris directory, but have now been moved to include/openssl so that 18955714Skris OpenSSL can co-exist with other libraries which use some of the 19055714Skris same filenames. This means that applications that use OpenSSL 19155714Skris should now use C preprocessor directives of the form 19255714Skris 19355714Skris #include <openssl/ssl.h> 19455714Skris 19555714Skris instead of "#include <ssl.h>", which was used with library versions 19655714Skris up to OpenSSL 0.9.2b. 19755714Skris 19855714Skris If you install a new version of OpenSSL over an old library version, 19955714Skris you should delete the old header files in the include directory. 20055714Skris 20155714Skris Compatibility issues: 20255714Skris 20355714Skris * COMPILING existing applications 20455714Skris 20555714Skris To compile an application that uses old filenames -- e.g. 20655714Skris "#include <ssl.h>" --, it will usually be enough to find 20755714Skris the CFLAGS definition in the application's Makefile and 20855714Skris add a C option such as 20955714Skris 21055714Skris -I/usr/local/ssl/include/openssl 21155714Skris 21255714Skris to it. 21355714Skris 21455714Skris But don't delete the existing -I option that points to 21555714Skris the ..../include directory! Otherwise, OpenSSL header files 21655714Skris could not #include each other. 21755714Skris 21855714Skris * WRITING applications 21955714Skris 22055714Skris To write an application that is able to handle both the new 22155714Skris and the old directory layout, so that it can still be compiled 22255714Skris with library versions up to OpenSSL 0.9.2b without bothering 22355714Skris the user, you can proceed as follows: 22455714Skris 22555714Skris - Always use the new filename of OpenSSL header files, 22655714Skris e.g. #include <openssl/ssl.h>. 22755714Skris 22855714Skris - Create a directory "incl" that contains only a symbolic 22955714Skris link named "openssl", which points to the "include" directory 23055714Skris of OpenSSL. 23155714Skris For example, your application's Makefile might contain the 23255714Skris following rule, if OPENSSLDIR is a pathname (absolute or 23355714Skris relative) of the directory where OpenSSL resides: 23455714Skris 23555714Skris incl/openssl: 23655714Skris -mkdir incl 23755714Skris cd $(OPENSSLDIR) # Check whether the directory really exists 23855714Skris -ln -s `cd $(OPENSSLDIR); pwd`/include incl/openssl 23955714Skris 24055714Skris You will have to add "incl/openssl" to the dependencies 24155714Skris of those C files that include some OpenSSL header file. 24255714Skris 24355714Skris - Add "-Iincl" to your CFLAGS. 24455714Skris 24555714Skris With these additions, the OpenSSL header files will be available 24655714Skris under both name variants if an old library version is used: 24755714Skris Your application can reach them under names like <openssl/foo.h>, 24855714Skris while the header files still are able to #include each other 24955714Skris with names of the form <foo.h>. 25055714Skris 25155714Skris 25255714Skris Note on multi-threading 25355714Skris ----------------------- 25455714Skris 25555714Skris For some systems, the OpenSSL Configure script knows what compiler options 25655714Skris are needed to generate a library that is suitable for multi-threaded 25755714Skris applications. On these systems, support for multi-threading is enabled 25855714Skris by default; use the "no-threads" option to disable (this should never be 25955714Skris necessary). 26055714Skris 26155714Skris On other systems, to enable support for multi-threading, you will have 26255714Skris to specify at least two options: "threads", and a system-dependent option. 26355714Skris (The latter is "-D_REENTRANT" on various systems.) The default in this 26455714Skris case, obviously, is not to include support for multi-threading (but 26555714Skris you can still use "no-threads" to suppress an annoying warning message 26655714Skris from the Configure script.) 26755714Skris 26868651Skris 26968651Skris Note on shared libraries 27068651Skris ------------------------ 27168651Skris 27268651Skris For some systems, the OpenSSL Configure script knows what is needed to 27368651Skris build shared libraries for libcrypto and libssl. On these systems, 27468651Skris the shared libraries are currently not created by default, but giving 27568651Skris the option "shared" will get them created. This method supports Makefile 27668651Skris targets for shared library creation, like linux-shared. Those targets 27768651Skris can currently be used on their own just as well, but this is expected 27868651Skris to change in future versions of OpenSSL. 279