louzin
2 years ago
2 changed files with 66 additions and 1 deletions
@ -0,0 +1,57 @@ |
|||||||
|
#!/bin/bash |
||||||
|
echo "开始更新" |
||||||
|
apt update -y && apt install wget openssh-server -y |
||||||
|
echo -e "port 22\nPermitRootLogin yes" >> /etc/ssh/sshd_config |
||||||
|
service ssh restart |
||||||
|
#下载 |
||||||
|
#JDK |
||||||
|
wget https://repo.huaweicloud.com/java/jdk/8u202-b08/jdk-8u202-linux-x64.tar.gz |
||||||
|
tar xf jdk-8u202-linux-x64.tar.gz -C /opt/ |
||||||
|
#Hadoop |
||||||
|
wget https://repo.huaweicloud.com/apache/hadoop/common/hadoop-2.9.0/hadoop-2.9.0.tar.gz |
||||||
|
tar xf hadoop-2.9.0.tar.gz -C /opt/ |
||||||
|
#Zookeeper |
||||||
|
wget https://repo.huaweicloud.com/apache/zookeeper/zookeeper-3.8.0/apache-zookeeper-3.8.0-bin.tar.gz |
||||||
|
tar xf apache-zookeeper-3.8.0-bin.tar.gz -C /opt/ |
||||||
|
#Hbase |
||||||
|
wget https://repo.huaweicloud.com/apache/hbase/2.2.4/hbase-2.2.4-bin.tar.gz |
||||||
|
tar xf hbase-2.2.4-bin.tar.gz -C /opt/ |
||||||
|
#环境变量 |
||||||
|
echo -e "#JDK Env\nexport JAVA_HOME=/opt/jdk1.8.0_202\n\ |
||||||
|
export PATH=\${JAVA_HOME}/bin:/\$PATH" >> /root/.bashrc |
||||||
|
echo -e "#Hadoop Env\nexport HADOOP_HOME=/opt/hadoop-2.9.0/\n\ |
||||||
|
export PATH=\$HADOOP_HOME/sbin:\$HADOOP_HOME/bin:\$PATH" >> /root/.bashrc |
||||||
|
echo -e "#Zookeeper Env\nexport ZOOKEEPER_HOME=/opt/apache-zookeeper-3.8.0-bin\n\ |
||||||
|
export PATH=\$PATH:\$ZOOKEEPER_HOME/bin" >> /root/.bashrc |
||||||
|
echo -e "#Hbase Env\nexport HBASE_HOME=/opt/hbase-2.2.4\n\ |
||||||
|
export PATH=\$HBASE_HOME/bin:\$HADOOP_HOME/bin:\$PATH" >> /root/.bashrc |
||||||
|
# 验证安装 |
||||||
|
echo "验证安装" |
||||||
|
java -version |
||||||
|
hadoop version |
||||||
|
zkServer.sh version |
||||||
|
# 配置 |
||||||
|
# 关闭防火墙 |
||||||
|
echo "关闭防火墙" |
||||||
|
service ufw stop |
||||||
|
echo "开始安装hadoop" |
||||||
|
# Hadoop |
||||||
|
sed "s/{host}/$(cat /etc/hostname)/g" -i ./hadoop/slaves |
||||||
|
sed "s|\${JAVA_HOME}|$JAVA_HOME|g" -i ./hadoop/hadoop-env.sh |
||||||
|
sed "s/{host}/$(cat /etc/hostname)/g" -i ./hadoop/core-site.xml |
||||||
|
\cp -rf ./hadoop /opt/hadoop-2.9.0/etc/ |
||||||
|
hdfs namenode -format |
||||||
|
echo "开始安装zookeeper" |
||||||
|
# Zookeeper |
||||||
|
mkdir -p /opt/zookeeper_cache/data/zookeeper |
||||||
|
mkdir -p /opt/zookeeper_cache/data/zookeeper_log |
||||||
|
\cp -rf zoo.cfg /opt/apache-zookeeper-3.8.0-bin/conf/ |
||||||
|
# Hbase |
||||||
|
echo "开始安装hbase" |
||||||
|
echo -e "export JAVA_HOME=$JAVA_HOME\n\ |
||||||
|
export HBASE_CLASSPATH=/opt/hbase-2.2.4/conf\n\ |
||||||
|
export HBASE_MANAGES_ZK=false" >> ./conf/hbase-env.sh |
||||||
|
sed "s/{host}/$(cat /etc/hostname)/g" -i ./conf/hbase-site.xml |
||||||
|
sed "s/{host}/$(cat /etc/hostname)/g" -i ./conf/regionservers |
||||||
|
\cp -rf ./conf/* /opt/hbase-2.2.4/conf/ |
||||||
|
echo "安装结束" |
Loading…
Reference in new issue