aboutsummaryrefslogtreecommitdiffstats
path: root/.homeinstall/README.md
blob: 6500cab6d02caeb4ed4d93fb36ddcbcc3bca06ea (plain) (blame)
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
# Hubzilla at Home next to your Router

Run hubzilla-setup.sh for an unattended installation of hubzilla.

The script is known to work without adjustments with

+ Hardware
  - Mini-PC with Debian-9.2-amd64, or
  - Rapberry 3 with Raspbian, Debian-9.3
+ DynDNS
  - selfHOST.de
  - freedns.afraid.org

## Disclaimers

- This script does work with Debian 9 only.
- This script has to be used on a fresh debian install only (it does not take account for a possibly already installed and configured webserver or sql implementation).

# Step-by-Step Overwiew

## Preconditions

Hardware

+ Internet connection and router at home
+ Mini-pc connected to your router (a Raspberry 3 will do for very small Hubs)
+ USB drive for backups

Software

+ Fresh installation of Debian 9 (Stretch)
+ Router with open ports 80 and 443 for your Hub

## The basic steps (quick overview)

+ Register your own domain (for example at selfHOST) or a free subdomain (for example at freeDNS)
+ Log on to your new debian (server)
  - apt-get install git
  - mkdir -p /var/www
  - cd /var/www
  - git clone https://github.com/redmatrix/hubzilla.git html
  - cd /html/.homeinstall
  - cp hubzilla-config.txt.template hubzilla-config.txt
  - nano hubzilla-config.txt
    - Read the comments carefully
    - Enter your values: db pass, domain, values for dyn DNS
  - Make sure your your external drive (for backups) is mounted
  - hubzilla-setup.sh as root
    - ... wait, wait, wait until the script is finised
  - reboot
+ Open your domain with a browser and step throught the initial configuration of hubzilla.

# Step-by-Step in Detail

## Preparations Hardware

### Mini-PC

### Recommended: USB Drive for Backups

The installation will create a daily backup written to an external drive.

The USB drive must be compatible with the filesystems

- ext4 (if you do not want to encrypt the USB) 
- LUKS + ext4 (if you want to encrypt the USB) 

The backup includes 

- Hubzilla DB
- Hubzilla installation /var/www/html
- Certificates for letsencrypt

## Preparations Software

### Install Debian Linux on the Mini-PC

Download the stable Debian at https://www.debian.org/  
(Debian 8 is no longer supported.)

Create bootable USB drive with Debian on it.You could use

- unetbootin, https://en.wikipedia.org/wiki/UNetbootin
- or simply the linux command "dd"

Example for command dd...

    su -
    dd if=2017-11-29-raspbian-stretch.img of=/dev/mmcblk0

Do not forget to unmount the SD card before and check if unmounted like in this example...

    su -
    umount /dev/mmcblk0*
    df -h


Switch off your mini pc, plug in your USB drive and start the mini pc from the
stick. Install Debian. Follow the instructions of the installation.

### Configure your Router

Open the ports 80 and 443 on your router for your Debian

## Preparations Dynamic IP Address

Your Hubzilla must be reachable by a domain that you can type in your browser

    cooldomain.org

You can use subdomains as well

    my.cooldomain.org

There are two way to get a domain...

### Method 1: Buy a Domain 

...for example buy at selfHOST.de  

The cost are around 10,- € once and 1,50 € per month (2017).

### Method 2 Register a (free) Subdomain

...for example register at freedns.afraid.org

Follow the instructions in .homeinstall/hubzilla-config.txt.  


## Install Hubzilla on your Debian

Login to your debian
(Provided your username is "you" and the name of the mini pc is "debian". You
could take the IP address instead of "debian")

    ssh -X you@debian

Change to root user

    su -l

Install git

    apt-get install git

Make the directory for apache and change diretory to it

    mkdir /var/www
    cd /var/www/

Clone hubzilla from git ("git pull" will update it later)

    git clone https://github.com/redmatrix/hubzilla html

Change to the install script

    cd html/.homeinstall/
    
Copy the template file
    
    cp hubzilla-config.txt.template hubzilla-config.txt

Change the file "hubzilla-config.txt". Read the instructions there carefully and enter your values.

    nano hubzilla-config.txt

Make sure your external drive (for backups) is plugged in and can be mounted as configured in "hubzilla-config.txt". Otherwise the daily backups will not work.

Run the script

     ./hubzilla-setup.sh

Wait... The script should not finish with an error message.

In a webbrowser open your domain.
Expected: A test page of hubzilla is shown. All checks there should be
successfull. Go on...
Expected: A page for the Hubzilla server configuration shows up.

Leave db server name "127.0.0.1" and port "0" untouched.

Enter

- DB user name = hubzilla
- DB pass word = This is the password you entered in "hubzilla-config.txt"
- DB name = hubzilla

Leave db type "MySQL" untouched.

Follow the instructions in the next pages.

After the daily script was executed at 05:30 (am)

- look at var/www/html/hubzilla-daily.log
- check your backup on the external drive
- optionally view the daily log under yourdomain.org/admin/logs/
  - set the logfile to var/www/html/hubzilla-daily.log

## Note for the Rasperry 

The script was tested with an Raspberry 3 under Raspian (Debian 9.3, 2017-11-29-raspbian-stretch.img).

It is recommended to deinstall these programms to avoid endless updates. Use...

    sudo apt-get purge wolfram-engine sonic-pi
    sudo apt-get autoremove

It is recommended to run the Raspi without graphical frontend (X-Server). Use...

    sudo raspi-config

to boot the Rapsi to the client console.

DO NOT FORGET TO CHANGE THE DEFAULT PASSWORD FOR USER PI!