[lei@bogon ~]$ java -version
openjdk version "1.8.0_65"
OpenJDK Runtime Environment (build 1.8.0_65-b17)
OpenJDK 64-Bit Server VM (build 25.65-b01, mixed mode)
[lei@bogon ~]$ rpm -qa | grep java
java-1.7.0-openjdk-1.7.0.91-2.6.2.3.el7.x86_64
tzdata-java-2015g-1.el7.noarch
python-javapackages-3.4.1-11.el7.noarch
javapackages-tools-3.4.1-11.el7.noarch
java-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_64
java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64
java-1.7.0-openjdk-headless-1.7.0.91-2.6.2.3.el7.x86_64
[lei@bogon ~]$ rpm -e --nodeps tzdata-java-2015g-1.el7.noarch
错误:can't create 事务 lock on /var/lib/rpm/.rpm.lock (权限不够) [lei@bogon ~]$ su 密码:
[root@bogon lei]# rpm -e --nodeps java-1.7.0-openjdk-1.7.0.91-2.6.2.3.el7.x86_64
[root@bogon lei]# rpm -e --nodeps tzdata-java-2015g-1.el7.noarch
[root@bogon lei]# rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_64
[root@bogon lei]# rpm -e --nodeps java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64
[root@bogon lei]# rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.91-2.6.2.3.el7.x86_64
[root@bogon lei]# tar -zxf/home/lei/桌面/jdk-8u77-linux-x64.tar.gz -C /opt
[root@bogon lei]# vim /etc/profile.d/java.sh
JAVA_HOME=/opt/jdk1.8.0_77
JRE_HOME=/opt/jdk1.8.0_77/jre
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH
PATH=$JAVA_HOME/bin:$PATH
source /etc/profile.d/java.sh
[root@bogon lei]# ssh localhost
The authenticity of host 'localhost (::1)' can't be established.
ECDSA key fingerprint is 7b:10:e3:b5:ea:7d:29:be:77:83:1c:c0:1d:85:de:ba.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
[root@localhost's password:
Last login: Sat Apr 2 22:32:44 2016
[root@bogon ~]# ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
Generating public/private dsa key pair.
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
e0:ba:3c:c5:73:dd:f0:39:51:ad:87:4b:dc:32:46:83 root@bogon
The key's randomart image is:
+--[ DSA 1024]----+
| . . |
| E + .|
| . + = |
| . . . . O o|
| .. S. + = = |
| .+ . . = . |
| .. o . |
| ... |
| o. |
+-----------------+
[root@bogon ~]# cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
[root@bogon ~]# chmod 0600 ~/.ssh/authorized_keys
[root@bogon ~]# ssh localhost
Last login: Sat Apr 2 22:51:41 2016 from localhost
tar -zxf /home/lei/桌面/hadoop-2.7.2.tar.gz -C /opt
vim /etc/profile.d/hadoop.sh
export HADOOP_HOME=/opt/hadoop-2.7.2
export HADOOP_PREFIX=/opt/hadoop-2.7.2
source /etc/profile.d/hadoop.sh
[root@bogon ~]# cd /opt/hadoop-2.7.2
[root@bogon hadoop-2.7.2]# vim etc/hadoop/hadoop-env.sh
export JAVA_HOME=/opt/
[root@bogon hadoop-2.7.2]# bin/hadoop
[root@bogon hadoop-2.7.2]# vim etc/hadoop/core-site.xml
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>
[root@bogon hadoop-2.7.2]# vim etc/hadoop/hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
[root@bogon hadoop-2.7.2]# bin/hdfs namenode -format
省略N行
16/04/02 22:54:15 INFO common.Storage: Storage directory /tmp/hadoop-root/dfs/name has been successfully formatted.
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at bogon/221.192.153.42
************************************************************/
[root@bogon hadoop-2.7.2]# sbin/start-dfs.sh
[root@bogon hadoop-2.7.2]# bin/hdfs dfs -mkdir /user
[root@bogon hadoop-2.7.2]# bin/hdfs dfs -mkdir /user/lei
### 如果出现没有input错误
[root@bogon hadoop-2.7.2]# bin/hdfs dfs -put etc/hadoop input
put: `input': No such file or directory
### 手动创建
[root@bogon hadoop-2.7.2]# bin/hadoop fs -mkdir -p input
[root@bogon hadoop-2.7.2]# bin/hdfs dfs -put etc/hadoop input
[root@bogon hadoop-2.7.2]# bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.2.jar grep input output 'dfs[a-z.]+'
[root@bogon hadoop-2.7.2]# bin/hadoop dfs -ls
DEPRECATED: Use of this script to execute hdfs command is deprecated.
Instead use the hdfs command for it.
Found 2 items
drwxr-xr-x - root supergroup 0 2016-04-02 23:39 input
drwxr-xr-x - root supergroup 0 2016-04-02 23:43 output
[root@bogon hadoop-2.7.2]#sbin/start-dfs.sh
[root@bogon hadoop-2.7.2]# mv etc/hadoop/mapred-site.xml.template etc/hadoop/mapred-site.xml
[root@bogon hadoop-2.7.2]# vim etc/hadoop/mapred-site.xml
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
[root@bogon hadoop-2.7.2]# vim etc/hadoop/yarn-site.xml
<configuration>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration>
[root@bogon hadoop-2.7.2]# sbin/start-yarn.sh