-
Notifications
You must be signed in to change notification settings - Fork 6
Setting_up_Openstack
Mo Morsi edited this page Jan 4, 2013
·
6 revisions
title: Setting_up_Openstack
updated_on: Thu Sep 20 12:16:12 ~~0400 2012\
\
h1. Setting up Openstack
\

\
] to presentations / demo portal
\
These are complete end-to-end instruction on how to setup openstack on a
Fresh Fedora 17 system, for use in demoing Aeolus
\
h2. Prereqs
\
Openstack can be run in a vm or baremetal, it cannot be run off a live
cd though.
\
Openstack does not require too much in terms of resources, but for my vm
I dedicated 1 CPU w/ 2GB of memory and 20GB of disk
\
h3. Installation:
\
h4. Mysql:
\
yum install mysql-server\
mysqladmin~~uroot password “cloudpass”\
service mysqld restart\
yum install ~~~~enablerepo=updates-testing openstack-utils
openstack-nova openstack-glance openstack-keystone openstack-dashboard
qpid-cpp-server-daemon\
openstack-db~~~~service nova ~~~~init~~y~~~~rootpw cloudpass\
openstack-db~~~~service glance~~~~init~~y ~~~~rootpw cloudpass\
openstack-db~~~~service keystone ~~~~init~~y~~~~rootpw cloudpass
\
h4. Preq Services:
\
systemctl start qpidd.service\
systemctl enable qpidd.service\
systemctl start libvirtd.service\
systemctl enable libvirtd.service
\
h4. Volume Group
\
dd if=/dev/zero of=/var/lib/nova/nova-volumes.img bs=1M seek=2k count=0\
vgcreate nova-volumes \$\
openstack-config~~~~set /etc/nova/nova.conf DEFAULT volume\_group
nova-volumes
\
h4. Authentication
\
openstack-config~~~~set /etc/keystone/keystone.conf DEFAULT admin\_token
\$
\
openstack-config~~~~set /etc/nova/api-paste.ini filter:authtoken
admin\_tenant\_name service\
openstack-config~~~~set /etc/nova/api-paste.ini filter:authtoken
admin\_user nova\
openstack-config~~~~set /etc/nova/api-paste.ini filter:authtoken
admin\_password servicepass\
openstack-config~~~~set /etc/nova/nova.conf DEFAULT auth\_strategy
keystone
\
openstack-config~~~~set /etc/glance/glance-api.conf paste\_deploy flavor
keystone\
openstack-config~~~~set /etc/glance/glance-registry.conf paste\_deploy
flavor keystone\
openstack-config~~~~set /etc/glance/glance-api-paste.ini
filter:authtoken admin\_tenant\_name service\
openstack-config~~~~set /etc/glance/glance-api-paste.ini
filter:authtoken admin\_user glance\
openstack-config~~~~set /etc/glance/glance-api-paste.ini
filter:authtoken admin\_password servicepass\
openstack-config~~~~set /etc/glance/glance-registry-paste.ini
filter:authtoken admin\_tenant\_name service\
openstack-config~~~~set /etc/glance/glance-registry-paste.ini
filter:authtoken admin\_user glance\
openstack-config~~~~set /etc/glance/glance-registry-paste.ini
filter:authtoken admin\_password servicepass
\
h4. Only if running in a vm:
\
openstack-config~~~~set /etc/nova/nova.conf DEFAULT libvirt\_type qemu\
openstack-config~~~~set /etc/nova/nova.conf DEFAULT
scheduler\_default\_filters AllHostsFilter\
setsebool~~P virt\_use\_execmem on
#### Openstack services
systemctl start openstack-glance-api.service\
systemctl enable openstack-glance-api.service\
systemctl start openstack-glance-registry.service\
systemctl enable openstack-glance-registry.service
systemctl start openstack-nova-api.service\
systemctl enable openstack-nova-api.service\
systemctl start openstack-nova-objectstore.service\
systemctl enable openstack-nova-objectstore.service\
systemctl start openstack-nova-compute.service\
systemctl enable openstack-nova-compute.service\
systemctl start openstack-nova-network.service\
systemctl enable openstack-nova-network.service\
systemctl start openstack-nova-volume.service\
systemctl enable openstack-nova-volume.service\
systemctl start openstack-nova-scheduler.service\
systemctl enable openstack-nova-scheduler.service
systemctl start openstack-keystone.service\
systemctl enable openstack-keystone.service
#### Users
export OS\_USERNAME=admin\
export OS\_PASSWORD=cloudpass\
export OS\_TENANT\_NAME=admin\
export OS\_AUTH\_URL=http://127.0.0.1:5000/v2.0/\
export SERVICE\_ENDPOINT=http://openstack:5000/v2.0/ \# \<= note this is
‘openstack’ on purpose\
export SERVICE\_TOKEN=\$ADMIN\_TOKEN\
ADMIN\_PASSWORD=cloudpass SERVICE\_PASSWORD=servicepass
openstack-keystone-sample-data
#### Network
nova-manage network create demonet 10.0.0.0/24 1 256
~~~~bridge=demonetbr0\
modprobe nbd \
nova-manage user admin admin ABCDEF FEDCBA\
virsh net-destroy default
\
h4. Add image to glance:
\
wget
[http://syracloud.net/\~mmorsi/f16-x86\_64-openstack-sda.qcow2](http://syracloud.net/~mmorsi/f16-x86_64-openstack-sda.qcow2)\
glance add name=f16-jeos is\_public=true disk\_format=qcow2
container\_format=bare \< f16-x86\_64-openstack-sda.qcow
\
h4. Using openstack
\
Now openstack is setup and you can launch instances. As a regular user:
\
export OS\_USERNAME=‘admin’\
export OS\_PASSWORD=‘ABCDEF’\
export OS\_TENANT\_NAME=‘admin’\
export
OS\_AUTH\_URL=‘[http://localhost:5000/v2.0](http://localhost:5000/v2.0)’
\
nova keypair-add mykey \> oskey.priv\
chmod 600 oskey.priv
\
h5. Helper script to restart openstack services:
\
\# cat restart-nova \
\#/bin/bash\
service openstack-nova-api stop\
service openstack-nova-compute stop\
service openstack-nova-volume stop\
service openstack-nova-network stop\
service openstack-nova-objectstore stop\
service openstack-nova-scheduler stop\
service openstack-glance-api stop\
service openstack-glance-registry stop\
service openstack-keystone stop
\
h5. Helper script to list instances
\
\# cat /home/clouduser/list-instances \
export OS\_USERNAME=‘admin’\
export OS\_PASSWORD=‘cloudpass’\
export OS\_TENANT\_NAME=‘admin’\
export
OS\_AUTH\_URL=‘[http://localhost:5000/v2.0](http://localhost:5000/v2.0)’\
nova list
\
h5. Helper script to start instance
\
\# cat /home/clouduser/start-instance\
export OS\_USERNAME=‘admin’\
export OS\_PASSWORD=‘cloudpass’\
export OS\_TENANT\_NAME=‘admin’\
export
OS\_AUTH\_URL=‘[http://localhost:5000/v2.0](http://localhost:5000/v2.0)’\
nova boot myserver\$1~~~~flavor 2 ~~~~key\_name pkey~~~~image \$(glance
index | grep f16-jeos | awk ‘{print \$1}’)
Invoke with a string/number to append to instance name, eg
./start-instance 50
##### Helper script to stop instances
\# cat /home/clouduser/stop-instances \
export OS\_USERNAME=‘admin’\
export OS\_PASSWORD=‘cloudpass’\
export OS\_TENANT\_NAME=‘admin’\
export
OS\_AUTH\_URL=‘[http://localhost:5000/v2.0](http://localhost:5000/v2.0)’\
arr=\$(nova list | grep myserver)\
echo “Stopping instances”\
for x in \$arr ; do\
if [[ “\$x” =\~ myserver.\* ]] ; then\
echo “Stopping \$x”\
nova delete \$x\
fi\
done\
echo “Instances Stopped”