OpenStack 在 Ubuntu12.04X64 系统上的安装
详细讲解了 OpenStack 在 Ubuntu12.04X64 系统上的安装过程
OpenStack 在 Ubuntu12.04X64 系统上的安装
1.运行 VMware Workstation 8。
2.安装 Ubuntu-12.04-server-amd64.iso 系统。
注意:选择安装 SSH 服务
安装过程略。
3.修改计算机 IP。
1)
sudo vi /etc/network/interfaces
--------------------------------------------------------------------
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.110
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 192.168.1.1
auto eth1
iface eth1 inet static
address 192.168.4.1
netmask 255.255.255.0
network 192.168.4.0
broadcast 192.168.4.255
2)
sudo vi /etc/resolv.conf
SmartMap
--------------------------------------------------------------------
3) 删除 rules 文件
sudo rm -rf /etc/udev/rules.d/*.rules
4) 重启网卡
sudo /etc/init.d/networking restart
4.修改计算机名。
1)
sudo vi /etc/hostname
------------------------------------------
server1
2)
sudo vi /etc/hosts
5.安装更新
1)sudo apt-get update
2)sudo apt-get upgrade
6.安装 unzip
sudo apt-get install -y unzip
7.安装 NTP
1)
sudo apt-get install -y ntp
2)
sudo vi /etc/ntp.conf
--------------------------------
server ntp.ubuntu.com
server 127.127.1.0
fudge 127.127.1.0 stratum 10
3)
sudo service ntp restart
8.安装 database
1)
sudo apt-get install mysql-server python-mysqldb
设置密码:zyx
2)
sudo vi /etc/mysql/my.cnf
-------------------------------------
bind-address = 0.0.0.0
3)
sudo restart mysql
4)
sudo mysql -u root -p -e 'CREATE DATABASE nova;'
5)
sudo mysql -u root -p -e 'CREATE USER novadbadmin;'
6)
sudo mysql -u root -p -e "GRANT ALL PRIVILEGES ON nova.* TO 'novadbadmin'@'%';"
7)
sudo mysql -u root -p -e "SET PASSWORD FOR 'novadbadmin'@'%' = PASSWORD('zyx');"
8)
sudo mysql -u root -p -e 'CREATE DATABASE glance;'
9)
sudo mysql -u root -p -e 'CREATE USER glancedbadmin;'
10)
sudo mysql -u root -p -e "GRANT ALL PRIVILEGES ON glance.* TO 'glancedbadmin'@'%';"
11)
sudo mysql -u root -p -e "SET PASSWORD FOR 'glancedbadmin'@'%' = PASSWORD('zyx');"
12)
sudo mysql -u root -p -e 'CREATE DATABASE keystone;'
13)
sudo mysql -u root -p -e 'CREATE USER keystonedbadmin;'
14)
sudo mysql -u root
-p
-e "GRANT ALL PRIVILEGES ON keystone.* TO
'keystonedbadmin'@'%';"
15)
sudo mysql -u root -p -e "SET PASSWORD FOR 'keystonedbadmin'@'%' = PASSWORD('zyx');"
16)去掉一些账号
sudo mysql -u root -p
use mysql;
select user, host, password from user;
delete from user where user ='';
delete from user where user ='root' and host in ('localhost','server1','::1');
update user set host = '%';
select user, host, password from user;
exit;
sudo restart mysql
9.安装 Keystone
1)
sudo apt-get install qemu-kvm libvirt-bin virt-manager bridge-utils
2)
sudo vi /etc/keystone/keystone.conf
------------------------------
admin_token = admin
connection = mysql://keystonedbadmin:zyx@192.168.1.110/keystone
3)
sudo service keystone restart
4)
sudo keystone-manage db_sync
5)
sudo vi ~/.bashrc
-----------------------------------
export SERVICE_ENDPOINT="http://127.0.0.1:35357/v2.0"
export SERVICE_TOKEN=admin
6)
export SERVICE_ENDPOINT="http://localhost:35357/v2.0"
export SERVICE_TOKEN=admin
10.安装 Tenant
1) tenant
keystone tenant-create --name admin
keystone tenant-create --name service
2) user
keystone user-create --name admin --pass
GIS Pathfinder
keystone user-create --name nova --pass nova
keystone user-create --name glance --pass glance
keystone user-create --name swift --pass swift
3) Roles
keystone role-create --name admin
keystone role-create --name Member
4) Listing Tenants, Users and Roles
keystone tenant-list
keystone user-list
keystone role-list
11.建立 Role、 User、Tenant 之间的关系
1) add a role of 'admin' to the user 'admin' of the tenant 'admin'
keystone
user-role-add
--user
14e28eac9fae45838825fb911c68f98d
--role
7b188668bfc04af1a7cbe2ea8bdb2943 --tenant_id 3c6158c0c0224ef8a1a4eef7af234b83
2) add a role of 'admin' to the users 'nova', 'glance' and 'swift' of the tenant 'service'
keystone
user-role-add
--user
dce9bbe0901b4f4ca398fcf9203376a7
--role
7b188668bfc04af1a7cbe2ea8bdb2943 --tenant_id c7ada364379a4fb1b6e0c38ad3ecb04c
keystone
user-role-add
--user
3321caaf108744c0b7a7ec313c779bf1
--role
7b188668bfc04af1a7cbe2ea8bdb2943 --tenant_id c7ada364379a4fb1b6e0c38ad3ecb04c
keystone
user-role-add
--user
8df17045802a411c9f9b1387fdd33c03
--role
7b188668bfc04af1a7cbe2ea8bdb2943 --tenant_id c7ada364379a4fb1b6e0c38ad3ecb04c
3) add a role of 'Member' to the user 'admin' of the tenant 'admin'
keystone
user-role-add
--user
14e28eac9fae45838825fb911c68f98d
--role
454ebb833d824504be3af54f5351b23e --tenant_id 3c6158c0c0224ef8a1a4eef7af234b83
12.创建服务
1)
keystone service-create --name nova --type compute --description 'OpenStack Compute Service'
keystone service-create --name volume --type volume --description 'OpenStack Volume Service'
keystone service-create --name glance --type image --description 'OpenStack Image Service'
keystone service-create --name swift --type object-store --description 'OpenStack Storage Service'
keystone service-create --name keystone --type identity --description 'OpenStack Identity Service'
keystone service-create --name ec2 --type ec2 --description 'EC2 Service'
2)
keystone service-list
13.创建终端点。
1)
creating an endpoint for nova-compute
keystone endpoint-create --region myregion --service_id 2e76574b1e474960862fa1fdeb27910c
--publicurl
'http://192.168.1.110:8774/v2/$(tenant_id)s'
--adminurl
'http://192.168.1.110:8774/v2/$(tenant_id)s'
--internalurl
'http://192.168.1.110:8774/v2/$(tenant_id)s'
2)
creating an endpoint for nova-volume
keystone endpoint-create --region myregion --service_id 960411d1442f497b8f1313e023deb580
--publicurl
'http://192.168.1.110:8776/v1/$(tenant_id)s'
--adminurl
'http://192.168.1.110:8776/v1/$(tenant_id)s'
--internalurl
'http://192.168.1.110:8776/v1/$(tenant_id)s'
3)
creating an endpoint for glance
keystone endpoint-create --region myregion --service_id d5dde3f8494f4a2fa15cad8ae0f7a83a
--publicurl 'http://192.168.1.110:9292/v1' --adminurl 'http://192.168.1.110:9292/v1' --internalurl
'http://192.168.1.110:9292/v1'
4)
creating an endpoint for swift
keystone endpoint-create --region myregion --service_id 55996d9e70f0474e96e1b7832abfff78
--publicurl
'http://192.168.1.110:8080/v1/AUTH_$(tenant_id)s'
--adminurl
'http://192.168.1.110:8080/v1' --internalurl 'http://192.168.1.110:8080/v1/AUTH_$(tenant_id)s'
5)
creating an endpoint for keystone
keystone endpoint-create --region myregion --service_id 17e2894ca0cf4a23b79dd6fedac7162b
--publicurl
'http://192.168.1.110:5000/v2.0'
--adminurl
'http://192.168.1.110:35357/v2.0'
--internalurl 'http://192.168.1.110:5000/v2.0'
6)
creating an endpoint for ec2
keystone endpoint-create --region myregion --service_id 7ab9254829ce42a18e7315585f4fb06d
--publicurl
'http://192.168.1.110:8773/services/Cloud'
--adminurl
'http://192.168.1.110:8773/services/Admin'
--internalurl
'http://192.168.1.110:8773/services/Cloud'
14.安装 Glance
1)
sudo apt-get install glance glance-api glance-client glance-common glance-registry python-glance
2)
sudo vi /etc/glance/glance-api-paste.ini
admin_tenant_name = service
admin_user = glance
admin_password = glance
3)
sudo vi /etc/glance/glance-registry-paste.ini
admin_tenant_name = service
admin_user = glance
admin_password = glance
4)
sudo vi /etc/glance/glance-registry.conf
sql_connection = mysql://glancedbadmin:zyx@192.168.1.110/glance
[paste_deploy]
flavor = keystone
5)
sudo vi /etc/glance/glance-api.conf
[paste_deploy]
flavor = keystone
6)
sudo glance-manage version_control 0
sudo glance-manage db_sync
7)
sudo restart glance-api
sudo restart glance-registry
8)
sudo vi ~/.bashrc
--------------------------------------------------------
export SERVICE_TOKEN=admin
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_AUTH_URL="http://127.0.0.1:5000/v2.0/"
export SERVICE_ENDPOINT="http://127.0.0.1:35357/v2.0"
9)
export SERVICE_TOKEN=admin
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_AUTH_URL="http://127.0.0.1:5000/v2.0/"
export SERVICE_ENDPOINT=http://127.0.0.1:35357/v2.0
15.安装 Nova
1)
sudo apt-get install nova-api nova-cert nova-compute nova-compute-kvm nova-doc nova-network
nova-objectstore nova-scheduler nova-volume rabbitmq-server novnc nova-consoleauth
2)
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=/run/lock/nova
--allow_admin_api=true
--use_deprecated_auth=false
--auth_strategy=keystone
--scheduler_driver=nova.scheduler.simple.SimpleScheduler
--s3_host=192.168.1.110
--ec2_host=192.168.1.110
--rabbit_host=192.168.1.110
--cc_host=192.168.1.110
--nova_url=http://192.168.1.110:8774/v1.1/
--routing_source_ip=192.168.1.110
--glance_api_servers=192.168.1.110:9292
--image_service=nova.image.glance.GlanceImageService
--iscsi_ip_prefix=192.168.4
--sql_connection=mysql://novadbadmin:zyx@192.168.1.110/nova
--ec2_url=http://192.168.1.110:8773/services/Cloud
--keystone_ec2_url=http://192.168.1.110:5000/v2.0/ec2tokens
--api_paste_config=/etc/nova/api-paste.ini
--libvirt_type=kvm
--libvirt_use_virtio_for_bridges=true
--start_guests_on_host_boot=true
--resume_guests_state_on_host_boot=true
# vnc specific configuration
--novnc_enabled=true
--novncproxy_base_url=http://192.168.1.110:6080/vnc_auto.html
--vncserver_proxyclient_address=192.168.1.110
--vncserver_listen=192.168.1.110
# network specific settings
--network_manager=nova.network.manager.FlatDHCPManager
--public_interface=eth0
--flat_interface=eth1
--flat_network_bridge=br100
--fixed_range=192.168.4.1/27
--floating_range=192.168.1.110/27
--network_size=32
--flat_network_dhcp_start=192.168.4.33
--flat_injected=False
--force_dhcp_release
--iscsi_helper=tgtadm
--connection_type=libvirt
--root_helper=sudo nova-rootwrap
--verbose
16.安装 iscsi
1)
sudo apt-get -y install iscsitarget iscsitarget-dkms
2)
sudo sed -i 's/false/true/g' /etc/default/iscsitarget
3)
sudo service iscsitarget restart
17.创建 LVM
1)
sudo fdisk -l
2)
sudo pvcreate /dev/sda5
3)
sudo vgcreate nova-volumes /dev/sda5
18.配置 Nova
1)
sudo chown -R nova:nova /etc/nova
sudo chmod 644 /etc/nova/nova.conf
2)
sudo vi /etc/nova/api-paste.ini
-------------------------------------------
admin_tenant_name = service
admin_user = nova
admin_password = nova
3)
sudo nova-manage db sync
4)
sudo nova-manage network create private --fixed_range_v4=192.168.4.32/27 --num_networks=1
--bridge=br100 --bridge_interface=eth1 --network_size=32
5)
sudo vi .bashrc
----------------------------------------------
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_AUTH_URL="http://127.0.0.1:5000/v2.0/"
6)
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_AUTH_URL="http://127.0.0.1:5000/v2.0/"
7)
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 nova-consoleauth;
8)
sudo nova-manage service list
19.安装 Dashboard
1)
sudo apt-get install openstack-dashboard
2)
sudo service apache2 restart
3)
sudo nova-manage service list
*******************************************************************************
*******************************************************************************
1.安装 Ubuntu-12.04-server-amd64.iso 系统。
注意:选择安装 SSH 服务
安装过程略。
2.修改计算机 IP。
1)
sudo vi /etc/network/interfaces
--------------------------------------------------------------------
auto lo
iface lo inet loopback
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.1
dns-nameservers 192.168.1.1
auto eth1
iface eth1 inet static
address 192.168.4.2
netmask 255.255.255.0
network 192.168.4.0
broadcast 192.168.4.255
2)
sudo vi /etc/resolv.conf
--------------------------------------------------------------------
3) 删除 rules 文件
sudo rm -rf /etc/udev/rules.d/*.rules
4) 重启网卡
sudo /etc/init.d/networking restart
3.修改计算机名。
1)
sudo vi /etc/hostname
------------------------------------------
server2
2)
sudo vi /etc/hosts
4.安装更新
1)
sudo apt-get update
2)
sudo apt-get upgrade
5.安装 unzip
sudo apt-get install -y unzip
6.安装 NTP
1)
sudo apt-get install -y ntp
2)
sudo vi /etc/ntp.conf
--------------------------------
server 192.168.1.110
3)
sudo service ntp restart
7.安装 bridge-utils
sudo apt-get install bridge-utils
8.安装 nova-compute
1)
sudo apt-get install nova-compute
2)
sudo chown -R nova:nova /etc/nova
sudo chmod -R 777 /etc/nova/
3)
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=/run/lock/nova
--allow_admin_api=true
--use_deprecated_auth=false
--auth_strategy=keystone
--scheduler_driver=nova.scheduler.simple.SimpleScheduler
--s3_host=192.168.1.110
--ec2_host=192.168.1.110
--rabbit_host=192.168.1.110
--cc_host=192.168.1.110
--nova_url=http://192.168.1.110:8774/v1.1/
--routing_source_ip=192.168.1.110
--glance_api_servers=192.168.1.110:9292
--image_service=nova.image.glance.GlanceImageService
--iscsi_ip_prefix=192.168.4
--sql_connection=mysql://novadbadmin:
--ec2_url=http://192.168.1.110:8773/services/Cloud
--keystone_ec2_url=http://192.168.1.110:5000/v2.0/ec2tokens
--api_paste_config=/etc/nova/api-paste.ini
--libvirt_type=kvm
--libvirt_use_virtio_for_bridges=true
--start_guests_on_host_boot=true
--resume_guests_state_on_host_boot=true
# vnc specific configuration
--novnc_enabled=true
--novncproxy_base_url=http://192.168.1.110:6080/vnc_auto.html
--vncserver_proxyclient_address=192.168.1.110
--vncserver_listen=192.168.1.110
# network specific settings
--network_manager=nova.network.manager.FlatDHCPManager
--public_interface=eth0
--flat_interface=eth1
--flat_network_bridge=br100
--fixed_range=192.168.4.1/27
--floating_range=192.168.1.110/27
--network_size=32
--flat_network_dhcp_start=192.168.4.33
--flat_injected=False
--force_dhcp_release
--iscsi_helper=tgtadm
--connection_type=libvirt
--root_helper=sudo nova-rootwrap
--verbose
3)
sudo vi .bashrc
----------------------------------------------
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_AUTH_URL="http://127.0.0.1:5000/v2.0/"
4)
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_AUTH_URL="http://127.0.0.1:5000/v2.0/"
5)
sudo service restart nova-compute
6)
sudo nova-manage service list
*******************************************************************************
*******************************************************************************
1.上传镜像到服务
1)
cd img
glance add name="ubuntu" is_public=true container_format=ovf disk_format=qcow2 <
ubuntu.img
2.产生 SSH 密钥
1)
ssh-keygen
cd .ssh
nova keypair-add --pub_key id_rsa.pub mykey
2)
nova keypair-list
3.启动实例
1)创建实例
nova boot --flavor 1 --image 9fc5c39b-151e-4fc5-9508-09c9573ae7ef --key_name mykey
myinstance
2)列出实例
nova list
3)重启实例
nova reboot 9fc5c39b-151e-4fc5-9508-09c9573ae7ef
4)删除实例
nova delete 9fc5c39b-151e-4fc5-9508-09c9573ae7ef
5)
nova console-log myinstance
6)
nova console-log myinstance
7)
ssh -i mykey
8)
nova flavor-list
sudo nova-manage flavor create <args> [options]
sudo nova-manage flavor delete <args> [options]
SmartMap
GIS Pathfinder
4.生成 IP
1)生成固定 IP
sudo nova-manage network create private --fixed_range_v4=192.168.4.3/27 --num_networks=1
--bridge=br100 --bridge_interface=eth1 --network_size=32
2)生成浮动 IP
sudo nova-manage floating create --ip_range=192.168.1.224/27
3)为实例生成浮动 IP(外网 IP)
nova floating-ip-create
----------------------------------------------------
192.168.1.225
4)为实例分配浮动 IP
nova add-floating-ip myinstance 192.168.1.225
5.去掉防火墙
sudo iptables -F
sudo iptables -X
sudo iptables -Z
sudo iptables -L
6.连接实例
|
|