1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
|
[b]How to install the Red Matrix on a Raspberry Pi[/b]
[zrl=[baseurl]/help/main] Back to the main page[/zrl]
Last update 2014-02-22
[hr]
You just bought a Raspberry Pi and want to run the RED Matrix with your own domain name?
Then this page is for you! You will:
[list=1]
[*] Install Raspberry OS (Debian Linux) on a Raspberry
[*] Install Apache Web Server, PHP, MaySQL, phpMyAdmin
[*] Register a free domain (dynamic DNS) and use it for your RED hub
[*] Install the RED Matrix
[*] Keep your Raspberry Pi and your Redmatrix up-to-date
[*] TODO Running Friendica with SSL
[*] TODO Make the webserver less vulnarable to attacks
[/list]
[size=large]1. Install Raspberry OS (Debian Linux)[/size]
instructions under [url=http://www.raspberrypi.org/downloads]http://www.raspberrypi.org/downloads[/url]
This page links to the quick start containing detailed instruction.
[b]Format SD card[/b]
using the program gparted under Linux Mint 15
format as FAT32
[b]Download NOOBS (offline and network install)[/b]
[url=http://downloads.raspberrypi.org/noobs]http://downloads.raspberrypi.org/noobs[/url]
unzip
copy unzipped files to SD card
[b]Install Raspbian as OS on the Rasperry Pi[/b]
connect with keyboard via USB
connect with monitor via HDMI
Insert SD card into Rasperry Pi
Connect with power supply to switch on the Rasperry
choose Raspbian as OS (> installs Raspbian....)
wait for the coniguration program raspi-config (you can later start it by sudo raspi-config)
[b]Configure Raspbian[/b]
in raspi-config > advanced > choose to use ssh (!! You need this to connect to administrate your Pi from your PC !!)
in raspi-config > change the password (of default user "pi" from "raspberry" to your password)
in raspi-config (optional) > Internationalisation options > Change Locale > to de_DE.utf-8 utf-8 (for example)
in raspi-config (optional) > Internationalisation options > Change Timezoe > set your timezone
in raspi-config (optional) > Overlock > medium
(Source [url=http://www.manfred-steger.de/tuts/20-der-eigene-webserver-mit-dem-raspberry-pi#]http://www.manfred-steger.de/tuts/20-der-eigene-webserver-mit-dem-raspberry-pi#[/url])
[b]More[/b]
[code]sudo reboot[/code]
Now its time to connect the Pi to the network.
[ul]
[*] pull out keyboard
[*] pull out monitor
[*] you even can pull out the power supply (USB)
[*] plug-in the network cable to the router
[*] plug-in the power supply again
[*] wait for a minute or to give the Pi time to boot and start ssh...
[/ul]
On your PC connect to the Pi to administrate (here update it).
Open the console on the PC (Window: Start > cmd, Linux: Shell)
Hint: use the router admin tool to find out the IP of your PI[code]ssh pi@192.168.178.37
sudo apt-get update
sudo apt-get dist-upgrade[/code]
(Source [url=http://www.manfred-steger.de/tuts/20-der-eigene-webserver-mit-dem-raspberry-pi#]http://www.manfred-steger.de/tuts/20-der-eigene-webserver-mit-dem-raspberry-pi#[/url])
[size=large]2. Install Apache Web Server, PHP, MaySQL, phpMyAdmin[/size]
[b]Install Apache Webserver[/b]
[code]sudo bash
sudo groupadd www-data[/code] might exist already
[code]sudo usermod -a -G www-data www-data
sudo apt-get update
sudo reboot[/code]
wait...
reconnect via ssh, example: [code]ssh pi@192.168.178.37
sudo apt-get install apache2 apache2-doc apache2-utils[/code]
Open webbrowser on PC and check [url=http://192.168.178.37]http://192.168.178.37[/url]
Should show you a page like "It works"
(Source [url=http://www.manfred-steger.de/tuts/20-der-eigene-webserver-mit-dem-raspberry-pi#]http://www.manfred-steger.de/tuts/20-der-eigene-webserver-mit-dem-raspberry-pi#[/url])
[b]Install PHP, MaySQL, phpMyAdmin[/b]
[code]sudo bash
apt-get install libapache2-mod-php5 php5 php-pear php5-xcache php5-curl
apt-get install php5-mysql
apt-get install mysql-server mysql-client[/code] enter and note the mysql passwort
[code]apt-get install phpmyadmin[/code]
Configuring phpmyadmin
- Select apache2
- Configure database for phpmyadmin with dbconfig-common?: Choose Yes
(Source [url=http://www.manfred-steger.de/tuts/20-der-eigene-webserver-mit-dem-raspberry-pi#]http://www.manfred-steger.de/tuts/20-der-eigene-webserver-mit-dem-raspberry-pi#[/url])
[b]Test installation[/b]
[code]cd /var/www[/code]
create a php file to test the php installation[code]sudo nano phpinfo.php[/code]
Insert into the file:[code]
<?php
phpinfo();
?>
[/code]
(save CTRL+0, ENTER, CTRL+X)
open webbrowser on PC and try [url=http://192.168.178.37/phpinfo.php]http://192.168.178.37/phpinfo.php[/url] (page shows infos on php)
connect phpMyAdmin with MySQL database [code]nano /etc/apache2/apache2.conf[/code]
- CTRL+V... to the end of the file
- Insert at the end of the file: (save CTRL+0, ENTER, CTRL+X)[code]Include /etc/phpmyadmin/apache.conf[/code]
restart apache[code]/etc/init.d/apache2 restart
sudo apt-get update
sudo apt-get upgrade
sudo reboot[/code]
(Source [url=http://www.manfred-steger.de/tuts/20-der-eigene-webserver-mit-dem-raspberry-pi#]http://www.manfred-steger.de/tuts/20-der-eigene-webserver-mit-dem-raspberry-pi#[/url])
[b]phpMyAdmin[/b]
open webbrowser on PC and try #^[url=http://192.168.178.37/phpmyadmin]http://192.168.178.37/phpmyadmin[/url]
(Source [url=http://www.manfred-steger.de/tuts/20-der-eigene-webserver-mit-dem-raspberry-pi#]http://www.manfred-steger.de/tuts/20-der-eigene-webserver-mit-dem-raspberry-pi#[/url])
[b]Create an empty database... that is later used by RED[/b]
open webbrowser on PC and try #^[url=http://192.168.178.37/phpmyadmin]http://192.168.178.37/phpmyadmin[/url]
Create an empty database
Note the access details (hostname, username, password, database name).
[size=large]3. Selfhost[/size]
(Source: #^[url=http://www.techjawab.com/2013/06/setup-dynamic-dns-dyndns-for-free-on.html]http://www.techjawab.com/2013/06/setup-dynamic-dns-dyndns-for-free-on.html[/url])
[url=http://freedns.afraid.org/signup/]http://freedns.afraid.org/signup/[/url]
[b]Step 1[/b]
Register for a Free domain at #^[url=http://freedns.afraid.org/signup/]http://freedns.afraid.org/signup/[/url]
(We will take techhome.homenet.org in this guide)
[b]Step 2[/b]
Logon to FreeDNS (where you just registered) and goto #^[url=http://freedns.afraid.org/dynamic/]http://freedns.afraid.org/dynamic/[/url]
Right click on "Direct Link" and copy the URL and paste it somewhere.
You should notice a large and unique alpha-numeric key in the URL, make a note of it as shown below:
[code]http://freedns.afraid.org/dynamic/update.php?alphanumeric-key[/code]
[b]Step 3[/b]
Install inadyn using the following command:[code]sudo apt-get install inadyn[/code]
[b]Step 4[/b]
Configure inadyn using the below steps:[code]sudo nano /etc/inadyn.conf[/code]
And add the following contains in it replacing the actual values:
[code]
--username [color=red]techhome[/color]
--password [color=red]mypassword[/color]
--update_period 3600
--forced_update_period 14400
--alias [color=red]techhome.homenet.org</b>,[color=red]alphanumeric key[/color]
--background
--dyndns_system default@freedns.afraid.org
--syslog
[/code]
[b]Step 5[/b]
Now, we need to ensure that the DNS updater (Inadyn) runs automatically after every re-boot[code]export EDITOR=gedit && sudo crontab -e[/code]
Add the following line:[code]@reboot /usr/sbin/inadyn[/code]
[b]Step 6[/b]
Reboot system and then run the following command to ensure inadyn is running:[code]
sudo reboot
ps -A | grep inadyn
[/code]
Now your host is ready and up for accessing from internet...
You can trying ssh-ing from another computer over the internet
[code]ssh username@techhome.homenet.org[/code]
Or, if any web server is running, then simply browse to #^[url=http://techhome.homenet.org]http://techhome.homenet.org[/url]
Or, you can just ping it to test ping techhome.homenet.org
To check the logs you can use this:
[code]more /var/log/messages |grep INADYN[/code]
[size=large]4. Install RED [/size]
(Source: [zrl=https://friendicared.net/help/Install]https://friendicared.net/help/Install[/zrl])
Linux Appache document root is /var/www/
Two files exist there (created by the steps above): index.html, phpinfo.php
[b]Install RED and its Addons[/b]
Cleanup: Remove the directory www/ (Git will not create files and folders in directories that are not empty.) Make sure you are in directory var[code]pi@pi /var $ cd /var[/code]
Remove directory[code]pi@pi /var $ sudo rm -rf www/[/code]
Download the sources of RED from GIT
[code]pi@pi /var $ sudo git clone https://github.com/friendica/red.git www[/code]
Download the sources of the addons from GIT
[code]pi@pi /var/www $ sudo git clone https://github.com/friendica/red-addons.git addon[/code]
Make user www-data the owner of the whole red directory (including subdirectories and files)
(TODO: This step has to be proofed by the next installation.)
[code]pi@pi /var $ chown -R www-data:www-data /var/www/[/code]
Check if you can update the sources from git[code]
pi@pi /var $ cd www
pi@pi /var/www $ git pull
[/code]
Check if you can update the addons
[code]pi@pi /var/www $ cd addon/
pi@pi /var/www/addon $ sudo git pull[/code]
Make sure folder view/tpl/smarty3 exists and is writable by the webserver
[code]pi@pi /var/www $ sudo chmod ou+w view/tpl/smarty3/[/code]
Create .htconfig.php and is writable by the webserver
[code]pi@pi /var/www $ sudo touch .htconfig.php
pi@pi /var/www $ sudo chmod ou+w .htconfig.php[/code]
[b]First start and initial configuration of your RED Matrix hub[/b]
In browser open #^[zrl=http://einervonvielen.mooo.com/]http://einervonvielen.mooo.com/[/zrl]
(Replace einervonvielen.mooo.com by your domain, see chapter selfhost. Be patient. It takes time.)
(#^[zrl=http://einervonvielen.mooo.com/index.php?q=setup]http://einervonvielen.mooo.com/index.php?q=setup[/zrl])
There might be errors like the following.
Error: libCURL PHP module required but not installed.
Solution:
apt-get install php5-curl
Error: Apache webserver mod-rewrite module is required but not installed.
Solution
(Source: [url=http://xmodulo.com/2013/01/how-to-enable-mod_rewrite-in-apache2-on-debian-ubuntu.html]http://xmodulo.com/2013/01/how-to-enable-mod_rewrite-in-apache2-on-debian-ubuntu.html[/url])
The default installation of Apache2 comes with mod_rewrite installed. To check whether this is the case, verify the existence of /etc/apache2/mods-available/rewrite.load
- pi@pi /var/www $ nano /etc/apache2/mods-available/rewrite.load
(You should find the contendt: LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so)
To enable and load mod_rewrite, do the rest of steps.
Create a symbolic link in /etc/apache2/mods-enabled
- pi@pi /var/www $ sudo a2enmod rewrite
Then open up the following file, and replace every occurrence of "AllowOverride None" with "AllowOverride all".
- pi@pi /var/www $ sudo nano /etc/apache2/sites-available/default
Finally, restart Apache2.
- pi@pi /var/www $ sudo service apache2 restart
Error store is writable (not checked)
Solution:
(TODO: Make writeable to group www-data only?)
pi@pi /var/www $ sudo mkdir store
pi@pi /var/www $ chown -R www-data:www-data /var/www/red/
pi@pi /var/www $ sudo chmod ou+w view
[b]More[/b]
Set up a cron job to run the poller once every 15 minutes in order to perform background processing.
- pi@pi /var/www $ which php
Make sure you are in the document root directory of the webserver
- pi@pi /var/www $ cd /var/www/
Try to execute the poller in oder to make sure it works
- pi@pi /var/www $ /usr/bin/php include/poller.php
Create the cronjob
- pi@pi /var/www $ crontab -e
Enter
- */15 * * * * cd /var/www/; /usr/bin/php include/poller.php
- Save and exit.
Prevent search engines from indexing your site. Why? This can cause heavy resource use.
[code]
php util/config system block_public_search 1
[/code]
[size=large]5. Keep your Raspberry Pi and your Redmatrix up-to-date[/size]
Git update of RED every day at 4 am and addons at 5 am every day
Try if the command is working
- pi@pi /var/www $ sudo git pull
Create the cronjob
- pi@pi /var/www $ crontab -e
Enter the following to update RED at 4:01 am every day
- 01 04 * * * cd /var/www/; sudo git pull
Enter the following to update the addons at 5:01 am every day
- 01 05 * * * cd /var/www/addon/; sudo git pull
Enter the following to update the Raspberry Pi (Raspbian OS = Debian) at 6:01 am every day
- 01 06 * * * sudo aptitude -y update && sudo aptitude -y safe-upgrade
Save and exit.
[size=large]6. Running Friendica with SSL[/size]
Follow the instructions here:
[url=https://github.com/friendica/friendica/wiki/Running-Friendica-with-SSL]https://github.com/friendica/friendica/wiki/Running-Friendica-with-SSL[/url]
Return to the [zrl=[baseurl]/help/main]Main documentation page[/zrl]
|