Archive for : December, 2017

PHP 5.6 on Ubuntu 16.04 LTS

As from Ubuntu 16.04 the default PHP version is 7. Should you want to install the PHP5 packages, you need to add a repository.

Lets add two repositories, one for Apache2 and PHP5

#add-apt-repository ppa:ondrej/apache2
#add-apt-repository ppa:ondrej/php

After adding the repositories, update APT:-

#apt-get update

Once the update is done, you are ready to install packages. Use apt-cache search to look for packages:-

#apt-cache search php5

Sample output from that command:-

php5.6-dev – Files for PHP5.6 module development
php5.6-common – documentation, examples and common module for PHP
php5.6 – server-side, HTML-embedded scripting language (metapackage)
php5.6-curl – CURL module for PHP
php5.6-gd – GD module for PHP
php5.6-imap – IMAP module for PHP

LCX/LXD Cheatsheet – Snapshots

Container Information / List Snapshots for a Container
#lxd info CONTAINER-NAME --verbose

Create Snapshots
#lxc snapshot CONTAINER-NAME
#lxc snapshot CONTAINER-NAME

Restore Container from Snapshot
#lxc restore CONTAINER-NAME/CONTAINER-NAME

Rename / Move a Snapshot
lxc move CONTAINER-NAME/SNAPSHOT-NAME CONTAINER-NAME/NEW-SNAPSHOT-NAME

Create a Container from a Snapshot
lxc copy CONTAINER-NAME/SNAPSHOT-NAME NEW-CONTAINER-NAME

Delete a Snapshot
lxc delete CONTAINER-NAME/SNAPSHOT-NAME

Cloning
lxc copy SOURCE DESTINATION
lxc move OLD-CONTAINER-NAME NEW-CONTAINER-NAME

While the source container is running:-
lxc snapshot NODE:CONTAINER SNAPSHOT
lxc copy NODE:CONTAINER/SNAPSHOT NEW-CONTAINER

Managing Images
lxc image list #list local images
lxc launch IMAGE CONTAINER #lxc launch ubuntu:14.04
lxc publish CONTAINER --alias NEW-IMAGE-NAME #turn a container into an image
lxc publish CONTAINER/SNAPSHOT --alias NEW-IMAGE-NAME #turn a past container image into a new image
lxc image delete NAME #deleting images

Exporting a Container (stopping it)
#lxc list
#lxc publish CONTAINER --force --alias CONTAINER_`date -I` #use --force to have it stopped and restarted.
#lxc image list
#lxc image export CONTAINER_`date -I`
#ls
xxxxxxxxxxxxxxxxx.tar.gz

Exporting a Container (without stopping it)
#lxc list
#lxc snapshot container_name snapshot_name
#lxc publish container_name/snapshot_name --alias image_name
#lxc image list
#lxc image export CONTAINER_`date -I`
#ls
xxxxxxxxxxxxxxxxx.tar.gz

Importing a Container
#lxc image import xxxxxxxxxxxxxx.tar.gz --alias=test1
#lxc image list
#lxc launch test1 test2
#lxc exec test2 bash