ubuntu22.04新机使用(换源,下载软件,安装显卡驱动,锁屏长亮)
换源
国内有很多Ubuntu的镜像源,包括阿里的、网易的,还有很多教育网的源,比如:清华源、中科大源。推荐使用中科大源,快得很。
/etc/apt/sources.list
编辑/etc/apt/sources.list文件, 在文件最前面添加以下条目(操作前请做好相应备份):
中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
然后执行命令:
sudo apt-get update
sudo apt-get upgrade
其他几份国内源如下,可按需添加:
清华源:
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
阿里源:
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
网易163源:
deb http://mirrors.163.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy-backports main restricted universe multiverse
星火商店
使用linux不方便的一点是软件的下载,需要软件的linux版本,可以去软件的官网找到linux版本下载,推荐直接使用星火商店下载,十分方便。星火商店官网:https://spark-app.store/
选择软件本体下载,换源后可以安装软件本体可以自动安装依赖:
点击开始下载,选择第一个下载:
使用apt下载:
sudo apt install ./xxxx.deb
安装成功后可选择自己需要的应用下载,十分方便:
安装显卡驱动
1.官网下载驱动
根据自己显卡选择驱动,官网地址:https://www.nvidia.cn/Download/index.aspx?lang=cn#
下载后放到英文路径下,中文容易乱码。
2.关闭secure boot
查看secure boot
mokutil --sb-state
如果是enabled,开机时进入bios将secure boot调整为disabled。
3.更新软件列表和安装必要软件、依赖
sudo apt-get update
sudo apt-get install g++
sudo apt-get install gcc
sudo apt-get install make
4.禁用默认驱动
在安装NVIDIA驱动以前需要禁止系统自带显卡驱动nouveau。
sudo gedit /etc/modprobe.d/blacklist.conf
在打开文件的末尾添加:
blacklist nouveau
options nouveau modeset=0
最后更新一下系统的initramfs镜像文件:
sudo update-initramfs -u
重启,lsmod没有输出的话就说明禁用了nouveau。
lsmod | grep nouveau
5.进入tty模式
sudo telinit 3
输入用户名和密码登录。
禁用X-window服务:
sudo service gdm3 stop
6.给下载的驱动文件权限,安装驱动
sudo chmod 777 NVIDIA-Linux-x86_64-535.129.03.run
sudo ./NVIDIA-Linux-x86_64-535.129.03.run –no-opengl-files -no-x-check
7.安装选项:
这两个问题选No,其他的选accept,continue install,yes等正面词汇。
- Would you like to register the kernel module souces with DKMS? This will allow DKMS to automatically build a new module, if you install a different kernel later? No
- Nvidia’s 32-bit compatibility libraries? No
8.启动图形界面
sudo service gdm3 start
9.查看驱动
nvidia-smi
屏幕的分辨率可以调整了:
锁屏长亮
长按window键 + L 即可常亮锁屏。短按就是取消常亮锁屏