總網頁瀏覽量

搜尋此網誌

2011年5月25日 星期三

NovaInstall for Single Machine Installation Record

Step 1: Install required prerequisites
sudo apt-get install -y rabbitmq-server
##Starting rabbitmq-server: SUCCESS
Step 2: Install Nova packages
sudo apt-get install -y python-software-properties
##Setting up python-software-properties (0.80.9) ...
sudo add-apt-repository ppa:nova-core/trunk
 ###
gpg: requesting key 2A2356C9 from hkp server keyserver.ubuntu.com
gpg: key 2A2356C9: public key "Launchpad Nova Packages" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1) 
sudo apt-get update
 ###Reading package lists... Done
sudo apt-get install -y python-nova
###Processing triggers for python-support ...
sudo apt-get install -y nova-common nova-doc nova-api nova-network 
 ####
nova-network is already the newest version.
nova-doc is already the newest version.
nova-common is already the newest version.
nova-api is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 30 not upgraded
sudo apt-get install -y nova-objectstore nova-scheduler nova-compute
 ###
nova-scheduler is already the newest version.
nova-objectstore is already the newest version.
nova-compute is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 30 not upgraded.
sudo apt-get install -y euca2ools
###euca2ools is already the newest version.
sudo apt-get install -y unzip
###unzip is already the newest version.


Step 3:setting up the SQL Database (MySQL) on the Cloud Controller
bash
MYSQL_PASS=nova
NOVA_PASS=notnova
bash
MYSQL_PASS=nova
NOVA_PASS=notnova
cat >> MYSQL_PRESEED | debconf-set-selections
mysql-server-5.1 mysql-server/root_password password $MYSQL_PASS
mysql-server-5.1 mysql-server/root_password_again password $MYSQL_PASS
mysql-server-5.1 mysql-server/start_on_boot boolean true
MYSQL_PRESEED
mysql_preseed $mysql_pass="" boolean="" debconf-set-selections="" mysql-server-5.1="" mysql-server="" mysql_preseed<="" password="" pre="" root_password="" root_password_again="" start_on_boot="" true="" |="">









/usr/bin/nova-manage db sync
/usr/bin/nova-manage user admin dub
###export EC2_ACCESS_KEY=afe710a5-bbc8-45ad-ba69-38db885d3542
###export EC2_SECRET_KEY=54eeb1b8-2b00-4bb8-9092-5e32022be640
/usr/bin/nova-manage project create dubproject dub
/usr/bin/nova-manage network create 192.168.0.0/24 1 256 

sudo apt-get install -y mysql-server
---設mysql root 密碼
sudo sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf
sudo service mysql restart
### 
mysql start/running, process 1819
sudo mysql -uroot -p$MYSQL_PASS -e 'CREATE DATABASE nova;'
sudo mysql -uroot -p$MYSQL_PASS -e "GRANT ALL PRIVILEGES ON *.* TO 'nova'@'%' WITH GRANT OPTION;"
sudo mysql -uroot -p$MYSQL_PASS -e "SET PASSWORD FOR 'nova'@'%' = PASSWORD('$NOVA_PASS');"

Step 4:Installing the Compute Node
nano /etc/network/interfaces

auto lo
iface lo inet loopback
auto br100
iface br100 inet static
bridge_ports eth0
bridge_stp off
bridge_maxwait 0
bridge_fd 0
address 192.168.104.11
netmask 255.255.255.0
network 192.168.104.0
gateway 192.168.104.254
broadcast 192.168.104.255
dns-nameservers 8.8.4.4

sudo /etc/init.d/networking restart
restart libvirt-bin; restart nova-network; restart nova-compute;

libvirt-bin start/running, process 1994
nova-network start/running, process 2012
nova-compute start/running, process 2025
restart nova-api; restart nova-objectstore; restart nova-scheduler

nova-api start/running, process 2113
nova-objectstore start/running, process 2121
nova-scheduler start/running, process 2135
 Step6 Creating Certifications
mkdir –p /root/creds
/usr/bin/python /usr/bin/nova-manage project zipfile $NOVA_PROJECT $NOVA_PROJECT_USER /root/creds/novacreds.zip
unzip /root/creds/novacreds.zip -d /root/creds/
Archive:  /root/creds/novacreds.zip
 extracting: /root/creds/novarc
 extracting: /root/creds/pk.pem
 extracting: /root/creds/cert.pem
 extracting: /root/creds/cacert.pem
cat /root/creds/novarc >> ~/.bashrc
source ~/.bashrc
source /root/creds/novarc
sudo reboot

Enabling Access to VMs on the Compute Node

euca-authorize -P icmp -t -1:-1 default----錯誤[Errno 111] Connection refused
-rw-r----- 1 root nova 461 2011-05-25 22:03 nova.conf (nova.conf 為root所有) ---改
-rw-r----- 1 nova nova 461 2011-05-25 22:03 nova.conf (nova.conf 為nova所有)
正確
euca-authorize -P icmp -t -1:-1 default
default None None icmp -1 -1 0.0.0.0/0
GROUP   default
PERMISSION      default ALLOWS  icmp    -1      -1      FROM    CIDR    0.0.0.0/0
euca-authorize -P tcp -p 22 default
default None None tcp 22 22 0.0.0.0/0
GROUP   default
PERMISSION      default ALLOWS  tcp     22      22      FROM    CIDR    0.0.0.0/0
Configuring Multiple Compute Nodes

restart libvirt-bin; service nova-compute restart

libvirt-bin start/running, process 1703
nova-compute start/running, process 1725

chgrp kvm /dev/kvm
chmod g+rwx /dev/kvm
iptables -t nat -A PREROUTING -d 169.254.169.254/32 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.104.13:8773
mysql -uroot -pnova nova -e 'select * from services;'

2011年5月5日 星期四

Static IP & KVM

1.編輯
 vi /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 172.18.11.191
netmask 255.255.255.0
gateway 172.18.11.254

egrep -c '(vmx|svm)' /proc/cpuinfo 檢查cpu是否支援虛擬化
如果算出來的數字大於 0 的話,就表示有支援了,不過還是記得要去 BIOS 裡確認是否有 Enable CPU Virtualization 的功能喔

2. 正式安裝相關套件
首先不多說,就是安裝 KVM 下去
# apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder
好了之後可以檢查 KVM 是否有啟動了,還有它所載入的 Module 為何
# lsmod | grep kvm
kvm_intel              56851  0
kvm                   367707  1 kvm_intel
檢查 KVM 有載入哪些 Module
# modprobe -l | grep kvm
kernel/arch/x86/kvm/kvm.ko
kernel/arch/x86/kvm/kvm-intel.ko
kernel/arch/x86/kvm/kvm-amd.ko
檢查我們的硬體規格
# virsh nodeinfo
處理器類型:   x86_64
處理器數目:   2
處理器的頻率: 800 MHz
處理器的插槽: 1
每個插槽的核心: 2
每個核心的執行續: 1
NUMA cell:         1
記憶體大小:   4058760 kB
因為我裝的版本是 ubuntu desktop 64 位元版,所以用圖形化的介面來操作
因此來安裝一個比較視覺化的管理軟體,方便未來管理
# apt-get install virt-manager
裝好之後應該會在「應用程式」->「系統工具」看到一個「虛擬機器管理員」
3. 網路設定
接下來要來搞定網路這一塊,首先我們要弄出一張虛擬網卡讓它可以橋接原本的 eth0 出去,到時裡面的 VM 網路才會通
首先網路卡給停掉 ( 這裡的 vim 是我另外裝的,預設是沒有的 )
# invoke-rc.d networking stop
# vim /etc/network/interfaces
如果你的網路環境是手動設定 IP 的話,請參考這個設定
auto lo
iface lo inet loopback

auth eth0
iface eth0 inet manual

auto br0
iface br0 inet static
        address 192.168.0.105
        network 192.168.0.0
        netmask 255.255.255.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        bridge_ports eth0
        bridge_stp off
        bridge_fd 0
        bridge_maxwait 0
如果你的網路環境是 DHCP 的話,請參考這個設定
auto lo
iface lo inet loopback

auth eth0
iface eth0 inet manual

auto br0
iface br0 inet dhcp
        bridge_ports eth0
        bridge_stp off
        bridge_fd 0
        bridge_maxwait 0