Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #title :install-cloudstack45-on-centos66.sh
- #description :This script will install CloudStack 4.5 on CentOS 6.6
- #author :Henry den Hengst
- #date :17-11-2015
- #version :0.2
- #usage :bash install-cloudstack45-on-centos66.sh
- #URL :http://192.168.1.2:8080/client/
- #user_password :The default username is ‘admin’, and the default password is ‘password’
- #notes :Check yum fastestmirror config before execution: http://goo.gl/aaVoLv
- #bash_version :4.1.2(1)-release
- #credits_source :http://goo.gl/caMX1q
- #alternative :https://github.com/thehyperadvisor/cldstk-deploy/blob/master/README.md
- #
- # Edit the TCP/IP setting to your own need:
- sed -i 's!ONBOOT=no!ONBOOT=yes!g' /etc/sysconfig/network-scripts/ifcfg-eth0
- sed -i 's!NM_CONTROLLED=yes!NM_CONTROLLED=no!g' /etc/sysconfig/network-scripts/ifcfg-eth0
- sed -i 's!BOOTPROTO=dhcp!BOOTPROTO=none!g' /etc/sysconfig/network-scripts/ifcfg-eth0
- sed -i '$ a\IPADDR=192.168.1.2' /etc/sysconfig/network-scripts/ifcfg-eth0
- sed -i '$ a\NETMASK=255.255.255.0' /etc/sysconfig/network-scripts/ifcfg-eth0
- sed -i '$ a\GATEWAY=192.168.1.1' /etc/sysconfig/network-scripts/ifcfg-eth0
- sed -i '$ a\DNS1=8.8.8.8' /etc/sysconfig/network-scripts/ifcfg-eth0
- sed -i '$ a\DNS2=8.8.4.4' /etc/sysconfig/network-scripts/ifcfg-eth0
- #
- # network start, network start on boot
- chkconfig network on
- service network start
- #
- # set FQDN alike the FQDN during CentOS 6.x installation! Check /etc/sysconfig/network
- sed -i '$ a\192.168.1.2 cloudstack01.domain.local' /etc/hosts
- service network restart
- #
- # set SELinux to permissive
- setenforce 0
- sed -i 's!SELINUX=enforcing!SELINUX=permissive!g' /etc/selinux/config
- #
- # update centos system
- yum update -y
- #
- # Install Network Time Protocol
- yum -y install ntp
- # start ntp service
- service ntpd start
- # start ntp service on boot
- chkconfig ntpd on
- #
- # Add the CloudStack repo.
- cat >/etc/yum.repos.d/cloudstack.repo <<-EOF
- [cloudstack]
- name=cloudstack
- baseurl=http://cloudstack.apt-get.eu/rhel/4.5/
- enabled=1
- gpgcheck=0
- EOF
- #
- # install nfs
- yum -y install nfs-utils
- # backup nfs config
- mv /etc/exports /etc/exports-backup
- # modify nfs config
- cat >/etc/exports <<-EOF
- /secondary *(rw,async,no_root_squash,no_subtree_check)
- /primary *(rw,async,no_root_squash,no_subtree_check)
- EOF
- #
- # create directories
- cd /
- mkdir /primary
- mkdir /secondary
- #
- # modify nfs sysconfig
- sed -i 's!#LOCKD_TCPPORT=32803!LOCKD_TCPPORT=32803!g' /etc/sysconfig/nfs
- sed -i 's!#LOCKD_UDPPORT=32769!LOCKD_UDPPORT=32769!g' /etc/sysconfig/nfs
- sed -i 's!#MOUNTD_PORT=892!MOUNTD_PORT=892!g' /etc/sysconfig/nfs
- sed -i 's!#RQUOTAD_PORT=875!RQUOTAD_PORT=875!g' /etc/sysconfig/nfs
- sed -i 's!#STATD_PORT=662!STATD_PORT=662!g' /etc/sysconfig/nfs
- sed -i 's!#STATD_OUTGOING_PORT=2020!STATD_OUTGOING_PORT=2020!g' /etc/sysconfig/nfs
- #
- # backup iptables
- mv /etc/sysconfig/iptables /etc/sysconfig/iptables-backup
- # modify iptables (check TCP/IP subnet!)
- cat >>/etc/sysconfig/iptables <<-EOF
- -A INPUT -s 192.168.1.0/24 -m state --state NEW -p udp --dport 111 -j ACCEPT
- -A INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 111 -j ACCEPT
- -A INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 2049 -j ACCEPT
- -A INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 32803 -j ACCEPT
- -A INPUT -s 192.168.1.0/24 -m state --state NEW -p udp --dport 32769 -j ACCEPT
- -A INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 892 -j ACCEPT
- -A INPUT -s 192.168.1.0/24 -m state --state NEW -p udp --dport 892 -j ACCEPT
- -A INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 875 -j ACCEPT
- -A INPUT -s 192.168.1.0/24 -m state --state NEW -p udp --dport 875 -j ACCEPT
- -A INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 662 -j ACCEPT
- -A INPUT -s 192.168.1.0/24 -m state --state NEW -p udp --dport 662 -j ACCEPT
- EOF
- #
- # restart iptables
- service iptables restart
- # start rpcbind service
- service rpcbind start
- # start nfs service
- service nfs start
- # start rpcbind service on boot
- chkconfig rpcbind on
- # start nfs on boot
- chkconfig nfs on
- #
- # install mysql server
- yum -y install mysql-server
- # backup mysql config
- mv /etc/my.cnf /etc/my.cnf-backup
- # modify mysql config
- cat >/etc/my.cnf <<-EOF
- innodb_rollback_on_timeout=1
- innodb_lock_wait_timeout=600
- max_connections=350
- log-bin=mysql-bin
- binlog-format = 'ROW'
- EOF
- #
- # start mysql
- service mysqld start
- # startup mysql at boot
- chkconfig mysqld on
- #
- # install cloudstack management
- yum -y install cloudstack-management
- cloudstack-setup-databases cloud:password@localhost --deploy-as=root
- cloudstack-setup-management
- #
- /usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt \
- -m /secondary \
- -u http://cloudstack.apt-get.eu/systemvm/4.5/systemvm64template-4.5-kvm.qcow2.bz2 \
- -h kvm -F
- #
- # install cloudstack agent
- yum -y install cloudstack-agent
- #
- # modify qemu
- sed -i 's!#vnc_listen!vnc_listen!g' /etc/libvirt/qemu.conf
- # modify libvirt
- sed -i 's!#listen_tls!listen_tls!g' /etc/libvirt/libvirtd.conf
- sed -i 's!#listen_tcp!listen_tcp!g' /etc/libvirt/libvirtd.conf
- sed -i 's!#tcp_port!tcp_port!g' /etc/libvirt/libvirtd.conf
- sed -i 's!#auth_tcp = "sasl"!auth_tcp = "none"!g' /etc/libvirt/libvirtd.conf
- sed -i 's!#mdns_adv = 1!mdns_adv = 0!g' /etc/libvirt/libvirtd.conf
- sed -i 's!#LIBVIRTD_ARGS="--listen"!LIBVIRTD_ARGS="--listen"!g' /etc/sysconfig/libvirtd
- #
- # restart libvirt
- service libvirtd restart
Advertisement
Add Comment
Please, Sign In to add comment