电脑配置清单(基于锦恢)
对ubuntu26.04做了修改
由于经常换电脑,记录一下简单的电脑配置流程。按照这个顺序配置即可。
Windows
必须是win11,因为我需要这个版本上面的一些特性,或是功能性的,或是装饰性的。
一、登录微软账号
- 同步部分OS配置
- 同步edge
- 同步应用商店
二、转移基本的静态文件
- 所有的图片(壁纸+图标+光标)
- 所有的额外字体文件(Jetbrain+Nerd等宽字体+几款我喜欢的中文字体)
.ssh文件夹(用于登录服务器)- windows terminal 的配置文件
setting.json,并替换本机windows terminal配置文件,将部分的图标路径进行修改。
三、下载应用软件
- 前往魔法地址获取订阅,解压安装包配置V2rayN。
- 安装包安装:nM3U8, xMouse,Goldendict(导入词典文件),Office套件(如有必要),Adobe(Photoshp,Audition,Acrobat),Davince,外设驱动
- 官网下载: 微信,腾讯会议,搜狗输入法(配置皮肤设置),百度网盘,夸克网盘, 火绒,Office套件,Everything,Localsend,Pixpin, Potplayer,quicklook,pandoc
四、配置开发环境
-
删除和python默认起冲突的可执行文件。使用管理员权限打开powershell,输入:
cd C:\Users\<用户名>\AppData\Local\Microsoft\WindowsApps rm python* -
下载git
- 前往 https://git-scm.com/download/win
- 配置信息:
git config --global user.email xxx git config --global user.name xxxname = Naphthalene220 email = liheyang220@126.com
-
设置代理(不需要):
git config --global http.proxy http://127.0.0.1:<端口号> git config --global https.proxy https://127.0.0.1:<端口号>
改用
git config --global http.https://github.com.proxy socks5h://127.0.0.1:10808
-
安装python
- 去 https://www.python.org/downloads/windows/ 寻找稳定版本的x64可执行文件下载
- 配置pip源:
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple pip config set global.proxy socks5h://127.0.0.1:10808 -
安装MinGW https://sourceforge.net/projects/mingw/
忘记安装配置怎么选看这篇博客
-
安装cmake https://cmake.org/download/
如果安装了VS,可以查看路径
C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin,这里面存在VS构建的cmake,上面的cmake可以不用下载。
-
安装node https://nodejs.org/en/download/
npm 换源:
npm config set registry https://registry.npmmirror.com -
安装go(暂时不需要)
- 找到安装 https://golang.google.cn/dl/
- 配置:
go env -w GO111MODULE=on go env -w GOPROXY=https://goproxy.cn,direct- 如果有必要,设置GOROOT和GOPATH环境变量
-
安装Java:https://www.oracle.com/hk/java/technologies/downloads/
-
测试以上编译器、解释器能否正常工。
-
安装vscode(科学上网),安装后打开并登录GitHub账号进行配置与插件同步(等到左下角的“正在同步”消失后,就可以退出了)
-
安装VS2022(反正是最新版的就行),安装windows通用开发和C++的(19G好像是)(不需要)
-
安装 glow:(不太需要)
## windows
$ wget -c https://kirigaya.cn/files/windows_tools/glow_Windows_x86_64.zip
## Linux
$ wget -c https://kirigaya.cn/files/linux_tools/glow_Linux_x86_64.tar.gz
五、配置终端
以管理员权限打开windows terminal,执行下面的指令
- 配置 powershell,安装powershell插件
# 允许运行Install-Module脚本
set-executionpolicy remotesigned
# 更新最新版本的PSReadLine,为了自动补全
Install-Module PSReadLine -Force
# 安装最新版本的Zlocation,更快捷的文件夹跳转
Install-Module ZLocation -Force
# 创建powershell 的初始化脚本,点击确认创建即可
notepad $profile
# 安装几个插件
Install-Module posh-git
Install-Module Terminal-Icons
-
安装并配置oh-my-posh
- 安装oh-my-posh
winget install JanDeDobbeleer.OhMyPosh -s winget如果该方法失效,移步oh-my-posh windows set up查看最新安装方法
- 下载oh-my-posh主题(只需要官网下载cleandetailed即可)
git clone https://github.com/JanDeDobbeleer/oh-my-posh将里面的theme文件夹保留即可。
- 测试
oh-my-posh init pwsh | Invoke-Expression -
配置整体运行文件
notepad $profile
将以下文本写入其中:
oh-my-posh init pwsh --config <主题路径(json文件)> | Invoke-Expression
Import-Module posh-git
Import-Module Terminal-Icons
Import-Module Zlocation
Set-PSReadLineOption -PredictionSource History
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
cls
重新打开terminal查看安装效果
六、安装WSL2
以管理员身份打开windows terminal
# 开启VM组件 开启后需要重启电脑
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
# 安装Ubuntu
wsl --install -d Ubuntu
# 设置为wsl2
wsl --set-default-version 2
以上操作完成后,在win+Q中搜索ubuntu on Windows,打开,完成安装和账号注册(Unix账号必须是开头小写的单词)
完成后打开windows terminal的下拉菜单,会发现多出了一个Ubuntu的标签页。后面移步Linux的配置。
七、兴趣爱好
-
cuDNN开发套件(用于开发kernel op和安装编译torch cuda) https://developer.nvidia.com/cuda-downloads
卸载无用的组件:
winget uninstall "Windows web experience Pack"
Linux
配置代理
直接切换wsl的代理方式
操作步骤:
[wsl2]
networkingMode=mirrored
dnsTunneling=true
firewall=true
autoProxy=true
-
应用配置:打开 PowerShell 或 CMD,运行以下命令关闭所有 WSL 实例,使其重启并生效。
wsl --shutdown
-
验证结果:重新打开 WSL2,可以尝试在 Linux 里直接
curl一下localhost上的端口,如果通了,并且之前的警告不再出现,就说明配置成功了。
局域网配置(不需要)
打开v2rayn允许本地局域网访问 wsl2 运行 得到ip
ipconfig.exe | iconv -f gbk -t utf-8 | grep -A 10 "WSL"
运行
export http_proxy="socks5h://172.19.240.1:10808"
export https_proxy="socks5h://172.19.240.1:10808"
一、给apt换源(24.04后方式修改)
cd /etc/apt/
# 留个source备份
sudo mv sources.list.d/ubuntu.sources sources.list.d/ubuntu.sources.backup
# 使用源
sudo vim sources.list.d/ubuntu.sources
使用清华源 去官网复制代码 Ubuntu | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
更新一下:
sudo apt update
sudo apt upgrade
24.04前系统模式
cd /etc/apt/
# 留个source备份
sudo mv sources.list sources.list.backup
# 使用源
sudo vim sources.list
写入:(根据ubuntu版本号自己查,如果源的版本和ubuntu版本不一致,那么后续更新就会发生依赖问题。e.g. Ubuntu20.04对应focal-XXX的源)
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
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse multiverse
保存退出。
移除自带的包(因为可能和国内源的软件有冲突)
sudo apt remove ubuntu-advantage-tools
更新一下:
sudo apt update
sudo apt upgrade
二、安装基本的开发工具
# mingw套组
sudo apt install build-essential cmake
# python3 pip 工具
sudo apt install python3-pip
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
三、美化终端(使用zsh)
安装
sudo apt install zsh
chsh -s $(which zsh)
在bashrc里面加入
export SHELL=`which zsh`
[ -z "$ZSH_VERSION" ] && exec "$SHELL" -l
重新打开当前终端,就会进入zsh终端,接着安装oh-my-zsh主题框架。
cd ~
git clone https://gitee.com/mirrors/oh-my-zsh
sh oh-my-zsh/tools/install.sh
安装两个插件
cd ~/.oh-my-zsh/custom/plugins/
# 高亮关键词
git clone https://gitee.com/testbook/zsh-syntax-highlighting.git
# 自动补全
git clone https://gitee.com/qiushaocloud/zsh-autosuggestions
# 更加丰富的高亮
git clone https://gitee.com/wangl-cc/fast-syntax-highlighting
# 展示自动补全历史
git clone https://gitee.com/wenhuifu/zsh-autocomplete
然后进入~/.zshrc在plugins参数中添加zsh-syntax-highlighting和zsh-autosuggestions。也就是说你的.zshrc中必须要有一行长这样:
plugins=(git zsh-syntax-highlighting zsh-autosuggestions fast-syntax-highlighting zsh-autocomplete)
下载 powerlevel10k 配置
四、安装部分驱动程序
默认pip 版本较低,升级一下
pip install --upgrade pip
安装opencv的包
sudo apt install libopencv-dev
pip install opencv-python
安装torch cuda
sudo apt install nvidia-cuda-toolkit