准备安装节点:
1. 安装ubuntu server镜像到Vmware;(OpenSSH,Virtual Machine Host)
2. 修改apt源
sudo chmod +x /etc/apt/sources.list
sudo vim /etc/apt/sources.list
%s/us\.archive\.ubuntu/mirrors\.aliyun/g
3. sudo apt-get update
4. sudo apt-get install ubuntu-cloud-keyring
5. sudo vi /etc/apt/sources.list.d/cloudarchive-juno.list
deb http://ubuntu-cloud.archive.canonical.com/ubuntu trusty-updates/juno main
6. sudo apt-get update
7. sudo apt-get dist-upgrade
安装OpenStack支撑服务:
DateBase:
MySQL, PostgreSQL(PG), SQLite, MariaDB
sudo apt-get install -y mariadb-server
sudo apt-get install python-mysqldb
vim /etc/mysql/my.cnf
bind-address = xx.xx.xx.xx
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = ’SET NAMES utf8‘
character-set-server = utf8
sudo service mysql restart
mysql_secure_installation
AMQP
RabbitMQ, qpid, ZeroMQ
sudo apt-get install rabbitmq-server
sudo rabbitmqctl change_password guest 1
安装keystone:
sudo apt-get install keystone python-keystoneclient
mysql -u root -p
create database keystone;
grant all privileges on keystone.* to ‘keystone’@‘localhost’ identified by ‘1’;
grant all privileges on keystone.* to ‘keystone’@‘%’ identified by ‘1’;
exit;
sudo vim /etc/keystone/keystone.conf
admin_token=ADMIN
[database]
connection=mysql://keystone:1@XX.XX.XX.XX/keystone
[token]
provider=keystone.token.providers.[pkiz|pki|uuid].Provider #uuid
driver=keystone.token.persistence.backends.sql.Token
verbose=true
sudo cat /etc/passwd
sudo keystone-manage db_sync
sudo rm -f /var/lib/keystone/keystone.db
sudo service keystone restart
export OS_SERVICE_ENDPOINT=http://xx.xx.xx.xx:35357/v2.0
# 创建租户
keystone tenant-create —name admin (无token)
export OS_SERVICE_TOKEN=ADMIN
keystone tenant-creat —name admin
# 创建用户
keystone user-create —name admin —tenant admin —pass 1
keystone role-create —name admin
keystone user-role-add —tenant admin —user admin —role admin
keystone user-role-list —tenant admin —user admin
keystone tenant-create —name service
keystone service-create —name keystone —type=identity
keystone endpoint-create —service-id=XXXXXX —publicurl=http://xx.xx.xx.xx:5000/v2.0 —internalurl=http://xx.xx.xx.xx:5000/v2.0 —adminurl=http://xx.xx.xx.xx:35357/v2.0
keystone help endpoint-create
unset OS_SERVICE_TOKEN OS_SERVICE_ENDPOINT
keystone —os-auth-url=http://xx.xx.xx.xx:35357/v2.0 —os-username=admin —os-password=1 —os-tenant-name=admin tenant-create —name demo
# 创建环境变量文件,简化命令参数
vi adminrc
export OS_AUTH_URL=http://xx.xx.xx.xx:35357/v2.0
export OS_USERNAME=admin
export OS_PASSWORD=1
export OS_TENANT_NAME=admin
source adminrc
sudo vi /etc/keystone/keystone.conf
#admin_token=ADMIN (注释掉)
sudo service keystone restart
keystone tenant-list
keystone user-role-list —user=admin —tenant=admin
安装glance:
mysql -uroot -p
create database glance;
grant all privileges on glance.* to ‘glance’@‘localhost’ identified by ‘1’;
grant all privileges on glance.* to ‘glance’@‘%’ identified by ‘1’;
exit;
keystone user-create —name glance —pass 1
keystone user-role-add —user glance —tenant service —role admin
keystone user-role-list —user glance —tenant service
keystone service-create —name glance —type image
keystone endpoint-create —service-id xxxxxxx \
—publicurl http://xx.xx.xx.xx:9292 \
—internalurl http://xx.xx.xx.xx:9292 \
—adminurl http://xx.xx.xx.xx:9292 \
—region regionOne
sudo apt-get install glance python-glanceclient
sudo vi /etc/glance/glance-api.conf
connection = mysql://glance:1@xx.xx.xx.xx/glance
[keystone_authtoken]
auth_url = http://xx.xx.xx.xx:5000/v2.0
identity_uri = http://xx.xx.xx.xx.xx:35357
admin_tenant_name = service
admin_user = glance
admin_password = 1
flavor = keystone
verbose = True
default_store = file
sudo vi /etc/glance-registry.conf
verbose = True
[database]
connection = mysql://glance:1@xx.xx.xx.xx/glance
[keystone_authtoken]
auth_url = http://xx.xx.xx.xx:5000/v2.0
identity_uri = http://xx.xx.xx.xx.xx:35357
admin_tenant_name = service
admin_user = glance
admin_password = 1
flavor=keystone
sudo glance-manage db_sync
sudo service glance-registry restart
sudo service glance-api restart
# 上传镜像
glance image-create —copy-from http://cdn.download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img —name cirrus-0.3.3 —disk-format qcow2 —container-format bare
glance image-list
安装Nova:
mysql -uroot -p
create database nova;
grant all privileges on nova.* to nova@‘localhost’ identified by ‘1’;
grant all privileges on nova.* to nova@‘%’ identified by ‘1’;
keystone user-create —name nova —pass 1
keystone user-role-add —user nova —tenant service —role admin
keystone user-role-list —user nova —tenant service
keystone service-create —name nova —type compute
keystone endpoint-create —service-id XXXX \
—publicurl http://192.168.114.169:8774/v2/%\(tenant_id\)s \
—internalurl http://192.168.114.169:8774/v2/%\(tenant_id\)s \
—adminurl http://192.168.114.169:8774/v2/%\(tenant_id\)s
sudo apt-get install nova-api nova-scheduler nova-conductor nova-cert nova-consoleauth nova-novncproxy nova-compute sysfsutils python-novaclient
sudo vi /etc/nova/nova.conf
rpc_backend=rabbit
rabbit_host=192.168.114.169
rabbit_password=1
auth_strategy=keystone
my_ip=192.168.114.169
vnc_enabled=True
vncserver_listen=192.168.114.169
vncserver_proxyclient_address=192.168.114.169
novncproxy_base_url=http://192.168.114.169:6080/vnc_auto.html
verbose=True
[database]
connection=mysql://nova:1@192.168.114.169/nova
[keystone_authtoken]
auth_uri=http://192.168.114.169:5000/v2.0
identity_uri=http://192.168.114.169:35357
admin_tenant_name=service
admin_user=nova
admin_password=1
[glance]
host=192.168.114.169
:wq
cat /proc/cpuinfo |grep -E “vmx|svm” (intel | amd) 硬件辅助虚拟化技术
sudo nova-manage db sync
mysql -uroot -proot
use nova
show tables;
vi nova_services_restart.sh
sudo service nova-api restart
sudo service nova-scheduler restart
sudo service nova-conductor restart
sudo service nova-compute restart
sudo service nova-cert restart
sudo service nova-consoleauth restart
sudo service nova-novncproxy restart
sudo chmod +x nova_services_restart.sh
./nova_services_restart.sh
nova servcie-list
验证
nova flavor-list (指定虚拟机有多大)
nova image-list
关机
sudo halt
vmware添加一块网卡
修改vmware配置
sudo vim /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.conf
host UbuntuOSAllInOne {
hardware ethernet 00:0C:29:44:BC:0D;
fixed-address 192.168.22.142;
}
sudo vim /Library/Preferences/VMware\ Fusion/vmnet1/dhcpd.conf
同上
重启vmware&虚拟机
dmesg |grep eth
sudo vim /etc/network/interfaces
auto eth1
iface eth1 inet dhcp
启动eth1
sudo ifup eth1
再次重启虚拟机
sudo reboot
重启之后ifconfig就能看到eth1
基于nova-network实现openstack网络环境
sudo vi /etc/nova/nova.conf
[default]
控制节点,网络设置
network_api_class = nova.network.api.API
security_group_api = nova
计算节点
firewall_driver = nova.virt.libvirt.firewall.IptablesFirewallDriver
network_manager = nova.network.manager.FlatDHCPManager 不分租户网络
network_size = 254
allow_same_net_traffic = False
多节点,高可用部署
multi_host = True
send_arp_for_ha = True
share_dhcp_address = True
force_dhcp_release = True
flat_network_bridge = br100
flat_interface = eth1
public_interface = eth0
source adminrc
nova service-list
sudo apt-get install nova-network
nova network-create --fixed-range-v4 192.168.0.0/24 --bridge br100 --multi-host T net1
nova network-list
nova flavor-list
nova image-list
nova boot --flavor m1.tiny --image cirrus-0.3.3 --nic net-id=708664b5-3d5f-4801-a75e-7ea63b3a62a8 instance1
nova list
nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0
nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
nova secgroup-list-rules default
nova get-vnc-console instance1 novnc
ssh cirros@192.168.0.2 ("cubswin:)")
OpenStack All in One 虚拟机环境手动安装(Ubuntu)
原文:http://lucianlv.blog.51cto.com/9871307/1671841