Project

General

Profile

Installing Wt on CentOS5 » History » Version 7

Pieter Libin, 10/29/2009 01:07 PM

1 7 Pieter Libin
h1. Installing Wt on CentOS5
2
3 6 Pieter Libin
{{toc}}
4 4 Pieter Libin
5 1 Pieter Libin
The purpose of this page is to provide information on how to install Wt on CentOS5.2. As a special note, I am installing to a XEN domU instance, however I believe any CentOS5.2 install will work the same. I was logged in as root through the duration of this install. This document was originally adapted from [[Installing Wt on Fedora Core]].
6
7
8 7 Pieter Libin
h2. Install Wt dependencies 
9 1 Pieter Libin
10
11 7 Pieter Libin
h3. Required dependencies 
12 1 Pieter Libin
13
It was not my preference to install from source, however my yum setup did not recognize some of the packages.
14
15
16 7 Pieter Libin
h4. Boost 
17 1 Pieter Libin
18
Boost is installed by hand so we can build the multi-threaded libraries. If you use 'yum install boost boost-devel' you will run into problems running some of the examples. So I recommend installing it by hand.
19
20
<pre>
21
wget http://internap.dl.sourceforge.net/sourceforge/boost/boost_1_37_0.tar.gz
22
tar zxvf boost_1_37_0.tar.gz
23
cd boost_1_37_0/
24
./configure --with-libraries=thread,regex,program_options,date_time,signals,system,filesystem
25
make install
26
</pre>
27
28
29 7 Pieter Libin
h4. CMAKE 
30 1 Pieter Libin
31
Install cmake from source
32
<pre>
33
wget http://www.cmake.org/files/v2.6/cmake-2.6.2.tar.gz
34
tar zxvf cmake-2.6.2.tar.gz
35
cd cmake-2.6.2
36
./bootstrap; make; make install
37
</pre>
38
39
40 7 Pieter Libin
h2. Building Wt 
41 1 Pieter Libin
42
<pre>
43
wget http://internap.dl.sourceforge.net/sourceforge/witty/wt-2.2.2.tar.gz
44
tar zxvf wt-2.2.2.tar.gz
45
cd wt-2.2.2
46
mkdir build
47
cd build
48
49
# make sure you substitute your version of boost and gcc into this statement
50
cmake -DBOOST_DIR=/usr/local -DBOOST_VERSION=1_37 -DBOOST_COMPILER=gcc41 ..
51
make
52
make -C examples
53
make install
54
</pre>
55
56
Wt will configure itself to use the build-in http server by default.
57
58
59 7 Pieter Libin
h2. Running the Examples provided 
60 1 Pieter Libin
61
This section covers how to run the hello example. Other examples may be run in a similar manner. Some examples may require additional dependencies to be setup.
62
63
64 7 Pieter Libin
h3. Running Hello 
65 1 Pieter Libin
66
<pre>
67
cd ../examples/hello
68
../../build/examples/hello/hello.wt --docroot . --http-address 0.0.0.0 --http-port 8080
69
</pre>
70
71
Type the following url into your web browser, substitute vm01 with localhost or the appropriate url.
72
73
http://vm01:8080/
74
75
*That's it. The rest of this document is provided for additional support. None of the steps below are required for basic Wt functionality
76
77
78 7 Pieter Libin
h2. Optional dependencies 
79
80 1 Pieter Libin
Some examples require additional dependencies to run properly.
81
82
83 7 Pieter Libin
h3. Installing GD 
84 1 Pieter Libin
85
<pre>
86
yum install gd gd-devel
87
</pre>
88
89
90 7 Pieter Libin
h3. Installing MySQL++ 
91 1 Pieter Libin
92
There has got to be a better way! This does seem to work though. I chose a source rpm so it would be built for x86_64 platform, your architecture may be named differently.
93
94
Install mysql development libraries
95
<pre>
96
yum install mysql-devel
97
</pre>
98
99
Build a binary rpm from source so it is specific for my platform
100
<pre>
101
rpmbuild --rebuild http://tangentsoft.net/mysql++/releases/mysql++-3.0.8-1.src.rpm
102
</pre>
103
104
Install the rpms. Note you may have to substitute <B>x86_64</B> for your platform
105
<pre>
106
cd /usr/src/redhat/RPMS/x86_64
107
rpm -i mysql++-3.0.8-1.x86_64.rpm
108
rpm -i mysql++-debuginfo-3.0.8-1.x86_64.rpm
109
rpm -i mysql++-devel-3.0.8-1.x86_64.rpm
110
rpm -i mysql++-manuals-3.0.8-1.x86_64.rpm
111
</pre>
112
113
114 7 Pieter Libin
h2. Deployment with FastCGI 
115 1 Pieter Libin
116
See Deployment with FastCGI in page [[Installing Wt on Gentoo]]
117
118
119 7 Pieter Libin
h2. Other Wt Examples 
120 1 Pieter Libin
121
122 7 Pieter Libin
h3. Hangman 
123 1 Pieter Libin
124
Hangman is a bit more difficult to run. 
125
* Install the Mysql++ dependency
126
127
* Fix 'Result' compile error in hangman/HangmanDb.C
128
<pre>
129
     MySql++ type <B>Result</B> was renamed to <B>StoreQueryResult</B>.
130
     Replace all instances of 'Result' with 'StoreQueryResult'
131
</pre>
132
133
* Rebuild Wt examples
134
135
* Make sure MySQL is running
136
<pre>
137
service mysqld start
138
</pre>
139
140
* Create the default hangman schema
141
<pre>
142
mysql < dbscript
143
</pre>
144
145
* Run hangman
146
<pre>
147
cd ../examples/hangman
148
../../build/examples/hangman/hangman.wt --docroot . --http-address 0.0.0.0 --http-port 8080
149
</pre>
150
151
152 7 Pieter Libin
h3. Filetreetable 
153 1 Pieter Libin
154
<pre>
155
cd ../examples/filetreetable
156
../../build/examples/filetreetable/filetreetable.wt --docroot . --http-address 0.0.0.0 --http-port 8080
157
</pre>
158
159
160 7 Pieter Libin
h2. Trouble shooting 
161 1 Pieter Libin
162
163 7 Pieter Libin
h3. Opening up port 8080 
164 1 Pieter Libin
165
This is not requirement if you are view the examples from localhost.
166
167
If you get an error message like:
168
<pre>
169
Failed to Connect
170
171
Firefox can't establish a connection to the server at vm01:8080.    
172
173
Though the site seems valid, the browser was unable to establish a connection.
174
</pre>
175
176
This message may mean you need to open up port 8080. If you wish to access port 8080 remotely then add the following rule to file <B>/etc/sysconfig/iptables</B>
177
<pre>
178
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
179
</pre>
180
181
Restart iptables for the change to take effect.
182
<pre>
183
/etc/init.d/iptables restart
184
</pre>