—————————————————————————————————————–
—————————————————————————————————————–
server1
—————————————————————————————————————–
——————————————————————————————————————

0.
sudo apt-get update
sudo apt-get upgrade

1.
sudo apt-get install -y bridge-utils

2.
————————————–
sudo vi /etc/network/interfaces

auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.120
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.10

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.255.0
broadcast 192.168.255.255

—————————————
sudo vi /etc/network/interfaces

search smartmap
nameserver 218.30.19.40
nameserver 192.168.0.3

3.
sudo /etc/init.d/networking restart

 

4.
sudo apt-get install -y ntp

5.
sudo vi /etc/ntp.conf

server ntp.ubuntu.com
server 127.127.1.0
fudge 127.127.1.0 stratum 10

6.
sudo /etc/init.d/ntp restart

7.
sudo apt-get install -y mysql-server

8.
sudo vi /etc/mysql/my.cnf

bind-address = 0.0.0.0

9.
sudo restart mysql

10.
sudo apt-get install -y glance

10.1
sudo mysql -u root -p -e \’CREATE DATABASE glance;\’

10.2
sudo mysql -u root -p -e \’CREATE USER glancedbadmin;\’

10.3
sudo mysql -u root -p -e “GRANT ALL PRIVILEGES ON glance.* TO \’glancedbadmin\’@\’%\’ ;”

10.4
sudo mysql -u root -p -e “SET PASSWORD FOR \’glancedbadmin\’@\’%\’ = PASSWORD(\’zyx\’);”

11.
sudo vi /etc/glance/glance-registry.conf

sql_connection = mysql://glancedbadmin:zyx@192.168.1.120/glance

12
sudo restart glance-registry

13
sudo apt-get install -y rabbitmq-server nova-common nova-doc python-nova nova-api nova-network nova-volume nova-objectstore nova-scheduler nova-compute

14
sudo apt-get install -y euca2ools

15
sudo apt-get install -y unzip

15.1
sudo mysql -u root -p -e \’CREATE DATABASE nova;\’

15.2
sudo mysql -u root -p -e \’CREATE USER novadbadmin;\’

15.3
sudo mysql -u root -p -e “GRANT ALL PRIVILEGES ON nova.* TO \’novadbadmin\’@\’%\’ ;”

15.4
sudo mysql -u root -p -e “SET PASSWORD FOR \’novadbadmin\’@\’%\’ = PASSWORD(\’zyx\’);”

16.
sudo vi /etc/nova/nova.conf

 

–dhcpbridge_flagfile=/etc/nova/nova.conf
–dhcpbridge=/usr/bin/nova-dhcpbridge
–logdir=/var/log/nova
–state_path=/var/lib/nova
–lock_path=/var/lock/nova
–verbose
–s3_host=192.168.1.120
–rabbit_host=192.168.1.120
–cc_host=192.168.1.120
–nova_url=http://192.168.1.120:8774/v1.1/
–fixed_range=192.168.0.0/16
–network_size=8
–routing_source_ip=192.168.1.120
–sql_connection=mysql://novadbadmin:zyx@127.0.0.1/nova
–glance_api_servers=192.168.3.1:9292
–image_service=nova.image.glance.GlanceImageService
–iscsi_ip_prefix=192.168.
–vlan_interface=br100
–public_interface=eth0

另作参考
/etc/nova/nova.conf

–dhcpbridge_flagfile=/etc/nova/nova.conf
–dhcpbridge=/usr/bin/nova-dhcpbridge
–logdir=/var/log/nova
–state_path=/var/lib/nova
–lock_path=/var/lock/nova
–flagfile=/etc/nova/nova-compute.conf
–verbose
#
–sql_connection=mysql://novadbuser:novaDBsekret@172.17.0.133/nova
#
–network_manager=nova.network.manager.FlatDHCPManager
–flat_network_bridge=br100
–flat_injected=False
–flat_interface=eth0
–public_interface=eth0
#
–vncproxy_url=http://172.17.0.133:6080
–daemonize=1
–rabbit_host=172.17.0.133
–osapi_host=172.17.0.133
–ec2_host=172.17.0.133
–image_service=nova.image.glance.GlanceImageService
–glance_api_servers=172.17.0.133:9292
–use_syslog

 

17.
sudo apt-get -y install iscsitarget iscsitarget-dkms

18
sudo sed -i \’s/false/true/g\’ /etc/default/iscsitarget

19
sudo service iscsitarget restart

20
20.1
sudo pvcreate /dev/sda5

20.2
sudo vgcreate nova-volumes /dev/sda5

20.3
sudo chown -R root:nova /etc/nova
sudo chmod 644 /etc/nova/nova.conf

20.4

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

 

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

21
sudo nova-manage db sync

22
sudo nova-manage network create private 192.168.3.0/24 1 256

23
sudo nova-manage floating create –ip_range=192.168.0.224/27

24
sudo nova-manage user admin novaadmin
——————————————
export EC2_ACCESS_KEY=8fd58eb3-11f6-4131-9c8b-6d3e83119a9c
export EC2_SECRET_KEY=a3201eba-0cdf-43ca-88da-4e4ccbafea5f
———————————————————

 

25
sudo nova-manage project create proj novaadmin

26
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

 

27
mkdir /home/zyx/creds

28
sudo nova-manage project zipfile proj novaadmin /home/zyx/creds/novacreds.zip

29
cd /home/zyx/creds
unzip novacreds.zip
sudo chown zyx:zyx /home/zyx/creds/ -R

30
sudo nova-manage user exports novaadmin
———————————————

export EC2_ACCESS_KEY=8fd58eb3-11f6-4131-9c8b-6d3e83119a9c
export EC2_SECRET_KEY=a3201eba-0cdf-43ca-88da-4e4ccbafea5f

————————————————————

31
sudo vi novarc

Open the novarc file and replace the line
export EC2_ACCESS_KEY=”novaadmin:proj”
with
export EC2_ACCESS_KEY=”8fd58eb3-11f6-4131-9c8b-6d3e83119a9c:proj”

32
source /home/zyx/creds/novarc

 

33
euca-describe-availability-zones verbose

——————————————————–
1
sudo apt-get install swift swift-proxy memcached swift-account swift-container swift-object

2
sudo apt-get install xfsprogs curl

3
sudo fdisk /dev/sdb

4
sudo mkfs.xfs -i size=1024 /dev/sdb1
sudo tune2fs -l /dev/sdb1 |grep -i inode

5
sudo mkdir /mnt/sdb1

6
sudo vi /etc/fstab

/dev/sdb1 /mnt/sdb1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0

7
sudo mkdir /mnt/sdb1

——————————————————————-

1.
sudo apt-get install -y bzr

2.
sudo easy_install virtualenv

3.
sudo bzr init-repo .

4.
sudo bzr branch lp:openstack-dashboard -r 46 /opt/osdb

 

 

—————————————————————————————————————–
—————————————————————————————————————–
server2
—————————————————————————————————————–
——————————————————————————————————————

1.
sudo apt-get install -y bridge-utils

2.
sudo vi /etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
# auto eth0
# iface eth0 inet dhcp

auto eth0
iface eth0 inet static
address 192.168.1.130
netmask 255.255.255.0
gateway 192.168.1.10

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.255.0
broadcast 192.168.255.255

3.
sudo /etc/init.d/networking restart

4.
sudo apt-get install -y ntp

5.
sudo vi /etc/ntp.conf

server 192.168.0.120

6.
sudo /etc/init.d/ntp restart

7.
sudo apt-get install -y nova-common python-nova nova-compute vlan

8.
sudo apt-get install -y euca2ools

9.
sudo apt-get install -y unzip

10.
sudo vi /etc/nova/nova.conf

–dhcpbridge_flagfile=/etc/nova/nova.conf
–dhcpbridge=/usr/bin/nova-dhcpbridge
–logdir=/var/log/nova
–state_path=/var/lib/nova
–lock_path=/var/lock/nova
–state_path=/var/lib/nova
–verbose
–s3_host=192.168.0.120
–rabbit_host=192.168.0.120
–cc_host=192.168.0.120
–network_size=8
–routing_source_ip=192.168.0.120
–sql_connection=mysql://root:zyx@192.168.0.120/nova
–glance_api_servers=192.168.3.1:9292
–image_service=nova.image.glance.GlanceImageService
–iscsi_ip_prefix=192.168.
–vlan_interface=br100

11.
sudo restart nova-compute

11.(在Service1上)
euca-describe-availability-zones verbose

———————————————————–
AVAILABILITYZONE        nova    available
AVAILABILITYZONE        |- ubuntuServer
AVAILABILITYZONE        | |- nova-network       enabled 🙂 2012-01-08 02:46:27
AVAILABILITYZONE        | |- nova-compute       enabled 🙂 2012-01-08 02:46:36
AVAILABILITYZONE        | |- nova-scheduler     enabled 🙂 2012-01-08 02:46:35
AVAILABILITYZONE        | |- nova-volume        enabled 🙂 2012-01-08 02:46:36
AVAILABILITYZONE        |- ubuntuServer2
AVAILABILITYZONE        | |- nova-compute       enabled 🙂 2012-01-08 02:46:35

 

—————————————————————————————————————–
—————————————————————————————————————–
client
—————————————————————————————————————–
——————————————————————————————————————
1.
sudo vi /etc/network/interfaces

auto lo
iface lo inet loopback

# The primary network interface
# auto eth0
# iface eth0 inet dhcp

auto eth0
iface eth0 inet static
address 192.168.1.150
netmask 255.255.255.0
gateway 192.168.1.1

2.
sudo /etc/init.d/networking restart

3.
sudo apt-get install -y ntp

4.
sudo vi /etc/ntp.conf

server 192.168.0.120

5.
sudo /etc/init.d/ntp restart

6.
sudo apt-get install -y euca2ools

7.
sudo apt-get install -y qemu-kvm

8.
sudo apt-get install -y unzip

8.
mkdir /home/zyx/creds
cd /home/zyx/creds
scp zyx@192.168.1.120:/home/zyx/creds/novacreds.zip .      //  1032d205-9237-41c3-b072-ff8b11de5e8e
unzip novacreds.zip

9.
source novarc
euca-describe-availability-zones verbose

10.
vi .profile

source /home/zyx/creds/novarc

—————————————————————————————————————-
Desktop-VNC
—————————————————————————————————————–
1.
sudo apt-get update

2.The instructions are same as converting a normal server install to a desktop one. Gnome 3 is the default in 11.10, so you can just run the following(press Ctrl – Alt – T to open Terminal)

sudo apt-get install ubuntu-desktop
sudo startx

3.(optional)
apt-get install gdm

4.
sudo apt-get install -y vnc4server

5.
su – zyx

6.
vncpasswd

 

7.
vncserver :1
vncserver -kill :1

8.
vi .vnc/xstartup

# add follows
exec gnome-session &

6.
vncserver :1 -geometry 1280×800 -depth 24

vncserver -kill :1

 

8.
sudo dpkg -l | grep vnc

sudo apt-cache search vnc

sudo apt-get install xvnc4viewer

 

—————————————————————————
LVM–Mount
—————————————————————————

1.安装lvm2

 sudo apt-get install lvm2

 

2.

sudo fdisk -l
————结果———

 Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     3905535     1951744   82  Linux swap / Solaris
/dev/sda2         3905536     5859327      976896   83  Linux
/dev/sda3         5859328    35155967    14648320   8e  Linux LVM
/dev/sda4   *    35155968    41940991     3392512   83  Linux

 3.

partprobe

 ————结果———

4.PV阶段

 sudo pvscan
 sudo pvcreate /dev/sda3
 sudo pvscan
 sudo pvdisplay

   — Physical volume —
  PV Name               /dev/sda3
  VG Name               lvmfsvg
  PV Size               13.97 GiB / not usable 1.00 MiB
  Allocatable           yes (but full)
  PE Size               16.00 MiB
  Total PE              894
  Free PE               0
  Allocated PE          894
  PV UUID               PqPT3V-42Ls-fDNS-Govj-jqd1-8Y3E-TGplzJ

5.VG阶段

  sudo vgcreate -s 16M lvmfsvg /dev/sda3
  sudo vgscan
  sudo vgdisplay

  — Volume group —
  VG Name               lvmfsvg
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               13.97 GiB
  PE Size               16.00 MiB
  Total PE              894
  Alloc PE / Size       894 / 13.97 GiB
  Free  PE / Size       0 / 0
  VG UUID               6xdlAb-UfZf-imgz-VBp1-mbgF-Veep-U1PVSI

 

5.LV阶段 

  sudo lvcreate -l 894 -n lvmfslv lvmfsvg

  sudo ll /dev/lvmfsvg/lvmfslv
  sudo lvdisplay

 — Logical volume —
  LV Name                /dev/lvmfsvg/lvmfslv
  VG Name                lvmfsvg
  LV UUID                uXPGlQ-YKpR-UFtW-XvfM-o7iC-ahEk-TBvMt2
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                13.97 GiB
  Current LE             894
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  – currently set to     256
  Block device           252:0

6.文件系统阶段
   sudo mkfs -t ext4 /dev/lvmfsvg/lvmfslv
   sudo mount /dev/lvmfsvg/lvmfslv /mnt/lvm

   sudo df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda4              3339208    693716   2475868  22% /
udev                   1023796         4   1023792   1% /dev
tmpfs                   412324       280    412044   1% /run
none                      5120         0      5120   0% /run/lock
none                   1030808         0   1030808   0% /run/shm
/dev/sda2               961528    180644    732040  20% /var
/dev/mapper/lvmfsvg-lvmfslv
                      14417392    166816  13518212   2% /mnt/lvm

 

—————————————————————————
Create Image
—————————————————————————

1.
sudo apt-get install kvm-pxe

2.
cd /mnt/lvm

3.
kvm-img create -f raw server.img 5G

4.
sudo kvm -m 512 -cdrom /dev/cdrom -drive file=server.img,if=scsi,index=0 -boot d -net nic -net user -nographic -vnc :0

5.
vncviewer 192.168.1.120:5900

安装系统
使用一个EXT4分区到/
安装OpenSSH

6.
sudo kvm -m 256 -drive file=server.img,if=scsi,index=0,boot=on -boot c -net nic -net user -nographic -vnc :0

7.
vncviewer 192.168.1.120:5900

7.1
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install openssh-server cloud-init

———————————————————————————————-
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

——————–
nameserver 10.0.2.3
———————————————————————————————–

————————————————————————————
让虚拟机中的虚拟机上外网
————————————————————————————
1.

 sudo apt-get install uml-utilities

2.
sudo tunctl -b -u root

3.

sudo ifconfig tap0 up

4.
sudo route add -host 10.0.2.15 dev tap0

1.

route add -host <ip-of-host> dev <network-interface>

route add default gw <ip-of-host>
ping

————————————————————————————-
Upload Image–Run Instance
————————————————————————————-

1.
euca-bundle-image -i server.img

2.
euca-upload-bundle -b mybucket -m /tmp/server.img.manifest.xml

3.
euca-register mybucket/server.img.manifest.xml

—————————-
可将1\2\3
合并成这样:
uec-publish-tarball ubuntu-11.04-server-cloudimg-amd64.tar.gz ubuntubucket x86_64

uec-publish-image -t image –kernel-file boot/vmlinuz-3.0.0-12-server –ramdisk-file boot/initrd.img-3.0.0-12-server amd64 serverfinal.img mybucket

4.
euca-describe-images
———————————————
MAGE ami-00000001 mybucket/server.img.manifest.xml  uploading private  x86_64 machine     instance-store

5.
cd ~/creds
euca-add-keypair mykey > mykey.priv
chmod 600 mykey.priv

6.
euca-describe-keypairs

7.
euca-run-instances ami-00000001 -k mykey -t m1.tiny

8.
euca-describe-instances
———————————————
RESERVATION r-d2ulnjeu proj default
INSTANCE i-00000001 ami-00000001 192.168.3.3 192.168.3.3 pending mykey (proj, Server2) 0  m1.tiny 2012-01-15T13:43:13Z nova ami-00000000 ami-00000000

9.
euca-get-console-output i-00000001

———————————————————

10.
euca-allocate-address
———————————
ADDRESS 192.168.1.224

11.
euca-associate-address -i i-00000001 192.168.1.224

12.
nova list

12.
euca-authorize default -P tcp -p 22 -s 0.0.0.0/0

13.
euca-authorize default -P icmp -t -1:-1

14.
ssh -i mykey.pem zyx@192.168.1.224

15.
euca-terminate-instances i-00000005

————————————————————————

————————————————————————

—————————————————————————————————————–
—————————————————————————————————————–
其它
—————————————————————————————————————–
——————————————————————————————————————
1.
wget http://uec-images.ubuntu.com/server/releases/natty/release/ubuntu-11.04-server-uec-amd64.tar.gz

2.

uec-publish-image -t image –kernel-file boot/vmlinuz-3.0.0-12-server –ramdisk-file boot/initrd.img-3.0.0-12-server amd64 serverfinal.img mybucket

cloud-publish-image -t image –kernel-file vmlinuz-3.0.0-12-server –ramdisk-file initrd.img-3.0.0-12-server amd64 serverfinal.img mybucket

uec-publish-tarball /home/zyx/creds/ubuntu-11.04-server-cloudimg-amd64.tar.gz images

cloud-publish-tarball /home/zyx/creds/ubuntu-11.04-server-cloudimg-amd64.tar.gz images

uec-publish-tarball /home/zyx/creds/ubuntu-11.04-server-cloudimg-amd64.tar.gz ubuntu1010-bucket x86_64

3.
$> sudo apt-get install -y glance
$> sudo glance-control glance-api start

4.
sudo apt-get install xen-hypervisor-4.1-amd64 xen-utils-4.1 xenwatch xen-tools xen-utils-common xenstore-utils

sudo apt-get install virtinst virt-viewer virt-manager

sudo update-grub

5.
5.1.
sudo mkfs -t ext4 -c /dev/sdb1

5.2.
vi /etc/fstab
/dev/sdb1       /mnt/sdb1 ext4 defaults 0       0

5.3.
sudo mount -a

6.
sudo mkfs.xfs -f -d agcount=32 -l size=131072b /dev/vda

7.
virt-install –name myWinXP –ram 512 –disk path=/tmp/winxp.img,size=6 –vnc –os-variant winxp –cdrom /dev/sr0

sudo virt-install –connect qemu:///system -n xpsp2 -r 512 -f windows.qcow2 -s 12 -c windowsxpsp2.iso –vnc –noautoconsole –os-type windows –os-variant winxp

sudo virt-install –connect qemu:///system -n hardy -r 512 -f hardy.qcow2 -s 12 -c hardy-server-amd64.iso –vnc –noautoconsole –os-type linux –os-variant ubuntuHardy –accelerate –network=network:default

sudo virt-install –name ubuntuISO –connect qemu:///system -r 512 -f /mnt/lvm/server.img -c /home/zyx/Downloads/ubuntu-11.10-server-amd64.iso –graphics vnc,port=5900,password=ibm2008 –os-type linux –os-variant ubuntuHardy

sudo virt-install –name ubuntu –ram 512 –disk path=/mnt/lvm/server.img,size=6 –vnc –os-variant winxp –c /home/zyx/Downloads/ubuntu-11.10-server-amd64.iso

sudo virt-install –connect qemu:///system -n xpsp2 -r 512 -f windows.qcow2 -s 12 -c windowsxpsp2.iso –vnc –noautoconsole –os-type windows –os-variant winxp

————————————————————————————————————————————–

————————————————————————————————————————————–

http://wiki.openstack.org/FlagsGrouping

http://wiki.openstack.org/InstallFromSource

http://wiki.openstack.org/NetworkServicePOC?highlight=%28FlatDHCPManager%29

 

 

 

版权声明:本文为gispathfinder原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/gispathfinder/archive/2012/01/18/2325128.html