Last active
May 4, 2016 17:29
-
-
Save csabatini/3aa3d267926075820d50 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # increase max open files | |
| echo -e "root soft nofile 32768\nroot hard nofile 32768" >> /etc/security/limits.conf | |
| echo -e "session required pam_limits.so" >> /etc/pam.d/common-session | |
| echo -e "session required pam_limits.so" >> /etc/pam.d/common-session-noninteractive | |
| # format + mount disks | |
| DISKS=(/dev/sdc /dev/sdd /dev/sde /dev/sdf /dev/sdg /dev/sdh /dev/sdi /dev/sdj /dev/sdk /dev/sdl /dev/sdm /dev/sdn /dev/sdo /dev/sdp /dev/sdq) | |
| i=0 | |
| cp /etc/fstab ~/ | |
| cp /etc/fstab /etc/fstab.original | |
| for disk in "${DISKS[@]}"; do | |
| (echo c; echo u; echo n; echo p; echo 1; echo ; echo ; echo p; echo w;) | fdisk ${disk} | |
| mkfs.ext4 ${disk}"1" | |
| mount_point="" | |
| mount_point="pd"$i | |
| mkdir -p /media/${mount_point}/hadoop | |
| uuid=$(blkid | grep "${disk}" | grep -oP '[-a-z0-9]{36}') | |
| echo "UUID=${uuid} /media/${mount_point} ext4 defaults 0 0" >> ~/fstab | |
| i=$[$i+1] | |
| done | |
| mv ~/fstab /etc/fstab | |
| mount -a | |
| # install packages | |
| apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD | |
| cd /etc/apt/sources.list.d | |
| wget http://public-repo-1.hortonworks.com/ambari/ubuntu12/2.x/updates/2.2.1.0/ambari.list | |
| apt-get update | |
| DEBIAN_FRONTEND=noninteractive apt-get install -y openjdk-7-jdk ntp ambari-agent htop sysstat mdadm | |
| update-rc.d ntp defaults | |
| # edit /etc/sudoers for admin group | |
| sed -i 's/%admin ALL=(ALL) ALL/%admin ALL=(ALL) NOPASSWD:ALL/g' /etc/sudoers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment