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