INSTALL 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. Wt Installation instructions on Unix-like systems
  2. This page lists the instructions for building and installing Wt. It is
  3. organized in 3 sections:
  4. * [1]Requirements
  5. * [2]Building and installing the library
  6. * [3]Trying the examples (or your own Wt application)
  7. Requirements
  8. The library provides two ways for deploying applications: either using
  9. the FastCGI protocol, in conjunction with a webserver (like apache), or
  10. using a built-in web server (wthttpd). You only need one of these, but
  11. you can have both of them.
  12. The built-in web server is more convenient during development and is
  13. easier to setup. It also allows you to use WebSockets.
  14. The FastCGI based solution can be more convenient for deployment behind
  15. another web server.
  16. Each of these two choices correspond to a library, a so-called
  17. connector library. Below it is outlined how to configure the build
  18. process of Wt to build either or both libraries (libwthttp and
  19. libfcgi).
  20. Thus, to build a Wt library with built-in web server you need to link
  21. against libwt and libwthttp. To build a Wt library which acts as a
  22. FastCGI process, you need to link against libwt and libfcgi.
  23. 1 Wt requirements
  24. * Compiler: gcc-3.3.4 or higher, or gcc-4.1.x or higher, or other
  25. Ansi C++ compiler that can deal with boost-like C++ code.
  26. * [4]CMake cross-platform build system:
  27. Preferably CMake 2.6, which comes with a usable script for finding
  28. boost libraries, but CMake 2.4 is still supported using Wt's own
  29. boost find script.
  30. * [5]C++ boost library (preferably version 1.46.1 or higher), with or
  31. without thread support. You can verify you have a thread-enabled
  32. boost installation by locating the libboost_thread library. Thread
  33. support is not essential: Wt functionality is not affected except
  34. for exotic things like server push and reentrant event loops. Most
  35. importantly, even without thread support Wt can handle multiple
  36. concurrent sessions.
  37. Older versions of boost, up until 1.36 are also supported, but some
  38. features will be disabled that depend on the revised versions of
  39. spirit, namely JSON parsing and improved SQL parsing (for Wt::Dbo).
  40. * Optionally, [6]OpenSSL, which is used to support the HTTPS protocol
  41. in the web client, and the HTTPS protocol in the built-in wthttpd
  42. connector.
  43. * Optionally, [7]Haru Free PDF Library, which is used to provide
  44. support for painting to PDF (WPdfImage).
  45. * Optionally, [8]GraphicsMagick, for supporting painting to raster
  46. images (PNG, GIF, ...) (WRasterImage).
  47. * Optionally, [9]PostgreSQL, for the PostgreSQL backend for Wt::Dbo
  48. (Dbo::backend::Postgres).
  49. * Optionally, [10]Firebird, for the Firebird backend for Wt::Dbo
  50. (Dbo::backend::Firebird).
  51. * Optionally, [11]Pango, for improved font support in the WPdfImage
  52. and WRasterImage paint devices.
  53. 1a Using FastCGI
  54. When using FastCGI, Wt requires a webserver (like apache, lighttpd or
  55. nginx) which supports the FastCGI protocol.
  56. Given that Apache is still the most popular webserver, below are the
  57. requirements for apache, for other web servers the list is similar:
  58. * [12]FCGI library, including C++ bindings (libfcgi++)
  59. * A suitable plugin for your web server.
  60. 1b Using wthttpd
  61. When using the built-in webserver, two more libraries may be installed
  62. to enable optional features (you can also build without them), but
  63. otherwise no extra dependencies are required.
  64. * Optionally, zlib (libz), for compression over HTTP.
  65. * Optionally, OpenSSL (libopenssl), for HTTPS.
  66. 2 Additional and optional requirements for some of the examples
  67. * Qt, for the libwtwithqt interopability layer
  68. __________________________________________________________________
  69. Building and installing the Wt library
  70. 1. Create a build directory
  71. The recommended way to build the library is in a seperate build
  72. directory, for example within the top-level of the Wt package:
  73. $ cd wt-x.xx
  74. $ mkdir build
  75. $ cd build
  76. 2. Configure the library
  77. $ cmake ../
  78. The latter command will try to locate the necessary libraries. If
  79. everything is OK, then this should end with something like:
  80. -- Generating done
  81. -- Build files have been written to: /home/kdforc0/project/wt/build
  82. To build a multi-threaded version of Wt, which uses multiple threads
  83. for handling concurrent requests, you need a thread-enabled boost
  84. library. By default, CMake 2.6 will only search for a thread-enabled
  85. boost installation, while CMake 2.4 will fall-back to a
  86. non-multithreaded boost library, reporting:
  87. ...
  88. -- Looking for pthread_create in pthread - found
  89. ** Disabling multi threading.
  90. ...
  91. Most linux distributions provide multi-threaded boost libraries by
  92. default now.
  93. If CMake fails, because it cannot resolve all dependencies, then you
  94. may help CMake by setting some variables to help CMake locate the
  95. libraries. This may be done on the command-line using -Dvar=value or
  96. using the interactive program:
  97. $ ccmake ../
  98. or
  99. $ cmake-gui ../
  100. The GUI lists all variables that are configurable in Wt's build
  101. process. Variables that you may set to configure Wt's built-in boost
  102. finding method:
  103. BOOST_COMPILER
  104. The boost compiler signature. For a library
  105. libboost_regex-gcc41-mt-1_37.so, this is 'gcc41'
  106. BOOST_VERSION
  107. The boost compiler signature. For a library
  108. libboost_regex-gcc41-mt-1_37.so, this is '1_37'
  109. BOOST_DIR
  110. The boost installation directory. This is the directory where
  111. lib/ and include/ are located for your boost installation.
  112. Other variables specify several build and configuration aspects of Wt,
  113. of which the most relevant ones are (there are many more visible in the
  114. GUI):
  115. CMAKE_INSTALL_PREFIX
  116. Installation prefix for the library and include files)
  117. CONFIGDIR
  118. Path for configuration files (default is /etc/wt/)
  119. CONNECTOR_FCGI
  120. Build the FastCGI connector (libwtfcgi) ?
  121. CONNECTOR_HTTP
  122. Build the stand-alone httpd connector (libwthttp) ?
  123. EXAMPLES_CONNECTOR
  124. Which connector library to use for the examples? (wthttp or
  125. wtfcgi)
  126. MULTI_THREADED
  127. Build a multi-threaded wthttpd? While on by default, and
  128. recommended, you may want to disable this for example if you
  129. suspect threading problems. Note that recursive event loops
  130. (most notably when using Dialog::exec()) are not possible
  131. without thread support.
  132. The following variables apply to the FastCGI connector:
  133. RUNDIR
  134. Default location for Wt runtime session management (can be
  135. overridden in the Configuration file)
  136. WEBUSER
  137. Webserver username: used to assign permissions to RUNDIR
  138. WEBGROUP
  139. Webserver groupname: used to assign permissions to RUNDIR
  140. The following variables apply to the wthttpd connector:
  141. WTHTTP_CONFIGURATION
  142. Location of the wthttpd configuration file (default is
  143. /etc/wt/wthttpd)
  144. To change any entry, use [Enter]. To save and quit, do [c] followed by
  145. [g].
  146. 3. Build the library
  147. $ make
  148. 4. Install the library (as user with sufficient permissions):
  149. $ make install
  150. 5. Get your LD_LIBRARY_PATH ok, if needed (mostly for FastCGI).
  151. If you did not install Wt in a directory (CMAKE_INSTALL_PREFIX)
  152. included in the default linker dynamic library search path, then the
  153. web server will not be able to start Wt programs (such as the
  154. examples).
  155. Fix it by (as user with sufficient permissions):
  156. $ ln -s /your/path/to/lib/libwt.so /usr/lib
  157. $ ln -s /your/path/to/lib/libwtfcgi.so /usr/lib
  158. __________________________________________________________________
  159. Trying the examples (or your own Wt application)
  160. Deploying an application is different when using FastCGI or the
  161. built-in web server (wthttpd).
  162. The examples that come with the library use the connector specified by
  163. the build option EXAMPLES_CONNECTOR (see supra).
  164. Some examples need third-party JavaScript libraries (ExtJS or TinyMCE).
  165. * Download ExtJS from [13]http://yogurtearl.com/ext-2.0.2.zip, and
  166. install it according to these instructions:
  167. [14]http://www.webtoolkit.eu/wt/doc/reference/html/group__ext.html
  168. * Download TinyMCE from [15]http://tinymce.moxiecode.com/ and install
  169. its tiny_mce folder into the resources/ folder.
  170. You will notice 404 File not Found errors for ext/ or
  171. resources/tiny_mce/ if you are missing these JavaScript libraries.
  172. A. Using FastCGI and apache
  173. 1. Build the examples
  174. $ make -C examples
  175. 2. Deploy the example foobar
  176. The easiest way to deploy the examples is by copying the binary (from
  177. your build directory) and the source directory (which contains the
  178. images) and the resources/ into the same destination directory
  179. somewhere in your Apache server (we no longer generate a ./deploy.sh
  180. script that took care of some of this).
  181. $ export DESTINATION=/var/www/localhost/htdocs/wt-examples
  182. $ mkdir -p $DESTINATION/foobar
  183. $ cp -r examples/foobar/* resources/* build/examples/foobar/*.wt $DESTINATIO
  184. N/foobar/
  185. This does however make public also files (such as message resources
  186. bundles, data files, etc...) that do not need to be served by your web
  187. server. The clean way to deploy your own applications is to use the
  188. "approot" property to deploy those files to a directory outside the
  189. webserver's doc root.
  190. 3. Configure Apache
  191. Treat the example as a mod_fastcgi application, by adding a line to
  192. 20_mod_fastcgi.conf in your Apache configuration modules.d/ directory,
  193. e.g.:
  194. FastCgiServer /var/www/localhost/htdocs/wt-examples/composer/composer.wt
  195. 4. Restart apache
  196. B. Using wthttpd
  197. 1. Build the examples
  198. $ make -C examples
  199. 2. Running an example
  200. Most examples use additional files, such as message resource bundles,
  201. which are not indicated with absolute path names. Therefore the working
  202. directory should be the source directory for the example. A similar
  203. argument goes for icons and the setting of the --docroot variable.
  204. Since Wt 3.1.4, you can use the "approot" property to move the
  205. additional files that should not be available to browsers outside of
  206. the docroot.
  207. $ cd ../examples/foobar # source directory for example foobar
  208. $ ln -s ../../resources . # include standard Wt resource files
  209. $ ../../build/examples/foobar/foobar.wt --docroot . --http-address 0.0.0.0 -
  210. -http-port 8080
  211. This will start a httpd server listening on all local interfaces, on
  212. port 8080, and you may browse the example at [16]http://127.0.0.1:8080/
  213. You will notice 404 File not Found errors for resources/ files if you
  214. are missing the resources files.
  215. These are all the command-line options that are available:
  216. General options:
  217. -h [ --help ] produce help message
  218. -t [ --threads ] arg (=10) number of threads
  219. --servername arg (=vierwerf) servername (IP address or DNS name)
  220. --docroot arg document root for static files
  221. --errroot arg root for error pages
  222. --accesslog arg access log file (defaults to stdout)
  223. --no-compression do not compress dynamic text/html and text/plai
  224. n responses
  225. --deploy-path arg (=/) location for deployment
  226. --session-id-prefix arg prefix for session-id's (overrides wt_config.xm
  227. l setting)
  228. -p [ --pid-file ] arg path to pid file (optional)
  229. -c [ --config ] arg location of wt_config.xml. If unspecified,
  230. WT_CONFIG_XML is searched in the environment,
  231. if it does not exist then the compiled-in
  232. default (/etc/wt/wt_config.xml) is tried. If
  233. the default does not exist, we revert to
  234. default values for all parameters.
  235. --max-request-size arg Maximum size of a HTTP request. This also
  236. limits POST requests, so this is an upper limit
  237. for file uploads. Default is 40MB.
  238. --max-memory-request-size arg Requests are usually read in memory before
  239. being processed. To avoid DOS attacks where
  240. large requests take up all RAM, use this
  241. parameter to force requests that are larger
  242. than the specified size to be spooled to disk.
  243. This will also spool file uploads to disk.
  244. --gdb do not shutdown when receiving Ctrl-C (and let
  245. gdb break instead)
  246. HTTP server options:
  247. --http-address arg IPv4 (e.g. 0.0.0.0) or IPv6 Address (e.g. 0::0)
  248. --http-port arg (=80) HTTP port (e.g. 80)
  249. HTTPS server options:
  250. --https-address arg IPv4 (e.g. 0.0.0.0) or IPv6 Address (e.g. 0::0)
  251. --https-port arg (=443) HTTPS port (e.g. 443)
  252. --ssl-certificate arg SSL server certificate chain file
  253. e.g. "/etc/ssl/certs/vsign1.pem"
  254. --ssl-private-key arg SSL server private key file
  255. e.g. "/etc/ssl/private/company.pem"
  256. --ssl-tmp-dh arg File for temporary Diffie-Hellman parameters
  257. e.g. "/etc/ssl/dh512.pem"
  258. References
  259. 1. file:///home/roel/project/wt/git/wt/INSTALL.html#requirements
  260. 2. file:///home/roel/project/wt/git/wt/INSTALL.html#build
  261. 3. file:///home/roel/project/wt/git/wt/INSTALL.html#examples
  262. 4. http://www.cmake.org/
  263. 5. http://www.boost.org/
  264. 6. http://www.openssl.org/
  265. 7. http://libharu.org/
  266. 8. http://www.graphicsmagick.org/
  267. 9. http://www.posgresql.org/
  268. 10. http://www.firebirdsql.org/
  269. 11. http://www.pango.org/
  270. 12. http://www.fastcgi.com/
  271. 13. http://yogurtearl.com/ext-2.0.2.zip
  272. 14. http://www.webtoolkit.eu/wt/doc/reference/html/group__ext.html
  273. 15. http://tinymce.moxiecode.com/
  274. 16. http://127.0.0.1:8080/