Ubuntu 16.04 虚拟机安装完成之后你需要做的几件事

一、修改主机名

打开终端

$ sudo hostname Ubuntu  # 这里的Ubuntu指的是你想要修改的主机名
$ sudo vi /etc/hostname  # 将原有主机名修改成你想要显示的主机名

这里写图片描述 Tips:

hostname XXX # 这是临时修改主机名,即重启失效
编辑 /etc/hostname # 这是永久修改主机名,即重启不失效

这里写图片描述 Warning:

sudo: 无法解析主机:Ubuntu
解决方案:
编辑/etc/hosts文件
将 127.0.0.1 对应的原主机名修改为 Ubuntu 即可

二、修改并更新软件源以及更新软件

修改软件源

$ cp /etc/apt/sources.list /etc/apt/sources.list.bak  # 先备份
$ sudo gedit /etc/apt/sources.list  # 用新源覆盖原文件内容

# 网易软件源:
deb http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb http://mirrors.163.com/ubuntu/ precise universe
deb-src http://mirrors.163.com/ubuntu/ precise universe
deb http://mirrors.163.com/ubuntu/ precise-updates universe
deb-src http://mirrors.163.com/ubuntu/ precise-updates universe
deb http://mirrors.163.com/ubuntu/ precise multiverse
deb-src http://mirrors.163.com/ubuntu/ precise multiverse
deb http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse


# 阿里软件源
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse


# 搜狐软件源
deb http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.sohu.com/ubuntu/ trusty-backports main restricted universe multiverse

更新软件

$ sudo apt update  # update是更新软件列表
$ sudo apt upgrade  # upgrade是更新软件

这里写图片描述 Warning:

正在读取软件包列表… 完成
正在分析软件包的依赖关系树
正在读取状态信息… 完成
正在计算更新… 完成
下列软件包是自动安装的并且现在不需要了:
snap-confine
使用’sudo apt autoremove‘来卸载它(它们)。
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。

解决方案:
sudo apt autoremove # 卸载

三、安装vim和htop

$ sudo apt install vim  # install后面写需要安装的包名 不知道vim是什么的去自行面壁
$ sudo apt install htop  # htop可以更直观的看到系统资源使用情况,top升级版

Ubuntu 16.04 虚拟机安装完成之后你需要做的几件事_第1张图片

你可能感兴趣的:(Ubuntu)