133
133
<section xml:id="Glance-d1e634">
134
134
<title>Glance</title>
135
<para>Glance is an image Server that Nova can use to pickup images from. Glance is very modular and can use several types of storage backends such as filestore, s3 etc. We are installing Glance before installing Nova, so that when we get to configuring Nova, glance is ready to be used by Nova.</para>
136
<programlisting>sudo apt-get install glance
135
<para>Glance is an image server that Nova can use to pickup images from. Glance is very modular and can use several types of storage backends such as filestore, s3 etc. We are installing Glance before installing Nova, so that when we get to configuring Nova, glance is ready to be used by Nova.</para>
136
<programlisting>sudo apt-get install -y glance
137
137
</programlisting>
138
138
<para>The default config file at /etc/glance/glance.conf is good to use for a simple file store as the storage backend. Glance can be configured to use other storage backends such as Swift.</para>
139
<para>Glance uses sqlite as the default database backend. While sqlite offers a quick and easy way to get started, for production use, you may consider a database such as MySQL or PostgreSQL.</para>
139
<para>Glance uses SQLite as the default database backend. While SQLite offers a quick and easy way to get started, for production use, you may consider a database such as MySQL or PostgreSQL.</para>
140
140
<para>Glance has two components - glance-api and glance-registry. These can be controlled using the concerned upstart jobs.</para>
142
<section xml:id="MySQL_Server-d1e657"><title>MySQL Server</title>
143
<title>Database configuration</title>
144
<para>Nova can use MySQL or PostgreSQL for storing its data. For non-production use, SQLite is also an option.</para>
145
<section xml:id="MySQL_Server-d1e657"><title>MySQL</title>
143
146
<para>Install mysql-server package</para>
144
147
<programlisting>sudo apt-get install -y mysql-server
145
148
</programlisting>
146
<section xml:id="Configuration-d1e667">
147
<title>Configuration</title>
148
149
<para>Set a variable called "MYSQL_PASS" for use in the various commands below:</para>
149
150
<programlisting>MYSQL_PASS="mygreatsecret"
150
151
</programlisting>
171
165
<para>Set password for novadbadmin.</para>
172
166
<programlisting>sudo mysql -uroot -p$MYSQL_PASS -e "SET PASSWORD FOR 'novadbadmin'@'%' = PASSWORD('$MYSQL_PASS');"</programlisting>
175
<title>Installing Sqlite (Instead of Mysql)</title>
168
<section xml:id="PostgreSQL_dle678">
169
<title>PostgreSQL</title>
170
<para>Install PostgreSQL and the python driver for PostgreSQL</para>
171
<programlisting>sudo apt-get install -y postgresql python-psycopg2</programlisting>
172
<para>Setup PostgreSQL to listen on all interfaces by editing /etc/postgresql/9.1/main/postgresql.conf and uncommenting and modifying the relevant line. Look for the right file if you have a different version of PostgreSQL</para>
173
<programlisting>listen_addresses = '*'</programlisting>
174
<para>Restart PostgreSQL server to ensure that it starts listening on all interfaces.</para>
175
<programlisting>sudo /etc/init.d/postgresql restart</programlisting>
176
<para>Create a user called 'novadbadmin' with password 'mygreatesecret', create the database 'nova' and give 'novadbadmin' all privileges on that database.</para>
181
CREATE user novadbadmin;
182
ALTER user novadbadmin with password 'mygreatsecret';
183
CREATE DATABASE nova;
184
GRANT ALL PRIVILEGES ON database nova TO novadbadmin;
186
<para>Configure Postgresql to accept connections from users from any machine on 10.10.10.0/24 and 192.168.3.0/24 by adding the following line to /etc/postgresql/9.1/main/pg_hba.conf.</para>
188
host all all 10.130.221.0/24 md5
189
host all all 192.168.3.0/24 md5
191
<para>Restart PostgreSQL.</para>
192
<programlisting>/etc/init.d/postgresql restart</programlisting>
194
<section xml:id="SQLite_dle899">
195
<title>SQLite</title>
176
196
<para>Installation</para>
177
<programlisting>sudo apt-get install sqlite</programlisting>
197
<programlisting>sudo apt-get install -y sqlite</programlisting>
180
200
<section xml:id="Nova_Components-d1e718">
263
286
<para>novarc contains several environmental variables including your nova credentials to be set before you can use the commands from euca2ools such euca-describe-images, euca-describe-instances etc. these variables can be set by sourcing novarc file.</para>
264
287
<programlisting>source /home/localadmin/creds/novarc
265
288
</programlisting>
266
<para>Restart all the nova related services.</para>
267
<programlisting>sudo restart libvirt-bin; sudo restart nova-network; sudo restart nova-compute; sudo restart nova-api; sudo restart nova-objectstore; sudo restart nova-scheduler; sudo restart nova-volume; sudo restart glance-api; sudo restart glance-registry</programlisting>
268
289
<para>Check if the credentials are working and if nova has been setup properly by running:</para>
269
290
<programlisting>euca-describe-availability-zones verbose
270
291
</programlisting>
271
292
<para>If you see something like the following with all components happy, it means that the set up is ready to be used.</para>
273
AVAILABILITYZONE nova available
274
AVAILABILITYZONE |- server1
275
AVAILABILITYZONE | |- nova-compute enabled : -) 2011-04-03 07:48:50
276
AVAILABILITYZONE | |- nova-scheduler enabled : -) 2011-04-03 07:48:48
277
AVAILABILITYZONE | |- nova-network enabled : -) 2011-04-03 07:48:49
278
AVAILABILITYZONE | |- nova-volume enabled : -) 2011-04-03 07:48:49
281
<section xml:id="Nova_dashboard-d1e879">
282
<title>Nova dashboard</title>
283
<para>OpenStack-dashboard is a web interface for managing users, user credentials, key pairs, images, instances etc.</para>
284
<para>Install bazaar version control system to fetch required software from the repository at launchpad.</para>
286
sudo apt-get install -y bzr
287
sudo easy_install virtualenv
289
<para>You have already finished setting up credentials for a user called localadmin in the Nova configuration section above. The credentials of this user will need to embedded into the dashboard's configuration file.</para>
290
<para>Checkout the source of OpenStack-dashboard from bzr and execute run_tests.sh, which does not only test the installation, but also installs several dependencies of the dashboard.</para>
293
sudo bzr branch lp:openstack-dashboard -r 46 /opt/osdb
296
cd openstack-dashboard
298
<para>Note: It has been tested with revison 46 of OpenStack Dashboard</para>
299
<para>Since you are trying to checkout from bzr anonymously, a message saying "You have not informed bzr of your Launchpad ID..." is displayed. You can safely ignore that.</para>
301
<para>Edit /opt/osdb/openstack-dashboard/local/local_settings.py to include certain details required for connecting to nova-api.</para>
303
NOVA_DEFAULT_ENDPOINT = 'http://localhost:8773/services/Cloud'
304
NOVA_DEFAULT_REGION = 'nova'
305
NOVA_ACCESS_KEY = 'b6a7e3ca-f894-473b-abca-84329d9829fa:proj'
306
NOVA_SECRET_KEY = '2d61a361-965a-4ed6-966a-d9f543b42531'
307
NOVA_ADMIN_USER = 'novaadmin'
308
NOVA_PROJECT = 'proj'
310
<para>A simple way of doing this will be to copy the relevant lines from novarc file that we discussed above.</para>
311
<section xml:id="Setting_Up_E-mail_service_for_the_web_interface-d1e919">
312
<title>Setting Up E-mail service for the web interface</title>
313
<para>In order to have mails generated by OpenStack dashboard delivered, we need to configure dashboard with the details of an smtp server by editing local_settings.py file.</para>
315
EMAIL_HOST = 'server1.example.com'
318
<para>If the mail server provides only authenticated SMTP, add the following lines:</para>
323
<para>If the mail server requires a TLS connection, add the following lines:</para>
324
<programlisting>EMAIL_USE_TLS = 'True'
326
<para>Create a openstack-dashboard database and its schema with the syncdb command. Provide the name/email address/desired password of the administrative user when prompted.</para>
327
<programlisting>sudo tools/with_venv.sh dashboard/manage.py syncdb</programlisting>
328
<para>While creating the schema, the above command asks you to create an admin account for the dashboard. Choose the user name as the project admin's user name you chose above while creating the project ( novadmin in our case). You can choose any password you like.</para>
329
<para>Launch the default python-django server. If you want the dashboard application to be available on port 8000 :</para>
330
<programlisting>sudo tools/with_venv.sh dashboard/manage.py runserver 10.10.10.2:8000
332
<para>To check the installation open a browser and enter the following URL</para>
333
<programlisting>http://10.10.10.2:8000
335
<para>You should be able to login as "novaadmin" using the password chosen above. Any other user trying to access the interface for the first time, will need to sign up and will be able to use the interface after the account is approved by the administrator.</para>
336
<para>A successful login and display of the project named "proj" on the dashboard will indicate that the dashboard has been setup successfully</para>
338
<section xml:id="OpenStack_Dashboard_with_Mysql_Database-d1e972">
339
<title>OpenStack Dashboard with Mysql Database</title>
340
<para>Dashboard uses SQLite database by default. For a production use, MySQL or PostgreSQL may be more preferable. The procedure for MySQL is given below. Procedure for PostgreSQL will be very similar.
342
<para>Install python-dev and libmysqlclient-dev</para>
344
sudo apt-get install libmysqlclient-dev
345
sudo apt-get install python-dev
347
<para>Activate virtualenv and install mysql-python package inside the virtual environment of Dashboard.</para>
349
cd /opt/osdb/openstack-dashboard
351
source .dashboard-venv/bin/activate
352
easy_install mysql-python
354
<para>Create a MySQL database user with all privileges on OpenStack Dashboard database</para>
356
mysql -uroot -pmygreatsecret
358
>create database dashboarddb;
359
>grant ALL on dashboarddb.* to nova@localhost identified by 'mygreatsecret';
361
<para>Update the DATABASES section of the Django's local_settings.py file (/opt/osdb/openstack-dashboard/local/local_settings.py) with the MySQL database settings. Here is the relevant extract from the updated file:</para>
365
'ENGINE': 'django.db.backends.mysql',
366
'NAME': 'dashboarddb',
368
'PASSWORD': 'mygreatsecret',
370
'default-character-set': 'utf8',
374
<para>Create the schema in the database</para>
375
<programlisting>sudo tools/with_venv.sh dashboard/manage.py syncdb
378
<section xml:id="Running_Dashboard_on_apache2_with_mod_wsgi-d1e1013">
379
<title>Running Dashboard on apache2 with mod_wsgi</title>
380
<para>While the web server that is included in Django is good for testing, for production use, it is recommended to use a web server like Apache with mod_wsgi.</para>
381
<para>Install apache2 and wsgi module.</para>
382
<programlisting>sudo apt-get install apache2 libapache2-mod-wsgi
384
<para>Dashboard includes a file django.wsgi(/opt/osdb/openstack-dashboard/dashboard/wsgi/django.wsgi) to help in running dashboard under Apache with WSGI. You can replace the default file with the file below.</para>
386
# Ref: http://jmoiron.net/blog/deploying-django-mod-wsgi-virtualenv/
392
#we are adding virtual environment path.
393
vepath = '/opt/osdb/openstack-dashboard/.dashboard-venv/lib/python2.7/site-packages'
394
os.environ['PYTHON_EGG_CACHE'] = '/opt/osdb/openstack-dashboard/.dashboard-venv/lib/python2.7/site-packages'
396
prev_sys_path = list(sys.path)
398
# add the site-packages of our virtualenv as a site dir
399
site.addsitedir(vepath)
401
# reorder sys.path so new directories from the addsitedir show up first
403
new_sys_path = [p for p in sys.path if p not in prev_sys_path]
405
for item in new_sys_path:
406
sys.path.remove(item)
407
sys.path[:0] = new_sys_path
409
# import from down here to pull in possible virtualenv django install
411
from django.core.handlers.wsgi import WSGIHandler
412
os.environ['DJANGO_SETTINGS_MODULE'] = 'dashboard.settings'
413
application = WSGIHandler()
416
<section xml:id="Setting_up_the_virtual_host_and_WSGI_alias_in_Apache-d1e1035">
417
<title>Setting up the virtual host and WSGI alias in Apache</title>
418
<para>Create /etc/apache2/sites-available/openstack with the following contents:</para>
421
<VirtualHost 10.10.10.2:8000>
422
ServerName 10.10.10.2
423
WSGIScriptAlias / /opt/osdb/openstack-dashboard/dashboard/wsgi/django.wsgi
424
Alias /media/admin/ /opt/osdb/openstack-dashboard/.dashboard-venv/lib/python2.7/site-packages/django/contrib/admin/media/
427
<para>Enable virtual host.</para>
429
sudo a2ensite openstack
430
sudo /etc/init.d/apache2 reload
432
<para>Dashboard should now be available at http://10.10.10.2:8000</para>
294
AVAILABILITYZONE nova available
295
AVAILABILITYZONE |- server1
296
AVAILABILITYZONE | |- nova-compute enabled :-) 2011-09-29 07:26:04
297
AVAILABILITYZONE | |- nova-scheduler enabled :-) 2011-09-29 07:26:04
298
AVAILABILITYZONE | |- nova-network enabled :-) 2011-09-29 07:26:07
299
AVAILABILITYZONE | |- nova-volume enabled :-) 2011-09-29 07:26:06
436
303
<section xml:id="Server_2-d1e1059">
437
<title>Server 2</title>
438
<para>This server runs nova-compute and all the virtual machines and hypervisor. You can also bundle images on Server 2.</para>
304
<title>Server2</title>
305
<para>This server runs nova-compute and all the virtual machines and hypervisor. You can also bundle images on Server2.</para>
439
306
<section xml:id="BaseOS-d1e1064">
440
307
<title>BaseOS</title>
441
308
<para>Install 64-bit version of Natty Server</para>