INSTALL.html 15 KB

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