openstack

openstack参考文档

准备工作:

虚拟机上网
[root@server1 ~]# route add default gw 172.25.3.250     
-bash: route: command not found虚拟机上网
[root@server1 ~]# vim /etc/yum.repos.d/redhat.repo 
[root@server1 ~]# vim /etc/yum.repos.d/dvd.repo 
[root@server1 ~]# yum repolist
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
dvd                                                      | 4.1 kB     00:00     
(1/2): dvd/group_gz                                        | 136 kB   00:00     
(2/2): dvd/primary_db                                      | 3.9 MB   00:00     
repo id                              repo name                            status
dvd                                  rhel7.3                              4,751
repolist: 4,751
[root@server1 ~]# yum install net-tools -y

[root@server1 ~]# route add default gw 172.25.3.250
[root@server1 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.25.3.250    0.0.0.0         UG    0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0
172.25.3.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
[root@server1 ~]# vim /etc/resolv.conf 
nameserver 114.114.114.114
[root@foundation3 mitaka]# iptables -t nat -I POSTROUTING -s 172.25.3.0/24 -j MASQUERADE    ## 火墙地址伪装
[root@server1 ~]# ping baidu.com   ##虚拟机上网
PING baidu.com (123.125.115.110) 56(84) bytes of data.
64 bytes from 123.125.115.110 (123.125.115.110): icmp_seq=1 ttl=48 time=512 ms
64 bytes from 123.125.115.110 (123.125.115.110): icmp_seq=2 ttl=48 time=80.7 ms
64 bytes from 123.125.115.110 (123.125.115.110): icmp_seq=3 ttl=48 time=59.0 ms
^C
--- baidu.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2024ms
rtt min/avg/max/mdev = 59.089/217.368/512.219/208.679 ms

时间同步

[root@foundation3 ~]# vim /etc/chrony.conf
server 172.25.254.250 iburst               ## 同步254.250上的时间
allow 172.25/16                 ##允许172.25网段的主机同步本机时间

[root@server1 ~]# vim /etc/chrony.conf
server 172.25.3.250 iburst     ## 同步3.250上的时间
[root@server1 ~]# yum list chrony
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Installed Packages
chrony.x86_64                     2.1.1-3.el7                      @anaconda/7.3
[root@server1 ~]# yum install chrony.x86_64 -y
[root@foundation3 ~]# chronyc sources -v
210 Number of sources = 1

  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                \     |          |  zzzz = estimated error.
||                                 |    |           \
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^* 172.25.254.250                3   8   377    55    +72us[ +123us] +/-   38ms
[root@controller ~]# chronyc sources -v     ##时间同步成功!
        210 Number of sources = 1
  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                \     |          |  zzzz = estimated error.
||                                 |    |           \
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^* 172.25.3.250                  4   6   377    16  -1758ns[ -129us] +/-   49ms
yum源
[root@foundation3 yum.repos.d]# cd /var/www/html           ## mitaka 放在发布目录中
[root@foundation3 html]# ls
mitaka  rhel6  rhel6.5  rhel7.3 

[root@server1 ~]# vim /etc/yum.repos.d/dvd.repo 
[dvd]
name=rhel7.3
baseurl=http://172.25.3.250/rhel7.3
gpgcheck=0

[openstack]
name=openstack
baseurl=http://172.25.3.250/mitaka
gpgcheck=0

[root@server1 ~]# yum repolist
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
dvd                                                                   | 4.1 kB  00:00:00     
openstack                                                             | 2.9 kB  00:00:00     
openstack/primary_db                                                  | 141 kB  00:00:00     
repo id                                    repo name                                   status
dvd                                        rhel7.3                                     4,751
openstack                                  openstack                                     279

repolist: 5,030

或者从网上找包 直接https://repos.fedorapeople.org/repos/openstack/EOL/openstack-mitaka/

openstack_第1张图片

网络配置

添加一块网卡eth1

[root@server1 ~]# cd /etc/sysconfig/network-scripts/
[root@server1 network-scripts]# cp ifcfg-eth0 ifcfg-eth1
[root@server1 network-scripts]# vim ifcfg-eth0
NAME="eth0"
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=172.25.3.1
PREFIX=24
GETWAY=172.25.254.3
DNS1=114.114.114.114
       
[root@server1 network-scripts]# vim ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
                
[root@server1 network-scripts]# vim /boot/grub2/grub.cfg 
 99         linux16 /vmlinuz-3.10.0-514.el7.x86_64 root=/dev/mapper/rhel-root ro rd.lvm.lv=rh    el/root rd.lvm.lv=rhel/swap rhgb quiet LANG=en_US.UTF-8  net.ifnames=0

[root@server1 network-scripts]# ifup eth1
[root@server1 network-scripts]# ip addr
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0:  mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 52:54:00:7a:8d:73 brd ff:ff:ff:ff:ff:ff
    inet 172.25.3.1/24 brd 172.25.3.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fe7a:8d73/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1:  mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 52:54:00:eb:26:c9 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::5054:ff:feeb:26c9/64 scope link 
       valid_lft forever preferred_lft forever
[root@server1 network-scripts]# systemctl status NetworkManager
● NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:NetworkManager(8)
[root@server1 network-scripts]# systemctl disable NetworkManager

修改主机名称

[root@server1 network-scripts]# hostname
server1
[root@server1 network-scripts]# hostnamectl set-hostname controller
[root@server1 network-scripts]# hostname
controller
[root@server1 network-scripts]# logout
Connection to 172.25.3.1 closed.
[kiosk@foundation3 ~]$ ssh [email protected]
[email protected]'s password: 
Last login: Sat Dec  1 10:48:54 2018 from 172.25.3.250

[root@controller ~]# yum upgrade   ##

[root@controller ~]# getenforce
Disabled
[root@controller ~]# yum install python-openstackclient -y

[root@controller ~]# yum install mariadb mariadb-server python2-PyMySQL
[root@controller ~]# vim /etc/my.cnf.d/openstack.cnf
[root@controller ~]#  systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@controller ~]# systemctl start mariadb.service
[root@controller ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
[root@controller ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@controller ~]# mysql -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> quit
Bye
[root@controller ~]# yum install rabbitmq-server
[root@controller ~]# vim /etc/sysconfig/memcached 
[root@controller ~]# systemctl enable memcached.service
Created symlink from /etc/systemd/system/multi-user.target.wants/memcached.service to /usr/lib/systemd/system/memcached.service.
[root@controller ~]# systemctl start memcached.service
[root@controller ~]# netstat -anplt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 172.25.3.1:3306         0.0.0.0:*               LISTEN      1617/mysqld         
tcp        0      0 0.0.0.0:11211           0.0.0.0:*               LISTEN      2335/memcached      
tcp        0      0 0.0.0.0:4369            0.0.0.0:*               LISTEN      1/systemd           
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      647/sshd            
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      861/master          
tcp        0      0 0.0.0.0:25672           0.0.0.0:*               LISTEN      1800/beam           
tcp        0      0 172.25.3.1:22           172.25.3.250:56570      ESTABLISHED 1260/sshd: root@pts 
tcp        0      0 172.25.3.1:4369         172.25.3.1:35892        TIME_WAIT   -                   
tcp        0      0 127.0.0.1:4369          127.0.0.1:35006         ESTABLISHED 1886/epmd           
tcp        0      0 127.0.0.1:35006         127.0.0.1:4369          ESTABLISHED 1800/beam           
tcp6       0      0 :::11211                :::*                    LISTEN      2335/memcached      
tcp6       0      0 :::22                   :::*                    LISTEN      647/sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      861/master          
tcp6       0      0 :::5672                 :::*                    LISTEN      1800/beam           
(reverse-i-search)`def': route add ^Cfault gw 172.25.3.250
[root@controller ~]# systemctl start rabbitmq
Failed to start rabbitmq.service: Unit not found.
[root@controller ~]# rabbitmq-plugins enable rabbitmy_management
Error: The following plugins could not be found:
  rabbitmy_management

[root@controller ~]# rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
  mochiweb
  webmachine
  rabbitmq_web_dispatch
  amqp_client
  rabbitmq_management_agent
  rabbitmq_management

Applying plugin configuration to rabbit@controller... started 6 plugins.
[root@controller ~]# netstat -anplt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 172.25.3.1:3306         0.0.0.0:*               LISTEN      1617/mysqld         
tcp        0      0 0.0.0.0:11211           0.0.0.0:*               LISTEN      2335/memcached      
tcp        0      0 0.0.0.0:4369            0.0.0.0:*               LISTEN      1/systemd           
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      647/sshd            
tcp        0      0 0.0.0.0:15672           0.0.0.0:*               LISTEN      1800/beam           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      861/master          
tcp        0      0 0.0.0.0:25672           0.0.0.0:*               LISTEN      1800/beam           
tcp        0      0 172.25.3.1:22           172.25.3.250:56570      ESTABLISHED 1260/sshd: root@pts 
tcp        0      0 127.0.0.1:48708         127.0.0.1:4369          TIME_WAIT   -                   
tcp        0      0 127.0.0.1:4369          127.0.0.1:35006         ESTABLISHED 1886/epmd           
tcp        0      0 172.25.3.1:4369         172.25.3.1:42033        TIME_WAIT   -                   
tcp        0      0 127.0.0.1:35006         127.0.0.1:4369          ESTABLISHED 1800/beam           
tcp        0      0 172.25.3.1:4369         172.25.3.1:51224        TIME_WAIT   -                   
tcp        0      0 127.0.0.1:44472         127.0.0.1:4369          TIME_WAIT   -                   
tcp        0      0 172.25.3.1:54209        172.25.3.1:25672        TIME_WAIT   -                   
tcp6       0      0 :::11211                :::*                    LISTEN      2335/memcached      
tcp6       0      0 :::22                   :::*                    LISTEN      647/sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      861/master          
tcp6       0      0 :::5672                 :::*                    LISTEN      1800/beam           
[root@controller ~]# mysql -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> quit
Bye
[root@controller ~]# mysql -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@controller ~]# mysql -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 14
Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE DATABASE keystone;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' \
    ->   IDENTIFIED BY 'keystone';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%'    IDENTIFIED BY 'keystone';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> quit
Bye
[root@controller ~]# yum install openstack-keystone httpd mod_wsgi -y

[root@controller ~]# openssl rand -hex 10
4fb1047fc66953142f4e
[root@controller ~]# vim  /etc/keystone/keystone.conf
[root@controller ~]# su -s /bin/sh -c "keystone-manage db_sync" keystone
[root@controller ~]# cd /etc/keystone
[root@controller keystone]# ls
default_catalog.templates  keystone-paste.ini  policy.json
keystone.conf              logging.conf        sso_callback_template.html
[root@controller keystone]# ll
total 100
-rw-r----- 1 root     keystone  2303 Sep 22  2016 default_catalog.templates
-rw-r----- 1 root     keystone 73221 Dec  1 11:56 keystone.conf
-rw-r----- 1 root     keystone  2400 Sep 22  2016 keystone-paste.ini
-rw-r----- 1 root     keystone  1046 Sep 22  2016 logging.conf
-rw-r----- 1 keystone keystone  9699 Sep 22  2016 policy.json
-rw-r----- 1 keystone keystone   665 Sep 22  2016 sso_callback_template.html
[root@controller keystone]# keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
[root@controller keystone]# vim /etc/httpd/conf/httpd.conf
[root@controller keystone]# vim /etc/httpd/conf.d/wsgi-keystone.conf
[root@controller keystone]# systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@controller keystone]# systemctl start httpd.service
[root@controller keystone]# netstat -anplt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 172.25.3.1:3306         0.0.0.0:*               LISTEN      1617/mysqld         
tcp        0      0 0.0.0.0:11211           0.0.0.0:*               LISTEN      2335/memcached      
tcp        0      0 0.0.0.0:4369            0.0.0.0:*               LISTEN      1/systemd           
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      647/sshd            
tcp        0      0 0.0.0.0:15672           0.0.0.0:*               LISTEN      1800/beam           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      861/master          
tcp        0      0 0.0.0.0:25672           0.0.0.0:*               LISTEN      1800/beam           
tcp        0      0 172.25.3.1:22           172.25.3.250:56570      ESTABLISHED 1260/sshd: root@pts 
tcp        0      0 127.0.0.1:4369          127.0.0.1:35006         ESTABLISHED 1886/epmd           
tcp        0      0 172.25.3.1:4369         172.25.3.1:52039        TIME_WAIT   -                   
tcp        0      0 127.0.0.1:35006         127.0.0.1:4369          ESTABLISHED 1800/beam           
tcp6       0      0 :::11211                :::*                    LISTEN      2335/memcached      
tcp6       0      0 :::80                   :::*                    LISTEN      3300/httpd          
tcp6       0      0 :::22                   :::*                    LISTEN      647/sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      861/master          
tcp6       0      0 :::35357                :::*                    LISTEN      3300/httpd          
tcp6       0      0 :::5000                 :::*                    LISTEN      3300/httpd          
tcp6       0      0 :::5672                 :::*                    LISTEN      1800/beam           
[root@controller keystone]# mysql -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use ketstone
ERROR 1049 (42000): Unknown database 'ketstone'
MariaDB [(none)]> use keystone
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [keystone]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| keystone           |
| mysql              |
| performance_schema |
+--------------------+
4 rows in set (0.00 sec)

MariaDB [keystone]> show tables;
+------------------------+
| Tables_in_keystone     |
+------------------------+
| access_token           |
| assignment             |
| config_register        |
| consumer               |
| credential             |
| domain                 |
| endpoint               |
| endpoint_group         |
| federated_user         |
| federation_protocol    |
| group                  |
| id_mapping             |
| identity_provider      |
| idp_remote_ids         |
| implied_role           |
| local_user             |
| mapping                |
| migrate_version        |
| password               |
| policy                 |
| policy_association     |
| project                |
| project_endpoint       |
| project_endpoint_group |
| region                 |
| request_token          |
| revocation_event       |
| role                   |
| sensitive_config       |
| service                |
| service_provider       |
| token                  |
| trust                  |
| trust_role             |
| user                   |
| user_group_membership  |
| whitelisted_config     |
+------------------------+
37 rows in set (0.00 sec)

MariaDB [keystone]> quit
Bye
(reverse-i-search)`': ^Cstemctl start httpd.service
[root@controller keystone]# vim /etc/keystone/
default_catalog.templates   keystone-paste.ini          sso_callback_template.html
fernet-keys/                logging.conf                
keystone.conf               policy.json                 
[root@controller keystone]# vim /etc/keystone/
default_catalog.templates   keystone-paste.ini          sso_callback_template.html
fernet-keys/                logging.conf                
keystone.conf               policy.json                 
[root@controller keystone]# vim /etc/keystone/
[root@controller keystone]# vim /etc/keystone/keystone.conf 
[root@controller keystone]# export OS_TOKEN=^C
[root@controller keystone]# vim /etc/keystone/keystone.conf 
[root@controller keystone]# export OS_TOKEN=4fb1047fc66953142f4e
[root@controller keystone]# export OS_URL=http://controller:35357/v3
[root@controller keystone]# export OS_IDENTITY_API_VERSION=3
[root@controller keystone]# openstack service create \
> --name keystone --description "OpenStack Identity" identity
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Identity               |
| enabled     | True                             |
| id          | e309afa27d6c48a78b8a058e149cc904 |
| name        | keystone                         |
| type        | identity                         |
+-------------+----------------------------------+
[root@controller keystone]# openstack service list
+----------------------------------+----------+----------+
| ID                               | Name     | Type     |
+----------------------------------+----------+----------+
| e309afa27d6c48a78b8a058e149cc904 | keystone | identity |
+----------------------------------+----------+----------+
[root@controller keystone]# openstack endpoint create --region RegionOne \
>   identity public http://controller:5000/v3
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | f3e5e114d06f490fb798745ac0ff01f3 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | e309afa27d6c48a78b8a058e149cc904 |
| service_name | keystone                         |
| service_type | identity                         |
| url          | http://controller:5000/v3        |
+--------------+----------------------------------+
[root@controller keystone]# openstack endpoint create --region RegionOne \
>   identity internal http://controller:5000/v3
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 47a09f9aa32b4795b2ce03de572fa48d |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | e309afa27d6c48a78b8a058e149cc904 |
| service_name | keystone                         |
| service_type | identity                         |
| url          | http://controller:5000/v3        |
+--------------+----------------------------------+
[root@controller keystone]# openstack endpoint create --region RegionOne \
>   identity admin http://controller:35357/v3
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 81522662e698496c8fc4f3ec6096b7fb |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | e309afa27d6c48a78b8a058e149cc904 |
| service_name | keystone                         |
| service_type | identity                         |
| url          | http://controller:35357/v3       |
+--------------+----------------------------------+
[root@controller keystone]# openstack  service list
+----------------------------------+----------+----------+
| ID                               | Name     | Type     |
+----------------------------------+----------+----------+
| e309afa27d6c48a78b8a058e149cc904 | keystone | identity |
+----------------------------------+----------+----------+
[root@controller keystone]# openstack endpoint list
+-------------+-----------+--------------+--------------+---------+-----------+---------------+
| ID          | Region    | Service Name | Service Type | Enabled | Interface | URL           |
+-------------+-----------+--------------+--------------+---------+-----------+---------------+
| 47a09f9aa32 | RegionOne | keystone     | identity     | True    | internal  | http://contro |
| b4795b2ce03 |           |              |              |         |           | ller:5000/v3  |
| de572fa48d  |           |              |              |         |           |               |
| 81522662e69 | RegionOne | keystone     | identity     | True    | admin     | http://contro |
| 8496c8fc4f3 |           |              |              |         |           | ller:35357/v3 |
| ec6096b7fb  |           |              |              |         |           |               |
| f3e5e114d06 | RegionOne | keystone     | identity     | True    | public    | http://contro |
| f490fb79874 |           |              |              |         |           | ller:5000/v3  |
| 5ac0ff01f3  |           |              |              |         |           |               |
+-------------+-----------+--------------+--------------+---------+-----------+---------------+
[root@controller keystone]# openstack domain create --description "Default Domain" default
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Default Domain                   |
| enabled     | True                             |
| id          | 73f30444372d44679cc4e1bd21c8ac68 |
| name        | default                          |
+-------------+----------------------------------+
[root@controller keystone]# openstack project create --domain default \
>   --description "Admin Project" admin
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Admin Project                    |
| domain_id   | 73f30444372d44679cc4e1bd21c8ac68 |
| enabled     | True                             |
| id          | a98bcb7543b2412c96b653aaefb81009 |
| is_domain   | False                            |
| name        | admin                            |
| parent_id   | 73f30444372d44679cc4e1bd21c8ac68 |
+-------------+----------------------------------+
[root@controller keystone]# openstack user create --domain default \
>   --password admin admin
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | 73f30444372d44679cc4e1bd21c8ac68 |
| enabled   | True                             |
| id        | 78eab60fc619417fac9c77eb88118d2b |
| name      | admin                            |
+-----------+----------------------------------+
[root@controller keystone]# openstack role create admin
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | None                             |
| id        | 151aa74eeddf4cb29e314041211e3034 |
| name      | admin                            |
+-----------+----------------------------------+
[root@controller keystone]# openstack role add --project admin --user admin admin
[root@controller keystone]# openstack project create --domain default \
>   --description "Service Project" service
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Service Project                  |
| domain_id   | 73f30444372d44679cc4e1bd21c8ac68 |
| enabled     | True                             |
| id          | 7d6efac22b75410f8a1256f63c02cda6 |
| is_domain   | False                            |
| name        | service                          |
| parent_id   | 73f30444372d44679cc4e1bd21c8ac68 |
+-------------+----------------------------------+
[root@controller keystone]# openstack project create --domain default \
>   --description "Demo Project" demo
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Demo Project                     |
| domain_id   | 73f30444372d44679cc4e1bd21c8ac68 |
| enabled     | True                             |
| id          | c191064700c94a01902b3af1df0f2c4f |
| is_domain   | False                            |
| name        | demo                             |
| parent_id   | 73f30444372d44679cc4e1bd21c8ac68 |
+-------------+----------------------------------+
[root@controller keystone]# openstack user create --domain default \
>   --password demo demo
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | 73f30444372d44679cc4e1bd21c8ac68 |
| enabled   | True                             |
| id        | 8a6291e7d59e4b4c888acba1774f0b18 |
| name      | demo                             |
+-----------+----------------------------------+
[root@controller keystone]# openstack role create user
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | None                             |
| id        | 97fa0ba72508455c9b3d70a42142b827 |
| name      | user                             |
+-----------+----------------------------------+
[root@controller keystone]# openstack role add --project demo --user demo user
[root@controller keystone]# unset OS_TOKEN OS_URL
[root@controller keystone]# openstack --os-auth-url http://controller:35357/v3 \
>   --os-project-domain-name default --os-user-domain-name default \
>   --os-project-name admin --os-username admin token issue
Password: 
+------------+------------------------------------------------------------------------------+
| Field      | Value                                                                        |
+------------+------------------------------------------------------------------------------+
| expires    | 2018-12-01T05:11:23.801234Z                                                  |
| id         | gAAAAABcAgnrlsK78r3nrsv2fX9VIk1s1EZ8OxLVeefciSAPMJSXS0zbRPTSwo0oFOEdwj3gbPZn |
|            | WyApwo4AQ7NSWboL9vwTy-4qWm-L-AoReN77a1U6VvtKedVaoDHNN0MRXhJfSSohZ4IYmY_JzF3p |
|            | H7f4RjOxASqPE6HwHvyAoDSnn4pUGyk                                              |
| project_id | a98bcb7543b2412c96b653aaefb81009                                             |
| user_id    | 78eab60fc619417fac9c77eb88118d2b                                             |
+------------+------------------------------------------------------------------------------+
[root@controller keystone]# openstack --os-auth-url http://controller:5000/v3 \
>   --os-project-domain-name default --os-user-domain-name default \
>   --os-project-name demo --os-username demo token issue
Password: 
+------------+------------------------------------------------------------------------------+
| Field      | Value                                                                        |
+------------+------------------------------------------------------------------------------+
| expires    | 2018-12-01T05:11:41.772253Z                                                  |
| id         | gAAAAABcAgn9RGUwmpx2EGnDpS_MAZbx8wnBo592Ks-24HIrssL5OhoGPRPJ_4eQdtkZXz1z7out |
|            | nMEJjfDLae8bC4_bQBbwQfHQe4YpfK_R9T6NMU_QTMriucl2wrnM3r6loOlzC-               |
|            | MloblCddFKH9gJbHImeu608hKWFn-MK_y0cjaLYaexZNI                                |
| project_id | c191064700c94a01902b3af1df0f2c4f                                             |
| user_id    | 8a6291e7d59e4b4c888acba1774f0b18                                             |
+------------+------------------------------------------------------------------------------+
[root@controller keystone]# cd
[root@controller ~]# vim admin-openrc 
[root@controller ~]# vim  demo-openrc
[root@controller ~]# source admin-openrc
[root@controller ~]# openstack user list
+----------------------------------+-------+
| ID                               | Name  |
+----------------------------------+-------+
| 78eab60fc619417fac9c77eb88118d2b | admin |
| 8a6291e7d59e4b4c888acba1774f0b18 | demo  |
+----------------------------------+-------+
[root@controller ~]# source demo-openrc 
[root@controller ~]# openstack user list





[root@controller ~]# mysql -p 
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 27
Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE DATABASE glance;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \
    ->   IDENTIFIED BY 'glance';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \
    ->   IDENTIFIED BY 'glance'
    -> ;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> quit
Bye

[root@controller ~]# . admin-openrc         ##切换到admin用户
[root@controller ~]# openstack user create --domain default --password glance glance
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | 73f30444372d44679cc4e1bd21c8ac68 |
| enabled   | True                             |
| id        | 381120acedac441aaf84d767f1dc7fe7 |
| name      | glance                           |
+-----------+----------------------------------+
[root@controller ~]# openstack role add --project service --user glance admin
[root@controller ~]# openstack service create --name glance \
>   --description "OpenStack Image" image
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Image                  |
| enabled     | True                             |
| id          | d85ef7c0047c4ace84a9f9d1a81e087a |
| name        | glance                           |
| type        | image                            |
+-------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne \
>   image public http://controller:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 94e19f9b85724ace8ae3be85cbcc2921 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | d85ef7c0047c4ace84a9f9d1a81e087a |
| service_name | glance                           |
| service_type | image                            |
| url          | http://controller:9292           |
+--------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne \
>   image internal http://controller:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | b65d37e4249a413db47286c2aaba111d |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | d85ef7c0047c4ace84a9f9d1a81e087a |
| service_name | glance                           |
| service_type | image                            |
| url          | http://controller:9292           |
+--------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne \
>   image admin http://controller:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | dcb135c1146847d9910b394c0f74a25f |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | d85ef7c0047c4ace84a9f9d1a81e087a |
| service_name | glance                           |
| service_type | image                            |
| url          | http://controller:9292           |
+--------------+----------------------------------+


glance:

    [root@controller ~]# yum install openstack-glance   -y 
    [root@controller ~]# vim /etc/glance/glance-api.conf
    
    [root@controller ~]# vim /etc/glance/glance-registry.conf
    [root@controller ~]# su -s /bin/sh -c "glance-manage db_sync" glance
    
    [root@controller ~]# systemctl enable openstack-glance-api.service \
    >   openstack-glance-registry.service
    Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-api.service to /usr/lib/systemd/system/openstack-glance-api.service.
    Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-registry.service to /usr/lib/systemd/system/openstack-glance-registry.service.
    
    [root@controller ~]# systemctl start openstack-glance-api.service \
    >   openstack-glance-registry.service
    [root@controller ~]# netstat -anplt | grep :9292
    tcp        0      0 0.0.0.0:9292            0.0.0.0:*               LISTEN      5197/python2        
    [root@controller ~]# ls
    admin-openrc  cirros-0.3.5-x86_64-disk.img  demo-openrc
    [root@controller ~]# ls
    admin-openrc  cirros-0.3.5-x86_64-disk.img  demo-openrc
    [root@controller ~]# openstack image create "cirros" \
    > --file cirros-0.3.5-x86_64-disk.img  \
    > --disk-format qcow2 --container-format bare \
    > --public
    +------------------+------------------------------------------------------+
    | Field            | Value                                                |
    +------------------+------------------------------------------------------+
    | checksum         | f8ab98ff5e73ebab884d80c9dc9c7290                     |
    | container_format | bare                                                 |
    | created_at       | 2018-12-01T06:27:44Z                                 |
    | disk_format      | qcow2                                                |
    | file             | /v2/images/74a9fcf1-6bc2-4ec1-8445-05811d4676b4/file |
    | id               | 74a9fcf1-6bc2-4ec1-8445-05811d4676b4                 |
    | min_disk         | 0                                                    |
    | min_ram          | 0                                                    |
    | name             | cirros                                               |
    | owner            | a98bcb7543b2412c96b653aaefb81009                     |
    | protected        | False                                                |
    | schema           | /v2/schemas/image                                    |
    | size             | 13267968                                             |
    | status           | active                                               |
    | tags             |                                                      |
    | updated_at       | 2018-12-01T06:27:44Z                                 |
    | virtual_size     | None                                                 |
    | visibility       | public                                               |
    +------------------+------------------------------------------------------+
    [root@controller ~]# openstack image list
    +--------------------------------------+--------+--------+
    | ID                                   | Name   | Status |
    +--------------------------------------+--------+--------+
    | 74a9fcf1-6bc2-4ec1-8445-05811d4676b4 | cirros | active |
    +--------------------------------------+--------+--------+



[root@controller ~]# mysql -p 
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 27
Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE DATABASE glance;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \
    ->   IDENTIFIED BY 'glance';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \
    ->   IDENTIFIED BY 'glance'
    -> ;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> quiyt
    -> quit
    -> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'quiyt
quit' at line 1
MariaDB [(none)]> quit
Bye
[root@controller ~]# openstack user create --domain default --password glance glance
Could not find resource default
[root@controller ~]# . admin-openrc
[root@controller ~]# openstack user create --domain default --password glance glance
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | 73f30444372d44679cc4e1bd21c8ac68 |
| enabled   | True                             |
| id        | 381120acedac441aaf84d767f1dc7fe7 |
| name      | glance                           |
+-----------+----------------------------------+
[root@controller ~]# openstack role add --project service --user glance admin
[root@controller ~]# openstack service create --name glance \
>   --description "OpenStack Image" image
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Image                  |
| enabled     | True                             |
| id          | d85ef7c0047c4ace84a9f9d1a81e087a |
| name        | glance                           |
| type        | image                            |
+-------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne \
>   image public http://controller:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 94e19f9b85724ace8ae3be85cbcc2921 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | d85ef7c0047c4ace84a9f9d1a81e087a |
| service_name | glance                           |
| service_type | image                            |
| url          | http://controller:9292           |
+--------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne \
>   image internal http://controller:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | b65d37e4249a413db47286c2aaba111d |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | d85ef7c0047c4ace84a9f9d1a81e087a |
| service_name | glance                           |
| service_type | image                            |
| url          | http://controller:9292           |
+--------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne \
>   image admin http://controller:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | dcb135c1146847d9910b394c0f74a25f |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | d85ef7c0047c4ace84a9f9d1a81e087a |
| service_name | glance                           |
| service_type | image                            |
| url          | http://controller:9292           |
+--------------+----------------------------------+
[root@controller ~]# yum install openstack-glance
[root@controller ~]# vim /etc/glance/glance-api.conf
[root@controller ~]# vim /etc/glance/glance-registry.conf
[root@controller ~]# su -s /bin/sh -c "glance-manage db_sync" glance
Option "verbose" from group "DEFAULT" is deprecated for removal.  Its value may be silently ignored in the future.
/usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:1056: OsloDBDeprecationWarning: EngineFacade is deprecated; please use oslo_db.sqlalchemy.enginefacade
  expire_on_commit=expire_on_commit, _conf=conf)
/usr/lib/python2.7/site-packages/pymysql/cursors.py:166: Warning: (1831, u'Duplicate index `ix_image_properties_image_id_name`. This is deprecated and will be disallowed in a future release.')
  result = self._query(query)
[root@controller ~]# systemctl enable openstack-glance-api.service \
>   openstack-glance-registry.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-api.service to /usr/lib/systemd/system/openstack-glance-api.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-glance-registry.service to /usr/lib/systemd/system/openstack-glance-registry.service.
[root@controller ~]# systemctl start openstack-glance-api.service \
>   openstack-glance-registry.service
[root@controller ~]# netstat -anplt | grep :9292
tcp        0      0 0.0.0.0:9292            0.0.0.0:*               LISTEN      5197/python2        
[root@controller ~]# ls
admin-openrc  cirros-0.3.5-x86_64-disk.img  demo-openrc
[root@controller ~]# ls
admin-openrc  cirros-0.3.5-x86_64-disk.img  demo-openrc
[root@controller ~]# openstack image create "cirros" \
>   --file cirros-0.3.4-x86_64-disk.img \
>   --disk-format qcow2 --container-format bare \
>   --public^C
[root@controller ~]#  openstack image create "cirros" \
> --file cirros-0.3.5-x86_64-disk.img  \
> >   --disk-format qcow2 --container-format bare \
> >   --public^C
[root@controller ~]# openstack image create "cirros" \
> --file cirros-0.3.5-x86_64-disk.img  \
> --disk-format qcow2 --container-format bare \
> --public
+------------------+------------------------------------------------------+
| Field            | Value                                                |
+------------------+------------------------------------------------------+
| checksum         | f8ab98ff5e73ebab884d80c9dc9c7290                     |
| container_format | bare                                                 |
| created_at       | 2018-12-01T06:27:44Z                                 |
| disk_format      | qcow2                                                |
| file             | /v2/images/74a9fcf1-6bc2-4ec1-8445-05811d4676b4/file |
| id               | 74a9fcf1-6bc2-4ec1-8445-05811d4676b4                 |
| min_disk         | 0                                                    |
| min_ram          | 0                                                    |
| name             | cirros                                               |
| owner            | a98bcb7543b2412c96b653aaefb81009                     |
| protected        | False                                                |
| schema           | /v2/schemas/image                                    |
| size             | 13267968                                             |
| status           | active                                               |
| tags             |                                                      |
| updated_at       | 2018-12-01T06:27:44Z                                 |
| virtual_size     | None                                                 |
| visibility       | public                                               |
+------------------+------------------------------------------------------+
[root@controller ~]# openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| 74a9fcf1-6bc2-4ec1-8445-05811d4676b4 | cirros | active |
+--------------------------------------+--------+--------+

配置控制节点:

[root@controller ~]#  mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 37
Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE DATABASE nova_api;
Query OK, 1 row affected (0.01 sec)

MariaDB [(none)]> CREATE DATABASE nova;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' \
    ->   IDENTIFIED BY 'nova';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%'    IDENTIFIED BY 'nova'; Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \
    ->   IDENTIFIED BY 'nova';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%'    IDENTIFIED BY 'nova'; Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> quit
Bye
[root@controller ~]# openstack user create --domain default  --password nova nova
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | 73f30444372d44679cc4e1bd21c8ac68 |
| enabled   | True                             |
| id        | d92b3c30949644ddb1c8958fdbb05908 |
| name      | nova                             |
+-----------+----------------------------------+
[root@controller ~]# openstack role add --project service --user nova admin
[root@controller ~]#  openstack service create --name nova \
>   --description "OpenStack Compute" compute
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Compute                |
| enabled     | True                             |
| id          | e6a68fff1d884d30a20926899f8d7eca |
| name        | nova                             |
| type        | compute                          |
+-------------+----------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne \
>   compute public http://controller:8774/v2.1/%\(tenant_id\)s
+--------------+-------------------------------------------+
| Field        | Value                                     |
+--------------+-------------------------------------------+
| enabled      | True                                      |
| id           | 6c164f1f52a747eeb900ae047ebb11f7          |
| interface    | public                                    |
| region       | RegionOne                                 |
| region_id    | RegionOne                                 |
| service_id   | e6a68fff1d884d30a20926899f8d7eca          |
| service_name | nova                                      |
| service_type | compute                                   |
| url          | http://controller:8774/v2.1/%(tenant_id)s |
+--------------+-------------------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne \
>   compute internal http://controller:8774/v2.1/%\(tenant_id\)s
+--------------+-------------------------------------------+
| Field        | Value                                     |
+--------------+-------------------------------------------+
| enabled      | True                                      |
| id           | d4c31c75d7d84ca390c719f8c9a58e4d          |
| interface    | internal                                  |
| region       | RegionOne                                 |
| region_id    | RegionOne                                 |
| service_id   | e6a68fff1d884d30a20926899f8d7eca          |
| service_name | nova                                      |
| service_type | compute                                   |
| url          | http://controller:8774/v2.1/%(tenant_id)s |
+--------------+-------------------------------------------+
[root@controller ~]# openstack endpoint create --region RegionOne \
>   compute admin http://controller:8774/v2.1/%\(tenant_id\)s
+--------------+-------------------------------------------+
| Field        | Value                                     |
+--------------+-------------------------------------------+
| enabled      | True                                      |
| id           | 8ca823e4251e4e4b90b14b3662f72afc          |
| interface    | admin                                     |
| region       | RegionOne                                 |
| region_id    | RegionOne                                 |
| service_id   | e6a68fff1d884d30a20926899f8d7eca          |
| service_name | nova                                      |
| service_type | compute                                   |
| url          | http://controller:8774/v2.1/%(tenant_id)s |
+--------------+-------------------------------------------+
[root@controller ~]# yum install openstack-nova-api openstack-nova-conductor \
>   openstack-nova-console openstack-nova-novncproxy \
>   openstack-nova-scheduler 

[root@controller ~]# vim /etc/nova/nova.conf
[root@controller ~]# su -s /bin/sh -c "nova-manage api_db sync" nova
[root@controller ~]#  su -s /bin/sh -c "nova-manage db sync" nova
/usr/lib/python2.7/site-packages/pymysql/cursors.py:166: Warning: (1831, u'Duplicate index `block_device_mapping_instance_uuid_virtual_name_device_name_idx`. This is deprecated and will be disallowed in a future release.')
  result = self._query(query)
/usr/lib/python2.7/site-packages/pymysql/cursors.py:166: Warning: (1831, u'Duplicate index `uniq_instances0uuid`. This is deprecated and will be disallowed in a future release.')
  result = self._query(query)
[root@controller ~]# systemctl enable openstack-nova-api.service \
>   openstack-nova-consoleauth.service openstack-nova-scheduler.service \
>   openstack-nova-conductor.service openstack-nova-novncproxy.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-api.service to /usr/lib/systemd/system/openstack-nova-api.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-consoleauth.service to /usr/lib/systemd/system/openstack-nova-consoleauth.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-scheduler.service to /usr/lib/systemd/system/openstack-nova-scheduler.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-conductor.service to /usr/lib/systemd/system/openstack-nova-conductor.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-novncproxy.service to /usr/lib/systemd/system/openstack-nova-novncproxy.service.
[root@controller ~]# systemctl start openstack-nova-api.service \
>   openstack-nova-consoleauth.service openstack-nova-scheduler.service \
>   openstack-nova-conductor.service openstack-nova-novncproxy.service

配置计算节点:

修改hostname:computer1
hostnamectl set-hostname computer1

解析:
172.25.3.1      controller
172.25.3.2      computer1

配置双网卡:

[root@computer1 network-scripts]# vim ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=172.25.3.2
PREFIX=24
TYPE=Ethernet
GATWAY=172.25.3.250   ##上网时需要配置
DNS1=114.114.114.114  ##域名解析
          
[root@computer1 network-scripts]# vim ifcfg-eth1
EVICE=eth1
ONBOOT=yes
BOOTPROTO=none
~             
[root@computer1 network-scripts]# systemctl restart network


[root@computer1 ~]# vim /etc/yum.repos.d/dvd.repo 
[root@computer1 ~]# yum repolist
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
dvd                                                                   | 4.1 kB  00:00:00     
openstack                                                             | 2.9 kB  00:00:00     
(1/3): dvd/group_gz                                                   | 136 kB  00:00:00     
(2/3): dvd/primary_db                                                 | 3.9 MB  00:00:00     
(3/3): openstack/primary_db                                           | 141 kB  00:00:00     
repo id                                    repo name                                   status
dvd                                        rhel7.3                                     4,751
openstack                                  openstack                                     279
repolist: 5,030
[root@computer1 ~]# vim /etc/hosts
172.25.3.1      controller
172.25.3.2      computer1
[root@computer1 ~]# yum install net-tools -y
[root@computer1 ~]# yum install openstack-nova-compute -y 


[root@computer1 ~]# vim /etc/nova/nova.conf
[root@computer1 ~]# egrep -c '(vmx|svm)' /proc/cpuinfo
0
[root@computer1 ~]# vim /etc/nova/nova.conf 
[root@computer1 ~]# systemctl enable libvirtd.service openstack-nova-compute.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-nova-compute.service to /usr/lib/systemd/system/openstack-nova-compute.service.
[root@computer1 ~]# systemctl start libvirtd.service openstack-nova-compute.service

网络配置下次再补上…

你可能感兴趣的:(openstack)