关于 UbuntuServer 的一些配置

ubuntu server 虚拟机命令行模式密码忘了怎么办

看这篇博客成功重置密码:

https://blog.csdn.net/DuanNaiLin/article/details/132510263

用 kali 进行 ssh 连接到这台 ubuntu 上会更好操作,ubuntu server 命令行模式无法复制粘贴。

ubuntu server 虚拟机代理配置有问题

以前的 ip 现在不能用了,需要重新配置代理,我当时是这样配置的:

sudo vim /etc/environment

在此文件中更改代理的 ip 和端口。

ubuntu server 换源

打开终端,以管理员权限登录。

备份原有的软件源列表:

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

打开源列表文件:

sudo nano /etc/apt/sources.list

把文件里原有的内容全部删除。

Ctrl + K 删除一行

根据需要选择国内镜像源并添加到文件中:

阿里云:

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb 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 main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

清华大学开源软件镜像站:

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse

清华大学镜像的 GPG Key:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7D8D0BF6
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0BDA11B1D58A4DF9

保存文件并退出编辑器。

Ctrl + X 保存并退出,Y 确认保存,最后回车退出。

更新软件源:

sudo apt update

至此,就把 Ubuntu Server更换到国内镜像源了。

你可能感兴趣的:(ubuntu)