Uses Cases
Last updated
Last updated
Images
Ardupilot
DroneKit Copter
DroneKit Python
QGroundControl
Distros
Lubuntu
Ubuntu Server
Change Cloud Image credentials
user@workstation:~$ cd Downloads
user@workstation:~/Downloads$ wget http://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64.tar.gz
user@workstation:~/Downloads$ sudo apt-get install libguestfs-tool
user@workstation:~/Downloads$ guestfish --rw -a xenial-server-cloudimg-amd64-disk1.img
Welcome to guestfish, the guest filesystem shell for
editing virtual machine filesystems and disk images.
Type: 'help' for help on commands
'man' to read the manual
'quit' to quit the shell
><fs> run
><fs> list-filesystems
/dev/sda1: ext4
><fs> mount /dev/sda1 /
><fs> vi /etc/cloud/cloud.cfg
><fs> exit
user@workstation:~/Downloads$
/etc/cloud/cloud.cfg
# The top level settings are used as module
# and system configuration.
# A set of users which may be applied and/or used by various modules
# when a 'default' entry is found it will reference the 'default_user'
# from the distro configuration specified below
users:
- default
- name: ubuntu
lock-passwd: false
plain_text_passwd: 'ubuntu'
# If this is set, 'root' will not be able to ssh in and they
# will get a message to login instead as the default $user
disable_root: true
# This will cause the set+update hostname module to not operate (if true)
preserve_hostname: false
# Example datasource config
# datasource:
# Ec2:
# metadata_urls: [ 'blah.com' ]
# timeout: 5 # (defaults to 50 seconds)
# max_wait: 10 # (defaults to 120 seconds)
# The modules that run in the 'init' stage
cloud_init_modules:
- migrator
- seed_random
- bootcmd
- write-files
- growpart
- resizefs
- disk_setup
- mounts
- set_hostname
- update_hostname
- update_etc_hosts
- ca-certs
- rsyslog
- users-groups
- ssh
# The modules that run in the 'config' stage
cloud_config_modules:
# Emit the cloud config ready event
# this can be used by upstart jobs for 'start on cloud-config'.
- emit_upstart
- snap_config
- ssh-import-id
- locale
- set-passwords
- grub-dpkg
- apt-pipelining
- apt-configure
- ntp
- timezone
- disable-ec2-metadata
- runcmd
- byobu
# The modules that run in the 'final' stage
cloud_final_modules:
- snappy
- package-update-upgrade-install
- fan
- landscape
- lxd
- puppet
- chef
- salt-minion
- mcollective
- rightscale_userdata
- scripts-vendor
- scripts-per-once
- scripts-per-boot
- scripts-per-instance
- scripts-user
- ssh-authkey-fingerprints
- keys-to-console
- phone-home
- final-message
- power-state-change
# System and/or distro specific settings
# (not accessible to handlers/transforms)
system_info:
# This will affect which distro class gets used
distro: ubuntu
# Default user name + that default users groups (if added/used)
default_user:
name: ubuntu
gecos: Ubuntu
groups: [adm, audio, cdrom, dialout, dip, floppy, lxd, netdev, plugdev, sudo, video]
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
shell: /bin/bash
# Other config here will be given to the distro class and/or path classes
paths:
cloud_dir: /var/lib/cloud/
templates_dir: /etc/cloud/templates/
upstart_dir: /etc/init/
package_mirrors:
- arches: [i386, amd64]
failsafe:
primary: http://archive.ubuntu.com/ubuntu
security: http://security.ubuntu.com/ubuntu
search:
primary:
- http://%(ec2_region)s.ec2.archive.ubuntu.com/ubuntu/
- http://%(availability_zone)s.clouds.archive.ubuntu.com/ubuntu/
- http://%(region)s.clouds.archive.ubuntu.com/ubuntu/
security: []
- arches: [armhf, armel, default]
failsafe:
primary: http://ports.ubuntu.com/ubuntu-ports
security: http://ports.ubuntu.com/ubuntu-ports
ssh_svcname: ssh
Change Hostname
ubuntu@ubuntu:~$ hostname
ubuntu
ubuntu@ubuntu:~$ vi /etc/hosts
127.0.0.1 ubuntu
On Virtual Machine, change nameservers
ubuntu@ubuntu:~$ vi /etc/resolvconf/resolv.conf.d/base
nameserver 8.8.8.8 8.8.4.4
ubuntu@ubuntu:~$ sudo resolvconf -u
Create snapshot
Download image
Enable SSH Server
stack@workstation:~/devstack$ cat userrc_early
# Use this for debugging issues before files in accrc are created
# Set up password auth credentials now that Keystone is bootstrapped
export OS_IDENTITY_API_VERSION=3
export OS_AUTH_URL=http://192.168.1.83/identity
export OS_USERNAME=admin
export OS_USER_DOMAIN_ID=default
export OS_PASSWORD=admin
export OS_PROJECT_NAME=admin
export OS_PROJECT_DOMAIN_ID=default
export OS_REGION_NAME=RegionOne
stack@workstation:~/devstack$ source userrc_early
stack@workstation:~/devstack$ glance image-list
+--------------------------------------+---------------------------+
| ID | Name |
+--------------------------------------+---------------------------+
| bad12c2e-645d-4453-b7da-f3c78a9d0a5c | cirros-0.3.5-x86_64-disk |
| e867d2a4-d4d3-446c-84c6-70b0ec4ca9a4 | ubuntu |
| 7a652931-1836-4489-805f-09e11a21890f | usecases.drone.ubuntu.one |
+--------------------------------------+---------------------------+
stack@workstation:~/devstack$
Not Working!
stack@workstation:~/devstack$ glance image-download --file usecases.drone.ubuntu.one.img 7a652931-1836-4489-805f-09e11a21890f
stack@workstation:~/devstack$ glance --os-image-api-version 2 image-create --container-format bare --disk-format qcow2 --copy-from usecases.drone.ubuntu.one-img
Clone Bitol Repository
ubuntu@ubuntu:~$ git clone https://github.com/TheIoTLearningInitiative/Bitol.git
ubuntu@ubuntu:~$ cd Bitol/SoftwareDevelopmentEnvironment/
ubuntu@ubuntu:~/Bitol/SoftwareDevelopmentEnvironment/$ bash Ardupilot.sh
Did not work to change password, do not follow these instructions
user@workstation:~/Downloads$ sudo apt install bzr
user@workstation:~/Downloads$ bzr branch lp:~smoser/+junk/backdoor-image
You have not informed bzr of your Launchpad ID, and you must do this to
write to Launchpad or access private data. See "bzr help launchpad-login".
Branched 37 revisions.
user@workstation:~/Downloads$
user@workstation:~/Downloads$ sh backdoor-image --user ubuntu --password ubuntu --password-auth xenial-server-cloudimg-amd64-disk1.img
user@workstation:~/Downloads$