]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - INSTALL
Merge commit 'refs/merge-requests/169' of git://gitorious.org/statusnet/mainline...
[quix0rs-gnu-social.git] / INSTALL
1 Prerequisites
2 =============
3
4 The following software packages are *required* for this software to
5 run correctly.
6
7 - PHP 5.2.3+. It may be possible to run this software on earlier
8   versions of PHP, but many of the functions used are only available
9   in PHP 5.2 or above. 5.2.6 or later is needed for XMPP background
10   daemons on 64-bit platforms. PHP 5.3.x should work correctly in this
11   release, but problems with some plugins are possible.
12 - MySQL 5.x. The StatusNet database is stored, by default, in a MySQL
13   server. It has been primarily tested on 5.x servers, although it may
14   be possible to install on earlier (or later!) versions. The server
15   *must* support the MyISAM storage engine -- the default for most
16   MySQL servers -- *and* the InnoDB storage engine.
17 - A Web server. Preferably, you should have Apache 2.2.x with the
18   mod_rewrite extension installed and enabled.
19
20 Your PHP installation must include the following PHP extensions:
21
22 - Curl. This is for fetching files by HTTP.
23 - XMLWriter. This is for formatting XML and HTML output.
24 - MySQL. For accessing the database.
25 - GD. For scaling down avatar images.
26 - mbstring. For handling Unicode (UTF-8) encoded strings.
27
28 For some functionality, you will also need the following extensions:
29
30 - Memcache. A client for the memcached server, which caches database
31   information in volatile memory. This is important for adequate
32   performance on high-traffic sites. You will also need a memcached
33   server to store the data in.
34 - Mailparse. Efficient parsing of email requires this extension.
35   Submission by email or SMS-over-email uses this extension.
36 - Sphinx Search. A client for the sphinx server, an alternative
37   to MySQL or Postgresql fulltext search. You will also need a
38   Sphinx server to serve the search queries.
39 - bcmath or gmp. For Salmon signatures (part of OStatus). Needed
40   if you have OStatus configured.
41 - gettext. For multiple languages. Default on many PHP installs;
42   will be emulated if not present.
43
44 You will almost definitely get 2-3 times better performance from your
45 site if you install a PHP bytecode cache/accelerator. Some well-known
46 examples are: eaccelerator, Turck mmcache, xcache, apc. Zend Optimizer
47 is a proprietary accelerator installed on some hosting sites.
48
49 External libraries
50 ------------------
51
52 A number of external PHP libraries are used to provide basic
53 functionality and optional functionality for your system. For your
54 convenience, they are available in the "extlib" directory of this
55 package, and you do not have to download and install them. However,
56 you may want to keep them up-to-date with the latest upstream version,
57 and the URLs are listed here for your convenience.
58
59 - DB_DataObject http://pear.php.net/package/DB_DataObject
60 - Validate http://pear.php.net/package/Validate
61 - OpenID from OpenIDEnabled (not the PEAR version!). We decided
62   to use the openidenabled.com version since it's more widely
63   implemented, and seems to be better supported.
64   http://openidenabled.com/php-openid/
65 - PEAR DB. Although this is an older data access system (new
66   packages should probably use PHP DBO), the OpenID libraries
67   depend on PEAR DB so we use it here, too. DB_DataObject can
68   also use PEAR MDB2, which may give you better performance
69   but won't work with OpenID.
70   http://pear.php.net/package/DB
71 - OAuth.php from http://oauth.googlecode.com/svn/code/php/
72 - markdown.php from http://michelf.com/projects/php-markdown/
73 - PEAR Mail, for sending out mail notifications
74   http://pear.php.net/package/Mail
75 - PEAR Net_SMTP, if you use the SMTP factory for notifications
76   http://pear.php.net/package/Net_SMTP
77 - PEAR Net_Socket, if you use the SMTP factory for notifications
78   http://pear.php.net/package/Net_Socket
79 - XMPPHP, the follow-up to Class.Jabber.php. Probably the best XMPP
80   library available for PHP. http://xmpphp.googlecode.com/. Note that
81   as of this writing the version of this library that is available in
82   the extlib directory is *significantly different* from the upstream
83   version (patches have been submitted). Upgrading to the upstream
84   version may render your StatusNet site unable to send or receive XMPP
85   messages.
86 - Facebook library. Used for the Facebook application.
87 - PEAR Validate is used for URL and email validation.
88 - Console_GetOpt for parsing command-line options.
89   predecessor to OStatus.
90 - HTTP_Request2, a library for making HTTP requests.
91 - PEAR Net_URL2 is an HTTP_Request2 dependency.
92
93 A design goal of StatusNet is that the basic Web functionality should
94 work on even the most restrictive commercial hosting services.
95 However, additional functionality, such as receiving messages by
96 Jabber/GTalk, require that you be able to run long-running processes
97 on your account. In addition, posting by email or from SMS require
98 that you be able to install a mail filter in your mail server.
99
100 Installation
101 ============
102
103 Installing the basic StatusNet Web component is relatively easy,
104 especially if you've previously installed PHP/MySQL packages.
105
106 1. Unpack the tarball you downloaded on your Web server. Usually a
107    command like this will work:
108
109        tar zxf statusnet-1.0.0rc1.tar.gz
110
111    ...which will make a statusnet-1.0.0rc1 subdirectory in your current
112    directory. (If you don't have shell access on your Web server, you
113    may have to unpack the tarball on your local computer and FTP the
114    files to the server.)
115
116 2. Move the tarball to a directory of your choosing in your Web root
117    directory. Usually something like this will work:
118
119        mv statusnet-1.0.0rc1 /var/www/statusnet
120
121    This will make your StatusNet instance available in the statusnet path of
122    your server, like "http://example.net/statusnet". "microblog" or
123    "statusnet" might also be good path names. If you know how to
124    configure virtual hosts on your web server, you can try setting up
125    "http://micro.example.net/" or the like.
126
127 3. Make your target directory writeable by the Web server.
128
129        chmod a+w /var/www/statusnet/
130
131    On some systems, this will probably work:
132
133        chgrp www-data /var/www/statusnet/
134        chmod g+w /var/www/statusnet/
135
136    If your Web server runs as another user besides "www-data", try
137    that user's default group instead. As a last resort, you can create
138    a new group like "statusnet" and add the Web server's user to the group.
139
140 4. You should also take this moment to make your avatar, background, and
141    file subdirectories writeable by the Web server. An insecure way to do
142    this is:
143
144        chmod a+w /var/www/statusnet/avatar
145        chmod a+w /var/www/statusnet/background
146        chmod a+w /var/www/statusnet/file
147
148    You can also make the avatar, background, and file directories
149    writeable by the Web server group, as noted above.
150
151 5. Create a database to hold your microblog data. Something like this
152    should work:
153
154        mysqladmin -u "username" --password="password" create statusnet
155
156    Note that StatusNet must have its own database; you can't share the
157    database with another program. You can name it whatever you want,
158    though.
159
160    (If you don't have shell access to your server, you may need to use
161    a tool like PHPAdmin to create a database. Check your hosting
162    service's documentation for how to create a new MySQL database.)
163
164 6. Create a new database account that StatusNet will use to access the
165    database. If you have shell access, this will probably work from the
166    MySQL shell:
167
168        GRANT ALL on statusnet.*
169        TO 'statusnetuser'@'localhost'
170        IDENTIFIED BY 'statusnetpassword';
171
172    You should change 'statusnetuser' and 'statusnetpassword' to your preferred new
173    username and password. You may want to test logging in to MySQL as
174    this new user.
175
176 7. In a browser, navigate to the StatusNet install script; something like:
177
178        http://yourserver.example.com/statusnet/install.php
179
180    Enter the database connection information and your site name. The
181    install program will configure your site and install the initial,
182    almost-empty database.
183
184 8. You should now be able to navigate to your microblog's main directory
185    and see the "Public Timeline", which will be empty. If not, magic
186    has happened! You can now register a new user, post some notices,
187    edit your profile, etc. However, you may want to wait to do that stuff
188    if you think you can set up "fancy URLs" (see below), since some
189    URLs are stored in the database.
190
191 Fancy URLs
192 ----------
193
194 By default, StatusNet will use URLs that include the main PHP program's
195 name in them. For example, a user's home profile might be
196 found at:
197
198     http://example.org/statusnet/index.php/statusnet/fred
199
200 On certain systems that don't support this kind of syntax, they'll
201 look like this:
202
203     http://example.org/statusnet/index.php?p=statusnet/fred
204
205 It's possible to configure the software so it looks like this instead:
206
207     http://example.org/statusnet/fred
208
209 These "fancy URLs" are more readable and memorable for users. To use
210 fancy URLs, you must either have Apache 2.x with .htaccess enabled and
211 mod_rewrite enabled, -OR- know how to configure "url redirection" in
212 your server.
213
214 1. Copy the htaccess.sample file to .htaccess in your StatusNet
215    directory. Note: if you have control of your server's httpd.conf or
216    similar configuration files, it can greatly improve performance to
217    import the .htaccess file into your conf file instead. If you're
218    not sure how to do it, you may save yourself a lot of headache by
219    just leaving the .htaccess file.
220
221 2. Change the "RewriteBase" in the new .htaccess file to be the URL path
222    to your StatusNet installation on your server. Typically this will
223    be the path to your StatusNet directory relative to your Web root.
224
225 3. Add or uncomment or change a line in your config.php file so it says:
226
227        $config['site']['fancy'] = true;
228
229 You should now be able to navigate to a "fancy" URL on your server,
230 like:
231
232     http://example.net/statusnet/main/register
233
234 If you changed your HTTP server configuration, you may need to restart
235 the server first.
236
237 If it doesn't work, double-check that AllowOverride for the StatusNet
238 directory is 'All' in your Apache configuration file. This is usually
239 /etc/httpd.conf, /etc/apache/httpd.conf, or (on Debian and Ubuntu)
240 /etc/apache2/sites-available/default. See the Apache documentation for
241 .htaccess files for more details:
242
243     http://httpd.apache.org/docs/2.2/howto/htaccess.html
244
245 Also, check that mod_rewrite is installed and enabled:
246
247     http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
248
249 Sphinx
250 ------
251
252 To use a Sphinx server to search users and notices, you'll need to
253 enable the SphinxSearch plugin. Add to your config.php:
254
255     addPlugin('SphinxSearch');
256     $config['sphinx']['server'] = 'searchhost.local';
257
258 You also need to install, compile and enable the sphinx pecl extension for
259 php on the client side, which itself depends on the sphinx development files.
260
261 See plugins/SphinxSearch/README for more details and server setup.
262
263 SMS
264 ---
265
266 StatusNet supports a cheap-and-dirty system for sending update messages
267 to mobile phones and for receiving updates from the mobile. Instead of
268 sending through the SMS network itself, which is costly and requires
269 buy-in from the wireless carriers, it simply piggybacks on the email
270 gateways that many carriers provide to their customers. So, SMS
271 configuration is essentially email configuration.
272
273 Each user sends to a made-up email address, which they keep a secret.
274 Incoming email that is "From" the user's SMS email address, and "To"
275 the users' secret email address on the site's domain, will be
276 converted to a notice and stored in the DB.
277
278 For this to work, there *must* be a domain or sub-domain for which all
279 (or most) incoming email can pass through the incoming mail filter.
280
281 1. Run the SQL script carrier.sql in your StatusNet database. This will
282    usually work:
283
284        mysql -u "statusnetuser" --password="statusnetpassword" statusnet < db/carrier.sql
285
286    This will populate your database with a list of wireless carriers
287    that support email SMS gateways.
288
289 2. Make sure the maildaemon.php file is executable:
290
291        chmod +x scripts/maildaemon.php
292
293    Note that "daemon" is kind of a misnomer here; the script is more
294    of a filter than a daemon.
295
296 2. Edit /etc/aliases on your mail server and add the following line:
297
298        *: /path/to/statusnet/scripts/maildaemon.php
299
300 3. Run whatever code you need to to update your aliases database. For
301    many mail servers (Postfix, Exim, Sendmail), this should work:
302
303        newaliases
304
305    You may need to restart your mail server for the new database to
306    take effect.
307
308 4. Set the following in your config.php file:
309
310        $config['mail']['domain'] = 'yourdomain.example.net';
311
312 At this point, post-by-email and post-by-SMS-gateway should work. Note
313 that if your mail server is on a different computer from your email
314 server, you'll need to have a full installation of StatusNet, a working
315 config.php, and access to the StatusNet database from the mail server.
316
317 XMPP
318 ----
319
320 XMPP (eXtended Message and Presence Protocol, <http://xmpp.org/>) is the
321 instant-messenger protocol that drives Jabber and GTalk IM. You can
322 distribute messages via XMPP using the system below; however, you
323 need to run the XMPP incoming daemon to allow incoming messages as
324 well.
325
326 1. You may want to strongly consider setting up your own XMPP server.
327    Ejabberd, OpenFire, and JabberD are all Open Source servers.
328    Jabber, Inc. provides a high-performance commercial server.
329
330 2. You must register a Jabber ID (JID) with your new server. It helps
331    to choose a name like "update@example.com" or "notice" or something
332    similar.  Alternately, your "update JID" can be registered on a
333    publicly-available XMPP service, like jabber.org or GTalk.
334
335    StatusNet will not register the JID with your chosen XMPP server;
336    you need to do this manually, with an XMPP client like Gajim,
337    Telepathy, or Pidgin.im.
338
339 3. Configure your site's XMPP variables, as described below in the
340    configuration section.
341
342 On a default installation, your site can broadcast messages using
343 XMPP. Users won't be able to post messages using XMPP unless you've
344 got the XMPP daemon running.  See 'Queues and daemons' below for how
345 to set that up. Also, once you have a sizable number of users, sending
346 a lot of SMS, OStatus, and XMPP messages whenever someone posts a message
347 can really slow down your site; it may cause posting to timeout.
348
349 NOTE: stream_select(), a crucial function for network programming, is
350 broken on PHP 5.2.x less than 5.2.6 on amd64-based servers. We don't
351 work around this bug in StatusNet; current recommendation is to move
352 off of amd64 to another server.
353
354 Public feed
355 -----------
356
357 You can send *all* messages from your social networking site to a
358 third-party service using XMPP. This can be useful for providing
359 search, indexing, bridging, or other cool services.
360
361 To configure a downstream site to receive your public stream, add
362 their "JID" (Jabber ID) to your config.php as follows:
363
364     $config['xmpp']['public'][] = 'downstream@example.net';
365
366 (Don't miss those square brackets at the end.) Note that your XMPP
367 broadcasting must be configured as mentioned above. Although you can
368 send out messages at "Web time", high-volume sites should strongly
369 consider setting up queues and daemons.
370
371 Queues and daemons
372 ------------------
373
374 Some activities that StatusNet needs to do, like broadcast OStatus, SMS,
375 and XMPP messages, can be 'queued' and done by off-line bots instead.
376 For this to work, you must be able to run long-running offline
377 processes, either on your main Web server or on another server you
378 control. (Your other server will still need all the above
379 prerequisites, with the exception of Apache.) Installing on a separate
380 server is probably a good idea for high-volume sites.
381
382 1. You'll need the "CLI" (command-line interface) version of PHP
383    installed on whatever server you use.
384
385 2. If you're using a separate server for queues, install StatusNet
386    somewhere on the server. You don't need to worry about the
387    .htaccess file, but make sure that your config.php file is close
388    to, or identical to, your Web server's version.
389
390 3. In your config.php files (both the Web server and the queues
391    server!), set the following variable:
392
393        $config['queue']['enabled'] = true;
394
395    You may also want to look at the 'daemon' section of this file for
396    more daemon options. Note that if you set the 'user' and/or 'group'
397    options, you'll need to create that user and/or group by hand.
398    They're not created automatically.
399
400 4. On the queues server, run the command scripts/startdaemons.sh.
401
402 This will run the queue handlers:
403
404 * queuedaemon.php - polls for queued items for inbox processing and
405   pushing out to OStatus, SMS, XMPP, etc.
406 * xmppdaemon.php - listens for new XMPP messages from users and stores
407   them as notices in the database; also pulls queued XMPP output from
408   queuedaemon.php to push out to clients.
409
410 These two daemons will automatically restart in most cases of failure
411 including memory leaks (if a memory_limit is set), but may still die
412 or behave oddly if they lose connections to the XMPP or queue servers.
413
414 Additional daemons may be also started by this script for certain
415 plugins, such as the Twitter bridge.
416
417 It may be a good idea to use a daemon-monitoring service, like 'monit',
418 to check their status and keep them running.
419
420 All the daemons write their process IDs (pids) to /var/run/ by
421 default. This can be useful for starting, stopping, and monitoring the
422 daemons.
423
424 Since version 0.8.0, it's now possible to use a STOMP server instead of
425 our kind of hacky home-grown DB-based queue solution. This is strongly
426 recommended for best response time, especially when using XMPP.
427
428 See the "queues" config section below for how to configure to use STOMP.
429 As of this writing, the software has been tested with ActiveMQ 5.3.
430
431 Themes
432 ------
433
434 Older themes (version 0.9.x and below) no longer work with StatusNet
435 1.0.x, due to major changes in the site layout. We ship with three new
436 themes for this version, 'neo', 'neo-blue' and 'neo-light'.
437
438 As of right now, your ability to change the theme is site-wide; users
439 can't choose their own theme. Additionally, the only thing you can
440 change in the theme is CSS stylesheets and some image files; you can't
441 change the HTML output, like adding or removing menu items.
442
443 You can choose a theme using the $config['site']['theme'] element in
444 the config.php file. See below for details.
445
446 You can add your own theme by making a sub-directory of the 'theme'
447 subdirectory with the name of your theme. Each theme can have the
448 following files:
449
450 display.css: a CSS2 file for "default" styling for all browsers.
451 ie6.css: a CSS2 file for override styling for fixing up Internet
452     Explorer 6.
453 ie7.css: a CSS2 file for override styling for fixing up Internet
454     Explorer 7.
455 logo.png: a logo image for the site.
456 default-avatar-profile.png: a 96x96 pixel image to use as the avatar for
457     users who don't upload their own.
458 default-avatar-stream.png: Ditto, but 48x48. For streams of notices.
459 default-avatar-mini.png: Ditto ditto, but 24x24. For subscriptions
460     listing on profile pages.
461
462 You may want to start by copying the files from the default theme to
463 your own directory.
464
465 Translation
466 -----------
467
468 Translations in StatusNet use the gettext system <http://www.gnu.org/software/gettext/>.
469 Theoretically, you can add your own sub-directory to the locale/
470 subdirectory to add a new language to your system. You'll need to
471 compile the ".po" files into ".mo" files, however.
472
473 Contributions of translation information to StatusNet are very easy:
474 you can use the Web interface at translatewiki.net to add one
475 or a few or lots of new translations -- or even new languages. You can
476 also download more up-to-date .po files there, if you so desire.
477
478 For info on helping with translations, see http://status.net/wiki/Translations
479
480 Backups
481 -------
482
483 There is no built-in system for doing backups in StatusNet. You can make
484 backups of a working StatusNet system by backing up the database and
485 the Web directory. To backup the database use mysqldump <http://ur1.ca/7xo>
486 and to backup the Web directory, try tar.
487
488 Private
489 -------
490
491 The administrator can set the "private" flag for a site so that it's
492 not visible to non-logged-in users. (This is the default for new installs of version 1.0!)
493
494 This might be useful for workgroups who want to share a social
495 networking site for project management, but host it on a public
496 server.
497
498 Total privacy is attempted but not guaranteed or ensured. Private sites
499 currently don't work well with OStatus federation.
500
501 Access to file attachments can also be restricted to logged-in users only.
502
503 1. Add a directory outside the web root where your file uploads will be
504    stored. Usually a command like this will work:
505
506        mkdir /var/www/statusnet-files
507
508 2. Make the file uploads directory writeable by the web server. An
509    insecure way to do this is:
510
511        chmod a+x /var/www/statusnet-files
512
513 3. Tell StatusNet to use this directory for file uploads. Add a line
514    like this to your config.php:
515
516        $config['attachments']['dir'] = '/var/www/statusnet-files';