记没有sudo的情况下HPC101节点的使用寄巧

简单的说,就是在没有sudo的情况下,一些配置如何退而求其次。

先说一下HPC101给的节点的状况:

  • 没有sudo(很显然)
  • 预装的软件包不多(SadServers都知道装一个asciinema你居然没有)

oh-my-zsh 配置

直接sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" (ref: Oh My Zsh - a delightful & open source framework for Zsh)

会到这个地方卡住:

1
2
3
4
Time to change your default shell to zsh:
Do you want to change your default shell to zsh? [Y/n]
Changing your shell to /usr/bin/zsh...
Password:

很显然我们没有Password,所以这里询问时直接n就行

然后通过写.bashrc的方式实现zsh自动启用

vi ~/.bashrc然后在结尾追加

1
2
3
4
5
6
7
# ========== OH MY ZSH init =========

if [ -t 1 ]; then
exec zsh
fi

# =====end== OH MY ZSH init =========

装一个 asciinema

没有sudo,所以不能apt install asciinema,所幸asciinema官网上就有退而求其次的方案:

1
pipx install asciinema

(ref: Getting started - asciinema docs)

jupyter notebook, over SSH

假定你想要偷集群的算力去学d2l.ai,你按照文档的步骤已经走到了这一步:

At this point, you can open http://localhost:8888 (it may have already opened automatically) in your web browser.

很显然集群上没有web browser,用X11 forwarding来转发则更是幽默,可以用以下手段:

1
ssh -L 8888:localhost:8888 hpc101

意思是说将本地的8888端口和远程的8888端口绑定。

然后就可以在本地浏览器访问jupyter notebook了