惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
The Hacker News
The Hacker News
V
Vulnerabilities – Threatpost
C
CXSECURITY Database RSS Feed - CXSecurity.com
Spread Privacy
Spread Privacy
P
Proofpoint News Feed
AWS News Blog
AWS News Blog
S
Securelist
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
T
Troy Hunt's Blog
SecWiki News
SecWiki News
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Security Latest
Security Latest
C
Cyber Attacks, Cyber Crime and Cyber Security
AI
AI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Stack Overflow Blog
Stack Overflow Blog
I
Intezer
I
InfoQ
Attack and Defense Labs
Attack and Defense Labs
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Recent Commits to openclaw:main
Recent Commits to openclaw:main
T
The Exploit Database - CXSecurity.com
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
N
News | PayPal Newsroom
云风的 BLOG
云风的 BLOG
S
Secure Thoughts
T
The Blog of Author Tim Ferriss
Martin Fowler
Martin Fowler
L
LINUX DO - 最新话题
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
D
Darknet – Hacking Tools, Hacker News & Cyber Security
A
About on SuperTechFans
Hacker News - Newest:
Hacker News - Newest: "LLM"
TaoSecurity Blog
TaoSecurity Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Webroot Blog
Webroot Blog
L
LangChain Blog
MyScale Blog
MyScale Blog
Recent Announcements
Recent Announcements
P
Privacy & Cybersecurity Law Blog
Vercel News
Vercel News
Engineering at Meta
Engineering at Meta
C
Cybersecurity and Infrastructure Security Agency CISA
Y
Y Combinator Blog
L
Lohrmann on Cybersecurity
B
Blog RSS Feed
The Last Watchdog
The Last Watchdog

博客园 - LixingTie

Git添加排除文件规则 [RabbitMQ+Python入门经典] 兔子和兔子窝 Win7强制删除文件 vim配置 Ubuntu部署HBase Ubuntu部署Zookeeper Ubuntu 12.04下安装Extmail 白话MongoDB(三) 白话MongoDB(二) 白话MongoDB(一) 关于HBase的一些零碎事 Paxos在大型系统中常见的应用场景 某分布式应用实践一致性哈希的一些问题 多IDC的数据分布设计(二) 多IDC的数据分布设计(一) Redis新的存储模式diskstore Redis容量及使用规划 Redis几个认识误区 一致性哈希(Consistent Hashing)
Ubuntu 12.04 Hadoop自动安装脚本
LixingTie · 2012-06-27 · via 博客园 - LixingTie

安装烦了,写个脚本吧。

#!/bin/bash

if [ `id -u` == 0 ]; then
  echo "must not be root!"
  exit 0
fi

#hadoop install
if [ ! -d ~/software/hadoop/ ]; then
  mkdir ~/software/hadoop/
fi

wget http://archive.apache.org/dist/hadoop/core/stable/hadoop-1.0.3.tar.gz -O ~/software/hadoop/hadoop-1.0.3.tar.gz
tar xvzf ~/software/hadoop/hadoop-*.tar.gz -C ~/software/hadoop/
rm ~/software/hadoop/hadoop-*.tar.gz

#hadoop config
if [ $(getconf LONG_BIT) == 64 ]; then
  echo "export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64" >> /etc/profile
else
  echo "export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-i386" >> /etc/profile
fi
echo "export HADOOP_HOME=~/software/hadoop/hadoop-1.0.3" >> /etc/profile
echo "export PATH=$PATH:$HADOOP_HOME/bin:$JAVA_HOME/bin" >> /etc/profile
echo "export HADOOP_HOME_WARN_SUPPRESS=1" >> /etc/profile

#hadoop core-site.xml
echo "<?xml version='1.0'?>" > ~/software/hadoop/hadoop-1.0.3/conf/core-site.xml
echo "<?xml-stylesheet type='text/xsl' href='configuration.xsl'?>" >> ~/software/hadoop/hadoop-1.0.3/conf/core-site.xml
echo "<configuration>" >> ~/software/hadoop/hadoop-1.0.3/conf/core-site.xml
echo "  <property>" >> ~/software/hadoop/hadoop-1.0.3/conf/core-site.xml
echo "    <name>fs.default.name</name>" >> ~/software/hadoop/hadoop-1.0.3/conf/core-site.xml
echo "    <value>hdfs://localhost:9000</value>" >> ~/software/hadoop/hadoop-1.0.3/conf/core-site.xml
echo "  </property>" >> ~/software/hadoop/hadoop-1.0.3/conf/core-site.xml
echo "  <property>" >> ~/software/hadoop/hadoop-1.0.3/conf/core-site.xml
echo "    <name>hadoop.tmp.dir</name>" >> ~/software/hadoop/hadoop-1.0.3/conf/core-site.xml
echo "    <value>~/software/hadoop/tmp</value>" >> ~/software/hadoop/hadoop-1.0.3/conf/core-site.xml
echo "  </property>" >> ~/software/hadoop/hadoop-1.0.3/conf/core-site.xml
echo "</configuration>" >> ~/software/hadoop/hadoop-1.0.3/conf/core-site.xml

#hadoop hdfs-site.xml
echo "<?xml version='1.0'?>" > ~/software/hadoop/hadoop-1.0.3/conf/hdfs-site.xml
echo "<?xml-stylesheet type='text/xsl' href='configuration.xsl'?>" >> ~/software/hadoop/hadoop-1.0.3/conf/hdfs-site.xml
echo "<configuration>" >> ~/software/hadoop/hadoop-1.0.3/conf/hdfs-site.xml
echo "  <property>" >> ~/software/hadoop/hadoop-1.0.3/conf/hdfs-site.xml
echo "    <name>dfs.name.dir</name>" >> ~/software/hadoop/hadoop-1.0.3/conf/hdfs-site.xml
echo "    <value>~/software/hadoop/name</value>" >> ~/software/hadoop/hadoop-1.0.3/conf/hdfs-site.xml
echo "  </property>" >> ~/software/hadoop/hadoop-1.0.3/conf/hdfs-site.xml
echo "  <property>" >> ~/software/hadoop/hadoop-1.0.3/conf/hdfs-site.xml
echo "    <name>dfs.data.dir</name>" >> ~/software/hadoop/hadoop-1.0.3/conf/hdfs-site.xml
echo "    <value>~/software/hadoop/data</value>" >> ~/software/hadoop/hadoop-1.0.3/conf/hdfs-site.xml
echo "  </property>" >> ~/software/hadoop/hadoop-1.0.3/conf/hdfs-site.xml
echo "  <property>" >> ~/software/hadoop/hadoop-1.0.3/conf/hdfs-site.xml
echo "    <name>dfs.replication</name>" >> ~/software/hadoop/hadoop-1.0.3/conf/hdfs-site.xml
echo "    <value>2</value>" >> ~/software/hadoop/hadoop-1.0.3/conf/hdfs-site.xml
echo "  </property>" >> ~/software/hadoop/hadoop-1.0.3/conf/hdfs-site.xml
echo "</configuration>" >> ~/software/hadoop/hadoop-1.0.3/conf/hdfs-site.xml

#hadoop mapred-site.xml
echo "<?xml version='1.0'?>" > ~/software/hadoop/hadoop-1.0.3/conf/mapred-site.xml
echo "<?xml-stylesheet type='text/xsl' href='configuration.xsl'?>" >> ~/software/hadoop/hadoop-1.0.3/conf/mapred-site.xml
echo "<configuration>" >> ~/software/hadoop/hadoop-1.0.3/conf/mapred-site.xml
echo "  <property>" >> ~/software/hadoop/hadoop-1.0.3/conf/mapred-site.xml
echo "    <name>mapred.job.tracker</name>" >> ~/software/hadoop/hadoop-1.0.3/conf/mapred-site.xml
echo "    <value>localhost:9001</value>" >> ~/software/hadoop/hadoop-1.0.3/conf/mapred-site.xml
echo "  </property>" >> ~/software/hadoop/hadoop-1.0.3/conf/mapred-site.xml
echo "</configuration>" >> ~/software/hadoop/hadoop-1.0.3/conf/mapred-site.xml

source /etc/profile
hadoop namenode -fromat
$HADOOP_HOME/bin/start-all.sh