两台机器,搭建了:
KVM, NTP, MariaDB, RabbitMQ, Memcached, Etcd, Placement, Keystone, Glance, Nova, Neutron, Horizon, Cinder, Swift,能够跑起来。是用的VMware Workstation, 两台CentOS7的虚机,分别有两个网卡,Storage/Compute节点有四个虚拟硬盘。
// Two machines, everyone has two NICs, Compute Node has three HardDisk
// Edit /etc/hosts
10.189.189.11 centos1
10.189.189.12 centos2
// When install the HW server, use CentOS7, and make sure the NIC is eth0 and eth1
vmlinuz initrd=initrd.img inst.stage2=hd:LABEL=CenOS\x207\x20x86_64 quiet net.ifnames=0 biosdevname=0
// Configure Controller Node eth0 has static IP 10.189.189.11, Compute Node eth0 has static IP 10.189.189.12
// Configure both eth1 don't have static IP (Sample file: /etc/sysconfig/network-scripts)
HWADDR=00:0c:29:8a:ac:04 //Keep unchanged
DEVICE=eth1
TYPE=Ethernet
BOOTPROTO=none
UUID=45576831-a680-3207-acbb-2e0ff2d4b246 //Keep unchanged
ONBOOT=yes
egrep -E '(vmx|svm)' /proc/cpuinfo
alias grep
yum install -y qemu-kvm libvirt
yum install -y virt-install
systemctl enable libvirtd
systemctl start libvirtd
yum install -y tigervnc-server
systemctl stop firewalld.service
systemctl disable firewalld.service
/usr/bin/vncserver
yum install centos-release-openstack-train
yum upgrade
yum install python-openstackclient
yum install openstack-selinux
yum install chrony
// Edit /etc/chrony.conf on controller node
server time1.aliyun.com iburst
// Repeat install chrony on compute node
// Edit /etc/chrony.conf on compute node
server 10.189.189.11 iburst
systemctl enable chronyd.service
systemctl start chronyd.service
yum install python-openstackclient
yum install mariadb mariadb-server python2-PyMySQL
// Create /etc/my.cnf.d/openstack.cnf
[mysqld]
bind-address = 10.189.189.11
default-storage-engine = innodb
innodb_file_per_table = on
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 rabbitmq-server
systemctl enable rabbitmq-server.service
systemctl start rabbitmq-server.service
rabbitmqctl add_user openstack openstack
rabbitmqctl set_permissions openstack ".*" ".*" ".*"
yum install memcached python-memcached
// Edit /etc/sysconfig/memcached
OPTIONS="-l 127.0.0.1,::1,10.189.189.11"
systemctl enable memcached.service
systemctl start memcached.service
rabbitmq-plugins list
rabbitmq-plugins enable rabbitmq_management
yum install etcd
// Edit the /etc/etcd/etcd.conf
#[Member]
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="http://10.189.189.11:2380"
ETCD_LISTEN_CLIENT_URLS="http://10.189.189.11:2379"
ETCD_NAME="centos1"
#[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://10.189.189.11:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://10.189.189.11:2379"
ETCD_INITIAL_CLUSTER="centos1=http://10.189.189.11:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01"
ETCD_INITIAL_CLUSTER_STATE="new"
systemctl enable etcd.service
systemctl start etcd.service
mysql -uroot -proot
// MariaDB [(none)]>
CREATE DATABASE keystone;
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' \
IDENTIFIED BY 'keystone';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' \
IDENTIFIED BY 'keystone';
yum install openstack-keystone httpd mod_wsgi
// Edit the /etc/keystone/keystone.conf
[database]
connection = mysql+pymysql://keystone:keystone@10.189.189.11/keystone
[token]
provider = fernet
su -s /bin/sh -c "keystone-manage db_sync" keystone
keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
keystone-manage credential_setup --keystone-user keystone --keystone-group keystone
keystone-manage bootstrap --bootstrap-password admin \
--bootstrap-admin-url http://10.189.189.11:5000/v3/ \
--bootstrap-internal-url http://10.189.189.11:5000/v3/ \
--bootstrap-public-url http://10.189.189.11:5000/v3/ \
--bootstrap-region-id RegionOne
// Edit the /etc/httpd/conf/httpd.conf
ServerName 10.189.189.11
ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/
systemctl enable httpd.service
systemctl start httpd.service
openstack project create --domain default \
--description "Service Project" service
openstack project create --domain default \
--description "Demo Project" myproject
openstack user create --domain default \
--password-prompt myuser
openstack role create myrole
openstack role add --project myproject --user myuser myrole
unset OS_AUTH_URL OS_PASSWORD
openstack --os-auth-url http://10.189.189.11:5000/v3 \
--os-project-domain-name Default --os-user-domain-name Default \
--os-project-name admin --os-username admin token issue
openstack --os-auth-url http://10.189.189.11:5000/v3 \
--os-project-domain-name Default --os-user-domain-name Default \
--os-project-name myproject --os-username myuser token issue
// Edit /root/admin-open:
export OS_PROJECT_DOMAIN_NAME=Default
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_AUTH_URL=http://10.189.189.11:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
// Edit /root/demo-open:
export OS_PROJECT_DOMAIN_NAME=Default
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_NAME=myproject
export OS_USERNAME=myuser
export OS_PASSWORD=myuser
export OS_AUTH_URL=http://10.189.189.11:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
source admin-open
openstack token issue
mysql -u root -proot
// MariaDB [(none)]>
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \
IDENTIFIED BY 'glance';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \
IDENTIFIED BY 'glance';
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 RegionOne \
image public http://10.189.189.11:9292
openstack endpoint create --region RegionOne \
image internal http://10.189.189.11:9292
openstack endpoint create --region RegionOne \
image admin http://10.189.189.11:9292
yum install openstack-glance
// Edit the /etc/glance/glance-api.conf
[database]
connection = mysql+pymysql://glance:glance@10.189.189.11/glance
[keystone_authtoken]
www_authenticate_uri = http://10.189.189.11:5000
auth_url = http://10.189.189.11:5000
memcached_servers = 10.189.189.11:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = glance
[paste_deploy]
flavor = keystone
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
su -s /bin/sh -c "glance-manage db_sync" glance
systemctl enable openstack-glance-api.service
systemctl start openstack-glance-api.service
cd /tmp
wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
glance image-create --name "cirros" \
--file /tmp/cirros-0.4.0-x86_64-disk.img \
--disk-format qcow2 --container-format bare \
--visibility public
glance image-list
mysql -u root -proot
// MariaDB [(none)]>
CREATE DATABASE placement;
GRANT ALL PRIVILEGES ON placement