远程服务器相关配置

创建子用户

useradd -d /home/ddzzkk -m ddzzkk
usermod -s /bin/bash ddzzkk
passwd ddzzkk
mkdir /home/ddzzkk/.ssh
cp ~/.ssh/authorized_keys /home/ddzzkk/.ssh/
chmod 755 /home/ddzzkk/
chmod 700 /home/ddzzkk/.ssh
chmod 600 /home/ddzzkk/.ssh/authorized_keys 
chown -R ddzzkk:ddzzkk /home/ddzzkk
echo 'ddzzkk ALL=(ALL) ALL' | sudo EDITOR='tee -a' visudo # 把ddzzkk添加到sudo用户里
# 如果passwd用不了,就用chpasswd
echo "user:passwd" sudo chpasswd

安装Homebrew

  • 把以下内容添加到~/.bash_profile
# 不用清华的是因为清华源有的貌似下不了,没有阿里云的好用。
export HOMEBREW_API_DOMAIN="https://mirrors.aliyun.com/homebrew-bottles/api"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.aliyun.com/homebrew/homebrew-bottles"
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.aliyun.com/homebrew/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.aliyun.com/homebrew/homebrew-core.git"
  • 安装Homebrew
# 从清华镜像下载安装脚本并安装 Homebrew / Linuxbrew
git clone --depth=1 https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/install.git brew-install
/bin/bash brew-install/install.sh
rm -rf brew-install
# 或者,直接使用github安装
[/root]$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • 替换Homebrew仓库
export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
brew update
  • 针对linux系统
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
# 注:自 brew 4.0 起,使用默认 prefix (即 "/home/linuxbrew/.linuxbrew") 的大部分 Homebrew 用户无需设置 homebrew/core 镜像,只需设置 HOMEBREW_API_DOMAIN 即可。
# 如果不是默认 prefix 或者需要使用 Homebrew 的开发命令 (如 `brew cat <formula>`),则仍然需要设置 homebrew/core 镜像。
# 请按需执行如下命令:
brew tap --custom-remote --force-auto-update homebrew/core https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
# 除 homebrew/core 仓库外的 tap 仓库仍然需要设置镜像
brew tap --custom-remote --force-auto-update homebrew/command-not-found https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-command-not-found.git
brew tap --custom-remote --force-auto-update homebrew/services https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-services.git
brew update
  • 复原远程仓库
# brew 程序本身,Homebrew / Linuxbrew 相同
unset HOMEBREW_BREW_GIT_REMOTE
git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew
# 以下针对 Linux 系统上的 Linuxbrew
unset HOMEBREW_API_DOMAIN
unset HOMEBREW_CORE_GIT_REMOTE
brew tap --custom-remote homebrew/core https://github.com/Homebrew/homebrew-core
brew tap --custom-remote homebrew/command-not-found https://github.com/Homebrew/homebrew-command-not-found
brew tap --custom-remote homebrew/services https://github.com/Homebrew/homebrew-services
# 重新拉取远程
brew update

安装zsh和oh-my-zsh

# 从brew安装zsh
brew install zsh
# 从github安装oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# 或从oh-my-zsh的网站上安装
sh -c "$(curl -fsSL https://install.ohmyz.sh)"
# 安装之后,调整vscode-server的default profile为zsh
brew install jq
jq '. + {"terminal.integrated.defaultProfile.linux": "zsh"}' ~/.vscode-server/data/Machine/settings.json > temp.json && mv temp.json ~/.vscode-server/data/Machine/settings.json

安装nvim

get the tarball from nvim's release page
then

mv nvim-linux64.tar.gz ~/TOOL/ && cd ~/TOOL
unzip nvim-linux64.tar.gz

Finally add ~/TOOL/nvim-linux64/bin/ to your PATH environment variable.

Install trash-util

sudo apt install trash-util

Its default trash folder will be ~/.local/share/Trash.

posted on 2024-04-30 16:25  火焰龙卷风  阅读(6)  评论(0编辑  收藏  举报

导航