接下来准备相关脚本,在controller节点上的脚本有:
1-DisableNetworkManager.sh
2-InstallNTP.sh
4-InstallMySQL.sh
5-StartMySQL.sh
6-SetMySQLPassword.sh
8-InstallOpenstackPackage.sh
9-InstallMessagingServer.sh
10-StartMessagingService.sh
11-InstallIdentityService.sh
12-CreateKeystoneDatabase.sh
13-CreateAdminToken.sh
14-InstallSetupTools.sh
15-InstallCommandlineClients.sh
16-InstallImageService.sh
17-CreateGlanceDatabase.sh
18-StartGlanceService.sh
19-VerifyImageService.sh
20-InstallComputeService.sh
21-CreateNovaDatabase.sh
22-StartNovaService.sh
24-ConfigureControllerNetwork.sh
26-CreateInitialNetwork.sh
demo-openrc
localrc
在compute1节点上的脚本有:
1-DisableNetworkManager.sh
23-ConfigureNovaCompute.sh
25-ConfigureComputeNetwork.sh
3-SetNTPServer.sh
7-InstallMySQL-python.sh
8-InstallOpenstackPackage.sh
localrc
脚本前面的数字是执行的顺序,不连续是因为有些脚本在Controller节点上执行后,要切换到Compute1节点上去执行。如果两个节点上执行顺序编号是一样的,就两边都要执行。一般先在Controller节点上执行。
脚本的内容与官方文档上的顺序内容基本上是一致的。
脚本具体内容如下:
Controller节点上的脚本:
[root@controller openstack]# for i in *sh
> do
> echo ">>>>>>>>>>Filename :"
$i
> cat $i
> done
>>>>>>>>>>Filename :
10-StartMessagingService.sh
service qpidd start
chkconfig qpidd on
>>>>>>>>>>Filename :
11-InstallIdentityService.sh
yum install openstack-keystone python-keystoneclient
echo "#################################################"
echo "About to execute:openstack-config --set
/etc/keystone/keystone.conf database connection
mysql://keystone:$KEYSTONE_DBPASS@controller/keystone"
echo "Press Enter to continue"
read
openstack-config --set /etc/keystone/keystone.conf \
database connection
mysql://keystone:$KEYSTONE_DBPASS@controller/keystone
>>>>>>>>>>Filename :
12-CreateKeystoneDatabase.sh
export TMPFILE="CreateKeystoneDatabase.tmp"
echo "drop database if exists keystone;" > $TMPFILE
echo "create database keystone;" >> $TMPFILE
echo "GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost'
IDENTIFIED BY '"$KEYSTONE_DBPASS"';" >> $TMPFILE
echo "GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%'
IDENTIFIED BY '"$KEYSTONE_DBPASS"';" >>$TMPFILE
echo "exit" >> $TMPFILE
echo "##########################################"
echo "About to execute the following MySQL Command:"
cat $TMPFILE
echo "Press Enter to continue"
read
mysql -u root -p$DATABASE_PASS < $TMPFILE
rm $TMPFILE
su -s /bin/sh -c "keystone-manage db_sync" keystone
>>>>>>>>>>Filename :
13-CreateAdminToken.sh
export ADMIN_TOKEN=$(openssl rand -hex 10)
echo $ADMIN_TOKEN > ADMIN_TOKEN_TMP_FILE
openstack-config --set /etc/keystone/keystone.conf DEFAULT \
admin_token $ADMIN_TOKEN
keystone-manage pki_setup --keystone-user keystone
--keystone-group keystone
chown -R keystone:keystone /etc/keystone/ssl
chmod -R o-rwx /etc/keystone/ssl
service openstack-keystone start
chkconfig openstack-keystone on
(crontab -l -u keystone 2>&1 | grep -q token_flush) ||
\
echo '@hourly
/usr/bin/keystone-manage token_flush
>/var/log/keystone/keystone-tokenflush.log 2>&1' >>
/var/spool/cron/keystone
export OS_SERVICE_TOKEN=$ADMIN_TOKEN
export OS_SERVICE_ENDPOINT=http://controller:35357/v2.0
echo "##################################################"
echo "About to execute the following command:"
echo "keystone user-create --name=admin --pass=$ADMIN_PASS
--email=$ADMIN_EMAIL"
echo "Press Enter to continue"
read
keystone user-create --name=admin --pass=$ADMIN_PASS
--email=$ADMIN_EMAIL
keystone role-create --name=admin
keystone tenant-create --name=admin --description="Admin
Tenant"
keystone user-role-add --user=admin --tenant=admin
--role=admin
keystone user-role-add --user=admin --role=_member_
--tenant=admin
echo "##################################################"
echo "About to execute the following command:"
echo "keystone user-create --name=demo --pass=$DEMO_PASS
--email=$DEMO_EMAIL"
echo "Press Enter to continue"
read
keystone user-create --name=demo --pass=$DEMO_PASS
--email=$DEMO_EMAIL
keystone tenant-create --name=demo --description="Demo
Tenant"
keystone user-role-add --user=demo --role=_member_
--tenant=demo
keystone tenant-create --name=service --description="Service
Tenant"
keystone service-create --name=keystone --type=identity \
--description="OpenStack Identity"
keystone endpoint-create \
--service-id=$(keystone service-list | awk '/
identity / {print $2}') \
--publicurl=http://controller:5000/v2.0 \
--internalurl=http://controller:5000/v2.0
\
--adminurl=http://controller:35357/v2.0
unset OS_SERVICE_TOKEN OS_SERVICE_ENDPOINT
keystone --os-username=admin --os-password=$ADMIN_PASS \
--os-auth-url=http://controller:35357/v2.0
token-get
keystone --os-username=admin --os-password=$ADMIN_PASS \
--os-tenant-name=admin
--os-auth-url=http://controller:35357/v2.0 \
token-get
echo "########## execute:keystone user-list############"
keystone user-list
echo "########## execute:keystone user-role-list --user admin
--tenant admin"
keystone user-role-list --user admin --tenant admin
>>>>>>>>>>Filename :
14-InstallSetupTools.sh
wget https://bootstrap./ez_setup.py
-O - | python
yum install python-pip
>>>>>>>>>>Filename :
15-InstallCommandlineClients.sh
pip install python-ceilometerclient
pip install python-cinderclient
pip install python-glanceclient
pip install python-heatclient
pip install python-keystoneclient
pip install python-neutronclient
pip install python-novaclient
pip install python-swiftclient
pip install python-troveclient
>>>>>>>>>>Filename :
16-InstallImageService.sh
yum install openstack-glance python-glanceclient
openstack-config --set /etc/glance/glance-api.conf database \
connection
mysql://glance:$GLANCE_DBPASS@controller/glance
openstack-config --set /etc/glance/glance-registry.conf database
\
connection
mysql://glance:$GLANCE_DBPASS@controller/glance
openstack-config --set /etc/glance/glance-api.conf DEFAULT
\
rpc_backend qpid
openstack-config --set /etc/glance/glance-api.conf DEFAULT
\
qpid_hostname controller
>>>>>>>>>>Filename :
17-CreateGlanceDatabase.sh
export TMPFILE="CreateGlanceDatabase.tmp"
echo "drop database if exists glance;" > $TMPFILE
echo "create database glance;" >> $TMPFILE
echo "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED
BY '"$GLANCE_DBPASS"';" >> $TMPFILE
echo "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED
BY '"$GLANCE_DBPASS"';" >>$TMPFILE
echo "exit" >> $TMPFILE
echo "##########################################"
echo "About to execute the following MySQL Command:"
cat $TMPFILE
echo "Press Enter to continue"
read
mysql -u root -p$DATABASE_PASS < $TMPFILE
rm $TMPFILE
su -s /bin/sh -c "glance-manage db_sync" glance
>>>>>>>>>>Filename :
18-StartGlanceService.sh
keystone user-create --name=glance --pass=$GLANCE_PASS
--email=$GLANCE_EMAIL
keystone user-role-add --user=glance --tenant=service
--role=admin
openstack-config --set /etc/glance/glance-api.conf
keystone_authtoken \
auth_uri http://controller:5000
openstack-config --set /etc/glance/glance-api.conf
keystone_authtoken \
auth_host controller
openstack-config --set /etc/glance/glance-api.conf
keystone_authtoken \
auth_port 35357
openstack-config --set /etc/glance/glance-api.conf
keystone_authtoken \
auth_protocol http
openstack-config --set /etc/glance/glance-api.conf
keystone_authtoken \
admin_tenant_name service
openstack-config --set /etc/glance/glance-api.conf
keystone_authtoken \
admin_user glance
openstack-config --set /etc/glance/glance-api.conf
keystone_authtoken \
admin_password $GLANCE_PASS
openstack-config --set /etc/glance/glance-api.conf paste_deploy
\
flavor keystone
openstack-config --set /etc/glance/glance-registry.conf
keystone_authtoken \
auth_uri http://controller:5000
openstack-config --set /etc/glance/glance-registry.conf
keystone_authtoken \
auth_host controller
openstack-config --set /etc/glance/glance-registry.conf
keystone_authtoken \
auth_port 35357
openstack-config --set /etc/glance/glance-registry.conf
keystone_authtoken \
auth_protocol http
openstack-config --set /etc/glance/glance-registry.conf
keystone_authtoken \
admin_tenant_name service
openstack-config --set /etc/glance/glance-registry.conf
keystone_authtoken \
admin_user glance
openstack-config --set /etc/glance/glance-registry.conf
keystone_authtoken \
admin_password $GLANCE_PASS
openstack-config --set /etc/glance/glance-registry.conf
paste_deploy \
flavor keystone
keystone service-create --name=glance --type=image \
--description="OpenStack Image Service"
keystone endpoint-create \
--service-id=$(keystone service-list | awk '/
image / {print $2}') \
--publicurl=http://controller:9292 \
--internalurl=http://controller:9292 \
--adminurl=http://controller:9292
service openstack-glance-api start
service openstack-glance-registry start
chkconfig openstack-glance-api on
chkconfig openstack-glance-registry on
>>>>>>>>>>Filename :
19-VerifyImageService.sh
mkdir /tmp/images
cd /tmp/images/
wget
http://cdn.download./0.3.2/cirros-0.3.2-x86_64-disk.img
glance image-create --name "cirros-0.3.2-x86_64" --disk-format
qcow2 \
--container-format bare --is-public True
--progress < cirros-0.3.2-x86_64-disk.img
glance image-list
rm -r /tmp/images
>>>>>>>>>>Filename :
1-DisableNetworkManager.sh
service NetworkManager stop
service network start
chkconfig NetworkManager off
chkconfig network on
service iptables stop
chkconfig iptables off
service firewalld stop
chkconfig firewalld off
echo "#################################################"
echo "Edit /etc/selinux/config, set SELINUX=disabled"
echo "Press Enter to quit"
read
>>>>>>>>>>Filename :
20-InstallComputeService.sh
yum install openstack-nova-api openstack-nova-cert
openstack-nova-conductor \
openstack-nova-console openstack-nova-novncproxy
openstack-nova-scheduler \
python-novaclient
openstack-config --set /etc/nova/nova.conf \
database connection
mysql://nova:$NOVA_DBPASS@controller/nova
openstack-config --set /etc/nova/nova.conf \
DEFAULT rpc_backend qpid
openstack-config --set /etc/nova/nova.conf DEFAULT qpid_hostname
controller
openstack-config --set /etc/nova/nova.conf DEFAULT my_ip
$CONTROLLER_IP
openstack-config --set /etc/nova/nova.conf DEFAULT vncserver_listen
$CONTROLLER_IP
openstack-config --set /etc/nova/nova.conf DEFAULT
vncserver_proxyclient_address $CONTROLLER_IP
>>>>>>>>>>Filename :
21-CreateNovaDatabase.sh
export TMPFILE="CreateNovaDatabase.tmp"
echo "drop database if exists nova;" > $TMPFILE
echo "create database nova;" >> $TMPFILE
echo "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY
'"$NOVA_DBPASS"';" >> $TMPFILE
echo "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY
'"$NOVA_DBPASS"';" >>$TMPFILE
echo "exit" >> $TMPFILE
echo "##########################################"
echo "About to execute the following MySQL Command:"
cat $TMPFILE
echo "Press Enter to continue"
read
mysql -u root -p$DATABASE_PASS < $TMPFILE
rm $TMPFILE
su -s /bin/sh -c "nova-manage db sync" nova
>>>>>>>>>>Filename :
22-StartNovaService.sh
keystone user-create --name=nova --pass=$NOVA_PASS
--email=$NOVA_EMAIL
keystone user-role-add --user=nova --tenant=service
--role=admin
openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy
keystone
openstack-config --set /etc/nova/nova.conf keystone_authtoken
auth_uri http://controller:5000
openstack-config --set /etc/nova/nova.conf keystone_authtoken
auth_host controller
openstack-config --set /etc/nova/nova.conf keystone_authtoken
auth_protocol http
openstack-config --set /etc/nova/nova.conf keystone_authtoken
auth_port 35357
openstack-config --set /etc/nova/nova.conf keystone_authtoken
admin_user nova
openstack-config --set /etc/nova/nova.conf keystone_authtoken
admin_tenant_name service
openstack-config --set /etc/nova/nova.conf keystone_authtoken
admin_password $NOVA_PASS
keystone service-create --name=nova --type=compute \
--description="OpenStack Compute"
keystone endpoint-create \
--service-id=$(keystone service-list | awk '/
compute / {print $2}') \
--publicurl=http://controller:8774/v2/%\(tenant_id\)s \
--internalurl=http://controller:8774/v2/%\(tenant_id\)s \
--adminurl=http://controller:8774/v2/%\(tenant_id\)s
service openstack-nova-api start
service openstack-nova-cert start
service openstack-nova-consoleauth start
service openstack-nova-scheduler start
service openstack-nova-conductor start
service openstack-nova-novncproxy start
chkconfig openstack-nova-api on
chkconfig openstack-nova-cert on
chkconfig openstack-nova-consoleauth on
chkconfig openstack-nova-scheduler on
chkconfig openstack-nova-conductor on
chkconfig openstack-nova-novncproxy on
nova image-list
>>>>>>>>>>Filename :
24-ConfigureControllerNetwork.sh
openstack-config --set /etc/nova/nova.conf DEFAULT \
network_api_class nova.network.api.API
openstack-config --set /etc/nova/nova.conf DEFAULT \
security_group_api nova
service openstack-nova-api restart
service openstack-nova-scheduler restart
service openstack-nova-conductor restart
>>>>>>>>>>Filename :
26-CreateInitialNetwork.sh
nova network-create demo-net --bridge br100 --multi-host T \
--fixed-range-v4 $PUBLIC_IPRANGE
nova net-list
>>>>>>>>>>Filename :
28-InstallDashboard.sh
yum install memcached python-memcached mod_wsgi
openstack-dashboard
>>>>>>>>>>Filename :
2-InstallNTP.sh
yum install ntp
service ntpd start
chkconfig ntpd on
echo "##########################################"
echo "Edit /etc/ntp.conf"
echo "Add a line: 'Server controller iburst', remove all other
lines like server ...."
echo "Press Enter to quit"
read
>>>>>>>>>>Filename :
4-InstallMySQL.sh
yum install mysql mysql-server MySQL-python
echo "##################################################"
echo "Edit /etc/my.cnf,under [mysqld] setcion, add the following
lines:"
echo "bind-address=192.168.1.131"
echo "default-storage-engine = innodb"
echo "innodb_file_per_table"
echo "collation-server = utf8_general_ci"
echo "init-connect = 'SET NAMES utf8'"
echo "character-set-server = utf8"
echo "Press Enter to quit"
read
>>>>>>>>>>Filename :
5-StartMySQL.sh
service mysqld start
chkconfig mysqld on
>>>>>>>>>>Filename :
6-SetMySQLPassword.sh
mysql_install_db
mysql_secure_installation
>>>>>>>>>>Filename :
8-InstallOpenstackPackage.sh
yum install yum-plugin-priorities
yum install
http://repos./repos/openstack/openstack-icehouse/rdo-release-icehouse-3.noarch.rpm
yum install
http://dl./pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum install openstack-utils
yum install openstack-selinux
yum upgrade
echo "If all upgrading proceeded normally, please Enter to
reboot"
read
reboot
>>>>>>>>>>Filename :
9-InstallMessagingServer.sh
yum install qpid-cpp-server
echo
"########################################################################"
echo "Edit /etc/qpidd.conf, set as the following:"
echo "auth=no"
echo "Press Enter to quit"
read
Compute1节点上的脚本:
[root@compute1 openstack]# for i in *sh
> do
> echo
">>>>>>>>>>>>>>Filename:
" $i
> cat $i
> done
>>>>>>>>>>>>>>Filename:
1-DisableNetworkManager.sh
service NetworkManager stop
service network start
chkconfig NetworkManager off
chkconfig network on
service iptables stop
chkconfig iptables off
service firewalld stop
chkconfig firewalld off
echo "#################################################"
echo "Edit /etc/selinux/config, set SELINUX=disabled"
echo "Press Enter to quit"
read
>>>>>>>>>>>>>>Filename:
23-ConfigureNovaCompute.sh
yum install openstack-nova-compute
openstack-config --set /etc/nova/nova.conf database connection
mysql://nova:$NOVA_DBPASS@controller/nova
openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy
keystone
openstack-config --set /etc/nova/nova.conf keystone_authtoken
auth_uri http://controller:5000
openstack-config --set /etc/nova/nova.conf keystone_authtoken
auth_host controller
openstack-config --set /etc/nova/nova.conf keystone_authtoken
auth_protocol http
openstack-config --set /etc/nova/nova.conf keystone_authtoken
auth_port 35357
openstack-config --set /etc/nova/nova.conf keystone_authtoken
admin_user nova
openstack-config --set /etc/nova/nova.conf keystone_authtoken
admin_tenant_name service
openstack-config --set /etc/nova/nova.conf keystone_authtoken
admin_password $NOVA_PASS
openstack-config --set /etc/nova/nova.conf \
DEFAULT rpc_backend qpid
openstack-config --set /etc/nova/nova.conf DEFAULT qpid_hostname
controller
openstack-config --set /etc/nova/nova.conf DEFAULT my_ip
$COMPUTE1_IP
openstack-config --set /etc/nova/nova.conf DEFAULT vnc_enabled
True
openstack-config --set /etc/nova/nova.conf DEFAULT vncserver_listen
0.0.0.0
openstack-config --set /etc/nova/nova.conf DEFAULT
vncserver_proxyclient_address $COMPUTE1_IP
openstack-config --set /etc/nova/nova.conf \
DEFAULT novncproxy_base_url http://controller:6080/vnc_auto.html
openstack-config --set /etc/nova/nova.conf DEFAULT glance_host
controller
openstack-config --set /etc/nova/nova.conf libvirt virt_type
qemu
service libvirtd start
service messagebus start
chkconfig libvirtd on
chkconfig messagebus on
service openstack-nova-compute start
chkconfig openstack-nova-compute on
>>>>>>>>>>>>>>Filename:
25-ConfigureComputeNetwork.sh
yum install openstack-nova-network openstack-nova-api
openstack-config --set /etc/nova/nova.conf DEFAULT \
network_api_class nova.network.api.API
openstack-config --set /etc/nova/nova.conf DEFAULT \
security_group_api nova
openstack-config --set /etc/nova/nova.conf DEFAULT \
network_manager
nova.network.manager.FlatDHCPManager
openstack-config --set /etc/nova/nova.conf DEFAULT \
firewall_driver
nova.virt.libvirt.firewall.IptablesFirewallDriver
openstack-config --set /etc/nova/nova.conf DEFAULT \
network_size 254
openstack-config --set /etc/nova/nova.conf DEFAULT \
allow_same_net_traffic False
openstack-config --set /etc/nova/nova.conf DEFAULT \
multi_host True
openstack-config --set /etc/nova/nova.conf DEFAULT \
send_arp_for_ha True
openstack-config --set /etc/nova/nova.conf DEFAULT \
share_dhcp_address True
openstack-config --set /etc/nova/nova.conf DEFAULT \
force_dhcp_release True
openstack-config --set /etc/nova/nova.conf DEFAULT \
flat_network_bridge br100
openstack-config --set /etc/nova/nova.conf DEFAULT \
flat_interface eth1
openstack-config --set /etc/nova/nova.conf DEFAULT \
public_interface eth1
service openstack-nova-network start
service openstack-nova-metadata-api start
chkconfig openstack-nova-network on
chkconfig openstack-nova-metadata-api on
>>>>>>>>>>>>>>Filename:
3-SetNTPServer.sh
echo "Edit /etc/ntp.conf, add a line 'server controller
iburst'"
echo "Press Enter to continue"
read
>>>>>>>>>>>>>>Filename:
7-InstallMySQL-python.sh
yum install MySQL-python
>>>>>>>>>>>>>>Filename:
8-InstallOpenstackPackage.sh
yum install yum-plugin-priorities
yum install
http://repos./repos/openstack/openstack-icehouse/rdo-release-icehouse-3.noarch.rpm
yum install
http://dl./pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum install openstack-utils
yum install openstack-selinux
yum upgrade
echo "If all upgrading proceeded normally, please Enter to
reboot"
read
reboot
|