~trond-norbye/narada/main

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
Narada Installation

Welcome to the Narada Installation. 

This installation document will attempt to explain how to install Narada.

Prequisites:

* MySQL 5.0 and above
* Gearman
* MySQL Gearman User Defined Functions
* Sphinx 0.9.9
* Memcached 1.2.8
* Perl 5.8
* Apache 2.2
* mod_perl 2.0
* Various Perl Modules:
	DBI
	DBD::mysql
	Apache2::Request 
	Template	  
	Digest::MD5	  
	JSON::XS	  
	Sphinx::Search   
	CGI		  
	DBIx::Password   
	Cache::Memcached::libmemcached
	Storable
	Mail::Sendmail
	Email::Valid
	HTML::Entities
	File::Slurp
	HTML::Strip

This is not a simple package to install, with all the pre-requisites. 
It is, however, worth the effort to use, and I will b improving this 
to be as simple as possible. It's my intent to revive use of Perl for
web development. How to make that happen, I will gladly take your suggestions!

Ubuntu Prerequisite Packages:
--------------------------------------------------
# you can cut and paste here

# mysql server - if you aren't installing MySQL by source
apt-get install mysql mysql-server mysql-common 

# mysql client, needed for DBD::mysql
apt-get install mysql-client libmysqlclient15-dev

# apache 
apt-get install apache2 apache2-mpm-event libapr1-dev libapache2-mod-perl2 libapache-dbi-perl libapreq2

# perl modules
apt-get install libdbd-mysql-perl libemail-valid-perl libtemplate-perl libfile-policy-perl libjson-xs-perl libmail-sendmail-perl libmail-sendmail-perl libapache2-request-perl libdbix-password-perl libpath-class-perl libevent1 libevent-dev libyaml-perl libcache-memcached-perl libgearman-client-perl 

# for building 
apt-get install build-essential automake autoconf g++ m4 et install libtool libncurses5-dev byacc bison pkg-config

cpan -i HTML::Strip
cpan -i Cache::Memcached::libmemcached
cpan -i Sphinx::Search
cpan -i Gearman::Client
cpan -i Gearman::Worker

# enable apreq
a2enmod apreq

# -- not required, but nice to have --
apt-get install curl libwww-curl-perl 

RedHat Prerequisite Packages:
--------------------------------------------------

yum -y install yum yum-fastestmirror
yum -y install glibc glibc-common binutils coreutils tzdata \
  gcc gcc-c++ bison glibc-headers glibc-devel \
  libtool autoconf automake m4 make \
  openssl openssl-devel zlib zlib-devel libxml2 libxml2-devel curl curl-devel libevent libevent-devel \
  emacs-nox screen \
  perl cpan libwww-perl \
  httpd mod_perl mod_perl-devel libapreq2 libapreq2-devel perl-libapreq2 \
  mysql mysql-server mysql-devel \
  bzr bzrtools hg

CPAN Modules:

cpan CPAN YAML
cpan Apache::DBI AppConfig Cache::Memcached::libmemcached DBIx::Password \
 Memcached::libmemcached Digest::MD5 Digest::SHA1 Email::Valid Encode File::SearchPath File::Slurp \
 Gearman::Client Gearman::Task Gearman::Worker Getopt::Long HTML::Parser HTML::Strip JSON::XS \
 Mail::Sendmail Mail::Util Path::Class Sphinx::Search Task::Weaken Template Test::Pod Date::Format

# Install sphinx
wget http://www.sphinxsearch.com/downloads/sphinx-0.9.9-rc2.tar.gz
sudo groupadd sphinx
sudo useradd -d /usr/local/sphinx -g sphinx -s /bin/bash -m sphinx
cd sphinx-0.9.9-rc2
./configure --prefix=/usr/local/sphinx
make
make install

# Install memcached
tar xvzf memcached-1.2.8.tar.gz
cd memcached-1.2.8/
./configure --prefix=/usr/local

# install libmemcached
http://download.tangent.org/libmemcached-0.28.tar.gz
tar xvzf libmemcached-0.28.tar.gz
cd libmemcached-0.28/
./configure
make
sudo make install

# install Cache::Memcached::libmemcached
cpan -i Cache::Memcached::libmemcached

# install Gearman
wget http://launchpad.net/gearmand/trunk/0.5/+download/gearmand-0.5.tar.gz
tar xvzf gearmand-0.5.tar.gz 
cd gearmand-0.5/
./configure 
make
sudo make install

# install Gearman UDFs
wget http://launchpad.net/gearman-mysql-udf/trunk/0.3/+download/gearman-mysql-udf-0.3.tar.gz
tar xvzf gearman-mysql-udf-0.3.tar.gz 
./configure --with-mysql=/usr/bin/mysql_config --libdir=/usr/lib/mysql
make
sudo make install

== Set up Database privileges ==

* create Narada Schema
mysql> create database narada;
mysql> grant all privileges on narada.* to 'narada'@'localhost' identified by 'narad@';

* Now, make sure to add a narada "virtual" user to your Password.pm file, wherever that was 
installed. When you install DBIx::Password manually, you are prompted to enter the account
info to MySQL for that virtual user. However, if you installed via a yum or debian ubuntu 
package, you will need to edit 

patg@ishvara:~/narada$ locate Password.pm
/usr/share/perl5/DBIx/Password.pm

vi /usr/share/perl5/DBIx/Password.pm

And add the contents, edited to your password from the file:

perl-lib/Password.pm.fragment

You will see:

      'narada' => {
                         'username' => 'narada',
                         'password' => 'yourpassword',
                         'port' => '',
                         'database' => 'narada',
                         'attributes' => {},
                         'connect' => 'DBI:mysql:database=narada;host=localhost',
                         'driver' => 'mysql',
                         'host' => 'localhost'
                       },

Just change the password to whatever password you chose when you created
the narada user.

== Copy templates ==
You will need to copy the templates to wherever you would like to have them
located. Don't put them in the document root of your webserver (this may change)

mkdir /var/www/templates
cp -a templates/* /var/www/templates

== Copy javascript and css dirs ==

cp -a javascript <your document root>/
cp -a css <your document root>/