總網頁瀏覽量

搜尋此網誌

2011年7月9日 星期六

ubuntu 安裝 phpmyadmin 管理工具

安裝MySQL-Server
$ sudo apt-get install mysql-server
安裝Apache HTTP Server
$ sudo apt-get install apache2
安裝PHP for Apache HTTP Server
$ sudo apt-get install php5
安裝MySQL for Apache HTTP Server
$ sudo apt-get install libapache2-mod-auth-mysql
$ sudo apt-get install php5-mysql
安裝phpMyAdmin
$ sudo apt-get install phpmyadmin

http://127.0.0.1/phpmyadmin

2011年7月6日 星期三

單台 Novacc all in one and other compute node

 第一台 網路卡設定
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 0.0.0.0
netmask 255.255.255.0

auto eth1
iface eth1 inet static
address 0.0.0.0
netmask 255.255.255.0


auto eth1:1
iface eth1:1 inet static
address 172.18.11.191
netmask 255.255.255.0
broadcast 172.18.11.255
gateway 172.18.11.254
dns-nameservers 10.0.0.90
第二台
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 0.0.0.0
netmask 255.255.255.0

auto eth1
iface eth1 inet static
address 172.18.11.192
netmask 255.255.255.0
broadcast 172.18.11.255
gateway 172.18.11.254





/etc/nova/nova.conf

--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=172.18.11.191
--rabbit_host=172.18.11.191
--cc_host=172.18.11.191
--ec2_url=http://172.18.11.191:8773/services/Cloud
--fixed_range=192.168.3.0/24
--network_size=256
--FAKE_subdomain=ec2
--routing_source_ip=172.18.11.191
--sql_connection=mysql://root:nova@172.18.11.191/nova
--glance_api_servers=172.18.11.191:9292
--image_service=nova.image.glance.GlanceImageService
--flat_network_dhcp_start=192.168.3.5
--public_interface=eth1
--flat_interface=eth0
--flat_injected=False

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

2011年4月29日 星期五

Manual Installing Nova Cloud Controller Ver for Cactus


sudo apt-get install python-software-properties
sudo add-apt-repository ppa:nova-core/trunk

sudo apt-get update
sudo apt-get install -y rabbitmq-server
sudo apt-get install -y python-greenlet python-mysqldb 
sudo apt-get install -y nova-common nova-doc python-nova nova-api
sudo apt-get install -y nova-network nova-objectstore nova-scheduler nova-compute
sudo apt-get install -y euca2ools unzip
vi /etc/nova/nova.conf   

bash
MYSQL_PASS=nova
NOVA_PASS=notnova
cat <
<  MYSQL_PRESEED | debconf-set-sselections
mysql-server-5.1 mysql-server/root_password pasword $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


sudo apt-get install -y mysql-server

sudo sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf
sudo service mysql restart



mysql -uroot -p$MYSQL_PASS -e 'CREATE DATABASE nova;'
mysql -uroot -p$MYSQL_PASS -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;"
mysql -uroot -p$MYSQL_PASS -e "SET PASSWORD FOR 'root'@'%' =PASSWORD('$MYSQL_PASS');"


sudo addgroup nova
chown -R root:nova /etc/nova
chmod 640 /etc/nova/nova.conf

/usr/bin/nova-manage db sync
/usr/bin/nova-manage user admin dub
/usr/bin/nova-manage project create dubproject dub
/usr/bin/nova-manage network create 192.168.104.0/24 1 255

mkdir –p /root/creds
/usr/bin/python /usr/bin/nova-manage project zipfile dubproject dub /root/creds/novacreds.zip
 unzip /root/creds/novacreds.zip -d /root/creds/
cat /root/creds/novarc >> ~/.bashrc
source ~/.bashrc 
euca-authorize -P icmp -t -1:-1 default
euca-authorize -P tcp -p 22 default
killall dnsmasq service 
nova-network restart
/etc/init.d/networking restart
restart libvirt-bin; restart nova-network; restart nova-compute;
restart nova-api; restart nova-objectstore; restart nova-scheduler
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 $
NOVA_API_IP:8773

mysql -u$MYSQL_USER -p$MYSQL_PASS nova -e 'select * from
 services;'



2.Configuring Multiple Compute Nodes

ubuntu 更換網卡 鎖住原ip eth0 不見

1. cat /proc/net/dev "抓到的網路卡是eth1"
 eht1:    70634      820  0      0      0      0      0      0      4401        36    0      0      0      0      0      2.sudo 2.rm -f /etc/udev/rules.d/70-persistent-net.rules
3.sudo reboot