7 - Getting it up and running
19 * Additional configuration
27 The following software packages are *required* for this software to
30 - PHP 7+ PHP7.x is also supported.
31 - MariaDB 5+ MariaDB 10.x is also supported.
32 - Web server Apache, lighttpd and nginx will all work. CGI mode is
33 recommended and also some variant of 'suexec' (or a
34 proper setup php-fpm pool)
35 NOTE: mod_rewrite or its equivalent is extremely useful.
37 Your PHP installation must include the following PHP extensions for a
38 functional setup of GNU social:
40 - openssl (compiled in for Debian, enabled manually in Arch Linux)
41 - php-curl Fetching files by HTTP.
42 - php-exif Exchangeable image information.
43 - php-gd Image manipulation (scaling).
44 - php-intl Internationalization support (transliteration et al).
45 - php-json For WebFinger lookups and more.
46 - php-mbstring String manipulation
47 - php-mysql The native driver for MariaDB connections.
48 - php-gmp For Salmon signatures (part of OStatus)
49 - php-bcmath Arbitrary Precision Mathematics
50 - php-opcache Improved PHP performance by precompilation
51 - php-readline For interactive scripts
53 - php-ds Faster data structures
55 NOTE: Some distros require manual enabling in the relevant php.ini for some modules.
60 For some functionality, you will also need the following extensions:
62 - opcache Improves performance a _lot_. Included in PHP, must be
63 enabled manually in php.ini for most distributions. Find
64 and set at least: opcache.enable=1
65 - mailparse Efficient parsing of email requires this extension.
66 Submission by email or SMS-over-email uses this.
67 - sphinx A client for the sphinx server, an alternative to MySQL
68 or Postgresql fulltext search. You will also need a
69 Sphinx server to serve the search queries.
70 - gettext For multiple languages. Default on many PHP installs;
71 will be emulated if not present.
72 - exif For thumbnails to be properly oriented.
73 - php-ds For faster data structures; will be emulated if not present.
75 You may also experience better performance from your site if you configure
76 a PHP cache/accelerator. Most distributions come with "opcache" support.
77 Enable it in your php.ini where it is documented together with its settings.
82 Getting it up and running
83 -------------------------
85 Installing the basic GNU Social web component is relatively easy,
86 especially if you've previously installed PHP/MariaDB packages.
88 1. Unpack the tarball you downloaded on your Web server. Usually a
89 command like this will work:
91 tar zxf gnusocial-*.tar.gz
93 ...which will make a gnusocial-x.y.z subdirectory in your current
94 directory. (If you don't have shell access on your Web server, you
95 may have to unpack the tarball on your local computer and FTP the
98 2. Move the tarball to a directory of your choosing in your Web root
99 directory. Usually something like this will work:
101 mv gnusocial-x.y.z /var/www/gnusocial
103 This will often make your GNU Social instance available in the gnusocial
104 path of your server, like "http://example.net/gnusocial". "social" or
105 "blog" might also be good path names. If you know how to configure
106 virtual hosts on your web server, you can try setting up
107 "http://social.example.net/" or the like.
109 If you have "rewrite" support on your webserver, and you should,
110 then please enable this in order to make full use of your site. This
111 will enable "Fancy URL" support, which you can read more about if you
112 scroll down a bit in this document.
114 3. Make your target directory writeable by the Web server, please note
115 however that 'a+w' will give _all_ users write access and securing the
116 webserver is not within the scope of this document.
118 chmod a+w /var/www/gnusocial/
120 On some systems, this will work as a more secure alternative:
122 chgrp www-data /var/www/gnusocial/
123 chmod g+w /var/www/gnusocial/
125 If your Web server runs as another user besides "www-data", try
126 that user's default group instead. As a last resort, you can create
127 a new group like "gnusocial" and add the Web server's user to the group.
129 4. Create a database to hold your site data. Something like this
130 should work (you will be prompted for your database password):
132 mysqladmin -u "root" -p create social
134 Note that GNU Social should have its own database; you should not share
135 the database with another program. You can name it whatever you want,
138 (If you don't have shell access to your server, you may need to use
139 a tool like phpMyAdmin to create a database. Check your hosting
140 service's documentation for how to create a new MariaDB database.)
142 5. Create a new database account that GNU Social will use to access the
143 database. If you have shell access, this will probably work from the
146 GRANT ALL on social.*
147 TO 'social'@'localhost'
148 IDENTIFIED BY 'agoodpassword';
150 You should change the user identifier 'social' and 'agoodpassword'
151 to your preferred new database username and password. You may want to
152 test logging in to MariaDB as this new user.
154 6. In a browser, navigate to the GNU Social install script; something like:
156 https://social.example.net/install.php
158 Enter the database connection information and your site name. The
159 install program will configure your site and install the initial,
160 almost-empty database.
162 7. You should now be able to navigate to your social site's main directory
163 and see the "Public Timeline", which will probably be empty. You can
164 now register new user, post some notices, edit your profile, etc.
169 By default, GNU Social will use URLs that include the main PHP program's
170 name in them. For example, a user's home profile might be found at either
171 of these URLS depending on the webserver's configuration and capabilities:
173 https://social.example.net/index.php/fred
174 https://social.example.net/index.php?p=fred
176 It's possible to configure the software to use fancy URLs so it looks like
179 https://social.example.net/fred
181 These "fancy URLs" are more readable and memorable for users. To use
182 fancy URLs, you must either have Apache 2.x with .htaccess enabled and
183 mod_rewrite enabled, -OR- know how to configure "url redirection" in
184 your server (like lighttpd or nginx).
186 1. See the instructions for each respective webserver software:
187 * For Apache, inspect the "htaccess.sample" file and save it as
188 ".htaccess" after making any necessary modifications. Our sample
189 file is well commented.
190 * For lighttpd, inspect the lighttpd.conf.example file and apply the
191 appropriate changes in your virtualhost configuration for lighttpd.
192 * For nginx, inspect the nginx.conf.sample file and apply the appropriate
194 * For other webservers, we gladly accept contributions of
195 server configuration examples.
197 2. Assuming your webserver is properly configured and have its settings
198 applied (remember to reload/restart it), you can add this to your
199 GNU social's config.php file:
200 $config['site']['fancy'] = true;
202 You should now be able to navigate to a "fancy" URL on your server,
205 https://social.example.net/main/register
210 As of right now, your ability change the theme is limited to CSS
211 stylesheets and some image files; you can't change the HTML output,
212 like adding or removing menu items, without the help of a plugin.
214 You can choose a theme using the $config['site']['theme'] element in
215 the config.php file. See below for details.
217 You can add your own theme by making a sub-directory of the 'theme'
218 subdirectory with the name of your theme. Each theme can have the
221 display.css: a CSS2 file for "default" styling for all browsers.
222 logo.png: a logo image for the site.
223 default-avatar-profile.png: a 96x96 pixel image to use as the avatar for
224 users who don't upload their own.
225 default-avatar-stream.png: Ditto, but 48x48. For streams of notices.
226 default-avatar-mini.png: Ditto ditto, but 24x24. For subscriptions
227 listing on profile pages.
229 You may want to start by copying the files from the default theme to
235 A GNU social node can be configured as "private", which means it will not
236 federate with other nodes in the network. It is not a recommended method
237 of using GNU social and we cannot at the current state of development
238 guarantee that there are no leaks (what a public network sees as features,
239 private sites will likely see as bugs).
241 Private nodes are however an easy way to easily setup collaboration and
242 image sharing within a workgroup or a smaller community where federation
243 is not a desired feature. Also, it is possible to change this setting and
244 instantly gain full federation features.
246 Access to file attachments can also be restricted to logged-in users only:
248 1. Add a directory outside the web root where your file uploads will be
249 stored. Use this command as an initial guideline to create it:
251 mkdir /var/www/gnusocial-files
253 2. Make the file uploads directory writeable by the web server. An
254 insecure way to do this is (to do it properly, read up on UNIX file
255 permissions and configure your webserver accordingly):
257 chmod a+x /var/www/gnusocial-files
259 3. Tell GNU social to use this directory for file uploads. Add a line
260 like this to your config.php:
262 $config['attachments']['dir'] = '/var/www/gnusocial-files';
270 To use a Sphinx server to search users and notices, you'll need to
271 enable the SphinxSearch plugin. Add to your config.php:
273 addPlugin('SphinxSearch');
274 $config['sphinx']['server'] = 'searchhost.local';
276 You also need to install, compile and enable the sphinx pecl extension for
277 php on the client side, which itself depends on the sphinx development files.
279 See plugins/SphinxSearch/README for more details and server setup.
284 StatusNet supports a cheap-and-dirty system for sending update messages
285 to mobile phones and for receiving updates from the mobile. Instead of
286 sending through the SMS network itself, which is costly and requires
287 buy-in from the wireless carriers, it simply piggybacks on the email
288 gateways that many carriers provide to their customers. So, SMS
289 configuration is essentially email configuration.
291 Each user sends to a made-up email address, which they keep a secret.
292 Incoming email that is "From" the user's SMS email address, and "To"
293 the users' secret email address on the site's domain, will be
294 converted to a notice and stored in the DB.
296 For this to work, there *must* be a domain or sub-domain for which all
297 (or most) incoming email can pass through the incoming mail filter.
299 1. Run the SQL script carrier.sql in your StatusNet database. This will
302 mysql -u "statusnetuser" --password="statusnetpassword" statusnet < db/carrier.sql
304 This will populate your database with a list of wireless carriers
305 that support email SMS gateways.
307 2. Make sure the maildaemon.php file is executable:
309 chmod +x scripts/maildaemon.php
311 Note that "daemon" is kind of a misnomer here; the script is more
312 of a filter than a daemon.
314 2. Edit /etc/aliases on your mail server and add the following line:
316 *: /path/to/statusnet/scripts/maildaemon.php
318 3. Run whatever code you need to to update your aliases database. For
319 many mail servers (Postfix, Exim, Sendmail), this should work:
323 You may need to restart your mail server for the new database to
326 4. Set the following in your config.php file:
328 $config['mail']['domain'] = 'yourdomain.example.net';
333 For info on helping with translations, see the platform currently in use
334 for translations: https://www.transifex.com/projects/p/gnu-social/
336 Translations use the gettext system <http://www.gnu.org/software/gettext/>.
337 If you for some reason do not wish to sign up to the Transifex service,
338 you can review the files in the "locale/" sub-directory of GNU social.
339 Each plugin also has its own translation files.
341 To get your own site to use all the translated languages, and you are
342 tracking the git repo, you will need to install at least 'gettext' on
343 your system and then run:
349 Some activities that StatusNet needs to do, like broadcast OStatus, SMS,
350 XMPP messages and TwitterBridge operations, can be 'queued' and done by
351 off-line bots instead.
353 Two mechanisms are available to achieve offline operations:
355 * New embedded OpportunisticQM plugin, which is enabled by default
356 * Legacy queuedaemon script, which can be enabled via config file.
358 ### OpportunisticQM plugin
360 This plugin is enabled by default. It tries its best to do background
361 jobs during regular HTTP requests, like API or HTML pages calls.
363 Since queueing system is enabled by default, notices to be broadcasted
364 will be stored, by default, into DB (table queue_item).
366 Whenever it has time, OpportunisticQM will try to handle some of them.
368 This is a good solution whether you:
370 * have no access to command line (shared hosting)
371 * do not want to deal with long-running PHP processes
372 * run a low traffic GNU social instance
374 In other case, you really should consider enabling the queuedaemon for
375 performance reasons. Background daemons are necessary anyway if you wish
376 to use the Instant Messaging features such as communicating via XMPP.
380 If you want to use legacy queuedaemon, you must be able to run
381 long-running offline processes, either on your main Web server or on
382 another server you control. (Your other server will still need all the
383 above prerequisites, with the exception of Apache.) Installing on a
384 separate server is probably a good idea for high-volume sites.
386 1. You'll need the "CLI" (command-line interface) version of PHP
387 installed on whatever server you use.
389 Modern PHP versions in some operating systems have disabled functions
390 related to forking, which is required for daemons to operate. To make
391 this work, make sure that your php-cli config (/etc/php5/cli/php.ini)
392 does NOT have these functions listed under 'disable_functions':
394 * pcntl_fork, pcntl_wait, pcntl_wifexited, pcntl_wexitstatus,
395 pcntl_wifsignaled, pcntl_wtermsig
397 Other recommended settings for optimal performance are:
398 * mysqli.allow_persistent = On
399 * mysqli.reconnect = On
401 2. If you're using a separate server for queues, install StatusNet
402 somewhere on the server. You don't need to worry about the
403 .htaccess file, but make sure that your config.php file is close
404 to, or identical to, your Web server's version.
406 3. In your config.php files (on the server where you run the queue
407 daemon), set the following variable:
409 $config['queue']['daemon'] = true;
411 You may also want to look at the 'Queues and Daemons' section in
412 this file for more background processing options.
414 4. On the queues server, run the command scripts/startdaemons.sh.
416 This will run the queue handlers:
418 * queuedaemon.php - polls for queued items for inbox processing and
419 pushing out to OStatus, SMS, XMPP, etc.
420 * imdaemon.php - if an IM plugin is enabled (like XMPP)
421 * other daemons, like TwitterBridge ones, that you may have enabled
423 These daemons will automatically restart in most cases of failure
424 including memory leaks (if a memory_limit is set), but may still die
425 or behave oddly if they lose connections to the XMPP or queue servers.
427 It may be a good idea to use a daemon-monitoring service, like 'monit',
428 to check their status and keep them running.
430 All the daemons write their process IDs (pids) to /var/run/ by
431 default. This can be useful for starting, stopping, and monitoring the
432 daemons. If you are running multiple sites on the same machine, it will
433 be necessary to avoid collisions of these PID files by setting a site-
434 specific directory in config.php:
436 $config['daemon']['piddir'] = __DIR__ . '/../run/';
438 It is also possible to use a STOMP server instead of our kind of hacky
439 home-grown DB-based queue solution. This is strongly recommended for
440 best response time, especially when using XMPP.
448 There is no built-in system for doing backups in GNU social. You can make
449 backups of a working StatusNet system by backing up the database and
450 the Web directory. To backup the database use mysqldump <https://mariadb.com/kb/en/mariadb/mysqldump/>
451 and to backup the Web directory, try tar.
456 Upgrading is strongly recommended to stay up to date with security fixes
457 and new features. For instructions on how to upgrade GNU social code,
458 please see the UPGRADE file.
460 Additional configuration
461 ------------------------
463 Please refer to DOCUMENTATION/SYSTEM_ADMINISTRATORS/CONFIGURE for information.