咱又回到虚拟机了,记录一下,以便后面忘记了有的参考
ubuntu-14.04.6-desktop-amd64.iso在vmware11上运行配置NAT网络

设置NAT上网

1查看VMware-编辑-虚拟网络编辑器

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述自动分配的IP范围
在这里插入图片描述

2虚拟机设置网络连接为NAT模式

在这里插入图片描述

3开机Ubuntu设置wired connection

点击Auto Etherent即显示网络连接成功
在这里插入图片描述
即有上下两个箭头流量的标识

在这里插入图片描述
ctrl+alt+T打开终端输入sudo apt-get update成功
在这里插入图片描述

网络设置未成功时update的报错

报错信息如下

Err http://extras.ubuntu.com trusty InRelease Err 

Err http://security.ubuntu.com trusty-security InRelease
  
Err http://extras.ubuntu.com trusty InRelease
  
Err http://security.ubuntu.com trusty-security Release.gpg
  Could not resolve 'security.ubuntu.com'
Err http://extras.ubuntu.com trusty Release.gpg
  Could not resolve 'extras.ubuntu.com'
Err http://us.archive.ubuntu.com trusty InRelease
  
Err http://us.archive.ubuntu.com trusty-updates InRelease
  
Err http://us.archive.ubuntu.com trusty-backports InRelease
  
Err http://us.archive.ubuntu.com trusty Release.gpg
  Could not resolve 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com trusty-updates Release.gpg
  Could not resolve 'us.archive.ubuntu.com'
Err http://us.archive.ubuntu.com trusty-backports Release.gpg
  Could not resolve 'us.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/trusty/InRelease  

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/trusty-updates/InRelease  

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/trusty-backports/InRelease  

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/InRelease  

W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/trusty/InRelease  

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/Release.gpg  Could not resolve 'security.ubuntu.com'

W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/trusty/Release.gpg  Could not resolve 'extras.ubuntu.com'

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/trusty/Release.gpg  Could not resolve 'us.archive.ubuntu.com'

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/trusty-updates/Release.gpg  Could not resolve 'us.archive.ubuntu.com'

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/trusty-backports/Release.gpg  Could not resolve 'us.archive.ubuntu.com'

W: Some index files failed to download. They have been ignored, or old ones used instead.

其中错误:Err http://extras.ubuntu.com trusty InRelease Err
可以通过修改resolv.conf文件中的nameserver为8.8.8.8解决

sudo vi /etc/resolv.conf

edit和vim也可以进行将nameserver的值改为 8.8.8.8保存重启即可

vi/vim的基本使用

vi [filename] :打开文件,若文件不存在则新建文件并打开

vi/vim的三种模式

命令模式(command mode)
光标的移动,字符、字或行的删除,移动复制。
按【i】进入插入模式。
按【:】进入底行模式。
插入模式(Insert mode)
文字输入。
按【Esc】进入命令模式。
底行模式(last line mode)
文件保存退出vi,设置编辑环境,如寻找字符串、列出行号等。
需要注意的是一进入vi/vim就处于命令模式

模式下的功能

命令模式

插入命令 功能
i 插入光标前一个字符
I 插入行首
a 插入光标后一个字符
A 插入行未
o 向下新开一行,插入行首
O 向上新开一行,插入行首

删除命令 功能
x 删除光标后一个字符,相当于 Del
X 删除光标前一个字符,相当于 Backspace
dd 删除光标所在行,n dd 删除指定的行数
D 删除光标后本行所有内容,包含光标所在字符
d0 删除光标前本行所有内容,不包含光标所在字符
dw 删除光标开始位置的字,包含光标所在字符
撤销命令 功能
u 一步一步撤销
Ctrl+r 反撤销
重复命令 功能
. 重复上一次操作的命令
移动命令 功能
h 左移
j 下移
k 上移
l 右移
M 光标移动到屏幕中间行
L 光标移动到屏幕最后一行行首
G 移动到指定行,行号 -G
w 向后一次移动一个字
b 向前一次移动一个字
{ 按段移动,上移
} 按段移动,下移
Ctrl+d 向下翻半屏
Ctrl+u 向上翻半屏
Ctrl+f 向下翻一屏
Ctrl+b 向上翻一屏
gg 光标移动文件开头
G 光标移动到文件末尾
>> 文本行右移
<< 文本行左移
复制粘贴命令 功能
yy 复制当前行,n yy 复制 n 行
p 在光标所在位置向下新开辟一行,粘贴

替换命令 功能
r 替换当前字符
R 替换当前行光标后的字符
查找命令 功能
/ 查找
n 下一个
N 上一个

插入模式

底行模式

命令 功能
: w filename 将文章以指定的文件名filename保存
: wq 保存并退出
: q! 不保存强制退出

未完待补充

参考文章
linux(ubuntu)中vim/vi的常见用法

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐