ubuntu虚拟机装机备忘录

虚拟机总是GG,先在这里写一下

首先要换源

先备份一下源文件

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

再打开文件

1
sudo vim /etc/apt/sources.list

修改为如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#添加阿里源
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
#添加清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse multiverse
#163源
deb http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse

更新一下源

1
sudo apt-get update

出现依赖问题:

1
sudo apt-get -f install

更新软件

1
sudo apt-get upgrade

更改语言

这个没啥讲的。

设置->通用辅助->大号文本。

再设置一下终端字体大小。

安装软件

  1. 更新软件列表:apt update -y
  2. 搜索软件: apt search 关键字
  3. 显示软件包详情:apt show 软件包名
  4. 安装软件:apt install 软件包名
  5. 升级指定软件:apt upgrade 软件包名
  6. 升级所有可以升级的软件:apt upgrade
  7. 卸载软件:apt remove 软件包名
  8. 卸载软件并移除软件依赖:apt autoremove 软件包名
  9. 卸载软件并删除配置文件:apt remove 软件包名 --purge
1
2
3
4
5
sudo apt install vim
sudo apt install g++
sudo apt install codeblocks
sudo apt install python3-pip
sudo apt install git

deb下载

Microsoft Edge Insider Channels

下载网易云

配置vim

1
sudo vim ~/.vimrc

Consolas下载

YaHeiConsolas.tar

.vimrc配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

set encoding=utf-8 fileencodings=utf-8 "自动识别utf8
"设置默认保存位置
exec 'cd ' . fnameescape("~/Desktop")
"set pythonthreehome="C:\Program Files\Python38"

syntax on " 高亮
set cindent
set smartindent
set autoindent
set tabstop=4 " 修改 tab 字符的显示宽度
set shiftwidth=4 " 自动缩进所使用的空白长度
set softtabstop=4
set number " 显示行号
"set guifont=Consolas\ h17
set backspace=2
set ruler " 显示标尺
set clipboard=unnamed " 共享剪切板
set go= " 不要图形按钮
set nobackup

" 编译
function! Compile()
exec "w"
if &filetype == 'python'
exec "!python3 %"
elseif &filetype == 'cpp'
exec "!g++ % -o %< -std=c++14 -static-libgcc -Wall -g3"
elseif &filetype == 'c'
exec "!g++ % -o %<"
else
exec "! start %"
endif
endfunction


map<F9> <Esc>:call Compile() <CR>
imap<F9> <Esc>:call Compile() <CR>