~openstackbook/openstackbook/cactus

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
<?xml version="1.0" encoding="UTF-8"?><chapter xmlns:db="http://docbook.org/ns/docbook" xmlns="http://docbook.org/ns/docbook" xml:id="Installation_and_configuration-d1e385" version="5.0" xml:base="Installation.xml">
 <title>Installation and Configuration</title>
<section xml:id="Introduction-d1e390">
<title>Introduction</title>
<para>The following section describes how to set up a minimal cloud infrastructure based on OpenStack using 3 machines. These machines are referred to in this and subsequent chapters as Server1 and Server2 and Client1. Server1 runs all the components of Nova as well as Glance and OpenStack dashboard. Server2 runs only nova-compute. Since OpenStack components follow a shared-nothing policy, each component or any group of components can be installed on any server.</para>
<para>Client1 is not a required component. In our sample setup, it is used for bundling images, as a client to the web interface, and to run euca commands to manage the infrastructure. Having this client ensures that you do not need to meddle with the servers for tasks such as bundling. Also, bundling of Desktop Systems including Windows will require a GUI and it is better to have a dedicated machine for this purpose. We would recommend this machine to be VT-Enabled so that KVM can be run which allows for Windows VMs during image creation for bundling.</para>
<para>
<mediaobject>
 <imageobject role="fo">
  <imagedata fileref="images/openstackv5.png"
   format="PNG" scale="60"/>
 </imageobject>
 <imageobject role="html">
  <imagedata fileref="images/openstackv5html.png"
   format="PNG" />
 </imageobject>
</mediaobject>
</para>

<para>The installation steps use certain specifics such as host names/IP addresses etc. Modify them to suit your environment before using them. The following table summarizes these specifics.</para>
<table xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:html="http://www.w3.org/1999/xhtml" frame="all">
<title>Configuration</title>
<tgroup cols="4">
<thead>
<row>
<entry/>
<entry>Server 1</entry>
<entry>Server 2</entry>
<entry>Client 1</entry>
</row>
</thead>
<tbody>
<row>
<entry>Functionality</entry>
<entry>All components of OpenStack including nova-compute</entry>
<entry>nova-compute</entry>
<entry>Client</entry>
</row>
<row>
<entry>No of NICs</entry>
<entry>eth0 - Public N/W, eth1 - Private N/W</entry>
<entry>eth0 - Public N/W, eth1 - Private N/W</entry>
<entry>eth0 - Public N/W</entry>
</row>
<row>
<entry>IP addresses</entry>
<entry>eth0 - 10.10.10.2, eth1 - 192.168.3.1</entry>
<entry>eth0 - 10.10.10.3, eth1 - 192.168.3.2</entry>
<entry>eth0 - 10.10.10.4</entry>
</row>
<row>
<entry>Hostname</entry>
<entry>server1.example.com</entry>
<entry>server2.example.com</entry>
<entry>client.example.com</entry>
</row>
<row>
<entry>DNS servers</entry>
<entry>10.10.10.3</entry>
<entry>10.10.10.3</entry>
<entry>10.10.10.3</entry>
</row>
<row>
<entry>Gateway IP</entry>
<entry>10.10.10.1</entry>
<entry>10.10.10.1</entry>
<entry>10.10.10.1</entry>
</row>
</tbody>
</tgroup>
</table>
</section>
<section xml:id="Server1-d1e537">
<title>Server1</title>
 <para>As shown in the figure above, Server1 contains all nova- services including nova-compute, nova-api, nova-volume, nova-network, nova-objectstore as well as the Image Service Glance and the Dashboard. It contains two Network Interface Cards (NICs).</para>
<section xml:id="Base_OS-d1e542">
<title>Base OS</title>
<para>Boot the server off the Ubuntu server 11.04 CD. At the graphical menu select Install Ubuntu server and proceed with basic installation steps.
</para>
<para>We will also be running nova-volume on this server and it is ideal to have a dedicated partition for the use of nova-volume. So, ensure that you choose manual partitioning scheme while installing Ubuntu Server and create a dedicated partition with adequate amount of space for this purpose. We have referred to this partition in the rest of the chapter as /dev/sda6. You can substitute the correct device name of this dedicated partition based on your local setup while following the instructions. Also ensure that the partition type is set as Linux LVM ( 8e ) using fdisk either during install or immediately after installation is over.</para>
<itemizedlist>
<listitem><para>Create the first user with the name 'localadmin' .</para></listitem>
<listitem><para>Installation lets you setup the IP address for the first interface i.e. eth0. Set the IP address details.</para></listitem>
<listitem><para>During installation select only Openssh-server in the packages menu.</para></listitem>
</itemizedlist>
<para>Nova and Glance have been included in Universe repository . Enable Universe repository in your /etc/apt/sources.list.</para>
<para>Update the machine using the following commands.</para>
<programlisting>sudo apt-get update</programlisting>
<programlisting>sudo apt-get upgrade</programlisting>
<para>Install bridge-utils:</para>
<programlisting>sudo apt-get install bridge-utils</programlisting>
<para>Reboot the server and login as the admin user(localadmin) created during the OS installation.</para>
</section>
<section xml:id="Networking_Configuration-d1e591">
<title>Networking Configuration</title>
<para>Edit the /etc/network/interfaces file so as to looks like this:</para>
<programlisting>
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 10.10.10.2
netmask 255.255.255.0
broadcast 10.10.10.255
gateway 10.10.10.1
dns-nameservers 10.10.10.3

auto br100
iface br100 inet static
bridge_ports eth1
bridge_stp off
bridge_maxwait 0
bridge_fd 0
address 192.168.3.1
netmask 255.255.0.0
broadcast 192.168.255.255
</programlisting>
<para>Restart the network now</para>
<programlisting>sudo /etc/init.d/networking restart</programlisting>
</section>
<section xml:id="NTP_Server-d1e609">
<title>NTP Server</title>
<para>Install NTP package. This server is going to act as an NTP server for the nodes. The time on all components of OpenStack will have to be in sync. We can run NTP server on this and have other components sync to it.</para>
<programlisting>sudo apt-get install ntp</programlisting>
<para>Open the file /etc/ntp.conf and add the following 2 lines to make sure that the server serves time even when its connectivity to the Internet is down. The following settings ensure that the NTP server uses its own clock as the clock source:</para>
<programlisting>
server 127.127.1.0
fudge 127.127.1.0 stratum 10
</programlisting>
<para>Restart NTP service to make the changes effective</para>
<programlisting>sudo /etc/init.d/ntp restart</programlisting>
</section>
<section xml:id="Glance-d1e634">
<title>Glance</title>
<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>
<programlisting>sudo apt-get install glance
</programlisting>
<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>
<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>
<para>Glance has two components - glance-api and glance-registry. These can be controlled using the concerned upstart jobs.</para>
</section>
<section xml:id="MySQL_Server-d1e657"><title>MySQL Server</title>
<para>Install mysql-server package</para>
<programlisting>sudo apt-get install -y mysql-server
</programlisting>
<section xml:id="Configuration-d1e667">
<title>Configuration</title>
<para>Set a variable called "MYSQL_PASS" for use in the various commands below:</para>
<programlisting>MYSQL_PASS="mygreatsecret"
</programlisting>
<para>Change the bind address from 127.0.0.1 to 0.0.0.0 in /etc/mysql/my.cnf and it will look like this:</para>
<programlisting>bind-address = 0.0.0.0
</programlisting>
<para>Restart MySQL server to ensure that it starts listening on all interfaces.</para>
<programlisting>sudo restart mysql
</programlisting>
<para>If you did not set the MySQL root password during installation, set it now.</para>
<programlisting>mysqladmin -u root password $MYSQL_PASS
</programlisting>
<para>Create a database named nova.</para>
<programlisting>sudo mysql -uroot -p$MYSQL_PASS -e 'CREATE DATABASE nova;'
</programlisting>
<para>Update the database to grant super user privileges for root user to login from any IP.</para>
<programlisting>sudo mysql -uroot -p$MYSQL_PASS -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;"</programlisting>
<para>Set MySQL root password for login from any IP.</para>
<programlisting>sudo mysql -uroot -p$MYSQL_PASS -e "SET PASSWORD FOR 'root'@'%' = PASSWORD('$MYSQL_PASS');"</programlisting>
</section>
</section>
<section xml:id="Nova_Components-d1e718">
<title>Nova Components</title>
<para>Install the messaging queue server, RabbitMQ and various nova components.</para>
<programlisting>sudo apt-get install -y rabbitmq-server nova-common nova-doc python-nova python-psycopq2 nova-api nova-network nova-volume nova-objectstore nova-scheduler nova-compute</programlisting>
<para>Install euca2ools package for command line tools to interact with nova.</para>
<programlisting>sudo apt-get install -y euca2ools
</programlisting>
<para>Install unzip for extracting archives.</para>
<programlisting>sudo apt-get install -y unzip
</programlisting>
<para>Edit the /etc/nova/nova.conf file to look like this.</para>
<programlisting>
--dhcpbridge_flagfile=/etc/nova/nova.conf
--dhcpbridge=/usr/bin/nova-dhcpbridge
--logdir=/var/log/nova
--lock_path=/var/lock/nova
--state_path=/var/lib/nova
--verbose
--s3_host=10.10.10.2
--rabbit_host=192.168.3.1
--cc_host=192.168.3.1
--ec2_url=http://10.10.10.2:8773/services/Cloud
--fixed_range=192.168.0.0/16
--network_size=8
--FAKE_subdomain=ec2
--routing_source_ip=192.168.3.1
--sql_connection=mysql://root:mygreatsecret@10.10.10.2/nova
--glance_host=192.168.3.1
--image_service=nova.image.glance.GlanceImageService
--iscsi_ip_prefix=192.168.
</programlisting>
<para>Enable iscsitarget.</para>
<programlisting>sudo sed -i 's/false/true/g' /etc/default/iscsitarget</programlisting>
<para>Restart the iscsitarget service</para>
<programlisting>sudo service iscsitarget restart</programlisting>
<para>Create a Physical Volume.</para>
<programlisting>sudo pvcreate /dev/sda6
</programlisting>
<para>Create a Volume Group named nova-volumes.</para>
<programlisting>sudo vgcreate nova-volumes /dev/sda6
</programlisting>
<para>Create a group called "nova".</para>
<programlisting>sudo groupadd nova
</programlisting>
<para>Change the ownership of the /etc/nova folder and permissions for /etc/nova/nova.conf:</para>
<programlisting>
sudo chown -R root:nova /etc/nova
sudo chmod 644 /etc/nova/nova.conf
</programlisting>
<para>Restart all the nova related services.</para>
<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>
<para>Create nova schema in the MySQL Database.</para>
<programlisting>sudo nova-manage db sync</programlisting>
<para>Create a list of IPs to be used from the network of fixed Ips set inside nova.conf.</para>
<programlisting>sudo nova-manage network create 192.168.3.0/24 1 255
</programlisting>
<para>Allocate 32 pubic IP addresses for use with the instances starting from 10.10.10.225.</para>
<programlisting>sudo nova-manage floating create 10.10.10.2 10.10.10.224/27
</programlisting>
<para>Create a user with admin rights on nova.</para>
<programlisting>sudo nova-manage user admin novaadmin
</programlisting>
<para>Create a project named proj.</para>
<programlisting>sudo nova-manage project create proj novaadmin
</programlisting>
<para>Create a directory to download nova credentials and download the zip file.</para>
<programlisting>mkdir /home/localadmin/creds
</programlisting>
<para>Generate and save credentials for accessing/managing the nova cloud.</para>
<programlisting>sudo nova-manage project zipfile proj novaadmin /home/localadmin/creds/novacreds.zip
</programlisting>
<para>Contents of novacreds.zip are required to use euca2ools to manage the cloud infrastructure and you will need to transfer this zip file to any machine from where you want to run the commands from euca2ools. We will be using these credentials from client1 as well.
</para>
<para>Navigate in to the folder created and extract the files and change their ownership.</para>
<programlisting>
cd /home/localadmin/creds
unzip novacreds.zip
sudo chown localadmin:localadmin /home/localadmin/creds/ -R
</programlisting>
<para>Here are the files extracted:</para>
<para>cacert.pem, cert.pem, novarc, pk.pem</para>
<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>
<programlisting>source /home/localadmin/creds/novarc
</programlisting>
<para>Restart all the nova related services.</para>
<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>
<para>Check if the credentials are working and if nova has been setup properly by running:</para>
<programlisting>euca-describe-availability-zones verbose
</programlisting>
<para>If you see something like the following with all components happy, it means that the set up is ready to be used.</para>
<programlisting>
AVAILABILITYZONE nova available
AVAILABILITYZONE |- server1
AVAILABILITYZONE | |- nova-compute enabled : -) 2011-04-03 07:48:50
AVAILABILITYZONE | |- nova-scheduler enabled : -) 2011-04-03 07:48:48
AVAILABILITYZONE | |- nova-network enabled : -) 2011-04-03 07:48:49
AVAILABILITYZONE | |- nova-volume enabled : -) 2011-04-03 07:48:49
</programlisting>
</section>
<section xml:id="Nova_dashboard-d1e879">
<title>Nova dashboard</title>
<para>OpenStack-dashboard is a web interface for managing users, user credentials, key pairs, images, instances etc.</para>
<programlisting>
sudo easy_install virtualenv
</programlisting>
<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>
<para>Checkout the source of OpenStack-dashboard from github and execute run_tests.sh, which does not only test the installation, but also installs several dependencies of the dashboard.</para>
<programlisting>
cd /opt    
sudo wget https://github.com/4P/horizon/zipball/2011.2
sudo unzip 2011.2
sudo mv 4P-horizon-03dce19 osdb
cd osdb
sudo sh run_tests.sh
cd openstack-dashboard
</programlisting>

<para>Edit /opt/osdb/openstack-dashboard/local/local_settings.py to include certain details required for connecting to nova-api.</para>
<programlisting>
NOVA_DEFAULT_ENDPOINT = 'http://localhost:8773/services/Cloud'
NOVA_DEFAULT_REGION = 'nova'
NOVA_ACCESS_KEY = 'b6a7e3ca-f894-473b-abca-84329d9829fa:proj'
NOVA_SECRET_KEY = '2d61a361-965a-4ed6-966a-d9f543b42531'
NOVA_ADMIN_USER = 'novaadmin'
NOVA_PROJECT = 'proj'
</programlisting>
<para>A simple way of doing this will be to copy the relevant lines from novarc file that we discussed above.</para>
<section xml:id="Setting_Up_E-mail_service_for_the_web_interface-d1e919">
<title>Setting Up E-mail service for the web interface</title>
<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>
<programlisting>
EMAIL_HOST = 'server1.example.com'
EMAIL_PORT = 25
</programlisting>
<para>If the mail server provides only authenticated SMTP, add the following lines:</para>
<programlisting>
EMAIL_USER =
EMAIL_PASSWORD =
</programlisting>
<para>If the mail server requires a TLS connection, add the following lines:</para>
<programlisting>EMAIL_USE_TLS = 'True'
</programlisting>
<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>
<programlisting>sudo tools/with_venv.sh dashboard/manage.py syncdb</programlisting>
<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>
<para>Launch the default python-django server. If you want the dashboard application to be available on port 8000:</para>
<programlisting>sudo tools/with_venv.sh dashboard/manage.py runserver 10.10.10.2:8000
</programlisting>
<para>To check the installation open a browser and enter the following URL</para>
<programlisting>http://10.10.10.2:8000
</programlisting>
<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>
<para>A successful login and display of the project named "proj" on the dashboard will indicate that the dashboard has been setup successfully</para>
</section>
<section xml:id="OpenStack_Dashboard_with_Mysql_Database-d1e972">
<title>OpenStack Dashboard with Mysql Database</title>
<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.
</para>
<para>Install python-dev and libmysqlclient-dev</para>
<programlisting>
sudo apt-get install libmysqlclient-dev
sudo apt-get install python-dev
</programlisting>
<para>Activate virtualenv and install mysql-python package inside the virtual environment of Dashboard.</para>
<programlisting>
cd /opt/osdb/openstack-dashboard
sudo bash
source .dashboard-venv/bin/activate
easy_install mysql-python
</programlisting>
<para>Create a MySQL database user with all privileges on OpenStack Dashboard database</para>
<programlisting>
mysql -uroot -pmygreatsecret

&gt;create database dashboarddb;
&gt;grant ALL on dashboarddb.* to nova@localhost identified by 'mygreatsecret';
</programlisting>
<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>
<programlisting>
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'dashboarddb',
        'USER': 'nova',
        'PASSWORD': 'mygreatsecret',
        'HOST': 'localhost',
        'default-character-set': 'utf8',
    }
}
</programlisting>
<para>Create the schema in the database</para>
<programlisting>sudo tools/with_venv.sh dashboard/manage.py syncdb
</programlisting>
</section>
<section xml:id="Running_Dashboard_on_apache2_with_mod_wsgi-d1e1013">
<title>Running Dashboard on apache2 with mod_wsgi</title>
<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>
<para>Install apache2 and wsgi module.</para>
<programlisting>sudo apt-get install apache2 libapache2-mod-wsgi
</programlisting>
<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>
<programlisting>
# Ref: http://jmoiron.net/blog/deploying-django-mod-wsgi-virtualenv/

import sys
import site
import os

#we are adding virtual environment path.
vepath = '/opt/osdb/openstack-dashboard/.dashboard-venv/lib/python2.7/site-packages'
os.environ['PYTHON_EGG_CACHE'] = '/opt/osdb/openstack-dashboard/.dashboard-venv/lib/python2.7/site-packages'

prev_sys_path = list(sys.path)

# add the site-packages of our virtualenv as a site dir
site.addsitedir(vepath)

# reorder sys.path so new directories from the addsitedir show up first

new_sys_path = [p for p in sys.path if p not in prev_sys_path]

for item in new_sys_path:
    sys.path.remove(item)
sys.path[:0] = new_sys_path

# import from down here to pull in possible virtualenv django install

from django.core.handlers.wsgi import WSGIHandler
os.environ['DJANGO_SETTINGS_MODULE'] = 'dashboard.settings'
application = WSGIHandler()
</programlisting>
</section>
<section xml:id="Setting_up_the_virtual_host_and_WSGI_alias_in_Apache-d1e1035">
<title>Setting up the virtual host and WSGI alias in Apache</title>
<para>Create /etc/apache2/sites-available/openstack with the following contents:</para>
<programlisting>
Listen 8000
&lt;VirtualHost 10.10.10.2:8000&gt;
    ServerName 10.10.10.2
    WSGIScriptAlias / /opt/osdb/openstack-dashboard/dashboard/wsgi/django.wsgi
    Alias /media/admin/  /opt/osdb/openstack-dashboard/.dashboard-venv/lib/python2.7/site-packages/django/contrib/admin/media/
&lt;/VirtualHost&gt;
</programlisting>
<para>Enable virtual host.</para>
<programlisting>
sudo a2ensite openstack
sudo /etc/init.d/apache2 reload
</programlisting>
<para>Dashboard should now be available at http://10.10.10.2:8000</para>
</section>
</section>
</section>
<section xml:id="Server_2-d1e1059">
<title>Server 2</title>
 <para>This server runs nova-compute and all the virtual machines and hypervisor. You can also bundle images on Server 2.</para>
<section xml:id="BaseOS-d1e1064">
<title>BaseOS</title>
<para>Install 64-bit version of Natty Server</para>
</section>
<section xml:id="Networking_Configuration-d1e1073">
<title>Networking Configuration</title>
<para>Install bridge-utils:</para>
<programlisting>sudo apt-get install bridge-utils</programlisting>
<para>Edit the /etc/network/interfaces file so as to looks like this:</para>
<programlisting>
auto lo
 iface lo inet loopback
 auto eth0
 iface eth0 inet static
 address 10.10.10.3
 netmask 255.255.255.0
 broadcast 10.10.10.255
 gateway 10.10.10.1
 dns-nameservers 10.10.10.3

auto br100
 iface br100 inet static
 bridge_ports eth1
 bridge_stp off
 bridge_maxwait 0
 bridge_fd 0
 address 192.168.3.2
 netmask 255.255.0.0
 broadcast 192.168.255.255
</programlisting>
<para>Restart the network now</para>
<programlisting>sudo /etc/init.d/networking restart</programlisting>
</section>
<section xml:id="NTP_Client-d1e1098">
<title>NTP Client</title>
<para>Install NTP package.</para>
<programlisting>sudo apt-get install ntp</programlisting>
<para>Open the file /etc/ntp.conf and add the following line to sync to server1.</para>
<programlisting>server 10.10.10.2</programlisting>
<para>Restart NTP service to make the changes effective</para>
<programlisting>sudo /etc/init.d/ntp restart</programlisting>
</section>
<section xml:id="Nova_Components_nova-compute_alone_-d1e1123">
<title>Nova Components (nova-compute alone)</title>
<para>Install the nova-components and dependencies.</para>
<programlisting>
sudo apt-get install -y nova-common python-nova python-psycopq2 nova-compute vlan
</programlisting>
<para>Install euca tools, for command line tools</para>
<programlisting>sudo apt-get install -y euca2ools</programlisting>
<para>Install unzip for extracting archives</para>
<programlisting>
sudo apt-get install -y unzip
</programlisting>
<para>Edit the /etc/nova/nova.conf file to look like this. This file is essentially similar to the configuration file (/etc/nova/nova.conf) of Server1</para>
<programlisting>
--dhcpbridge_flagfile=/etc/nova/nova.conf
--dhcpbridge=/usr/bin/nova-dhcpbridge
--logdir=/var/log/nova
--lock_path=/var/lock/nova
--state_path=/var/lib/nova
--verbose
--s3_host=10.10.10.2
--rabbit_host=192.168.3.1
--cc_host=192.168.3.1
--ec2_url=http://10.10.10.2:8773/services/Cloud
--fixed_range=192.168.0.0/16
--network_size=8
--FAKE_subdomain=ec2
--routing_source_ip=192.168.3.2
--sql_connection=mysql://root:mygreatsecret@10.10.10.2/nova
--glance_host=192.168.3.1
--image_service=nova.image.glance.GlanceImageService
</programlisting>
</section>
</section>
<section xml:id="Client1-d1e1155">
<title>Client1</title>
<section xml:id="BaseOS-d1e1160">
<title>BaseOS</title>
<para>Install 64-bit version of Natty Desktop</para>
</section>
<section xml:id="Networking_Configuration-d1e1169">
<title>Networking Configuration</title>
<para>Edit the /etc/network/interfaces file so as to looks like this:</para>
<programlisting>
auto lo
 iface lo inet loopback
auto eth0
 iface eth0 inet static
 address 10.10.10.4
 netmask 255.255.255.0
 broadcast 10.10.10.255
 gateway 10.10.10.1
 dns-nameservers 10.10.10.3
</programlisting>
</section>
<section xml:id="NTP_Client-d1e1181">
<title>NTP Client</title>
<para>Install NTP package.</para>
<programlisting>sudo apt-get install ntp
</programlisting>
<para>Open the file /etc/ntp.conf and add the following line to sync to server1.</para>
<programlisting>
server 10.10.10.2
</programlisting>
<para>Restart NTP service to make the changes effective</para>
<programlisting>
sudo /etc/init.d/ntp restart
</programlisting>
</section>
<section xml:id="Client_Tools-d1e1206">
<title>Client Tools</title>
<para>As mentioned above, this is a desktop installation of Natty to be used for tasks such as bundling of images. It will also be used for managing the cloud infrastructure using euca2ools.</para>
<para>Install euca tools, for command line tools</para>
<programlisting>sudo apt-get install -y euca2ools</programlisting>
<para>Install qemu-kvm</para>
<programlisting>sudo apt-get install qemu-kvm</programlisting>
<para>Download the credentials we created for localadmin to this machine:</para>
<programlisting>
mkdir /home/localadmin/creds
cd /home/localadmin/creds
scp localadmin@10.10.10.2:/home/localadmin/creds/novacreds.zip .
unzip creds.zip
</programlisting>
<para>Source novarc file and see if connectivity to api server is working correctly:</para>
<programlisting>
source novarc
euca-describe-availability-zones verbose
</programlisting>
<para>The output should be similar to what is shown above in the configuration section for server1.</para>
<para>Note: If you want to avoid manually sourcing the novarc file every time, the user can add the following line to the .profile file in his home directory:</para>
<programlisting>
source /home/localadmin/creds/novarc
</programlisting>
</section>
</section>
</chapter>