|
| 1 | +# Title: CH2_Controller_Icehouse.txt |
| 2 | +# Purpose: |
| 3 | +# Modified installation for Icehouse on CentOS 6.6. |
| 4 | +# It is meant to replace the documented installation process in Chapter 2 for controller nodes only. |
| 5 | +# NOTE: Do not run commands that are commented out. |
| 6 | + |
| 7 | + |
| 8 | +## Configure the repos |
| 9 | +rpm -ivh https://repos.fedorapeople.org/repos/openstack/openstack-icehouse/rdo-release-icehouse-4.noarch.rpm |
| 10 | +rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm |
| 11 | + |
| 12 | +# Install crudini |
| 13 | +yum -y install crudini openstack-utils |
| 14 | + |
| 15 | +# Set the hostname |
| 16 | +sed -i "/HOSTNAME/c\HOSTNAME=controller.learningneutron.com" /etc/sysconfig/network |
| 17 | + |
| 18 | +# Add DNS entries |
| 19 | +echo 10.254.254.100 controller.learningneutron.com controller >> /etc/hosts |
| 20 | +echo 10.254.254.101 compute01.learningneutron.com compute01 >> /etc/hosts |
| 21 | + |
| 22 | +# Disable SELinux |
| 23 | +sed -i "/SELINUX=enforcing/c\SELINUX=disabled" /etc/selinux/config |
| 24 | + |
| 25 | +# Remove iptables |
| 26 | +iptables -D INPUT -j REJECT --reject-with icmp-host-prohibited |
| 27 | +iptables -D FORWARD -j REJECT --reject-with icmp-host-prohibited |
| 28 | +service iptables save |
| 29 | + |
| 30 | +# Install NTP |
| 31 | +yum -y install ntp |
| 32 | +service ntpd start |
| 33 | +chkconfig ntpd on |
| 34 | + |
| 35 | +# Upgrade and reboot |
| 36 | +yum -y upgrade |
| 37 | +reboot |
| 38 | + |
| 39 | +# Install MySQL Server |
| 40 | +yum -y install mysql mysql-server MySQL-python |
| 41 | +crudini --set /etc/my.cnf mysqld bind-address 10.254.254.100 |
| 42 | +service mysqld start |
| 43 | +chkconfig mysqld on |
| 44 | + |
| 45 | +# Configure MySQL Server |
| 46 | +/usr/bin/mysql_secure_installation |
| 47 | + |
| 48 | +# Install Qpid |
| 49 | +yum -y install qpid-cpp-server memcached |
| 50 | +sed -i "/^auth/s/auth=yes/auth=no/" /etc/qpidd.conf |
| 51 | +service qpidd start |
| 52 | +chkconfig qpidd on |
| 53 | + |
| 54 | +# Install Keystone |
| 55 | +yum -y install openstack-keystone python-keystoneclient |
| 56 | +crudini --set /etc/keystone/keystone.conf sql connection mysql://keystone:keystone@controller/keystone |
| 57 | +openstack-db --init --service keystone --password keystone |
| 58 | + |
| 59 | +ADMIN_TOKEN=$(openssl rand -hex 10) |
| 60 | +crudini --set /etc/keystone/keystone.conf DEFAULT admin_token $ADMIN_TOKEN |
| 61 | +keystone-manage pki_setup --keystone-user keystone --keystone-group keystone |
| 62 | +chown -R keystone:keystone /etc/keystone/* /var/log/keystone/keystone.log |
| 63 | +crudini --set /etc/keystone/keystone.conf token provider keystone.token.providers.pki.Provider |
| 64 | +service openstack-keystone start |
| 65 | +chkconfig openstack-keystone on |
| 66 | + |
| 67 | +# Configure Keystone |
| 68 | +export OS_SERVICE_TOKEN=$ADMIN_TOKEN |
| 69 | +export OS_SERVICE_ENDPOINT=http://controller:35357/v2.0 |
| 70 | +keystone tenant-create --name=admin --description="Admin Tenant" |
| 71 | +keystone tenant-create --name=service --description="Service Tenant" |
| 72 | +keystone user-create --name=admin --pass=secrete [email protected] |
| 73 | +keystone role-create --name=admin |
| 74 | +keystone user-role-add --user=admin --tenant=admin --role=admin |
| 75 | +keystone service-create --name=keystone --type=identity --description="Keystone Identity Service" |
| 76 | + |
| 77 | +keystone endpoint-create \ |
| 78 | + --service-id=`keystone service-get keystone | awk '/ id / { print $4 }'` \ |
| 79 | + --publicurl=http://controller:5000/v2.0 \ |
| 80 | + --internalurl=http://controller:5000/v2.0 \ |
| 81 | + --adminurl=http://controller:35357/v2.0 |
| 82 | + |
| 83 | +unset OS_SERVICE_TOKEN OS_SERVICE_ENDPOINT |
| 84 | +keystone --os-username=admin --os-password=secrete --os-auth-url=http://controller:35357/v2.0 token-get |
| 85 | +keystone --os-username=admin --os-password=secrete --os-tenant-name=admin --os-auth-url=http://controller:35357/v2.0 token-get |
| 86 | + |
| 87 | +# Configure environment vars |
| 88 | +mkdir ~/credentials |
| 89 | +cat >> ~/credentials/admin <<EOF |
| 90 | +export OS_USERNAME=admin |
| 91 | +export OS_PASSWORD=secrete |
| 92 | +export OS_TENANT_NAME=admin |
| 93 | +export OS_AUTH_URL=http://controller:35357/v2.0 |
| 94 | +EOF |
| 95 | +source ~/credentials/admin |
| 96 | +keystone token-get |
| 97 | +keystone user-list |
| 98 | + |
| 99 | +# Install Glance |
| 100 | +yum -y install openstack-glance |
| 101 | +openstack-db --init --service glance --password glance |
| 102 | + |
| 103 | +crudini --set /etc/glance/glance-api.conf DEFAULT sql_connection mysql://glance:glance@controller/glance |
| 104 | +crudini --set /etc/glance/glance-registry.conf DEFAULT sql_connection mysql://glance:glance@controller/glance |
| 105 | +keystone user-create --name=glance --pass=glance [email protected] |
| 106 | +keystone user-role-add --user=glance --tenant=service --role=admin |
| 107 | +crudini --set /etc/glance/glance-api.conf keystone_authtoken auth_host controller |
| 108 | +crudini --set /etc/glance/glance-api.conf keystone_authtoken admin_user glance |
| 109 | +crudini --set /etc/glance/glance-api.conf keystone_authtoken admin_tenant_name service |
| 110 | +crudini --set /etc/glance/glance-api.conf keystone_authtoken admin_password glance |
| 111 | +crudini --set /etc/glance/glance-registry.conf keystone_authtoken auth_host controller |
| 112 | +crudini --set /etc/glance/glance-registry.conf keystone_authtoken admin_user glance |
| 113 | +crudini --set /etc/glance/glance-registry.conf keystone_authtoken admin_tenant_name service |
| 114 | +crudini --set /etc/glance/glance-registry.conf keystone_authtoken admin_password glance |
| 115 | +cp /usr/share/glance/glance-api-dist-paste.ini /etc/glance/glance-api-paste.ini |
| 116 | +cp /usr/share/glance/glance-registry-dist-paste.ini /etc/glance/glance-registry-paste.ini |
| 117 | +crudini --set /etc/glance/glance-api-paste.ini filter:authtoken auth_host controller |
| 118 | +crudini --set /etc/glance/glance-api-paste.ini filter:authtoken admin_user glance |
| 119 | +crudini --set /etc/glance/glance-api-paste.ini filter:authtoken admin_tenant_name service |
| 120 | +crudini --set /etc/glance/glance-api-paste.ini filter:authtoken admin_password glance |
| 121 | +crudini --set /etc/glance/glance-api-paste.ini filter:authtoken flavor keystone |
| 122 | +crudini --set /etc/glance/glance-registry-paste.ini filter:authtoken auth_host controller |
| 123 | +crudini --set /etc/glance/glance-registry-paste.ini filter:authtoken admin_user glance |
| 124 | +crudini --set /etc/glance/glance-registry-paste.ini filter:authtoken admin_tenant_name service |
| 125 | +crudini --set /etc/glance/glance-registry-paste.ini filter:authtoken admin_password glance |
| 126 | +crudini --set /etc/glance/glance-registry-paste.ini filter:authtoken flavor keystone |
| 127 | + |
| 128 | +service openstack-glance-api start |
| 129 | +service openstack-glance-registry start |
| 130 | +chkconfig openstack-glance-api on |
| 131 | +chkconfig openstack-glance-registry on |
| 132 | + |
| 133 | +keystone service-create --name=glance --type=image --description="Glance Image Service" |
| 134 | + |
| 135 | +keystone endpoint-create \ |
| 136 | + --service-id=`keystone service-get glance | awk '/ id / { print $4 }'` \ |
| 137 | + --publicurl=http://controller:9292 \ |
| 138 | + --internalurl=http://controller:9292 \ |
| 139 | + --adminurl=http://controller:9292 |
| 140 | + |
| 141 | +# Verify glance |
| 142 | +mkdir /var/tmp/images ; cd /var/tmp/images/ |
| 143 | +wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img |
| 144 | +glance image-create --name=CirrOS-0.3.4 --disk-format=qcow2 --container-format=bare --is-public=true --file /var/tmp/images/cirros-0.3.4-x86_64-disk.img |
| 145 | +glance image-create --name=Ubuntu-14.04 --disk-format=qcow2 --container-format=bare --is-public=true --location http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img |
| 146 | +glance image-create --name=CentOS-6 --disk-format=qcow2 --container-format=bare --is-public=true --location http://cloud.centos.org/centos/6/images/CentOS-6-x86_64-GenericCloud.qcow2 |
| 147 | + |
| 148 | +# INSTALL NOVA CONTROLLER SERVICES |
| 149 | +yum -y install openstack-nova python-novaclient |
| 150 | +openstack-db --init --service nova --password nova |
| 151 | + |
| 152 | +crudini --set /etc/nova/nova.conf database connection mysql://nova:nova@controller/nova |
| 153 | +crudini --set /etc/nova/nova.conf DEFAULT rpc_backend nova.openstack.common.rpc.impl_qpid |
| 154 | +crudini --set /etc/nova/nova.conf DEFAULT qpid_hostname controller |
| 155 | +crudini --set /etc/nova/nova.conf DEFAULT my_ip 10.254.254.100 |
| 156 | +crudini --set /etc/nova/nova.conf DEFAULT vncserver_listen 10.254.254.100 |
| 157 | +crudini --set /etc/nova/nova.conf DEFAULT vncserver_proxyclient_address 10.254.254.100 |
| 158 | +keystone user-create --name=nova --pass=nova [email protected] |
| 159 | +keystone user-role-add --user=nova --tenant=service --role=admin |
| 160 | +crudini --set /etc/nova/nova.conf DEFAULT auth_strategy keystone |
| 161 | +crudini --set /etc/nova/nova.conf keystone_authtoken auth_host controller |
| 162 | +crudini --set /etc/nova/nova.conf keystone_authtoken auth_protocol http |
| 163 | +crudini --set /etc/nova/nova.conf keystone_authtoken auth_port 35357 |
| 164 | +crudini --set /etc/nova/nova.conf keystone_authtoken admin_user nova |
| 165 | +crudini --set /etc/nova/nova.conf keystone_authtoken admin_tenant_name service |
| 166 | +crudini --set /etc/nova/nova.conf keystone_authtoken admin_password nova |
| 167 | +crudini --set /etc/nova/api-paste.ini filter:authtoken auth_host controller |
| 168 | +crudini --set /etc/nova/api-paste.ini filter:authtoken auth_port 35357 |
| 169 | +crudini --set /etc/nova/api-paste.ini filter:authtoken auth_protocol http |
| 170 | +crudini --set /etc/nova/api-paste.ini filter:authtoken auth_uri http://controller:5000/v2.0 |
| 171 | +crudini --set /etc/nova/api-paste.ini filter:authtoken admin_tenant_name service |
| 172 | +crudini --set /etc/nova/api-paste.ini filter:authtoken admin_user nova |
| 173 | +crudini --set /etc/nova/api-paste.ini filter:authtoken admin_password nova |
| 174 | +crudini --set /etc/nova/nova.conf DEFAULT api_paste_config /etc/nova/api-paste.ini |
| 175 | + |
| 176 | +# Fixes a bug introduced in Icehouse |
| 177 | +crudini --set /etc/nova/nova.conf DEFAULT vif_plugging_is_fatal false |
| 178 | +crudini --set /etc/nova/nova.conf DEFAULT vif_plugging_timeout 0 |
| 179 | + |
| 180 | +keystone service-create --name=nova --type=compute --description="Nova Compute service" |
| 181 | + |
| 182 | +keystone endpoint-create \ |
| 183 | + --service-id=`keystone service-get nova | awk '/ id / { print $4 }'` \ |
| 184 | + --publicurl=http://controller:8774/v2/%\(tenant_id\)s \ |
| 185 | + --internalurl=http://controller:8774/v2/%\(tenant_id\)s \ |
| 186 | + --adminurl=http://controller:8774/v2/%\(tenant_id\)s |
| 187 | + |
| 188 | +service openstack-nova-api start |
| 189 | +service openstack-nova-cert start |
| 190 | +service openstack-nova-consoleauth start |
| 191 | +service openstack-nova-scheduler start |
| 192 | +service openstack-nova-conductor start |
| 193 | +service openstack-nova-novncproxy start |
| 194 | +service openstack-nova-console start |
| 195 | +chkconfig openstack-nova-api on |
| 196 | +chkconfig openstack-nova-cert on |
| 197 | +chkconfig openstack-nova-consoleauth on |
| 198 | +chkconfig openstack-nova-scheduler on |
| 199 | +chkconfig openstack-nova-conductor on |
| 200 | +chkconfig openstack-nova-novncproxy on |
| 201 | +chkconfig openstack-nova-console on |
| 202 | + |
| 203 | +# Install Horizon |
| 204 | +yum -y install mod_wsgi openstack-dashboard |
| 205 | +sed -i 's/ALLOWED_HOSTS/#ALLOWED_HOSTS/' /etc/openstack-dashboard/local_settings |
| 206 | +sed -i "/OPENSTACK_HOST/c\OPENSTACK_HOST = \"controller\"" /etc/openstack-dashboard/local_settings |
| 207 | +sed -i -e "\$aOPENSTACK_KEYSTONE_URL = \"http://controller:5000/v2.0\"" /etc/openstack-dashboard/local_settings |
| 208 | +sed -i 's/Listen 80/Listen 10.254.254.100:80/' /etc/httpd/conf/httpd.conf |
| 209 | + |
| 210 | +service httpd start |
| 211 | +chkconfig httpd on |
0 commit comments