Morgan Woods

真真夜夜的炼金工坊

Fedora环境配置

基础配置#

1. 更换镜像源加速下载#

加速 dnf
/etc/dnf/dnf.conf

fastestmirror=True
max_parallel_downloads=32
defaultyes=True
keepcache=True

更换清华源

sudo sed -e 's|^metalink=|#metalink=|g' \
         -e 's|^#baseurl=http://download.example/pub/fedora/linux|baseurl=https://mirrors.ustc.edu.cn/fedora|g' \
         -i.bak \
         /etc/yum.repos.d/fedora.repo \
         /etc/yum.repos.d/fedora-updates.repo

sudo dnf update

启动 rpm-fusion 源

sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

fedora flatpak

flatpak remote-delete fedora
sudo flatpak remote-modify flathub --url=https://mirror.sjtu.edu.cn/flathub

2. development tools#

sudo dnf groupinstall "Development Tools"
sudo dnf install -y gcc gcc-c++ git cmake ninja-build zlib-devel

安装并配置 Rust

export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup
export PATH="$HOME/.cargo/bin:$PATH"
curl https://sh.rustup.rs -sSf | sh

echo 'PATH="$HOME/.cargo/bin:$PATH"' >> ~/.zshrc

$HOME/.cargo/config.toml

[source.crates-io]
replace-with = 'aliyun'
[source.aliyun]
registry = "sparse+https://mirrors.aliyun.com/crates.io-index/"

.zshrc

export PATH="$HOME/.cargo/bin:$PATH"

3. ssh#

sudo sed -i -e 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' \
            -e 's/#Port 22/Port 22/' \
            -e 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' \
            -e 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
systemctl daemon-reload

4. text editor#

sudo dnf install vim neovim

5. Tampermonkey-firefox#

TamperMonkey
CSDN

6. proxy-tools#

wget https://files.catbox.moe/mreuef.gz
tar -xzf mreuef.tar.gz

可选配置#

ibus#

# 似乎不管是ibus还是fcitx在fedora中最近总是失效
# 就像是:ModuleNotFoundError: No module named 'gi'
# 解决办法如下:
sudo dnf install gcc gobject-introspection-devel cairo-gobject-devel pkg-config python3-devel gtk4
pip3 install pycairo
pip3 install PyGObject

fcitx5#

sudo dnf install fcitx5-chinese-addons fcitx5-autostart

# Gnome美化
# https://extensions.gnome.org/extension/261/kimpanel/

todesk#

cd Downloads
wget https://dl.todesk.com/linux/todesk-v4.7.2.0-x86_64.rpm # direct-link
sudo yum install libappindicator-gtk3
sudo rpm -Uvh todesk-v4.7.2.0-x86_64.rpm

# 记得将gnome来关闭挂起

zerotier#

curl -s https://install.zerotier.com | sudo bash

VSCode#

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" | sudo tee /etc/yum.repos.d/vscode.repo > /dev/null

dnf check-update
sudo dnf install code # or code-insiders

jetbrains#

wget https://download.jetbrains.com/toolbox/jetbrains-toolbox-2.3.2.31487.tar.gz

astronvim#

git clone https://github.com/Mieluoxxx/astronvim_config ~/.config/nvim
nvim --headless -c 'quitall'

oh-my-zsh#

sudo dnf install zsh
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
ZSH_CUSTOM="${ZSH:-$HOME/.oh-my-zsh}/custom"
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions && \
git clone https://github.com/zsh-users/zsh-completions $ZSH_CUSTOM/plugins/zsh-completions && \
git clone https://github.com/zsh-users/zsh-syntax-highlighting $ZSH_CUSTOM/plugins/zsh-syntax-highlighting

sed -i '/^plugins=(/ s/)$/ zsh-autosuggestions zsh-completions zsh-syntax-highlighting)/' ~/.zshrc
source ~/.zshrc

zoxide#

cargo install zoxide
sudo dnf install fzf

echo 'eval "$(zoxide init zsh)"' >> ~/.zshrc
source ~/.zshrc

miniconda3#

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

./miniconda3/bin/conda init zsh
source ~/.zshrc

Fedora NVIDIA 深度学习环境搭建#

section 1#

sudo dnf update
sudo dnf -y install kernel-devel 
sudo dnf -y install gcc

# 检查版本,保持一致
uname -r
rpm -qa | grep kernel

section 2#

# 1. check nouveau
lsmod | grep nouveau

# 2. check gpu
lspci | grep VGA

# 3. blacklist
sudo vim /etc/modprobe.d/blacklist-nouveau.conf 
blacklist nouveau
#options nouveau modeset=0

#安装用于处理ELF(可执行和链接格式)文件的开发工具库:elfutils-libelf-devel
sudo dnf install elfutils-libelf-devel

# 4. 重新初始化RAM磁盘,确保系统包含了最新的驱动程序和配置
sudo dracut -f

# 下载对应版本的NVIDIA显卡驱动
aria2c -s 4 -x 4 -j 10 https://us.download.nvidia.com/XFree86/Linux-x86_64/555.52.04/NVIDIA-Linux-x86_64-555.52.04.run
chmod a+x NVIDIA-Linux-x86_64-555.52.04.run

# 注销用户
# ctrl + alt + f2 进入 tty
sudo ./NVIDIA-Linux-x86_64-555.52.04.run

reboot

image

section 3#

# cuda程序
aria2c -s 4 -x 4 -j 10 https://developer.download.nvidia.com/compute/cuda/12.5.0/local_installers/cuda-repo-fedora39-12-5-local-12.5.0_555.42.02-1.x86_64.rpm
sudo rpm -i cuda-repo-fedora39-12-5-local-12.5.0_555.42.02-1.x86_64.rpm
sudo dnf clean all
sudo dnf -y install cuda-toolkit-12-5

echo 'PATH="/usr/local/cuda-12.5/bin:$PATH"' >> ~/.zshrc
echo 'LD_LIBRARY_PATH="/usr/local/cuda-12.5/lib64:$LD_LIBRARY_PATH"' >> ~/.zshrc
source ~/.zshrc

# cuda驱动
sudo dnf -y module install nvidia-driver:latest-dkms


# cudnn
aria2c -s 4 -x 4 -j 10 https://developer.download.nvidia.com/compute/cudnn/9.2.0/local_installers/cudnn-local-repo-rhel9-9.2.0-1.0-1.x86_64.rpm
sudo rpm -i cudnn-local-repo-rhel9-9.2.0-1.0-1.x86_64.rpm
sudo dnf clean all
sudo dnf -y install cudnn

sudo dnf -y install cudnn-cuda-12

启用 GTK4 的 Vulkan 后端#

sudo vim /etc/environment

GSK_RENDERER=vulkan

Fedora 测试通道#

sudo dnf update --enablerepo=updates-testing --refresh
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.