henrydenhengst

CentOS 6.6 CloudStack 4.5 installation

Nov 7th, 2014
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.40 KB | None | 0 0
  1. #!/bin/bash
  2. #title           :install-cloudstack45-on-centos66.sh
  3. #description     :This script will install CloudStack 4.5 on CentOS 6.6
  4. #author      :Henry den Hengst
  5. #date            :17-11-2015
  6. #version         :0.2  
  7. #usage       :bash install-cloudstack45-on-centos66.sh
  8. #URL             :http://192.168.1.2:8080/client/
  9. #user_password   :The default username is ‘admin’, and the default password is ‘password’
  10. #notes           :Check yum fastestmirror config before execution: http://goo.gl/aaVoLv
  11. #bash_version    :4.1.2(1)-release
  12. #credits_source  :http://goo.gl/caMX1q
  13. #alternative     :https://github.com/thehyperadvisor/cldstk-deploy/blob/master/README.md
  14. #
  15. # Edit the TCP/IP setting to your own need:
  16. sed -i 's!ONBOOT=no!ONBOOT=yes!g' /etc/sysconfig/network-scripts/ifcfg-eth0
  17. sed -i 's!NM_CONTROLLED=yes!NM_CONTROLLED=no!g' /etc/sysconfig/network-scripts/ifcfg-eth0
  18. sed -i 's!BOOTPROTO=dhcp!BOOTPROTO=none!g' /etc/sysconfig/network-scripts/ifcfg-eth0
  19. sed -i '$ a\IPADDR=192.168.1.2' /etc/sysconfig/network-scripts/ifcfg-eth0
  20. sed -i '$ a\NETMASK=255.255.255.0' /etc/sysconfig/network-scripts/ifcfg-eth0
  21. sed -i '$ a\GATEWAY=192.168.1.1' /etc/sysconfig/network-scripts/ifcfg-eth0
  22. sed -i '$ a\DNS1=8.8.8.8' /etc/sysconfig/network-scripts/ifcfg-eth0
  23. sed -i '$ a\DNS2=8.8.4.4' /etc/sysconfig/network-scripts/ifcfg-eth0
  24. #
  25. # network start, network start on boot
  26. chkconfig network on
  27. service network start
  28. #
  29. # set FQDN alike the FQDN during CentOS 6.x installation! Check /etc/sysconfig/network
  30. sed -i '$ a\192.168.1.2 cloudstack01.domain.local' /etc/hosts
  31. service network restart
  32. #
  33. # set SELinux to permissive
  34. setenforce 0
  35. sed -i 's!SELINUX=enforcing!SELINUX=permissive!g' /etc/selinux/config
  36. #
  37. # update centos system
  38. yum update -y
  39. #
  40. # Install Network Time Protocol
  41. yum -y install ntp
  42. # start ntp service
  43. service ntpd start
  44. # start ntp service on boot
  45. chkconfig ntpd on
  46. #
  47. # Add the CloudStack repo.
  48. cat >/etc/yum.repos.d/cloudstack.repo <<-EOF
  49. [cloudstack]
  50. name=cloudstack
  51. baseurl=http://cloudstack.apt-get.eu/rhel/4.5/
  52. enabled=1
  53. gpgcheck=0
  54. EOF
  55. #
  56. # install nfs
  57. yum -y install nfs-utils
  58. # backup nfs config
  59. mv /etc/exports /etc/exports-backup
  60. # modify nfs config
  61. cat >/etc/exports <<-EOF
  62. /secondary *(rw,async,no_root_squash,no_subtree_check)
  63. /primary *(rw,async,no_root_squash,no_subtree_check)
  64. EOF
  65. #
  66. # create directories
  67. cd /
  68. mkdir /primary
  69. mkdir /secondary
  70. #
  71. # modify nfs sysconfig
  72. sed -i 's!#LOCKD_TCPPORT=32803!LOCKD_TCPPORT=32803!g' /etc/sysconfig/nfs
  73. sed -i 's!#LOCKD_UDPPORT=32769!LOCKD_UDPPORT=32769!g' /etc/sysconfig/nfs
  74. sed -i 's!#MOUNTD_PORT=892!MOUNTD_PORT=892!g' /etc/sysconfig/nfs
  75. sed -i 's!#RQUOTAD_PORT=875!RQUOTAD_PORT=875!g' /etc/sysconfig/nfs
  76. sed -i 's!#STATD_PORT=662!STATD_PORT=662!g' /etc/sysconfig/nfs
  77. sed -i 's!#STATD_OUTGOING_PORT=2020!STATD_OUTGOING_PORT=2020!g' /etc/sysconfig/nfs
  78. #
  79. # backup iptables
  80. mv /etc/sysconfig/iptables /etc/sysconfig/iptables-backup
  81. # modify iptables (check TCP/IP subnet!)
  82. cat >>/etc/sysconfig/iptables <<-EOF
  83. -A INPUT -s 192.168.1.0/24 -m state --state NEW -p udp --dport 111 -j ACCEPT
  84. -A INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 111 -j ACCEPT
  85. -A INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 2049 -j ACCEPT
  86. -A INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 32803 -j ACCEPT
  87. -A INPUT -s 192.168.1.0/24 -m state --state NEW -p udp --dport 32769 -j ACCEPT
  88. -A INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 892 -j ACCEPT
  89. -A INPUT -s 192.168.1.0/24 -m state --state NEW -p udp --dport 892 -j ACCEPT
  90. -A INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 875 -j ACCEPT
  91. -A INPUT -s 192.168.1.0/24 -m state --state NEW -p udp --dport 875 -j ACCEPT
  92. -A INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 662 -j ACCEPT
  93. -A INPUT -s 192.168.1.0/24 -m state --state NEW -p udp --dport 662 -j ACCEPT
  94. EOF
  95. #
  96. # restart iptables
  97. service iptables restart
  98. # start rpcbind service
  99. service rpcbind start
  100. # start nfs service
  101. service nfs start
  102. # start rpcbind service on boot
  103. chkconfig rpcbind on
  104. # start nfs on boot
  105. chkconfig nfs on
  106. #
  107. # install mysql server
  108. yum -y install mysql-server
  109. # backup mysql config
  110. mv /etc/my.cnf /etc/my.cnf-backup
  111. # modify mysql config
  112. cat >/etc/my.cnf  <<-EOF
  113. innodb_rollback_on_timeout=1
  114. innodb_lock_wait_timeout=600
  115. max_connections=350
  116. log-bin=mysql-bin
  117. binlog-format = 'ROW'
  118. EOF
  119. #
  120. # start mysql
  121. service mysqld start
  122. # startup mysql at boot
  123. chkconfig mysqld on
  124. #
  125. # install cloudstack management
  126. yum -y install cloudstack-management
  127. cloudstack-setup-databases cloud:password@localhost --deploy-as=root
  128. cloudstack-setup-management
  129. #
  130. /usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt \
  131. -m /secondary \
  132. -u http://cloudstack.apt-get.eu/systemvm/4.5/systemvm64template-4.5-kvm.qcow2.bz2 \
  133. -h kvm -F
  134. #
  135. # install cloudstack agent
  136. yum -y install cloudstack-agent
  137. #
  138. # modify qemu
  139. sed -i 's!#vnc_listen!vnc_listen!g' /etc/libvirt/qemu.conf
  140. # modify libvirt
  141. sed -i 's!#listen_tls!listen_tls!g' /etc/libvirt/libvirtd.conf
  142. sed -i 's!#listen_tcp!listen_tcp!g' /etc/libvirt/libvirtd.conf
  143. sed -i 's!#tcp_port!tcp_port!g' /etc/libvirt/libvirtd.conf
  144. sed -i 's!#auth_tcp = "sasl"!auth_tcp = "none"!g' /etc/libvirt/libvirtd.conf
  145. sed -i 's!#mdns_adv = 1!mdns_adv = 0!g' /etc/libvirt/libvirtd.conf
  146. sed -i 's!#LIBVIRTD_ARGS="--listen"!LIBVIRTD_ARGS="--listen"!g' /etc/sysconfig/libvirtd
  147. #
  148. # restart libvirt
  149. service libvirtd restart
Advertisement
Add Comment
Please, Sign In to add comment