linux服务器初建之zsh安装
Oh My Zsh Installation Guide
1. Core Installation
1.1 Install Zsh
1 | # RedHat/Fedora/CentOS |
Verify the installation:
1 | zsh --version |
1.2 Set Zsh as Default Shell
1 | # Add Zsh to available shells |
Note: You'll need to log out and log back in for the change to take effect.
1.3 Install Oh My Zsh
Follow this step only if you need to use a proxy; otherwise, feel free to skip it.
1 | # Set proxy for shell |
Install Oh My Zsh:
1 | # Install using curl (recommended) |
1.4 Install Default Plugins
1 | # Install auto-suggestions |
1.5 Basic Configuration
Edit your ~/.zshrc
file:
1 | # Enable plugins |
2. Optional Enhancements
The above is the minimal setup for me. For more advanced configurations, you can customize your ~/.zshrc
file further.
2.1 PowerLevel10k Theme
Install the theme:
1 | git clone --depth 1 https://github.com/romkatv/powerlevel10k \ |
Configure in ~/.zshrc
:
1 | ZSH_THEME="powerlevel10k/powerlevel10k" |
Run configuration wizard:
1 | p10k configure |
Required font setup:
- Install
Nerd Font
: https://github.com/ryanoasis/nerd-fonts/releases/latest - Set your
terminal emulator
to use aNerd Font
2.2 Modern CLI Tools (via Rust)
Install Rust:
1 | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh |
Install enhanced command-line tools:
1 | # ripgrep: faster alternative to grep |
Add to ~/.zshrc
if using Rust tools:
1 | alias ls='lsd' |
3. Troubleshooting
-
Permission issues:
1
sudo chown -R $USER:$USER ~/.oh-my-zsh
-
Network-related issues:
- Check your internet connection
- Verify proxy settings if using a proxy
- Try downloading files directly if git clone fails
-
Plugin issues:
1
2
3
4# Reinstall plugins
rm -rf ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
rm -rf ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# Then repeat the plugin installation steps -
Theme display issues:
- Verify font installation
- Check terminal emulator settings
- Ensure terminal supports true color