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