关于 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更换到国内镜像源了。

相关推荐
Mr. Cao code3 小时前
探索OpenResty:高性能Web开发利器
linux·运维·服务器·前端·nginx·ubuntu·openresty
Molesidy13 小时前
【UAV】基于PX4+Ubuntu24.04.3的无人机制作的开发环境搭建
ubuntu·无人机·px4·gazebo·uav
绿箭柠檬茶16 小时前
Ubuntu 使用 Samba 共享文件夹
linux·运维·ubuntu
小猫挖掘机(绝版)19 小时前
通过tailscale实现一台电脑上vscode通过ssh连接另一台电脑上的VMware Linux 虚拟机
linux·windows·vscode·ubuntu·ssh
剑客的茶馆20 小时前
新服务器从0开始搭配Ubuntu+Conda+Docker+Dify
服务器·ubuntu·docker·conda·dify
正在走向自律1 天前
Ubuntu系统下Python连接国产KingbaseES数据库实现增删改查
开发语言·数据库·python·ubuntu·kingbasees·ksycopg2
weixin_456904271 天前
CentOS与Ubuntu的详细区别
linux·ubuntu·centos
zfxwasaboy1 天前
linux Kbuild详解关于fixdep、Q、quiet、escsq
android·linux·ubuntu
yaoxtao1 天前
java.nio.file.InvalidPathException异常
java·linux·ubuntu
IOT-Power2 天前
Ubuntu下把 SD 卡格式化为 FAT32
linux·运维·ubuntu