VariantConst
351 字
2 分钟
服务器快速配置速查

Oh-My-Zsh#

无 root 安装配置 oh-my-zsh(假设zsh已安装)

zsh
sh -c "$(curl -fsSL https://gitee.com/wosi/ohmyzsh/raw/master/tools/install.sh)"

常用 Oh-My-Zsh 插件和 powerlevel10k 主题(可选)

sh -c "$(curl -fsSL https://gitee.com/wosi/ohmyzsh/raw/master/tools/install_plugin.sh)"
git clone https://gitee.com/mengchaobbbigrui/powerlevel10k.git ~/.powerlevel10k
echo 'source ~/.powerlevel10k/powerlevel10k.zsh-theme' >>! ~/.zshrc
source ~/.zshrc

修改机器名称

vim ~/.p10k.zsh
/POWERLEVEL9K_CONTEXT_TEMPLATE
# 回车,把%m改成你想要的机器名,如 b0

MicroMamba#

安装

"${SHELL}" <(curl -L micro.mamba.pm/install.sh)
echo "alias conda=micromamba" >> ~/.zshrc

迁移环境

导出:

conda env export > environment.yml

安装:

conda env create -f environment.yml

Clash(可选)#

以你的方式上传 clash 文件和配置文件到服务器。假设的 clash 文件夹位于 path/to/clash/ ,其中包含 clash 可执行文件、 config.yaml 配置文件以及 Country.mmdb

将以下脚本保存为 /etc/systemd/system/clash.service

[Unit]
Description=Clash service
After=network.target

[Service]
Type=simple
User=[YOUR_USER_NAME]
ExecStart=path/to/clash -d path/to/clash-config-folder
Restart=on-failure
RestartPreventExitStatus=23

[Install]
WantedBy=multi-user.target

使用以下命令启动服务,设置开机启动,以及检查服务状态:

# 重载服务
sudo systemctl daemon-reload
# 开机启动
sudo systemctl enable clash
# 启动服务
sudo systemctl start clash
# 查看服务状态
sudo systemctl status clash

后台启动 clash 服务

nohup sudo ~/.clash/clash -d ~/.clash/ > ~/.clash/output.log 2>&1 &

把下面的代码添加到 ~/.zshrc,并 source ~/.zshrc

export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890

查看 clash 状态

cat ~/.clash/output.log

测试连接

curl google.com

LunarVim(可选)#

LunarVim 是一款基于 CLI 的 IDE。

安装 NeoVim

curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
chmod u+x nvim.appimage
./nvim.appimage --appimage-extract
mv squashfs-root ~/.nvim
echo 'export PATH=$PATH:~/.nvim/usr/bin' >> ~/.zshrc
source ~/.zshrc
nvim --version

安装 LunarVim

LV_BRANCH='release-1.3/neovim-0.9' bash <(curl -s https://raw.githubusercontent.com/LunarVim/LunarVim/release-1.3/neovim-0.9/utils/installer/install.sh)
echo 'export PATH=$PATH:~/.local/bin' >> ~/.zshrc
source ~/.zshrc

安装时只选择安装 python 相关依赖。安装完毕后输入 lvim 即可使用。

服务器快速配置速查
https://blog.variantconst.com/posts/server-quick-config/
作者
VariantConst
发布于
2023-10-16
许可协议
CC BY-NC-SA 4.0