ubuntu学习笔记(ssh的安装,SecureCRT连接,vim的安装及使用、jdk的安装)

简介

1.       ubuntu版本:ubuntu-12.04-server-i386.iso

 

安装SSH

安装命令如下,安装过程过于简单就不用说了。

sudo apt-get install openssh-server

 

查看是否安装成功:

ps -e |grep ssh

1329 ?        00:00:00 sshd

看到sshd那说明ssh-server已经启动了

 

查看IPifconfig

naxsu@ubuntu:~$ ifconfig

eth0      Link encap:Ethernet HWaddr 00:0c:29:e0:32:e5 

          inet addr:192.168.26.128 Bcast:192.168.26.255 Mask:255.255.255.0

          inet6 addr: fe80::20c:29ff:fee0:32e5/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

          RX packets:53 errors:0 dropped:0 overruns:0 frame:0

          TX packets:55 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:5999 (5.9 KB) TX bytes:7364 (7.3 KB)

          Interrupt:19 Base address:0x2000

 

lo        Link encap:Local Loopback 

          inet addr:127.0.0.1 Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING MTU:16436 Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

 

SecureCRT连接

安装jdk

1.       下载

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

2.       jdk移到/usr/local/目录下

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

[sudo] password for naxsu:

3.       安装

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用户密码

在终端执行 sudo passwd root 指令后,系统将会提示你设置一个新的 root 帐号密码

如果要禁用 root 帐号,那么可以执行 sudo passwd -l root

 

/etc/profile的设置对su root无效

那如何将/etc/profile的设置在su root也能生效呢?

naxsu@ubuntu:~$ su - root

Password:

“-”不能省略,它是–login的编写。

 

让当前配置立即生效

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:~#

以上提示说明安装成功。

本文链接: http://www.naxsu.com/ubuntu-xue-xi-bi-ji-ji-ben-huan-jing-di-da-jian/,转载请注明出处

你可能感兴趣的:(ubuntu学习笔记(ssh的安装,SecureCRT连接,vim的安装及使用、jdk的安装))