summaryrefslogtreecommitdiff
path: root/docs/zeearchive/NotesCreateFreedomBoxContainer.md
blob: 207127956b67303a0384146fd14915a63d4f44e1 (plain)
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
<!-- NotesCreateFreedomBoxContainer, Version: 6, Modified: 2019/10/05, Author: feurig -->
# Buster Notes

FreedomBox is packaged on Debian 10
### Creating a cloud-init capable Debian/10 container
Download container from images.
	
```sh
root@annie:~# lxc image copy images:debian/10 local: --copy-aliases
root@annie:~# lxc image list
+--------------------+--------------+--------+---------------------------------------------+--------+----------+------------------------------+
|       ALIAS        | FINGERPRINT  | PUBLIC |                 DESCRIPTION                 |  ARCH  |   SIZE   |         UPLOAD DATE          |
+--------------------+--------------+--------+---------------------------------------------+--------+----------+------------------------------+
| b (10 more)        | c395a7105278 | no     | ubuntu 18.04 LTS amd64 (release) (20180911) | x86_64 | 173.98MB | Sep 30, 2018 at 4:00am (UTC) |
+--------------------+--------------+--------+---------------------------------------------+--------+----------+------------------------------+
| debian/10 (7 more) | ec89a28d9d81 | no     | Debian buster amd64 (20190930_05:24)        | x86_64 | 73.00MB  | Sep 30, 2019 at 3:58pm (UTC) |
+--------------------+--------------+--------+---------------------------------------------+--------+----------+------------------------------+
root@annie:~# lxc init debian/10 buster
Creating buster
root@annie:~# lxc start buster
```	
Copy templates and metadata to image
	
```sh
root@annie:/var/lib/lxd/storage-pools/devil/containers/buster# cat ../viva/metadata.yaml >>metadata.yaml 
root@annie:/var/lib/lxd/storage-pools/devil/containers/buster# cp -rpv ../viva/templates/
cloud-init-meta.tpl     cloud-init-network.tpl  cloud-init-user.tpl     cloud-init-vendor.tpl   hostname.tpl            
root@annie:/var/lib/lxd/storage-pools/devil/containers/buster# cp -rpv ../viva/templates .
'../viva/templates/cloud-init-meta.tpl' -> './templates/cloud-init-meta.tpl'
'../viva/templates/cloud-init-network.tpl' -> './templates/cloud-init-network.tpl'
'../viva/templates/cloud-init-user.tpl' -> './templates/cloud-init-user.tpl'
'../viva/templates/hostname.tpl' -> './templates/hostname.tpl'
'../viva/templates/cloud-init-vendor.tpl' -> './templates/cloud-init-vendor.tpl'
root@annie:/var/lib/lxd/storage-pools/devil/containers/buster# nano metadata.yaml 
.... delete original templates section and properties from other system ....
```	
Add cloud-init, cloud-utils, and ssh server
	
```sh
root@annie:~# lxc exec buster bash
root@buster:~# apt-get install inetutils-ping nano cloud-init cloud-utils openssh-server python3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
...
root@buster:~# nano /etc/network/interfaces.d/50-cloud-init.cfg 
root@buster:~# rm /etc/network/interfaces
root@buster:~# ln -s /etc/network/interfaces.d/50-cloud-init.cfg /etc/network/interfaces

root@buster:~# shutdown -h now
```	
Publish the image
	
```sh
root@annie:~# lxc publish buster --alias debian/10cloud description="Debian buster plus cloud-init"
```	
## Using the container
If you are not going to keep the image you can create it using lxc init.
```sh
root@annie:/etc/ansible# lxc init debian/10cloud camo -p susdev19 -p default
root@annie:/etc/ansible# lxc start camo

```

Or you can add it to /etc/ansible/hosts and use the create-lxc-containers.yml playbook.

	
```sh
root@annie:/etc/ansible# grep camo hosts
camo  ip_address=192.168.0.253 purpose="Freedombox Test Server"  image_alias=debian/10cloud
root@annie:/etc/ansible# ansible-playbook playbooks/create-lxd-containers.yml 
...
root@annie:/etc/ansible# lxc list
+------------+---------+----------------------+------+------------+-----------+
|    NAME    |  STATE  |         IPV4         | IPV6 |    TYPE    | SNAPSHOTS |
+------------+---------+----------------------+------+------------+-----------+
| buster     | STOPPED |                      |      | PERSISTENT | 0         |
+------------+---------+----------------------+------+------------+-----------+
| camo       | RUNNING | 192.168.0.253 (eth0) |      | PERSISTENT | 0         |
+------------+---------+----------------------+------+------------+-----------+
```

## Installing freedombox
	 
```# apt-get install freedombox
```	 

There are a few questions on the install that need to be answered and then its more or less done. 
I am not sure I want it exposed until I figure out how to configure it securely. Am going to run it up on the home server first.