INSTALL revision 111147
1 2 INSTALLATION ON THE UNIX PLATFORM 3 --------------------------------- 4 5 [Installation on DOS (with djgpp), Windows, OpenVMS and MacOS (before MacOS X) 6 is described in INSTALL.DJGPP, INSTALL.W32, INSTALL.VMS and INSTALL.MacOS. 7 This document describes installation on operating systems in the Unix 8 family.] 9 10 To install OpenSSL, you will need: 11 12 * make 13 * Perl 5 14 * an ANSI C compiler 15 * a development environment in form of development libraries and C 16 header files 17 * a supported Unix operating system 18 19 Quick Start 20 ----------- 21 22 If you want to just get on with it, do: 23 24 $ ./config 25 $ make 26 $ make test 27 $ make install 28 29 [If any of these steps fails, see section Installation in Detail below.] 30 31 This will build and install OpenSSL in the default location, which is (for 32 historical reasons) /usr/local/ssl. If you want to install it anywhere else, 33 run config like this: 34 35 $ ./config --prefix=/usr/local --openssldir=/usr/local/openssl 36 37 38 Configuration Options 39 --------------------- 40 41 There are several options to ./config (or ./Configure) to customize 42 the build: 43 44 --prefix=DIR Install in DIR/bin, DIR/lib, DIR/include/openssl. 45 Configuration files used by OpenSSL will be in DIR/ssl 46 or the directory specified by --openssldir. 47 48 --openssldir=DIR Directory for OpenSSL files. If no prefix is specified, 49 the library files and binaries are also installed there. 50 51 no-threads Don't try to build with support for multi-threaded 52 applications. 53 54 threads Build with support for multi-threaded applications. 55 This will usually require additional system-dependent options! 56 See "Note on multi-threading" below. 57 58 no-zlib Don't try to build with support for zlib compression and 59 decompression. 60 61 zlib Build with support for zlib compression/decompression. 62 63 zlib-dynamic Like "zlib", but has OpenSSL load the zlib library dynamically 64 when needed. This is only supported on systems where loading 65 of shared libraries is supported. This is the default choice. 66 67 no-shared Don't try to create shared libraries. 68 69 shared In addition to the usual static libraries, create shared 70 libraries on platforms where it's supported. See "Note on 71 shared libraries" below. 72 73 no-asm Do not use assembler code. 74 75 386 Use the 80386 instruction set only (the default x86 code is 76 more efficient, but requires at least a 486). 77 78 no-<cipher> Build without the specified cipher (bf, cast, des, dh, dsa, 79 hmac, md2, md5, mdc2, rc2, rc4, rc5, rsa, sha). 80 The crypto/<cipher> directory can be removed after running 81 "make depend". 82 83 -Dxxx, -lxxx, -Lxxx, -fxxx, -Kxxx These system specific options will 84 be passed through to the compiler to allow you to 85 define preprocessor symbols, specify additional libraries, 86 library directories or other compiler options. 87 88 89 Installation in Detail 90 ---------------------- 91 92 1a. Configure OpenSSL for your operation system automatically: 93 94 $ ./config [options] 95 96 This guesses at your operating system (and compiler, if necessary) and 97 configures OpenSSL based on this guess. Run ./config -t to see 98 if it guessed correctly. If you want to use a different compiler, you 99 are cross-compiling for another platform, or the ./config guess was 100 wrong for other reasons, go to step 1b. Otherwise go to step 2. 101 102 On some systems, you can include debugging information as follows: 103 104 $ ./config -d [options] 105 106 1b. Configure OpenSSL for your operating system manually 107 108 OpenSSL knows about a range of different operating system, hardware and 109 compiler combinations. To see the ones it knows about, run 110 111 $ ./Configure 112 113 Pick a suitable name from the list that matches your system. For most 114 operating systems there is a choice between using "cc" or "gcc". When 115 you have identified your system (and if necessary compiler) use this name 116 as the argument to ./Configure. For example, a "linux-elf" user would 117 run: 118 119 $ ./Configure linux-elf [options] 120 121 If your system is not available, you will have to edit the Configure 122 program and add the correct configuration for your system. The 123 generic configurations "cc" or "gcc" should usually work on 32 bit 124 systems. 125 126 Configure creates the file Makefile.ssl from Makefile.org and 127 defines various macros in crypto/opensslconf.h (generated from 128 crypto/opensslconf.h.in). 129 130 2. Build OpenSSL by running: 131 132 $ make 133 134 This will build the OpenSSL libraries (libcrypto.a and libssl.a) and the 135 OpenSSL binary ("openssl"). The libraries will be built in the top-level 136 directory, and the binary will be in the "apps" directory. 137 138 If "make" fails, look at the output. There may be reasons for 139 the failure that aren't problems in OpenSSL itself (like missing 140 standard headers). If it is a problem with OpenSSL itself, please 141 report the problem to <openssl-bugs@openssl.org> (note that your 142 message will be recorded in the request tracker publicly readable 143 via http://www.openssl.org/support/rt2.html and will be forwarded to a 144 public mailing list). Include the output of "make report" in your message. 145 Please check out the request tracker. Maybe the bug was already 146 reported or has already been fixed. 147 148 [If you encounter assembler error messages, try the "no-asm" 149 configuration option as an immediate fix.] 150 151 Compiling parts of OpenSSL with gcc and others with the system 152 compiler will result in unresolved symbols on some systems. 153 154 3. After a successful build, the libraries should be tested. Run: 155 156 $ make test 157 158 If a test fails, look at the output. There may be reasons for 159 the failure that isn't a problem in OpenSSL itself (like a missing 160 or malfunctioning bc). If it is a problem with OpenSSL itself, 161 try removing any compiler optimization flags from the CFLAG line 162 in Makefile.ssl and run "make clean; make". Please send a bug 163 report to <openssl-bugs@openssl.org>, including the output of 164 "make report" in order to be added to the request tracker at 165 http://www.openssl.org/support/rt2.html. 166 167 4. If everything tests ok, install OpenSSL with 168 169 $ make install 170 171 This will create the installation directory (if it does not exist) and 172 then the following subdirectories: 173 174 certs Initially empty, this is the default location 175 for certificate files. 176 man/man1 Manual pages for the 'openssl' command line tool 177 man/man3 Manual pages for the libraries (very incomplete) 178 misc Various scripts. 179 private Initially empty, this is the default location 180 for private key files. 181 182 If you didn't choose a different installation prefix, the 183 following additional subdirectories will be created: 184 185 bin Contains the openssl binary and a few other 186 utility programs. 187 include/openssl Contains the header files needed if you want to 188 compile programs with libcrypto or libssl. 189 lib Contains the OpenSSL library files themselves. 190 191 Package builders who want to configure the library for standard 192 locations, but have the package installed somewhere else so that 193 it can easily be packaged, can use 194 195 $ make INSTALL_PREFIX=/tmp/package-root install 196 197 (or specify "--install_prefix=/tmp/package-root" as a configure 198 option). The specified prefix will be prepended to all 199 installation target filenames. 200 201 202 NOTE: The header files used to reside directly in the include 203 directory, but have now been moved to include/openssl so that 204 OpenSSL can co-exist with other libraries which use some of the 205 same filenames. This means that applications that use OpenSSL 206 should now use C preprocessor directives of the form 207 208 #include <openssl/ssl.h> 209 210 instead of "#include <ssl.h>", which was used with library versions 211 up to OpenSSL 0.9.2b. 212 213 If you install a new version of OpenSSL over an old library version, 214 you should delete the old header files in the include directory. 215 216 Compatibility issues: 217 218 * COMPILING existing applications 219 220 To compile an application that uses old filenames -- e.g. 221 "#include <ssl.h>" --, it will usually be enough to find 222 the CFLAGS definition in the application's Makefile and 223 add a C option such as 224 225 -I/usr/local/ssl/include/openssl 226 227 to it. 228 229 But don't delete the existing -I option that points to 230 the ..../include directory! Otherwise, OpenSSL header files 231 could not #include each other. 232 233 * WRITING applications 234 235 To write an application that is able to handle both the new 236 and the old directory layout, so that it can still be compiled 237 with library versions up to OpenSSL 0.9.2b without bothering 238 the user, you can proceed as follows: 239 240 - Always use the new filename of OpenSSL header files, 241 e.g. #include <openssl/ssl.h>. 242 243 - Create a directory "incl" that contains only a symbolic 244 link named "openssl", which points to the "include" directory 245 of OpenSSL. 246 For example, your application's Makefile might contain the 247 following rule, if OPENSSLDIR is a pathname (absolute or 248 relative) of the directory where OpenSSL resides: 249 250 incl/openssl: 251 -mkdir incl 252 cd $(OPENSSLDIR) # Check whether the directory really exists 253 -ln -s `cd $(OPENSSLDIR); pwd`/include incl/openssl 254 255 You will have to add "incl/openssl" to the dependencies 256 of those C files that include some OpenSSL header file. 257 258 - Add "-Iincl" to your CFLAGS. 259 260 With these additions, the OpenSSL header files will be available 261 under both name variants if an old library version is used: 262 Your application can reach them under names like <openssl/foo.h>, 263 while the header files still are able to #include each other 264 with names of the form <foo.h>. 265 266 267 Note on multi-threading 268 ----------------------- 269 270 For some systems, the OpenSSL Configure script knows what compiler options 271 are needed to generate a library that is suitable for multi-threaded 272 applications. On these systems, support for multi-threading is enabled 273 by default; use the "no-threads" option to disable (this should never be 274 necessary). 275 276 On other systems, to enable support for multi-threading, you will have 277 to specify at least two options: "threads", and a system-dependent option. 278 (The latter is "-D_REENTRANT" on various systems.) The default in this 279 case, obviously, is not to include support for multi-threading (but 280 you can still use "no-threads" to suppress an annoying warning message 281 from the Configure script.) 282 283 284 Note on shared libraries 285 ------------------------ 286 287 Shared library is currently an experimental feature. The only reason to 288 have them would be to conserve memory on systems where several program 289 are using OpenSSL. Binary backward compatibility can't be guaranteed 290 before OpenSSL version 1.0. 291 292 For some systems, the OpenSSL Configure script knows what is needed to 293 build shared libraries for libcrypto and libssl. On these systems, 294 the shared libraries are currently not created by default, but giving 295 the option "shared" will get them created. This method supports Makefile 296 targets for shared library creation, like linux-shared. Those targets 297 can currently be used on their own just as well, but this is expected 298 to change in future versions of OpenSSL. 299 300 Note on random number generation 301 -------------------------------- 302 303 Availability of cryptographically secure random numbers is required for 304 secret key generation. OpenSSL provides several options to seed the 305 internal PRNG. If not properly seeded, the internal PRNG will refuse 306 to deliver random bytes and a "PRNG not seeded error" will occur. 307 On systems without /dev/urandom (or similar) device, it may be necessary 308 to install additional support software to obtain random seed. 309 Please check out the manual pages for RAND_add(), RAND_bytes(), RAND_egd(), 310 and the FAQ for more information. 311 312 Note on support for multiple builds 313 ----------------------------------- 314 315 OpenSSL is usually built in it's source tree. Unfortunately, this doesn't 316 support building for multiple platforms from the same source tree very well. 317 It is however possible to build in a separate tree through the use of lots 318 of symbolic links, which should be prepared like this: 319 320 mkdir -p objtree/"`uname -s`-`uname -r`-`uname -m`" 321 cd objtree/"`uname -s`-`uname -r`-`uname -m`" 322 (cd $OPENSSL_SOURCE; find . -type f) | while read F; do 323 mkdir -p `dirname $F` 324 rm -f $F; ln -s $OPENSSL_SOURCE/$F $F 325 echo $F '->' $OPENSSL_SOURCE/$F 326 done 327 make -f Makefile.org clean 328 329 OPENSSL_SOURCE is an environment variable that contains the absolute (this 330 is important!) path to the OpenSSL source tree. 331 332 Also, operations like 'make update' should still be made in the source tree. 333