前言
最近因为项目需要,每次更新代码都要重新烧录系统,每次初始化都要打开好几个网页来复制命令实在太烦人了,所以将代码整合起来记录一下。
目录
1、JetsonNano 风扇自启动
2、JetsonNano 换源
3、JetsonNano 安装 VNC
4、JetsonNano 安装测试DeepStream
5、JetsonNano 安装Pytorch
6、JetsonNano 安装 torchvision
7、JetsonNano pip换源
8、JetsonNane 安装Ros
9、JetsonNano 安装 jetson-stats 状态查看器
内容
1、JetsonNano风扇自启动
cd /etc
sudo touch rc.local
sudo vim rc.local
#!/bin/bash
sleep 10
sudo /usr/bin/jetson_clocks
sudo sh -c 'echo 255 > /sys/devices/pwm-fan/target_pwm'
sudo chmod 755 /etc/rc.local
sudo reboot
2、JetsonNano换源
# 为防止误操作后无法恢复,先备份原文件sources.list
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
# 新建新的源文件source.list
sudo vim /etc/apt/sources.list
# 删掉原来的,粘贴下面的
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main multiverse restricted universe
sudo apt-get update
sudo apt-get upgrade
3、JetsonNano 安装 VNC
(之前有一段时间出现VNC内核与Jetsonnano不符的情况,不确定还能不能用)
sudo apt install vino
sudo ln -s ../vino-server.service /usr/lib/systemd/user/graphical-session.target.wants
gsettings set org.gnome.Vino prompt-enabled false
gsettings set org.gnome.Vino require-encryption false
sudo vim /usr/share/glib-2.0/schemas/org.gnome.Vino.gschema.xml
# 文件最后添加
<key name='enabled' type='b'>
<summary>Enable remote access to the desktop</summary>
<description>
If true, allows remote access to the desktop via the RFB
protocol. Users on remote machines may then connect to the
desktop using a VNC viewer.
</description>
<default>false</default>
</key>
sudo glib-compile-schemas /usr/share/glib-2.0/schemas
gsettings set org.gnome.Vino authentication-methods "['vnc']"
gsettings set org.gnome.Vino vnc-password $(echo -n '你自己的密码'|base64)
sudo reboot
gsettings set org.gnome.Vino enabled true
mkdir -p ~/.config/autostart
vim ~/.config/autostart/vino-server.desktop
[Desktop Entry]
Type=Application
Name=Vino VNC server
Exec=/usr/lib/vino/vino-server
NoDisplay=true
4、JetsonNano 安装测试DeepStream
sudo apt install \
libssl1.0.0 \
libgstreamer1.0-0 \
gstreamer1.0-tools \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly \
gstreamer1.0-libav \
libgstrtspserver-1.0-0 \
libjansson4=2.11-1
去官网下载deepstream,百度直接搜就行,下载好后文件名为:deepstream_sdk_v5.1.0_jetson.tbz2
下载5.1版本的DeepStream需要登陆一下
sudo tar -xvf deepstream_sdk_v5.1.0_jetson.tbz2 -C /
cd /opt/nvidia/deepstream/deepstream-5.1
sudo ./install.sh
sudo ldconfig
测试
cd /opt/nvidia/deepstream/deepstream-5.1/sources/objectDetector_Yolo
sudo CUDA_VER=10.2 make -C nvdsinfer_custom_impl_Yolo
./prebuild.sh
deepstream-app -c deepstream_app_config_yoloV3_tiny.txt
5、JetsonNano 安装Pytorch
提前下好 torch-1.8.0-cp36-cp36m-linux_aarch64.whl
sudo apt-get install python3-pip libopenblas-base libopenmpi-dev
pip3 install Cython
pip3 install numpy torch-1.8.0-cp36-cp36m-linux_aarch64.whl
6、JetsonNano 安装 torchvision
编译的时间可能有点长,耐心等待即可
sudo apt-get install libjpeg-dev zlib1g-dev libpython3-dev libavcodec-dev libavformat-dev libswscale-dev
git clone --branch v0.9.0 https://github.com/pytorch/vision torchvision
cd torchvision
export BUILD_VERSION=0.9.0
python3 setup.py install --user
pip3 install pillow
7、JetsonNano pip换源
mkdir ~/.pip
vim ~/.pip/pip.conf
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = https://pypi.tuna.tsinghua.edu.cn
8、JetsonNane 安装Ros
这一步走了很多弯路,主要原因是ros初始化:
sudo rosdep init
rosdep update
这两句报错。但是实际上我们在
sudo apt install ros-melodic-desktop-full
之后所有东西都已经是最新的了,因此没有必要再更新一遍(2021/07/13记录)
sudo sh -c echo deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main /etc/apt/sources.list.d/ros-latest.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt update
sudo apt install ros-melodic-desktop-full
echo source /opt/ros/melodic/setup.bash ~/.bashrc
source ~/.bashrc
sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential
创建工作空间
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace
编译工作空间
cd ~/catkin_ws/
catkin_make
设置环境变量
source devel/setup.bash
检查环境变量
echo $ROS_PACKAGE_PATH
9、JetsonNano 安装 jetson-stats 状态查看器
sudo -H pip3 install jetson-stats
sudo -H pip3 install -U jetson-states
查看硬件CPU、RAM、GPU的状态等
sudo jtop
查看 JetsonNano型号
jetson-releas