一、 配置常用 Ubuntu 安装的阿里源:
% cd /etc/apt
% sudo vi sources.list
# 编辑完成后需要执行:
% sudo apt update
# 18.04 版本替换为以下内容:
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
# 20.04 版本替换为以下内容:
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
# 22.04 版本替换为以下内容:
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
二、安装以下常用工具
1. 安装 ssh,ifconfig 等常用网络软件
% sudo apt install net-tools ssh
2. 安装 gcc 等常用开发库
% sudo apt install build-essential
三、常用配置命令
1. 添加用户及设置
% useradd [用户名]
% sudo vi /etc/group # 将用户增加到合适组中,如 sudo,admin
% sudo vi /etc/sudoers # 设置 sudo 时不需要输入命令
%sudo ALL=(ALL:ALL) NOPASSWD:ALL
[用户名] ALL=(ALL:ALL) NOPASSWD:ALL
2. 设置远程操作
# 开机默认进入命令行模式
% sudo systemctl set-default multi-user.target
# 开机默认进入图形用户界面
% sudo systemctl set-default graphical.target
2.1 合上笔记本盖子不休眠,取消 #HandleLidSwitch=suspend注释(即删除#号),然后将suspend改为ignore:
% sudo vi /etc/systemd/logind.conf
HandleLidSwitch=ignore
# 重启服务:
% sudo service systemd-logind restart
2.2 安装远程 vnc
% sudo apt install vino dconf-editor
# 进行系统 settings 中将共享(share)中的桌面共享打开,并启用自动登录
# 对 MacOS 等 vnc 客户端,需要运行 dconf-editor
# 进入:org -> gnome -> desktop -> remote access -> require encrytion 选择关闭
# 关闭 Ubuntu 桌面版动画,使应用程序菜单不再卡顿
% gsettings set org.gnome.desktop.interface enable-animations false
3. GPU 显示器安装
# Nvidia GPU 安装
% sudo ./NVIDIA-Linux-x86_64-510.85.02.run -z --dkms --no-opengl-files --no-cc-version-check