Last active
October 16, 2024 03:33
-
-
Save CooperHash/0bddeb1b9843331d7bbef90eb35e04bc to your computer and use it in GitHub Desktop.
setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 替换Ubuntu源为清华镜像 | |
echo "替换Ubuntu源为清华镜像..." | |
sudo tee /etc/apt/sources.list <<EOF | |
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main non-free contrib | |
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main non-free contrib | |
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main | |
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main | |
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main non-free contrib | |
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main non-free contrib | |
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main non-free contrib | |
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main non-free contrib | |
EOF | |
# 更新apt源 | |
echo "更新apt源..." | |
sudo apt update | |
# 安装Node.js和npm | |
echo "安装Node.js和npm..." | |
sudo apt install -y nodejs npm | |
# 检查Node.js和npm是否安装成功 | |
echo "检查Node.js和npm版本..." | |
node -v | |
npm -v | |
# 更换npm为国内源 | |
echo "更换npm为国内源..." | |
npm config set registry https://registry.npmmirror.com | |
# 全局安装pnpm | |
echo "全局安装pnpm..." | |
npm install -g pnpm | |
# 验证pnpm安装 | |
echo "检查pnpm版本..." | |
pnpm -v | |
echo "安装完成!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment