Created
September 22, 2016 12:51
-
-
Save SebastianCarroll/a9106c180a52fa0b3139d44897129e8b to your computer and use it in GitHub Desktop.
This file contains 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 | |
} | |
zypper install -y 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 SuSEfirewall2_setup off || true | |
service SuSEfirewall2_setup stop || true | |
chkconfig SuSEfirewall2_init off || true | |
service SuSEfirewall2_init stop || true | |
printf "## Info: Syncing time via ntpd\n" | |
#ntpd -qg || true | |
chkconfig ntp on || true | |
service ntp restart || true | |
printf "## Info: No selinux - skipping\n" | |
printf "## Info: setting ulimits\n" | |
printf '* - nofile 32768\n* - nproc 65536\n' >> /etc/security/limits.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment