服务器搭建
本人记忆着实一般,这几天新得了几台服务器的权限,要记录下来,怎么开坑,方便自己遇到此类问题。寻来方便。。
毕竟,前一天刚开一个服务器;第二天就忘了具体咋操作了
本人是做deep learning的,故本文仅仅适合DL的同学来看,其余不是很确定???
在/home/mazipei/目录下,下载miniconda/anaconda(看个人喜好,mini够用)
- 下载 Miniconda (Python3 version)
1
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
- 安装
1
bash Miniconda3-latest-Linux-x86_64.sh
- 随后一直按回车,所有都yes
安装好后,source ~/.bashrc
设置清华源
1
2python -m pip install --upgrade pip
pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple找一个github repo下一个你要用的 conda 环境,我目前在做 4d edit,找了 Instruct4D-to-4D
- 创建一个环境:
conda create -n instruct4d python=3.8
- 查看当前服务器装了什么版本的cuda,(一般师兄都会帮你装好)
cat /usr/local/cuda/version.json
ls /usr/local/ | grep cuda
- previous torch version
- 安装torch:
pip install torch==2.0.1+cu118 torchvision==0.15.2+cu118 --index-url https://download.pytorch.org/whl/cu118
- 安装当前repo需要的其他库:
pip install -r requirements.txt
- 创建一个环境:
注:
ssh connection timed out 可参考:https://stackoverflow.com/questions/59978826/why-ssh-connection-timed-out-in-vscode
2024年10月16日更:
由于zz原因,国内连接github是个运气问题,而服务器上没🪜。我本人又对github commit有种蜜汁强迫,经常git push要等好久。。。
最近发现有github镜像网站(两个都可以,但是连接时得关掉本地电脑的🪜):1. https://bgithub.xyz 2. https://ggithub.xyz
我这里以 bgithub.xyz 为例,讲解如何 git push:
- git clone :
git clone https://bgithub.xyz/<User Name>/<Repo Name>.git
- 根据这篇博客,生成token并set-url,https://www.cnblogs.com/oldweipro/p/16612197.html
- 但是注意,博客中的 set-url:
git remote set-url origin https://<your_token>@github.com/<USERNAME>/<REPO>.git
,由于是镜像,需要把github.com
更改为bgithub.xyz
- 但是注意,博客中的 set-url:
- git push:
git push origin main
2024年10月19日更:
HuggingFace 镜像下载:https://github.com/LetheSec/HuggingFace-Download-Accelerator
2024年10月29日更:
home目录空间不够,转到/data下载
1 | mkdir -p /data/duantong/conda_pkgs |
1 | conda create --prefix /data/duantong/conda_envs/4DG python=3.8 |
之后就是正常的pip安装
2025年01月21日更:
发现了一个可以全局替换 github.com
为 bgithub.xyz
的方法,
编辑 ~/.gitconfig
:
1 | vim ~/.gitconfig |
添加以下内容:
1 | [url "https://bgithub.xyz/"] |
你可以测试链接是否替换成功,例如克隆一个仓库:
1 | git clone https://github.com/user/repo.git |
实际会被替换为:
1 | git clone https://bgithub.xyz/user/repo.git |
有一点小问题的是,我们用SSH Key的方法来push时需要注释掉上面这段
2025年02月11日更:
拿到了内网的另一台服务器,copy 密钥
在原服务器 *.*.*.12
上执行:
1 | ssh-copy-id 用户名@*.*.*.13 |
就可以直接用密钥登陆新服务器 *.*.*.13
拷贝文件/目录(-r option):
1 | scp -r 本地目录 用户名@远程IP:/目标路径/ |
选择多个目录:
1 | scp -r {017,145,147,158} mazipei@*.*.*.13:/HDD_DISK/datasets/waymo_scenes |
排除目录传文件:
1 | rsync -avz --exclude "eval_output" --exclude "dataset" /HDD_DISK/users/mazipei/*** mazipei@*.*.*.*:/HDD_DISK/users/mazipei |
2025年02月21日更:
git clone 时,git@github.com's password:
注:SSH似乎不行?我换成了HTTPS (git@github.com -> https://github.com)
- 生成 SSH 密钥
1
ssh-keygen -t ed25519 -C "example@mail"
- 添加 SSH 公钥 到
github.com
复制这串 SSH 公钥(完整的 ssh-ed25519 AAAAC3…)。1
cat ~/.ssh/id_ed25519.pub
打开 github
Settings->SSH Keys,添加 SSH Key
- Title: 随便填
- Key:粘贴刚刚的 公钥
- 测试 SSH 连接username 是 github username
1
ssh username@github.com
- 可以克隆了
1
git clone https:@github.com:hyzhou404/hugs.git --recursive