ubuntu学习笔记2

安装jdk

<!--[if !supportLists]-->1.       <!--[endif]-->下载

wget http://download.oracle.com/otn-pub/java/jdk/6u31-b04/jdk-6u31-linux-i586.bin

<!--[if !supportLists]-->2.       <!--[endif]-->jdk移到/usr/local/目录下

naxsu@ubuntu:~$ sudo mv jdk-6u31-linux-i586.bin /usr/local/

[sudo] password for naxsu:

<!--[if !supportLists]-->3.       <!--[endif]-->安装

naxsu@ubuntu:/usr/local$ ./jdk-6u31-linux-i586.bin

-bash: ./jdk-6u31-linux-i586.bin: Permission denied

 

提示没权限

方法一:在前面加上sudo sh

root@ubuntu:/usr/java#sudo sh ./ jdk-6u31-linux-i586.bin

方法二:加权限

root@ubuntu:/usr/java# sudo chmod u+x jdk-6u31-linux-i586.bin

root@ubuntu:/usr/java# ./ jdk-6u31-linux-i586.bin

 

naxsu@ubuntu:/usr/local$ sudo chmod u+x jdk-6u31-linux-i586.bin

naxsu@ubuntu:/usr/local$ sudo ./jdk-6u31-linux-i586.bin

出问题了,如下:

naxsu@ubuntu:/usr/local$ sudo ./jdk-6u31-linux-i586.bin

./jdk-6u31-linux-i586.bin: 1: ./jdk-6u31-linux-i586.bin: cannot open html: No such file

./jdk-6u31-linux-i586.bin: 2: ./jdk-6u31-linux-i586.bin: cannot open head: No such file

./jdk-6u31-linux-i586.bin: 3: ./jdk-6u31-linux-i586.bin: cannot open title: No such file

./jdk-6u31-linux-i586.bin: 3: ./jdk-6u31-linux-i586.bin: Request: not found

./jdk-6u31-linux-i586.bin: 4: ./jdk-6u31-linux-i586.bin: cannot open META: No such file

./jdk-6u31-linux-i586.bin: 5: ./jdk-6u31-linux-i586.bin: cannot open link: No such file

./jdk-6u31-linux-i586.bin: 6: ./jdk-6u31-linux-i586.bin: cannot open link: No such file

: not foundlinux-i586.bin: 7: ./jdk-6u31-linux-i586.bin:

./jdk-6u31-linux-i586.bin: 8: ./jdk-6u31-linux-i586.bin: cannot open body: No such file

./jdk-6u31-linux-i586.bin: 9: ./jdk-6u31-linux-i586.bin: cannot open div: No such file

./jdk-6u31-linux-i586.bin: 10: ./jdk-6u31-linux-i586.bin: cannot open table: No such file

./jdk-6u31-linux-i586.bin: 11: ./jdk-6u31-linux-i586.bin: cannot open tr: No such file

./jdk-6u31-linux-i586.bin: 12: ./jdk-6u31-linux-i586.bin: Syntax error: redirection unexpected

vi编辑器打开,竟是一个网页。

 

只能到官网下载JDK

 

VMware Workstation虚拟机来识别USB设备(U)的方法

 首先,要使VM虚拟机能够识别USB设备,也就像Windows中的找到新硬件提示一样,打开虚拟机,运行后,插入USB设备(该设备已被Windows识别),然后按照图示方式选择Removable Devices,选择USB Device,然后在VM的右下角会出现USB设备图标,证明已经被VM识别出来了。

其次,因为在Linux系统中要读取U盘设备,必须通过文件挂载的方式来访问,即把USB设备也当成文件来访问,要挂载设备,首先要知道其设备名,然后在利用挂载命令挂载,可以用fdisk l或者dmesg命令获得USB设备的设备名假设为sdb1,然后新建一个文件夹目录比如mkdir myusb ,再利用mount t vfat 设备名 挂载目录命令挂载,这里可使用mount t vfat sdb1 myusb,然后就可以通过myusb目录访问USB设备上的内容。

最后,使用完毕之后要卸载USB,可以使用unmount挂载目录,或者unmount 设备名,即可使用unmount myusb或者unmount sdb1来卸载。

 

 

naxsu@ubuntu:/mnt$ sudo fdisk -l

[sudo] password for naxsu:

 

Disk /dev/sda: 21.5 GB, 21474836480 bytes

255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00063e01

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048    40894463    20446208   83  Linux

/dev/sda2        40896510    41940991      522241    5  Extended

/dev/sda5        40896512    41940991      522240   82  Linux swap / Solaris

 

Disk /dev/sdb: 4011 MB, 4011851776 bytes

255 heads, 63 sectors/track, 487 cylinders, total 7835648 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00328b06

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1   *          63     7835647     3917792+   c  W95 FAT32 (LBA)

 

naxsu@ubuntu:~$ sudo mount /dev/sdb1 /mnt/myusb

naxsu@ubuntu:~$ ls

naxsu@ubuntu:~$ cd /mnt/myusb/

naxsu@ubuntu:/mnt/myusb$ sudo cp jdk-6u24-linux-i586.bin /usr/local/

naxsu@ubuntu:/usr/local$ sudo chmod u+x jdk-6u24-linux-i586.bin

naxsu@ubuntu:/usr/local$ sudo ./jdk-6u24-linux-i586.bin

………

Press Enter to continue.....

 

 

Done.

 

配置环境变量

vim编辑,没有就安装

naxsu@ubuntu:/usr/local/jdk1.6.0_24$ vim /etc/profile

The program 'vim' can be found in the following packages:

 * vim

 * vim-gnome

 * vim-tiny

 * vim-athena

 * vim-gtk

 * vim-nox

Try: sudo apt-get install <selected package>

naxsu@ubuntu:/usr/local/jdk1.6.0_24$ sudo apt-get install vim

 

naxsu@ubuntu:/usr/local$ sudo vim /etc/profile

加入以下代码:

#set java environment

export JAVA_HOME= /usr/local/jdk1.6.0_24

export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib

export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOMR/bin

 

下面才有效

export JAVA_HOME=/usr/local/jdk1.6.0_24

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH

 

每次都用sudo太麻烦了,我们来激活root用户

naxsu@ubuntu:/usr/local$ sudo -s

root@ubuntu:/usr/local#

 

让当前配置立即生效

root@ubuntu:~# source /etc/profile

测试安装是否成功

root@ubuntu:~# echo $JAVA_HOME

/usr/local/jdk1.6.0_24

root@ubuntu:~# echo $PATH

/usr/local/jdk1.6.0_24/bin:/bin:/jre/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/bin

root@ubuntu:~# echo $CLASSPATH

.:/usr/local/jdk1.6.0_24/lib/dt.jar:/usr/local/jdk1.6.0_24/lib/tools.jar

root@ubuntu:~# java -version

java version "1.6.0_24"

Java(TM) SE Runtime Environment (build 1.6.0_24-b07)

Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)

root@ubuntu:~#

以上提示说明安装成功。

 

 

下一节,开始hodoop

你可能感兴趣的:(ubuntu)