安装zsh并配置oh my zsh,让你的Linux终端也有爆爽体验!
Oh My Zsh 是基于 zsh 命令行的一个扩展工具集,提供了丰富的扩展功能。
我的环境是安装的WSL2的Ubuntu20.04
下载安装zsh
首先点击这里下载最新的zsh源码
然后将源码包复制到/usr/local
cp /mnt/e/downloads/zsh-5.8.1.tar.xz /usr/local
tar xJvf zsh-5.8.1.tar.xz
cd zsh-5.8.1
下面安装依赖,centos7用户使用yum命令
依赖有gcc、ncurses-dev
apt install gcc ncurses-dev -y
make && make install
设置默认shell
ps(默认装到/usr/lcoal/bin/zsh)
which zsh | sudo tee -a /etc/shells
sudo chsh -s /usr/local/bin/zsh
重新用windows terminal开个Ubuntu终端就能使用zsh了
安装Oh My Zsh
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
安装插件
语法高亮插件zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
自动补全插件 zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
安装zsh-history-substring-search
git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search
安装python3.9环境
wget https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tgz
tar xzvf Python-3.9.9.tgz
cd Python-3.9.9
./configure prefix=/usr/local/python3 --enable-optimizations
make && make install
配置系统环境
whereis python
rm -rf /usr/bin/python
rm -rf /usr/bin/pip
cp /usr/local/python3/lib/libpython3.9.a /usr/lib
echo "/usr/lib" > /etc/ld.so.conf.d/python3.9.conf
ldconfig
ln -s /usr/local/python3/bin/python3 /usr/bin/python
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip
vi /etc/profile
source /etc/profile
安装autojump
git clone git://github.com/joelthelion/autojump.git
cd autojump
./install.py
vim ~/.zshrc
[[ -s /root/.autojump/etc/profile.d/autojump.sh ]] && source /root/.autojump/etc/profile.d/autojump.sh
启用插件
vim ~/.zshrc
plugins=( git
autojump
zsh-autosuggestions
zsh-syntax-highlighting
zsh-history-substring-search
)
source ~/.zshrc
参考文章:
ubuntu安装python3(源码安装方法)
ubuntu 安装并配置zsh
|