解决方案:用下面命令强制重启。
sudo systemctl --force --force reboot
问题2 未能加载虚拟光盘
点击分配光驱,移除虚拟盘即可。
Ububtu常用配置
1 vim配置
修改vimrc文件,vimrc文件的位置,在/usr/share/vim目录下,
sudo vim vimrc即可进入文件vimrc。
输入i即可编辑,在文件添加以下内容:
'设置编码'
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8
'显示行号'
set nu
set number
set cursorline
set cul 'cursorline的缩写形式'
set cursorcolumn
set cuc 'cursorcolumn的缩写形式'
set mouse=a
set selection=exclusive
set selectmode=mouse,key
set showmatch
'设置Tab长度为4空格'
set tabstop=4
'设置自动缩进长度为4空格'
set shiftwidth=4
'继承前一行的缩进方式,适用于多行注释'
set autoindent
set paste
set listchars=tab:>-,trail:-
'总是显示状态栏'
set laststatus=2
'显示光标当前位置'
set ruler
2 本机与虚拟机文件拖拽和剪贴板的共用
点击安装增强功能,如果出现未能加载虚拟光盘,可以看上文如何解决
在共享粘贴般和拖放中选择双向。
3源的更换(ubuntu18)
3.1备份文件![在这里插入图片描述](https://img-blog.csdnimg.cn/20191216120311819.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2ltaXNzeW91YWx3YWx5cw==,size_16,color_FFFFFF,t_70)
讲解一下cp命令的使用,该命令主要为了备份文件,示例如下:
cp file /usr/men/tmp/file1#将文件file复制到目录/usr/men/tmp下,并改名为file1
cp -r /usr/men /usr/zh#将目录/usr/men下的所有文件及其子目录复制到目录/usr/zh中
3.2查看版本信息,我是ubuntu18
版本代号为bionic,每个版本都有自己的代号
3.3将sources.list文件内容替换成下文内容,文件原有的内容必须全部注释
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
小贴士
手敲这么长很容易敲错,可以先在虚拟机桌面用vim新建一个文本文件,将这段内容从主机粘贴到虚拟机中的该文本文件中,如下图:
再用vim打开,在命令模式下,光标移动到要复制的行,如输入yy(这是复制当前行),如输入nyy(这是复制n行)
粘贴时,光标移动到要粘贴的位置,在命令模式下,输入p
3.4更新软件列表和软件包
sudo apt-get update#更新软件列表
sudo apt-get upgrade#更新软件包
参考博客
https://blog.csdn.net/zhangjiahao14/article/details/80554616
ubuntu20换源
还有其他参考博客当时忘了粘贴网址了。。。。