Ubuntu系统新安装后要做的事情888
1、安装英伟达显卡驱动
在命令行中运行:
nvidia-smi
检查Nvidia的驱动程序是否安装成功!
安装驱动的文章可以参考:
https://frankz1998.blogspot.com/2025/10/ubuntu_7.html
2、安装CUDA
命令行运行:
nvcc --version
检查cuda是否安装成功,如果未安装则运行:
sudo apt install nvidia-cuda-toolkit -y
安装CUDA的文章可以参考:
https://frankz1998.blogspot.com/2025/10/ubuntucuda_7.html
3、安装git
命令行运行:
sudo apt install git -y
4、安装ffmpeg
命令行运行:
sudo apt install ffmpeg -y
5、安装ssh
sudo apt install openssh-server
(
如果ubuntu ip,用户名与之前的相同,登陆失败,可以执行下面的命令:
ssh-keygen -R 192.168.0.49
-------------------------------
hostname -I
查看当前电脑的IP地址
-------------------------------
6、安装curl
命令行运行:
sudo apt install curl -y
7、安装node.js
方法一、(推荐,无需科学上网)
sudo apt install nodejs npm -y
方法二、(必须在科学上网的环境下)命令行运行:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
\. "$HOME/.nvm/nvm.sh"
nvm install 22
node -v
npm -v
检查是否安装成功
8、安装uv虚拟环境
(建议在科学上网的环境下)命令行运行:
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.local/bin/env
uv --version
检查uv的版本信息
9、安装g++
sudo apt install build-essential -y
查看版本信息,验证是否安装成功
g++ --version
10、安装miniconda:
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
sudo chmod 777 Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh
当安装过程中,提示:
You can undo this by running `conda init --reverse $SHELL`? [yes|no]
source ~/.bashrc
更新环境变量,即可立即使用conda命令
第一次运行conda create -n xxx python=3.x ...命令的时候,会让你接受协议,需要根据提示,复制命令,并回车确认。如下:
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
11、安装chrome
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor -o /usr/share/keyrings/google-chrome-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list
sudo apt update
sudo apt install google-chrome-stable
12、安装sublime 文本编辑器
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/sublimehq-archive.gpg > /dev/null
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt update
sudo apt install sublime-text
-------------------------------------------------------------------
创建了conda虚拟环境之后,安装了pytorch等依赖库之后,可以使用:
test.py代码来测试:
import torch
# 检查PyTorch是否可以访问CUDA
if torch.cuda.is_available():
print("CUDA is available! You can use your GPU.")
# 打印CUDA版本
print("CUDA version:", torch.version.cuda)
# 打印可用的GPU数量
print("Number of available GPUs:", torch.cuda.device_count())
# 打印当前使用的GPU名称
print("Current GPU name:", torch.cuda.get_device_name(0))
else:
print("CUDA is not available. PyTorch is running on CPU.")
--------------------------------------------------
查看ip地址
hostname -I
查看内存
lsmem
free -h
查看硬盘
df -h
评论
发表评论