Created
November 12, 2015 14:45
-
-
Save gbraccialli/9088753f292415c769a2 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/sh - | |
if [ "$(id -ru)" != 0 ]; then | |
printf >&2 'Error: this installer needs the ability to run commands as root.\n' | |
printf >&2 'Install as root or with sudo\n' | |
exit 1 | |
fi | |
my_disable_thp() { | |
( cat > /usr/local/sbin/ambari-thp-disable.sh <<-'EOF' | |
#!/usr/bin/env bash | |
# disable transparent huge pages: for Hadoop | |
thp_disable=true | |
if [ "${thp_disable}" = true ]; then | |
for path in redhat_transparent_hugepage transparent_hugepage; do | |
for file in enabled defrag; do | |
if test -f /sys/kernel/mm/${path}/${file}; then | |
echo never > /sys/kernel/mm/${path}/${file} | |
fi | |
done | |
done | |
fi | |
exit 0 | |
EOF | |
) | |
chmod +x /usr/local/sbin/ambari-thp-disable.sh | |
sh /usr/local/sbin/ambari-thp-disable.sh | |
printf '\nsh /usr/local/sbin/ambari-thp-disable.sh || /bin/true\n\n' >> /etc/rc.local | |
} | |
my_disable_ipv6() { | |
mkdir -p /etc/sysctl.d | |
( cat > /etc/sysctl.d/99-hadoop-ipv6.conf <<-'EOF' | |
## Disabled ipv6 | |
## Provided by Ambari Bootstrap | |
net.ipv6.conf.all.disable_ipv6 = 1 | |
net.ipv6.conf.default.disable_ipv6 = 1 | |
net.ipv6.conf.lo.disable_ipv6 = 1 | |
EOF | |
) | |
sysctl -e -p /etc/sysctl.d/99-hadoop-ipv6.conf | |
} | |
yum install -y -q curl ntp ntpdate openssl python zlib wget unzip openssh-clients | |
printf "## Info: Disabling ipv6\n" | |
my_disable_ipv6 | |
printf "## Info: Disabling thp\n" | |
my_disable_thp | |
printf "## Info: Disabling iptables\n" | |
chkconfig iptables off || true | |
service iptables stop || true | |
chkconfig ip6tables off || true | |
service ip6tables stop || true | |
printf "## Info: Syncing time via ntpd\n" | |
ntpd -qg || true | |
chkconfig ntpd on || true | |
service ntpd restart || true | |
printf "## Info: disabling selinux\n" | |
setenforce 0 || true | |
sed -i 's/\(^[^#]*\)SELINUX=enforcing/\1SELINUX=disabled/' /etc/selinux/config | |
sed -i 's/\(^[^#]*\)SELINUX=permissive/\1SELINUX=disabled/' /etc/selinux/config | |
printf "## Info: setting ulimits\n" | |
printf '* - nofile 32768\n* - nproc 65536\n' >> /etc/security/limits.conf | |
sed -i 's/1024/65536/' /etc/security/limits.d/90-nproc.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment