I've found myself having to setup my Jetson relatively frequently, so I compiled a list of steps I use.
These scripts assume and have an external drive plugged in at /dev/sda with an existing docker cache on partition /dev/sda1. These scripts:
- do not transmit telementary or collect any data
- do not touch your SSH config
- do not adjust partitions on your external drive
- do add the public key you specify to ~/.ssh/authorized_keys
- do edit your /etc/fstabto mount your drive on boot
- do DELETE /var/lib/docker, and edits docker config to point to external drive
I encourage you to read scripts/1-setup-ssh.sh and scripts/2-setup-docker.sh before you run them, or do a dry run first, so you understand exactly what they do!
Dry run
wget -qO- https://raw.githubusercontent.com/jacobhq/jetson-setup/main/scripts/1-setup-ssh.sh | bash -s -- --dry-run
wget -qO- https://raw.githubusercontent.com/jacobhq/jetson-setup/main/scripts/2-setup-docker.sh | bash -s -- --dry-run
wget -qO- https://raw.githubusercontent.com/jacobhq/jetson-setup/main/scripts/3-add-ssh-key.sh | bash -s -- --dry-run
Run the first script in the serial console, making sure to pass in your public key to authorize:
wget -qO- https://raw.githubusercontent.com/jacobhq/jetson-setup/main/scripts/1-setup-ssh.sh | bash -s -- "public_key_string"
Then disconnect from the serial console, and connect via SSH over the network before you run the second script:
wget -qO- https://raw.githubusercontent.com/jacobhq/jetson-setup/main/scripts/2-setup-docker.sh | bash
You can optionally import an existing SSH key with this script, but replace your keys in the below snippet:
wget -qO- https://raw.githubusercontent.com/jacobhq/jetson-setup/main/scripts/3-add-ssh-key.sh | bash -s -- "public_key_string" "private_key_string"
- 
Download and flash Jetson Linux using Balena Etcher1. Use flash from URL button: https://developer.nvidia.com/jetson-nano-sd-card-image
- 
Insert SD card into Jetson module (below heatsink) 
- 
Bridge pin J48 (located between power port and HDMI+DP ports)2. 
- 
Plug in your Jetson using a 5V 4A DC powersupply, and allow to boot. 
- 
Plug the Jetson into your computer via the micro USB, and locate COM port using Device Manager > Ports (COM and LPT). 
- 
Use PuTTY (connection type: serial) to ssh into the COM port you found, with a speed of 115200.
- 
Configure your Jetson in the terminal window 
- 
Before you do anything, you want to unplug yourself, so enable SSH asap: sudo apt update && sudo apt install openssh-server
- 
Use SSH public key authentication, where public_key_stringis your SSH public key, andjacobis your username3:mkdir -p ~/.sshecho public_key_string >> ~/.ssh/authorized_keyschmod -R go= ~/.sshchown -R jacob:jacob ~/.ssh
- 
[Optional] Diable password auth4: sudo nano /etc/ssh/sshd_configChange PasswordAuthenticationfromyestono, and restart SSH.PasswordAuthentication nosudo systemctl restart ssh
- 
Disconnect from serial with Ctrl+Dor thelogoutcommand, and unplug your computer from your Jetson
- 
SSH in over the network, where jetsonis the hostname, andjacobis the username. eg:ssh jacob@jetson.localor, if your username on your jetson is the same as your computer: ssh jetson.local
- 
Now update your Jetson (takes up to 3 hours), and install nice-to-haves (git and python3-pip are needed for jetson-containers): sudo apt upgrade && sudo apt install nano git python3-pip
Congrats, your jetson is ready to use!
SD cards are very slow, use an external SSD instead!
- 
Add yourself to the dockergroup:sudo usermod -aG docker $USER
- 
Plug in an SSD (all data on it will be ereased) 
- 
[Optional] Run lsblkto find your drive if you don't already know it
- 
Assuming no other drives are plugged in, run, where ais your drive:sudo parted /dev/sda
- 
In the resulting shell, erease the disk, remove each partition with rm, where 1 is the partition number: printrm 1quit
- 
Create two partitions (I like to split the disk in half, half for docker, half for models): sudo parted /dev/sdamkpart primary ext4 0GB 120GBmkpart primary ext4 120GB 240GBquit
- 
Now sort out docker: - 
Create docker directory: sudo mkdir -p /mnt/docker
- 
Mount partition5: sudo mount -t ext4 -o defaults /dev/sda1 /mnt/docker
- 
Find out UUID of partition /dev/sda1:sudo blkid -o list
- 
Edit /etc/fstabto mount on boot, wherepart_uuidis the UUID of your partition from step 3:sudo nano /etc/fstabAdd a new line with this: UUID=part_uuid /mnt/docker ext4 defaults 0
- 
Set permissions (docker will change these but whatevs): sudo chown jacob:jacob -R /mnt/docker
- 
Copy the existing Docker cache from /var/lib/dockerto/mnt/docker6:sudo cp -r /var/lib/docker /mnt/docker
- 
Edit /etc/docker/daemon.json:sudo nano /etc/docker/daemon.jsonTo look like this: { "runtimes": { "nvidia": { "path": "nvidia-container-runtime", "runtimeArgs": [] } }, "default-runtime": "nvidia", "data-root": "/mnt/docker" }
- 
Restart docker: sudo systemctl restart docker
- 
Check it worked: sudo docker info | grep 'Docker Root Dir'You should sse Docker Root Dir: /mnt/docker
- 
Delete /var/lib/dockersudo rm -rf /var/lib/docker
 
- 
- 
Over half way there! Now let's sort out the datadirectory used byjetson-containers. [TODO] Rethink steps. (see discussion in dusty-nv/jetson-containers#382). Your Jetson is now setup, and usable.
I worked hard to collate and perfect this process - if it helped you, please consider sponsoring me through GitHub Sponsors! Or, just star the repo to help with my morale!
Footnotes
- 
See NVIDIA's official getting started guide ↩ 
- 
Instructions from NVIDIA's setup in headless mode ↩ 
- 
See DigitalOcean's How to Set Up SSH Keys on Ubuntu 18.04 ↩ 
- 
Again, see DigitalOcean's How to Set Up SSH Keys on Ubuntu 18.04 ↩ 
- 
See Gordon Lesti's Mount ext4 USB flash drive to Raspberry Pi ↩ 
- 
See @dusty-nv's jetson-containers' setup.md↩