Skip to content

Instantly share code, notes, and snippets.

@ikegami-yukino
Last active December 25, 2015 03:59
Show Gist options
  • Save ikegami-yukino/6913377 to your computer and use it in GitHub Desktop.
Save ikegami-yukino/6913377 to your computer and use it in GitHub Desktop.
Ubuntu 12.10にHadoopを入れるスクリプト
#
# Ubuntu 12.10にHadoopを入れるスクリプト
#
# Java setting
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo update-java-alternatives -s java-7-oracle
echo 'export JAVA_HOME=/usr/lib/jvm/java-7-oracle' >> ~/.bashrc
source ~/.bashrc
# DisableIPv6
sudo echo '#disable ipv6'$'\n''net.ipv6.conf.all.disable_ipv6 = 1'$'\n''net.ipv6.conf.default.disable_ipv6 = 1'$'\n''net.ipv6.conf.lo.disable_ipv6 = 1' >> /etc/sysctl.conf
sudo sysctl -p
# Installing Hadoop
cd /usr/local
sudo wget https://www.apache.org/dist/hadoop/core/hadoop-1.2.1/hadoop-1.2.1.tar.gz
sudo tar -xzvf hadoop-1.2.1.tar.gz
sudo mv hadoop-1.2.1 hadoop
sudo rm hadoop-1.2.1.tar.gz
sudo addgroup hadoop
sudo adduser --ingroup hadoop hduser
sudo chown -R hduser:hadoop hadoop
# sudo dscl . -create /Users/hduser
# sudo dscl . -append /Groups/hadoop GroupMembership hduser
sudo mkdir -p /app/hadoop/tmp
sudo chmod 777 /app/hadoop/tmp
sudo chown hduser:hadoop /app/hadoop/tmp
bin/hadoop namenode -format
sudo apt-get install openssh-server
ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub
cd hadoop
su hduser
# core-site.xmlの編集
cat << EOT >> conf/core-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>/app/hadoop/tmp</value>
<description>A base for other temporary directories.</description>
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:54310</value>
<description>The name of the default file system.</description>
</property>
</configuration>
EOT
# hdfs-site.xmlの編集
cat << EOT >> conf/hdfs-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
<description>Default block replication.</description>
</property>
</configuration>
EOT
# mapred-site.xmlの編集
cat << EOT >> conf/mapred-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!-- Put site-specific property overrides in this file. -->
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>localhost:54311</value>
<description>The host and port that MapReduce jobtracker runs at.</description>
</property>
</configuration>
EOT
# hadoop-env.shの編集
echo 'export JAVA_HOME=/usr/lib/jvm/java-7-oracle'$'\n''export HADOOP_HOME_WARN_SUPPRESS="TRUE"' >> conf/hadoop-env.sh
rm temp.txt
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment