1. #!/bin/bash
    2. # Install CloudStack.sh
    3. # setting static ip in : /etc/sysconfig/network-scripts/ifcfg-eth0
    4. # Check Service
    5. # Install
    6. # hostname --fqdn
    7. # service network restart
    8. # trun off selinux in : /etc/selinux/config
    9. #SELinux=disabed
    10. # trun off iptables.
    11. service iptables stop
    12. service ip6tables stop
    13. chkconfig iptables off
    14. chkconfig ip6tables off
    15. #NTP
    16. yum install -y ntp
    17. chkconfig ntpd on
    18. service ntpd start
    19. # adding cloudstack repos
    20. [cloudstack]
    21. name=cloudstack
    22. baseurl=http://cloudstack.apt-get.eu/centos/6/4.5/
    23. enabled=1
    24. gpgcheck=0
    25. #NFS
    26. yum install -y nfs-utils
    27. # /etc/exports
    28. /secondary *(rw,async,no_root_squash,no_subtree_check)
    29. /primary *(rw,async,no_root_squash,no_subtree_check)
    30. # add top to /etc/sysconfig/nfs
    31. LOCKD_TCPPORT=32803
    32. LOCKD_UDPPORT=32769
    33. MOUNTD_PORT=892
    34. RQUOTAD_PORT=875
    35. STATD_PORT=662
    36. STATD_OUTGOING_PORT=2020
    37. # add iptable rules to /etc/sysconfig/iptables
    38. -A INPUT -s 172.16.10.0/24 -m state --state NEW -p udp --dport 111 -j ACCEPT
    39. -A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 111 -j ACCEPT
    40. -A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 2049 -j ACCEPT
    41. -A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 32803 -j ACCEPT
    42. -A INPUT -s 172.16.10.0/24 -m state --state NEW -p udp --dport 32769 -j ACCEPT
    43. -A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 892 -j ACCEPT
    44. -A INPUT -s 172.16.10.0/24 -m state --state NEW -p udp --dport 892 -j ACCEPT
    45. -A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 875 -j ACCEPT
    46. -A INPUT -s 172.16.10.0/24 -m state --state NEW -p udp --dport 875 -j ACCEPT
    47. -A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 662 -j ACCEPT
    48. -A INPUT -s 172.16.10.0/24 -m state --state NEW -p udp --dport 662 -j ACCEPT
    49. # service iptables restart
    50. service rpcbind start
    51. service nfs start
    52. chkconfig rpcbind on
    53. chkconfig nfs on
    54. # MySQL server
    55. yum install -y mysql-server
    56. # adding configure file in /etc/my.cnf : [mysqld]
    57. innodb_rollback_on_timeout=1
    58. innodb_lock_wait_timeout=600
    59. max_connections=350
    60. log-bin=mysql-bin
    61. binlog-format = 'ROW'
    62. service mysqld start
    63. chkconfig mysqld on
    64. mysql_secure_installation # remeber the root pass.
    65. # Cloudstack-management
    66. yum -y install cloudstack-management
    67. cloudstack-setup-databases cloud:[password]@localhost --deploy-as=root:[password]
    68. cloudstack-setup-management
    69. #System Template Setup
    70. /usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt -m /secondary -u http://cloudstack.apt-get.eu/systemvm/4.6/systemvm64template-4.6.0-kvm.qcow2.bz2 -h kvm -F
    71. # Install kvm
    72. yum -y install cloudstack-agent
    73. # qemu configuration : /etc/libvirt/qemu.conf
    74. vnc_listen=0.0.0.0
    75. # Libvirt Configuration : /etc/libvirt/libvirtd.conf
    76. listen_tls = 0
    77. listen_tcp = 1
    78. tcp_port = "16059"
    79. auth_tcp = "none"
    80. mdns_adv = 0
    81. # /etc/sysconfig/libvirtd
    82. LIBVIRTD_ARGS="--listen"
    83. service libvirtd restart
    84. lsmod | grep kvm:
    85. kvm_intel 55496 0
    86. kvm 337772 1 kvm_intel
    87. ##### UI Setting ####
    88. http://[ip]:8080/client