wluhan created page: Configure_simplestreams_for_a_private_cloud authored by wluhan's avatar wluhan
# Configure Simplestreams for a private cloud
When Juju bootstraps a cloud, it needs two critical pieces of information:
**The uuid of the image to use when starting new compute instances.**
**The URL from which to download the correct version of a tools tarball.**
We can simply think the essential information above is stored in two json files.
To learn more details ,you can refer [here](https://jujucharms.com/docs/1.25/howto-privatecloud).
Before generating the json files,we need to do some preparation:
1. Upload Ubuntu 14.04LTS(Trusty) and Ubuntu 16.04LTS(Xenial) image to Openstack
[Trusty image](http://cloud-images.ubuntu.com/trusty/20161014/)
[Xenial image](http://cloud-images.ubuntu.com/xenial/20161014/)
Choose xxxxx-server-cloudimg-amd64-disk1.img to download.
Upload the images to openstack:
![upload_image1](/uploads/1308a36f5dc021bf0b699b878f0f607c/upload_image1.png)
![upload_image2](/uploads/88cf9453b9c826f36d5669d9e29d564a/upload_image2.png)
2. Install Apache server
```shell
sudo apt-get install apache2
```
3. Generate image json file:
```shell
sudo juju metadata generate-image -a amd64 -i 843bef24-8c70-40e1-a380-972717c9e4b3 -r RegionOne -s xenial -d /var/www/html/stack -u http://172.16.1.3:5000/v2.0 -e openstack
```
Regarding the command-line flags used:
* -i 843bef24-8c70-40e1-a380-972717c9e4b3: specifies the ID of the Glance image that we just created before.
* -u http://172.16.1.3:5000/v2.0: specifies the Keystone URL, and should match the value from the auth-url field of our environment as specified in $HOME/.juju/environments.yaml.
* -e openstack: identifies the Juju environment described in $HOME/.juju/environments.yaml file.
* -s xenial: specifies the image series (the Ubuntu release name).
* -a amd64: specifies the CPU architecture.
* -d /var/www/html/stack: specifies the base directory where the metadata will be written to. For images, the path will be /opt/stack/images/streams/v1..
4. Generate tools json file:
```shell
juju metadata generate-tools -d /var/www/html/stack/ --stream released
```
Tips:
`/var/www/html` is the Apache server default directory
5. Use the validation command to ensure iamge and tools are available for juju to use:
```shell
juju metadata validate-images
juju metadata validate-tools
```
6. Download tool files:
[Download link](https://streams.canonical.com/juju/tools/agent/1.25.6/juju-1.25.6-xenial-amd64.tgz)
Download and put it in the directory `/var/www/html/stack/tools/released`
Tips:
Download the files that match Juju and operating system version
7. Change the files permission
```shell
cd /var/www/html/stack
sudo chmod -R 777 ./*
```
8. Bootstrap Juju
```shell
juju switch openstack
juju bootstrap
```
\ No newline at end of file