Internet of Tomohiro
If you found my articles interesting or useful, please donate using following links:
2022/9/15: Using a remote desktop or SSH is now disallowed from Colab runtimes
You can also use desktop environment on Google Colaboratory using VNC.
More details of this procedure:
https://github.com/demotomohiro/remocolab/blob/master/README.md
If you have questions:
https://github.com/demotomohiro/remocolab/wiki/Frequently-Asked-Questions
You don't need to buy paid plans. If you don't want to sign up for anything, there is Serveo version in following link. But it is slower than ngrok version.
https://github.com/demotomohiro/Google-Colaboratory-SSH-samples/blob/master/src/ssh_serveo.ipynb
!pip install git+https://github.com/demotomohiro/remocolab.git import remocolab remocolab.setupSSHD()
!pip install git+https://github.com/demotomohiro/remocolab.git import remocolab remocolab.setupVNC()
Select ngrok region
Probably the region closest to you is fastest.
- After setup completed, SSH command to login to the server is displayed. Copy it to your terminal and execute it.
You can run not only python code but also bash commands on Google Colaboratory. These commands are executed as root. You can install any packages with apt or pip. And you can even download any file with wget and run it. So you can easily install openssh and run sshd. It use ngrok so that you can login to the ssh server because you cannot login to it through the internet just by running sshd. But there are large latency because all communication between the server and the client go through the ngrok server.
Install Nim language that is faster and more elegant than python. Execute following command:
$ curl https://nim-lang.org/choosenim/init.sh -sSf | sh
After installing you asked to copy
export PATH=/home/colab/.nimble/bin:$PATH
to ~/.bashrc .
Then you can use Nim. yay!
$ echo "echo \"Hello Nim!\"" > hello.nim $ nim c -r hello.nim
by Tomohiro