First commit WIP
This commit is contained in:
commit
eb9af896c4
82
README.md
Normal file
82
README.md
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
# Smokeping Guide
|
||||||
|
|
||||||
|
This guide will walk you through how to set up smokeping on a raspberry pi using docker and ubuntu server.
|
||||||
|
|
||||||
|
## Install Ubuntu Server
|
||||||
|
|
||||||
|
### Download Ubuntu Image
|
||||||
|
|
||||||
|
In our example we're using a pi 3, so we'll go and grab their Ubuntu install image from [here](https://ubuntu.com/download/raspberry-pi).
|
||||||
|
|
||||||
|
### Install Etcher
|
||||||
|
|
||||||
|
You can use any variety of programs for this, including something as basic as ```dd```, however for ease of use I recommend using [etcher](https://www.balena.io/etcher/). Once downloaded, install the program.
|
||||||
|
|
||||||
|
### Write image
|
||||||
|
|
||||||
|
Once etcher is installed, unzip the the Ubuntu Server image and use etcher to write it to an SD card. It will prompt you to type in a password, this is normal.
|
||||||
|
|
||||||
|
_If the SD card was already mounted it may fail, just retry and it should work fine._
|
||||||
|
|
||||||
|
### Edit pre-boot configuration files
|
||||||
|
|
||||||
|
Once etcher has finished, macos will automatically mount the boot partition of the SD card ready for use. Ubuntu server ships with two files in the boot partition to allow customisations such as network config and passwords before first boot:
|
||||||
|
|
||||||
|
[network-config](config_files/network-config)<br>
|
||||||
|
[user-data](config_files/user-data)
|
||||||
|
|
||||||
|
_These config files are only used on the first boot, modifying them after first boot will have no effect. If you want to re-apply you must re-flash the SD card or manually edit the pi's configuration files by logging in to it._
|
||||||
|
|
||||||
|
#### network-config
|
||||||
|
|
||||||
|
The [network-config](config_files/network-config) set up the network interfaces for options such as:
|
||||||
|
|
||||||
|
* DHCP
|
||||||
|
* Static IP
|
||||||
|
* Wifi Networks
|
||||||
|
|
||||||
|
For the purposes of this tutorial it is safe to leave it as standard - this will give the pi a dynamic DHCP address.
|
||||||
|
|
||||||
|
#### user-data
|
||||||
|
|
||||||
|
The [user-data](config_files/user-data) file is used for a variety of configuration items, such as setting up users, installing packages, configuring hostnames etc. For the purposes of this tutorial we are going to do the following things:
|
||||||
|
|
||||||
|
* Disable automatic password expiry for the default user
|
||||||
|
* set the hostname to _smokepi_
|
||||||
|
|
||||||
|
To do this, edit the ```user-data``` config file, find the following section and modify it from:
|
||||||
|
|
||||||
|
```
|
||||||
|
chpasswd:
|
||||||
|
expire: false
|
||||||
|
list:
|
||||||
|
- ubuntu:ubuntu
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
To:
|
||||||
|
|
||||||
|
```
|
||||||
|
chpasswd:
|
||||||
|
expire: true
|
||||||
|
list:
|
||||||
|
- ubuntu:ubuntu
|
||||||
|
|
||||||
|
hostname: smokepi
|
||||||
|
```
|
||||||
|
|
||||||
|
Optionally you could change the default password from _ubuntu_ to _password1_ by changing it to this instead:
|
||||||
|
|
||||||
|
```
|
||||||
|
chpasswd:
|
||||||
|
expire: true
|
||||||
|
list:
|
||||||
|
- ubuntu:password1
|
||||||
|
|
||||||
|
hostname: smokepi
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Clear graphs
|
||||||
|
```
|
||||||
|
sudo rm -rf /opt/smokeping/data/*
|
||||||
|
```
|
30
config_files/network-config
Normal file
30
config_files/network-config
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# This file contains a netplan-compatible configuration which cloud-init
|
||||||
|
# will apply on first-boot. Please refer to the cloud-init documentation and
|
||||||
|
# the netplan reference for full details:
|
||||||
|
#
|
||||||
|
# https://cloudinit.readthedocs.io/
|
||||||
|
# https://netplan.io/reference
|
||||||
|
#
|
||||||
|
# Some additional examples are commented out below
|
||||||
|
|
||||||
|
version: 2
|
||||||
|
ethernets:
|
||||||
|
eth0:
|
||||||
|
dhcp4: true
|
||||||
|
optional: true
|
||||||
|
#wifis:
|
||||||
|
# wlan0:
|
||||||
|
# dhcp4: true
|
||||||
|
# optional: true
|
||||||
|
# access-points:
|
||||||
|
# myhomewifi:
|
||||||
|
# password: "S3kr1t"
|
||||||
|
# myworkwifi:
|
||||||
|
# password: "correct battery horse staple"
|
||||||
|
# workssid:
|
||||||
|
# auth:
|
||||||
|
# key-management: eap
|
||||||
|
# method: peap
|
||||||
|
# identity: "me@example.com"
|
||||||
|
# password: "passw0rd"
|
||||||
|
# ca-certificate: /etc/my_ca.pem
|
81
config_files/user-data
Normal file
81
config_files/user-data
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
#cloud-config
|
||||||
|
|
||||||
|
# This is the user-data configuration file for cloud-init. By default this sets
|
||||||
|
# up an initial user called "ubuntu" with password "ubuntu", which must be
|
||||||
|
# changed at first login. However, many additional actions can be initiated on
|
||||||
|
# first boot from this file. The cloud-init documentation has more details:
|
||||||
|
#
|
||||||
|
# https://cloudinit.readthedocs.io/
|
||||||
|
#
|
||||||
|
# Some additional examples are provided in comments below the default
|
||||||
|
# configuration.
|
||||||
|
|
||||||
|
# On first boot, set the (default) ubuntu user's password to "ubuntu" and
|
||||||
|
# expire user passwords
|
||||||
|
chpasswd:
|
||||||
|
expire: false
|
||||||
|
list:
|
||||||
|
- ubuntu:ubuntu
|
||||||
|
|
||||||
|
hostname: smokepi
|
||||||
|
|
||||||
|
# Enable password authentication with the SSH daemon
|
||||||
|
ssh_pwauth: true
|
||||||
|
|
||||||
|
## On first boot, use ssh-import-id to give the specific users SSH access to
|
||||||
|
## the default user
|
||||||
|
#ssh_import_id:
|
||||||
|
#- lp:my_launchpad_username
|
||||||
|
#- gh:my_github_username
|
||||||
|
|
||||||
|
## Add users and groups to the system, and import keys with the ssh-import-id
|
||||||
|
## utility
|
||||||
|
#groups:
|
||||||
|
#- robot: [robot]
|
||||||
|
#- robotics: [robot]
|
||||||
|
#- pi
|
||||||
|
#
|
||||||
|
#users:
|
||||||
|
#- default
|
||||||
|
#- name: robot
|
||||||
|
# gecos: Mr. Robot
|
||||||
|
# primary_group: robot
|
||||||
|
# groups: users
|
||||||
|
# ssh_import_id: foobar
|
||||||
|
# lock_passwd: false
|
||||||
|
# passwd: $5$hkui88$nvZgIle31cNpryjRfO9uArF7DYiBcWEnjqq7L1AQNN3
|
||||||
|
|
||||||
|
## Update apt database and upgrade packages on first boot
|
||||||
|
#package_update: true
|
||||||
|
#package_upgrade: true
|
||||||
|
|
||||||
|
## Install additional packages on first boot
|
||||||
|
#packages:
|
||||||
|
#- pwgen
|
||||||
|
#- pastebinit
|
||||||
|
#- [libpython2.7, 2.7.3-0ubuntu3.1]
|
||||||
|
|
||||||
|
## Write arbitrary files to the file-system (including binaries!)
|
||||||
|
#write_files:
|
||||||
|
#- path: /etc/default/keyboard
|
||||||
|
# content: |
|
||||||
|
# # KEYBOARD configuration file
|
||||||
|
# # Consult the keyboard(5) manual page.
|
||||||
|
# XKBMODEL="pc105"
|
||||||
|
# XKBLAYOUT="gb"
|
||||||
|
# XKBVARIANT=""
|
||||||
|
# XKBOPTIONS="ctrl: nocaps"
|
||||||
|
# permissions: '0644'
|
||||||
|
# owner: root:root
|
||||||
|
#- encoding: gzip
|
||||||
|
# path: /usr/bin/hello
|
||||||
|
# content: !!binary |
|
||||||
|
# H4sIAIDb/U8C/1NW1E/KzNMvzuBKTc7IV8hIzcnJVyjPL8pJ4QIA6N+MVxsAAAA=
|
||||||
|
# owner: root:root
|
||||||
|
# permissions: '0755'
|
||||||
|
|
||||||
|
## Run arbitrary commands at rc.local like time
|
||||||
|
#runcmd:
|
||||||
|
#- [ ls, -l, / ]
|
||||||
|
#- [ sh, -xc, "echo $(date) ': hello world!'" ]
|
||||||
|
#- [ wget, "http://ubuntu.com", -O, /run/mydir/index.html ]
|
Loading…
x
Reference in New Issue
Block a user