openstack的M版本安装

阅读更多
参考
http://docs.openstack.org/mitaka/install-guide-rdo


三台机器同步时间
ntpdate  cn.ntp.org.cn

两台机器controller节点mcon   compute节点mcom
配置
vim /etc/hosts
######
192.168.139.251 mcon
192.168.139.252 mcom
#####
/etc/sysconfig/network-scripts/ifcfg-eth0
#############
NAME="eth0"
DEVICE="eth0"
ONBOOT="yes"
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.139.251
NETMASK=255.255.240.0
GATEWAY=192.168.128.1
DNS1=114.114.114.114
#####################


systemctl stop firewalld.service
systemctl disable firewalld.service

vim /etc/hostname
vim /etc/selinux/config
########
SELINUX=disabled
########
yum install centos-release-openstack-mitaka -y
yum install https://rdoproject.org/repos/rdo-release.rpm -y
yum upgrade -y
yum install python-openstackclient -y
yum install openstack-selinux -y
yum install mariadb mariadb-server python2-PyMySQL -y

vim /etc/my.cnf.d/mariadb-server.cnf
###########################
[mysqld]
bind-address = 192.168.139.251
default-storage-engine = innodb
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
############################

systemctl enable mariadb.service
systemctl start mariadb.service

mysql_secure_installation
配置密码

yum install mongodb-server mongodb -y
/etc/mongod.conf
########
bind_ip = 192.168.139.251
smallfiles = true
##########
systemctl enable mongod.service
systemctl start mongod.service

yum install rabbitmq-server -y

systemctl enable rabbitmq-server.service
systemctl start rabbitmq-server.service

rabbitmqctl add_user openstack haoning
rabbitmqctl set_permissions openstack ".*" ".*" ".*"

yum install memcached python-memcached -y
systemctl enable memcached.service
systemctl start memcached.service
@@@@@@@@@@@@@@@@在controller节点安装keystone@@@@@@@@@@@@@@@@@@
mysql -u root -p
CREATE DATABASE keystone;

GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost'  IDENTIFIED BY 'haoning';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%'  IDENTIFIED BY 'haoning';
flush privileges;

openssl rand -hex 10 得到3b4cc857a2c7ba154ee3
yum install openstack-keystone httpd mod_wsgi -y

/etc/keystone/keystone.conf
##########
[DEFAULT]
admin_token = 3b4cc857a2c7ba154ee3
[database]
connection = mysql+pymysql://keystone:haoning@mcon/keystone
[token]
provider = fernet
#############

su -s /bin/sh -c "keystone-manage db_sync" keystone

keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone

/etc/httpd/conf/httpd.conf
########################
ServerName mcon
########################
/etc/httpd/conf.d/wsgi-keystone.conf
#########################
Listen 5000
Listen 35357


    WSGIDaemonProcess keystone-public processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
    WSGIProcessGroup keystone-public
    WSGIScriptAlias / /usr/bin/keystone-wsgi-public
    WSGIApplicationGroup %{GLOBAL}
    WSGIPassAuthorization On
    ErrorLogFormat "%{cu}t %M"
    ErrorLog /var/log/httpd/keystone-error.log
    CustomLog /var/log/httpd/keystone-access.log combined

   
        Require all granted
   




    WSGIDaemonProcess keystone-admin processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
    WSGIProcessGroup keystone-admin
    WSGIScriptAlias / /usr/bin/keystone-wsgi-admin
    WSGIApplicationGroup %{GLOBAL}
    WSGIPassAuthorization On
    ErrorLogFormat "%{cu}t %M"
    ErrorLog /var/log/httpd/keystone-error.log
    CustomLog /var/log/httpd/keystone-access.log combined

   
        Require all granted
   


#########################
systemctl enable httpd.service
systemctl start httpd.service

export OS_TOKEN=3b4cc857a2c7ba154ee3
export OS_URL=http://mcon:35357/v3
export OS_IDENTITY_API_VERSION=3

openstack service create  --name keystone --description "OpenStack Identity" identity
openstack endpoint create --region wuhan  identity public http://mcon:5000/v3
openstack endpoint create --region wuhan  identity internal http://mcon:5000/v3
openstack endpoint create --region wuhan  identity admin http://mcon:35357/v3
如果建错
openstack endpoint list
#openstack endpoint delete edc8611dda794bffb8221d4e794f214b

openstack domain create --description "Default Domain" default

openstack project create --domain default --description "Admin Project" admin
openstack user create --domain default  --password-prompt admin
openstack role create admin
openstack role add --project admin --user admin admin

openstack project create --domain default --description "Service Project" service
openstack project create --domain default --description "Demo Project" demo
openstack user create --domain default --password-prompt demo
openstack role create user
openstack role add --project demo --user demo user

openstack token issue


unset OS_TOKEN OS_URL
openstack --os-auth-url http://mcon:5000/v3  --os-project-domain-name default --os-user-domain-name default  --os-project-name demo --os-username demo token issue

o_admin.sh
##########################
export OS_PROJECT_DOMAIN_NAME=default
export OS_USER_DOMAIN_NAME=default
export OS_PROJECT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=haoning
export OS_AUTH_URL=http://mcon:35357/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
##########################

demo.sh
##########################
export OS_PROJECT_DOMAIN_NAME=default
export OS_USER_DOMAIN_NAME=default
export OS_PROJECT_NAME=demo
export OS_USERNAME=demo
export OS_PASSWORD=haoning
export OS_AUTH_URL=http://mcon:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
########################

. demo.sh
openstack token issue


@@@@@@@@@@@@@@@glance@@@@@@@@@@@@@@@@
mysql -u root -p
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'haoning';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'haoning';
flush PRIVILEGES;
openstack user create --domain default --password-prompt glance
openstack role add --project service --user glance admin

openstack service create --name glance  --description "OpenStack Image" image
openstack endpoint create --region wuhan image public http://mcon:9292
openstack endpoint create --region wuhan  image internal http://mcon:9292
openstack endpoint create --region wuhan image admin http://mcon:9292

yum install openstack-glance -y

/etc/glance/glance-api.conf
#########################
[database]
connection = mysql+pymysql://glance:haoning@mcon/glance
[keystone_authtoken]
auth_uri = http://mcon:5000
auth_url = http://mcon:35357
memcached_servers = mcon:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = haoning
[paste_deploy]
flavor = keystone
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
#########################

/etc/glance/glance-registry.conf
#####################
[database]
connection = mysql+pymysql://glance:haoning@mcon/glance
[keystone_authtoken]
auth_uri = http://mcon:5000
auth_url = http://mcon:35357
memcached_servers = mcon:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = haoning
[paste_deploy]
flavor = keystone
####################

su -s /bin/sh -c "glance-manage db_sync" glance

systemctl enable openstack-glance-api.service openstack-glance-registry.service
systemctl start openstack-glance-api.service openstack-glance-registry.service
. o_admin.sh
wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img

openstack image create "cirros"  --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --public
openstack image list

@@@@@@@@@@@@@@@@@@@nova controller节点@@@@@@@@@@@@@

mysql -u root -p
CREATE DATABASE nova_api;
CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'haoning';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'haoning';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'haoning';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'haoning';

#GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'zouhuiying';
#GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'zouhuiying';
#GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'zouhuiying';
#GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'zouhuiying';
flush privileges;
openstack user create --domain default --password-prompt nova
openstack role add --project service --user nova admin
openstack service create --name nova --description "OpenStack Compute" compute

openstack endpoint create --region wuhan compute public http://mcon:8774/v2.1/%\(tenant_id\)s
openstack endpoint create --region wuhan compute internal http://mcon:8774/v2.1/%\(tenant_id\)s
openstack endpoint create --region wuhan compute admin http://mcon:8774/v2.1/%\(tenant_id\)s

yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler -y
/etc/nova/nova.conf

api_database
database
都要配置,容易漏

######################
[DEFAULT]
enabled_apis = osapi_compute,metadata
rpc_backend = rabbit
auth_strategy = keystone
my_ip = 192.168.139.251
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[oslo_messaging_rabbit]
rabbit_host = mcon
rabbit_userid = openstack
rabbit_password = haoning
[api_database]
connection = mysql+pymysql://nova:haoning@mcon/nova_api
[database]
connection = mysql+pymysql://nova:haoning@mcon/nova
[keystone_authtoken]
auth_uri = http://mcon:5000
auth_url = http://mcon:35357
memcached_servers = mcon:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = haoning
#Comment out or remove any other options in the [keystone_authtoken] section.
[vnc]
vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip
[glance]
api_servers = http://mcon:9292
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
#####################
#其实还要配置【neutron】 ,后面继续配置
su -s /bin/sh -c "nova-manage api_db sync" nova
su -s /bin/sh -c "nova-manage db sync" nova

systemctl enable openstack-nova-api.service  openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
systemctl start openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
openstack service list

@@@@@@@@@@@@@@@nova compute节点@@@@@@@@@@@@@@@@@@@@@@@
yum install openstack-nova-compute -y

/etc/nova/nova.conf
################
[DEFAULT]
rpc_backend = rabbit
auth_strategy = keystone
my_ip = 192.168.139.252
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[oslo_messaging_rabbit]
rabbit_host = mcon
rabbit_userid = openstack
rabbit_password = haoning
[keystone_authtoken]
auth_uri = http://mcon:5000
auth_url = http://mcon:35357
memcached_servers = mcon:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = haoning
[vnc]
enabled = True
vncserver_listen = 0.0.0.0
vncserver_proxyclient_address = $my_ip
novncproxy_base_url = http://mcon:6080/vnc_auto.html
[glance]
api_servers = http://mcon:9292
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
[libvirt]
virt_type = qemu
#####################
egrep -c '(vmx|svm)' /proc/cpuinfo

systemctl enable libvirtd.service openstack-nova-compute.service
systemctl start libvirtd.service openstack-nova-compute.service
. o_admin.sh
openstack service list
openstack compute service list

@@@@@@@@@@@@@@@@@@@@@@@@@@neutron controller@@@@@@
create database neutron;
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY 'haoning';
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY 'haoning';
flush privileges;

openstack user create --domain default --password-prompt neutron
openstack role add --project service --user neutron admin


openstack service create --name neutron --description "OpenStack Networking" network
openstack endpoint create --region wuhan network public http://mcon:9696
openstack endpoint create --region wuhan network internal http://mcon:9696
openstack endpoint create --region wuhan network admin http://mcon:9696

yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables -y
/etc/neutron/neutron.conf
###########################
[DEFAULT]
rpc_backend = rabbit
auth_strategy = keystone

notify_nova_on_port_status_changes = True
notify_nova_on_port_data_changes = True

core_plugin = ml2
service_plugins = router
allow_overlapping_ips = True

[keystone_authtoken]
auth_uri = http://mcon:5000
auth_url = http://mcon:35357
memcached_servers = mcon:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = haoning

[oslo_messaging_rabbit]
rabbit_host = mcon
rabbit_userid = openstack
rabbit_password = haoning
[database]
connection = mysql+pymysql://neutron:haoning@mcon/neutron
[nova]
auth_url = http://mcon:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = wuhan
project_name = service
username = nova
password = haoning
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp
######################

/etc/neutron/plugins/ml2/ml2_conf.ini
###################################
[ml2]
type_drivers = flat,vlan,vxlan
tenant_network_types = vxlan
mechanism_drivers = linuxbridge,l2population
extension_drivers = port_security
[ml2_type_flat]
flat_networks = provider
[ml2_type_vxlan]
vni_ranges = 1:1000
[securitygroup]
enable_ipset = True
###################################

/etc/neutron/plugins/ml2/linuxbridge_agent.ini
#########################
[linux_bridge]
physical_interface_mappings = provider:eth0
[vxlan]
enable_vxlan = True
local_ip = 192.168.139.251
l2_population = True
[securitygroup]
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
############################

/etc/neutron/l3_agent.ini
############################
[DEFAULT]
interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
external_network_bridge =
############################



/etc/neutron/dhcp_agent.ini
#####################
[DEFAULT]
interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = True
###################


/etc/neutron/metadata_agent.ini
################
[DEFAULT]
nova_metadata_ip = mcon
metadata_proxy_shared_secret = METADATA_SECRET
#####################

/etc/nova/nova.conf
######################★★★★★★★★★★★★★★★★nova需要操作neutron,没有会报NoSuchOptError: no such option in group neutron: auth_plugin#####################
[neutron]
url = http://mcon:9696
auth_url = http://mcon:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = wuhan
project_name = service
username = neutron
password = haoning

service_metadata_proxy = True
metadata_proxy_shared_secret = METADATA_SECRET
#################################

ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron

systemctl restart openstack-nova-api.service

systemctl enable neutron-server.service  neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service
systemctl start neutron-server.service  neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service

systemctl enable neutron-l3-agent.service
systemctl start neutron-l3-agent.service

neutron agent-list
openstack service list



@@@@@@@@@@@@@@@@@@neutron compute节点@@@@@@@@@@@@@@@

yum install openstack-neutron-linuxbridge ebtables ipset -y

/etc/neutron/neutron.conf
##########################
[DEFAULT]
rpc_backend = rabbit
auth_strategy = keystone
[oslo_messaging_rabbit]
rabbit_host = mcon
rabbit_userid = openstack
rabbit_password = haoning
[keystone_authtoken]
auth_uri = http://mcon:5000
auth_url = http://mcon:35357
memcached_servers = mcon:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = haoning

[oslo_concurrency]
lock_path = /var/lib/neutron/tmp
############################

/etc/neutron/plugins/ml2/linuxbridge_agent.ini
########################
[linux_bridge]
physical_interface_mappings = provider:eth0
[vxlan]
enable_vxlan = True
local_ip = 192.168.139.252
l2_population = True
[securitygroup]
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
############################

/etc/nova/nova.conf
######################
[neutron]
url = http://mcon:9696
auth_url = http://mcon:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = wuhan
project_name = service
username = neutron
password = haoning
######################

systemctl restart openstack-nova-compute.service

systemctl enable neutron-linuxbridge-agent.service
systemctl start neutron-linuxbridge-agent.service


neutron ext-list
neutron agent-list


openstack flavor list
openstack flavor create --id 0 --vcpus 1 --ram 64 --disk 1 m1.nano


ssh-keygen -q -N ""
openstack keypair create --public-key ~/.ssh/id_rsa.pub mykey
openstack keypair list

#openstack security group rule create --proto icmp default
#openstack security group rule  list
#openstack security group rule create --proto tcp --dst-port 22 default

openstack image list
openstack network list

openstack security group list


nova service-list
neutron agent-list

neutron net-list



bridge fdb

你可能感兴趣的:(openstack)