ソースを参照

Friendica optimisations and Red installation

Bob Mottram 11 年 前
コミット
3144f8003f
共有1 個のファイルを変更した193 個の追加4 個の削除を含む
  1. 193
    4
      beaglebone.txt

+ 193
- 4
beaglebone.txt ファイルの表示

@@ -1175,6 +1175,9 @@ If all has gone well then there should be no warnings or errors after you run th
1175 1175
 
1176 1176
 *** Friendica
1177 1177
 **** Installation
1178
+
1179
+See [[Setting up a web site]] for details of how to update the Apache configuration for your Friendica site.
1180
+
1178 1181
 #+BEGIN_SRC: bash
1179 1182
 apt-get install mysql-server php5-common php5-cli php5-curl php5-gd php5-mysql php5-mcrypt
1180 1183
 #+END_SRC
@@ -1244,6 +1247,23 @@ Save and exit, then restart cron.
1244 1247
 service cron restart
1245 1248
 #+END_SRC
1246 1249
 
1250
+You can improve the speed of Friendica database searches by adding the following indexes:
1251
+
1252
+#+BEGIN_SRC: bash
1253
+mysql -u root -p
1254
+use friendica;
1255
+CREATE INDEX `uri_received` ON item(`uri`, `received`);
1256
+CREATE INDEX `received_uri` ON item(`received`, `uri`);
1257
+CREATE INDEX `contact-id_created` ON item(`contact-id`, created);
1258
+CREATE INDEX `uid_network_received` ON item(`uid`, `network`, `received`);
1259
+CREATE INDEX `uid_parent` ON item(`uid`, `parent`);
1260
+CREATE INDEX `uid_received` ON item(`uid`, `received`);
1261
+CREATE INDEX `uid_network_commented` ON item(`uid`, `network`, `commented`);
1262
+CREATE INDEX `uid_title` ON item(uid, `title`);
1263
+CREATE INDEX `created_contact-id` ON item(`created`, `contact-id`);
1264
+quit
1265
+#+END_SRC
1266
+
1247 1267
 **** Backups
1248 1268
 
1249 1269
 Make sure that the database gets backed up.  By using cron if anything goes wrong then you should be able to recover the database either from the previous day or the previous week.
@@ -1300,7 +1320,7 @@ chmod +x /etc/cron.weekly/friendicabackup
1300 1320
 #+END_SRC
1301 1321
 
1302 1322
 **** Recommended configuration
1303
-**** Admin
1323
+***** Admin
1304 1324
 To get to the admin settings you will need to be logged in with the admin email address which you specified at the beginning of the installation procedure.  Depending upon the theme which you're using "/admin/" will be available either as an icon or on a drop down menu.
1305 1325
 
1306 1326
 Under the *plugins* section the main one which you may wish to enable is the NSFW plugin.  With that enabled if a post contans the #NSFW tag then it will appear minimised by default and you will need to click a button to open it.
@@ -1311,7 +1331,7 @@ Under the *site* section give your Friendica node a name other than "/my friend
1311 1331
 
1312 1332
 It's probably a good idea to enable "/private posts by default for new users/" and also "/don't include post content in email notifications/".  Since traditional email isn't a secure system and is easily vulnerable to attack by systems such as [[https://en.wikipedia.org/wiki/XKeyscore][Xkeyscore]].
1313 1333
 
1314
-**** Settings
1334
+***** Settings
1315 1335
 Each user has their own customisable settings, typically available either via an icon or by an entry on a drop down menu.
1316 1336
 
1317 1337
 Under *additional features* enable "/richtext editor/", "/post preview/", "/group filter/", "/network filter/", "/edit sent posts/" and "/dislike posts/".
@@ -1320,14 +1340,183 @@ Under *display settings* select your desktop and mobile themes.
1320 1340
 
1321 1341
 Once you have connected to enough friends it's also a good idea to use the "/export personal data/" option from here.  This will save a file to your local system, which you can import into another friendica node if necessary.
1322 1342
 **** To access from an Android device
1323
-**** App
1343
+***** App
1324 1344
 Open a browser on your device and go to https://f-droid.org/ then download and install the F-Droid apk.  If you then open F-Droid you can search for and install the Friendica app.
1325 1345
 
1326 1346
 If you are using a self-signed certificate then at the login screen scroll down to the bottom, select the SSL settings then scroll down and disable SSL certificate checks.  You will then be able to log in using https, which at least gives you some protection via the encryption.
1327 1347
 
1328 1348
 More information about the Friendica app can be found on http://friendica-for-android.wiki-lab.net/
1329
-**** Mobile Theme
1349
+***** Mobile Theme
1330 1350
 Another way to access Friendica from a mobile device is to just use the web browser.  If you have selected a mobile theme within your settings then when viewing from an Android system the mobile theme will be displayed.
1351
+*** Red Matrix
1352
+**** Introduction
1353
+Red Matrix is the current version of the Friendica social networking system.  It's more general than Friendica in that it's designed as a generic communication system based around a protocol called "zot".  At the time of writing in early 2014 Red Matrix remains at an alpha stage of development and so it's not advised that you install it unless you're willing to put up with bugs and frustrations.  In the large majority of cases it's better to stick with Friendica for now.
1354
+
1355
+**** Prerequisites
1356
+The main problem with Red Matrix is that in order to install it you will need to have purchased a domain name (i.e. not a FreeDNS subdomain) and a SSL certificate for it.
1357
+
1358
+You could join some other Red Matrix server, but this suffers from "/The Levison Problem/" in which some goons show up with a gagging order demanding coppies of the SSL private key.  In that scenario unless the owner of the server is exceptionally brave users may never be informed that the site has been compromised or that there is interception hardware attached to the server.  Joining another server defeats the object of being digitally self-sufficient and raises legal question marks about the ownership of data which you might upload to a server which doesn't belong to you.
1359
+
1360
+**** Installation
1361
+
1362
+See [[Setting up a web site]] for details of how to update the Apache configuration for your Red Matrix site.
1363
+
1364
+#+BEGIN_SRC: bash
1365
+apt-get install mysql-server php5-common php5-cli php5-curl php5-gd php5-mysql php5-mcrypt
1366
+#+END_SRC
1367
+
1368
+Enter an admin password for MySQL.
1369
+
1370
+Create a mysql database.
1371
+
1372
+#+BEGIN_SRC: bash
1373
+mysql -u root -p
1374
+create database redmatrix;
1375
+CREATE USER 'redmatrixadmin'@'localhost' IDENTIFIED BY 'password';
1376
+GRANT ALL PRIVILEGES ON redmatrix.* TO 'redmatrixadmin'@'localhost';
1377
+quit
1378
+#+END_SRC
1379
+
1380
+You may need to fix Git SSL problems.
1381
+
1382
+#+BEGIN_SRC: bash
1383
+git config --global http.sslVerify true
1384
+apt-get install ca-certificates
1385
+cd ~/
1386
+emacs .gitconfig
1387
+#+END_SRC
1388
+
1389
+The .gitconfig file should look something like this:
1390
+
1391
+#+BEGIN_SRC: bash
1392
+[http]
1393
+        sslVerify = true
1394
+        sslCAinfo = /etc/ssl/certs/ca-certificates.crt
1395
+[user]
1396
+        email = myusername@mydomainname.com
1397
+        name = yourname
1398
+#+END_SRC
1399
+
1400
+Get the source code.
1401
+
1402
+#+BEGIN_SRC: bash
1403
+export HOSTNAME=mydomainname.com
1404
+cd /var/www/$HOSTNAME
1405
+mv htdocs htdocs_old
1406
+git clone https://github.com/friendica/red.git htdocs
1407
+chmod -R 755 htdocs
1408
+chown -R www-data:www-data htdocs
1409
+mkdir htdocs/view/tpl/smarty3
1410
+chmod 777 htdocs/view/tpl
1411
+chmod 777 htdocs/view/tpl/smarty3
1412
+git clone https://github.com/friendica/red-addons.git htdocs/addon
1413
+#+END_SRC
1414
+
1415
+Now visit the URL of your site and you should be taken through the rest of the installation procedure.  Note that this may take a few minutes so don't be concerned if it looks as if it has crashed - just leave it running.  If you have trouble with "allow override" ensure that "AllowOverride" is set to "all" in your Apache settings for the site (within /etc/apache2/sites-available) and then restart the apache2 service.
1416
+
1417
+Install the poller.
1418
+
1419
+#+BEGIN_SRC
1420
+emacs /etc/crontab
1421
+#+END_SRC
1422
+
1423
+and append the following, changing mydomainname.com to whatever your domain is.
1424
+
1425
+#+BEGIN_SRC
1426
+*/10 *  * * *	root	cd /var/www/mydomainname.com/htdocs; /usr/bin/php include/poller.php
1427
+#+END_SRC
1428
+
1429
+Save and exit, then restart cron.
1430
+
1431
+#+BEGIN_SRC: bash
1432
+service cron restart
1433
+#+END_SRC
1434
+
1435
+**** Backups
1436
+
1437
+Make sure that the database gets backed up.  By using cron if anything goes wrong then you should be able to recover the database either from the previous day or the previous week.
1438
+
1439
+#+BEGIN_SRC: bash
1440
+emacs /etc/cron.daily/redmatrixbackup
1441
+#+END_SRC
1442
+
1443
+Enter the following
1444
+
1445
+#+BEGIN_SRC: bash
1446
+#!/bin/sh
1447
+
1448
+MYSQL_PASSWORD=<mysql root password>
1449
+
1450
+umask 0077
1451
+
1452
+# Backup the database
1453
+mysqldump --password=$MYSQL_PASSWORD friendica > /var/backups/redmatrix_daily.sql
1454
+
1455
+# Make the backup readable only by root
1456
+chmod 600 /var/backups/redmatrix_daily.sql
1457
+#+END_SRC
1458
+
1459
+Save and exit.
1460
+
1461
+#+BEGIN_SRC: bash
1462
+chmod 600 /etc/cron.daily/redmatrixbackup
1463
+chmod +x /etc/cron.daily/redmatrixbackup
1464
+emacs /etc/cron.weekly/redmatrixbackup
1465
+#+END_SRC
1466
+
1467
+Enter the following
1468
+
1469
+#+BEGIN_SRC: bash
1470
+#!/bin/sh
1471
+
1472
+MYSQL_PASSWORD=<mysql root password>
1473
+
1474
+umask 0077
1475
+
1476
+# Backup the database
1477
+mysqldump --password=$MYSQL_PASSWORD friendica > /var/backups/redmatrix_weekly.sql
1478
+
1479
+# Make the backup readable only by root
1480
+chmod 600 /var/backups/redmatrix_weekly.sql
1481
+#+END_SRC
1482
+
1483
+Save and exit.
1484
+
1485
+#+BEGIN_SRC: bash
1486
+chmod 600 /etc/cron.weekly/redmatrixbackup
1487
+chmod +x /etc/cron.weekly/redmatrixbackup
1488
+#+END_SRC
1489
+
1490
+**** Recommended configuration
1491
+***** Admin
1492
+To get to the admin settings you will need to be logged in with the admin email address which you specified at the beginning of the installation procedure.  Depending upon the theme which you're using "/admin/" will be available either as an icon or on a drop down menu.
1493
+
1494
+Under the *plugins* section the main one which you may wish to enable is the NSFW plugin.  With that enabled if a post contans the #NSFW tag then it will appear minimised by default and you will need to click a button to open it.
1495
+
1496
+Under the *themes* section select a few themes, including mobile themes which are suitable for phones or tablets.
1497
+
1498
+Under the *site* section give your Friendica node a name other than "/my friend network/", you can change the icon and banner text and set the default mobile theme typically to /frost-mobile/.  If you don't want your node to host a lot of accounts for people you don't know then you may want to set the register policy to "/requires approval/".  For security it's probably a good idea only to host accounts for people who you actually know, rather than random strangers.  Also be aware that the Beaglebone does not have a great deal of computational power or bandwidth and will not function well if there are hundreds of users using your node.  If you're not federating with Diaspora or other sites then you may wish to select "/only allow Friendica contacts/".  That improves the security of the system, since communication between Friendica nodes is always encrypted separately and in addition to the usual SSL encryption layer - which makes life interesting for the Surveillance State and at least keeps those cryptanalysts employed.
1499
+
1500
+It's probably a good idea to enable "/private posts by default for new users/" and also "/don't include post content in email notifications/".  Since traditional email isn't a secure system and is easily vulnerable to attack by systems such as [[https://en.wikipedia.org/wiki/XKeyscore][Xkeyscore]].
1501
+
1502
+***** Settings
1503
+Each user has their own customisable settings, typically available either via an icon or by an entry on a drop down menu.
1504
+
1505
+Under *additional features* enable "/richtext editor/", "/post preview/", "/group filter/", "/network filter/", "/edit sent posts/" and "/dislike posts/".
1506
+
1507
+Under *display settings* select your desktop and mobile themes.
1508
+
1509
+Once you have connected to enough friends it's also a good idea to use the "/export personal data/" option from here.  This will save a file to your local system, which you can import into another friendica node if necessary.
1510
+**** To access from an Android device
1511
+***** App
1512
+Open a browser on your device and go to https://f-droid.org/ then download and install the F-Droid apk.  If you then open F-Droid you can search for and install the Friendica app.
1513
+
1514
+If you are using a self-signed certificate then at the login screen scroll down to the bottom, select the SSL settings then scroll down and disable SSL certificate checks.  You will then be able to log in using https, which at least gives you some protection via the encryption.
1515
+
1516
+More information about the Friendica app can be found on http://friendica-for-android.wiki-lab.net/
1517
+***** Mobile Theme
1518
+Another way to access Friendica from a mobile device is to just use the web browser.  If you have selected a mobile theme within your settings then when viewing from an Android system the mobile theme will be displayed.
1519
+
1331 1520
 ** Install a Blog
1332 1521
 
1333 1522
 Wordpress is the most popular blogging platform, but in practice I found it to be high maintenance with frequent security updates and breakages.  More practical for a home server is Flatpress.  Flatpress doesn't use a MySql database, just text files, and so is easy to relocate or reinstall.