xshell连接虚拟机ubantu系统问题总结

参考:
1.http://wenku.baidu.com/link?url=VRNvCa880AHQ9QHi6uXJQkXzVsuCDjNCiUZOyGtCqCPApSmzk931v0bfEDoBC86bZhSgicDRE4HO3TwhwkBmI59qsOLfD3LjUJkHKk6xrau
2.http://www.cnblogs.com/mliudong/p/4094519.html
3.http://www.tuicool.com/articles/EjMJNz
4.http://blog.csdn.net/chaihuasong/article/details/17009641
5.http://www.360doc.com/content/12/1119/17/8827884_248819500.shtml
6.http://www.linuxidc.com/Linux/2012-09/71087.htm

因为是Linux初学者,所以过程很曲折。
首先,我是想把自己的虚拟机Linux作为一个服务器,那么需要用xshell去连接,这就是最初简单的想法。
按照参考1的步骤,更改了网络连接,发现原来可以连接网络的虚拟机不能联网了。但是,这篇文章对我也是有启发的,由此我又搜索了ubantu系统的更改IP的办法,就这样找到了参考6的文章。
按照参考6的文章我更改了IP:192.168.54.100,这时我用主机去ping竟然能ping通了,很高兴,但是用xshell或者SecureCRT均还是不能连接。
然后,通过搜索知道应该是我的Linux没有安装ssh服务,那么就想着试着安装ssh服务试试,但没想到这么不容易。
首先,通过参考5得知各个命令,但是第一个命令就出了问题。
sudo apt-get install openssh-server执行后出现404,显然这肯定是因为之前改网络连接使得Linux不能联网了,因此,没办法,我只能又创建了一个NAT网络连接,使得Linux能够上网了。
但是仍然是同样的问题,这样我又通过搜索得知,需要在sudo apt-get install openssh-server之前需要执行sudo apt-get update操作。
但是,执行了sudo apt-get update又报错了,再次通过参考4得知需要修改sources.list来更新源。那么对于我一个初学者,如何替换sources.list文件呢?
又通过参考3,利用sudo gedit /etc/apt/sources.list命令打开文件,并将参考4里面给的163源替换到文件中。
这样,再次执行sudo apt-get update终于成功了!
然后开心的去执行sudo apt-get install openssh-server结果发现又报错了:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
 openssh-server : Depends: openssh-client (= 1:5.3p1-3ubuntu7.1) but 1:5.5p1-4ubuntu4 is to be installed
E: Broken packages

这时又通过参考2得知原由是自带的openssh-clien与所要安装的openssh-server所依赖的版本不同。
利用sudo apt-get install openssh-client=1:5.3p1-3ubuntu7.1命令又安装对应版本的openssh-clien,来覆盖掉ubuntu自带的。
最后再执行
sudo apt-get install openssh-server
终于成功了,通过ps -e|grep ssh命令看到存在sshd,证明已经安装成功!
通过命令$ netstat -tlp 以确认ssh-server已经正常工作!

这时再回到最初的想法,xshell连接Linux,ip是多少呢?
利用ifconfig命令,发现IP是192.168.114.128,利用xshell连接,用户名用root,输入root的密码,终于成功了!
运行rz命令想上传文件,但报错:

The program 'sz' is currently not installed.  You can install it by typing:
apt-get install lrzsz

根据提示,运行apt-get install lrzsz,成功!成功!

通过这个过程算是对Linux有个小的入门,同时也意识到分享的重要性,要是没有上面的那些网友的分享,自己也不可能学到这么多!所以想再此稍作整理,以备自己查阅和方便网友,谢谢!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值