https://ip.skk.moe/simple-dark

Debian / Ubuntu 相关

wget <http://fishros.com/install> -O fishros && . fishros
source <(wget -qO- <http://fishros.com/install>)

# chsrc
curl <https://chsrc.run/posix> | sudo bash

wget -O chsrc <https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-x64-linux>  && chmod +x ./chsrc

curl -L <https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-x64-linux> -o chsrc; chmod +x ./chsrc

# aarch64
curl -L <https://gitee.com/RubyMetric/chsrc/releases/download/pre/chsrc-aarch64-linux> -o chsrc; chmod +x ./chsrc

# 一键设置源 
sudo chsrc set ubuntu ustc

sudo sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list

sudo sed -E -i 's@https?://.*/ubuntu/?@<https://mirrors.tuna.tsinghua.edu.cn/ubuntu@g>' /etc/apt/sources.list

sed -E -i 's@https?://.*/ubuntu/?@<https://mirrors.cernet.edu.cn/ubuntu/@g>' /etc/apt/sources.list

sudo apt edit-sources # 验证换源

# fastfetch
wget <https://github.com/fastfetch-cli/fastfetch/releases/latest/download/fastfetch-linux-amd64.deb> && sudo apt install ./fastfetch*.deb

wget <https://github.com/fastfetch-cli/fastfetch/releases/latest/download/fastfetch-linux-aarch64.deb> && sudo apt install ./fastfetch*.deb

sudo add-apt-repository ppa:zhangsongcui3371/fastfetch
sudo apt update
sudo apt upgrade

# 每个ppa都会在/etc/apt/sources.list.d/目录下创建一个list文件。
# 只需把里面的ppa.launchpad.net改为 launchpad.proxy.ustclug.org ,http改为https即可。

sudo apt install curl git nano fish btop htop neofetch python-is-python3 \\
	gdebi gdebi-core
	
sudo apt install konsole dolphin konqueror

wget <http://fishros.com/install> -O fishros && . fishros

sudo su  # 切换到 root 用户并保留当前用户的环境变量和工作目录
sudo -i  # 完全模拟 root 用户的登录会话,并改变当前的环境变量和工作目录

export PATH="$PATH:/usr/local/bin:$HOME/.local/bin" #添加环境变量, : 号分割
export PATH="$HOME/.local/bin:$PATH"

sudo systemctl disable sddm # 命令禁用显示管理器 
sudo systemctl disable lightdm # 命令禁用显示管理器 

# 更新时间
sudo ntpdate pool.ntp.org

# 双系统时间不一致, 修改 Windows 硬件时钟为 UTC 时间
Reg add HKLM\\SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation /v RealTimeIsUniversal /t REG_DWORD /d 1

# 解决依赖
sudo apt install aptitude 
sudo aptitude install openssh-server

# oh-my-bash
bash -c "$(wget <https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh> -O -)"

sudo hostnamectl set-hostname 新主机名  # 更改主机名(永久且立即生效)

从ubuntu20升级到22 https://devv.ai/search?threadId=du6p57fk56gw

常用工具 (待更新)

中文相关

# 中文输入法
sudo apt install fcitx5 fcitx5-chinese-addons fcitx5-frontend-gtk4 \\
fcitx5-frontend-gtk3 fcitx5-frontend-gtk2 fcitx5-frontend-qt5

# 下载词库文件
wget <https://github.com/felixonmars/fcitx5-pinyin-zhwiki/releases/download/0.2.4/zhwiki-20220416.dict>

mkdir -p ~/.local/share/fcitx5/pinyin/dictionaries/
mv zhwiki-20220416.dict ~/.local/share/fcitx5/pinyin/dictionaries/

# 选择 fcitx5 引擎
im-config

# 开机自启
sudo cp /usr/share/applications/org.fcitx.Fcitx5.desktop /etc/xdg/autostart/

# 设置中文 (可选步骤)
	sudo apt install lang uage-pack-zh-hans  fonts-noto-cjk
sudo dpkg-reconfigure locales
sudo nano /etc/default/locale  

# 设置为 
LANG="zh_CN.UTF-8"
LC_ALL="zh_CN.UTF-8"

Python 相关

sudo apt install python3 python3-pip python-is-python3

# 设置源
chsrc set pip tuna
**chsrc set uv tuna**
chsrc set anaconda tuna
**chsrc set python <https://pypi.tuna.tsinghua.edu.cn/simple**>

pip install -i <https://mirror.lzu.edu.cn/pypi/web/simple> pip -U
# pip config set global.index-url <https://mirror.lzu.edu.cn/pypi/web/simple>
pip config set global.index-url <https://pypi.tuna.tsinghua.edu.cn/simple>
pip config list  # 查看是否配置成功

# 常用包
pip install opencv-python
pip install shell-gpt
nano ~/.config/shell_gpt/.sgptrc
# sk-boom30bf2ed3bb49ae817062595908d5ce

# 提示 which is not on PATH
nano ~/.bashrc  
export PATH="$HOME/.local/bin:$PATH"

pip show [package] # 查看环境路径

# 虚拟环境相关
python3 -m venv myenv --system-site-packages
source myenv/bin/activate.fish

pip freeze > requirements.txt
pip install -r requirements.txt

## miniforge
# <https://mirrors.tuna.tsinghua.edu.cn/github-release/conda-forge/miniforge/>
curl -L -O "<https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$>(uname -m).sh"
wget "<https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$>(uname -m).sh"
bash Miniforge3-$(uname)-$(uname -m).sh

## miniconda
mkdir -p ~/miniconda3
wget <https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh> -O ~/miniconda3/miniconda.sh
# wget <https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh> -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm ~/miniconda3/miniconda.sh

~/miniconda3/bin/conda init --all
conda init --all
conda config --set auto_activate_base false   # 禁用自动激活 conda
conda config --set auto_activate false  # 新版 API 参数

conda info --envs
conda create --name myenv python=3.11
conda activate myenv 

conda env list  # 列出所有环境
conda create --name newenv --clone oldenv # 复制环境:
conda env remove -n myenv  # 删除环境

conda clean --all

## uv
curl -LsSf <https://astral.sh/uv/install.sh> | sh
powershell -ExecutionPolicy ByPass -c "irm <https://astral.sh/uv/install.ps1> | iex"

# 国内镜像
curl -LsSf <https://gitee.com/wangnov/uv-custom/releases/download/latest/uv-installer-custom.sh> | sh
powershell -ExecutionPolicy Bypass -c "irm <https://gitee.com/wangnov/uv-custom/releases/download/latest/uv-installer-custom.ps1> | iex"

#  (可选) 配置 uv 自动识别并管理当前激活的 Conda/Mamba 环境
curl -LsSf <https://gitee.com/wangnov/uv-custom/releases/latest/download/setup_hooks.sh> | sh
powershell -ExecutionPolicy Bypass -c "irm <https://gitee.com/wangnov/uv-custom/releases/latest/download/setup_hooks.ps1> | iex"
	
uv init
uv venv --python 3.11.13
uv venv --python 3.10.18
uv add opencv-python
uv add -r requirements.txt
uv sync
python -m ensurepip --upgrade  # 安装缺失的 pip 
pip3 install -i <https://mirror.lzu.edu.cn/pypi/web/simple> pip -U

# pyproject.toml 配置清华源
[[tool.uv.index]]
url = "<https://pypi.tuna.tsinghua.edu.cn/simple>"
default = true

git

# 一次性配置 (项目级)
git config user.name "DBinK"
git config user.email "[email protected]"

git config user.name "clickowo"
git config user.email "[email protected]"

git config http.proxy <http://127.0.0.1:7897>
git config https.proxy <https://127.0.0.1:7897>

# 第一次配置
git config --global user.name "DBinK"
git config --global user.email "[email protected]"

# 设置代理
git config --global http.proxy <http://127.0.0.1:7897>
git config --global https.proxy <https://127.0.0.1:7897>

git config --global http.proxy $http_proxy
git config --global https.proxy $https_proxy

git config --global --unset http.proxy
git config --global --unset https.proxy

# 基础操作
git init    # 初始化项目, 有了GitHub几乎不用
git status  # 查看整个仓库的状态
git add .   # 把新增文件添加到暂存区,以备提交
git commit -m "本次提交的备注" # 命令生成一个新的提交
git push    # 提交推送到 GitHub 远程仓库
git push -f # 将本地分支强制推送到远程仓库

# 分支操作
git fetch origin              # 获取远程分支的最新更新
git reset --hard origin/main  # 将本地分支重置到远程分支的最新提交

ssh-keygen -t ed25519 -C "[email protected]"  #GitHub
ssh-keygen -t ed25519 -C "[email protected]"  #Gitee

Untitled

同时使用 github 和 gitee