Linux 小连招

Table of content:

实用脚本

安装docker

  • 国内
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
  • 国外
curl -sSL https://get.daocloud.io/docker | sh

安装Neo4j

参考 官方文档: Neo4j

mkdir -p /etc/apt/keyrings
wget -O - https://debian.neo4j.com/neotechnology.gpg.key | gpg --dearmor -o /etc/apt/keyrings/neotechnology.gpg
echo 'deb [signed-by=/etc/apt/keyrings/neotechnology.gpg] https://debian.neo4j.com stable latest' | tee -a /etc/apt/sources.list.d/neo4j.list
apt-get update
apt-get install neo4j

trouble shooting

系统没有使用 systemd 作为初始化系统

  • 报错信息:

    System has not been booted with systemd as init system (PID 1). Can't operate.
    Failed to connect to bus: Host is down
    
  • 操作:

    # 备份旧的下载源
    mv /etc/apt/sources.list /etc/apt/sources.list.old
    # 创建新的下载源
    vim /etc/apt/sources.list
    

    vim中填写

    deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
    
    deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
    
    deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
    
    deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
    deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
    

    输入完成后依次输入: Esc -> :wq -> Enter

    最后: sudo apt update

美化

oh-my-zsh

sudo apt-get install zsh
command -v zsh | sudo tee -a /etc/shells
chsh -s $(which zsh)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

插件配置

主题

jonathan 主题

ZSH_THEME="jonathan"
ZSH_THEME="gnzh"

zsh-autosuggestions

  1. Clone this repository into $ZSH_CUSTOM/plugins (by default ~/.oh-my-zsh/custom/plugins)

    git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
    
  2. Add the plugin to the list of plugins for Oh My Zsh to load (inside ~/.zshrc):

    plugins=( 
        # other plugins...
        zsh-autosuggestions
    )
    
  3. Start a new terminal session.

zsh-syntax-highlighting

Simply clone this repository and source the script:

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
echo "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc

Then, enable syntax highlighting in the current interactive shell:

source ./zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

If git is not installed, download and extract a snapshot of the latest development tree from:

https://github.com/zsh-users/zsh-syntax-highlighting/archive/master.tar.gz

Note the source command must be at the end of ~/.zshrc.