JetsonNano に Hello AI world などをインストールする

JetsonNano に Hello AI world などをインストールします。

hello ai world で opencv とか勝手に入るらしいんだけど実際どうなんだろう
そのうち検証します。

````bash:jet.sh
#!/bin/bash

# bash jet.sh ;

#-----------------------------------------------------------------------------------------------------------------------
# home dir name jp 2 english
#-----------------------------------------------------------------------------------------------------------------------
LANG=C xdg-user-dirs-gtk-update ;

#-----------------------------------------------------------------------------------------------------------------------
# setting
#-----------------------------------------------------------------------------------------------------------------------
gsettings set org.gnome.desktop.interface enable-animations false ;
gsettings set org.gnome.desktop.session idle-delay 0 ;
gsettings set org.gnome.settings-daemon.plugins.power idle-dim false ;
gsettings set org.gnome.shell.extensions.dash-to-dock dash-max-icon-size 30 ;

#-----------------------------------------------------------------------------------------------------------------------
# wall paper
#-----------------------------------------------------------------------------------------------------------------------
# wget http://hogehoge.com/1.jpg -O /home/$USERNAME/Pictures/1.jpg ;
# gsettings set org.gnome.desktop.background picture-uri "file:///home/$USERNAME/Pictures/1.jpg" ;

#-----------------------------------------------------------------------------------------------------------------------
# init update
#-----------------------------------------------------------------------------------------------------------------------
sudo apt update ;
sudo apt upgrade -y ;

#-----------------------------------------------------------------------------------------------------------------------
# jtop ( gpu top )
#-----------------------------------------------------------------------------------------------------------------------
sudo apt-get install python-pip ;
sudo -H pip install -U jetson-stats ;
sudo systemctl enable jetson_stats.service

#-----------------------------------------------------------------------------------------------------------------------
# software
#-----------------------------------------------------------------------------------------------------------------------
sudo apt install -y emacs-nox htop curl git axel samba openssh-server net-tools exfat-fuse exfat-utils ffmpeg ibus-mozc imagemagick lame ;

#-----------------------------------------------------------------------------------------------------------------------
# youtube-dl
#-----------------------------------------------------------------------------------------------------------------------
sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl ;
sudo chmod a+rx /usr/local/bin/youtube-dl ;

#-----------------------------------------------------------------------------------------------------------------------
# caps2ctrl
#-----------------------------------------------------------------------------------------------------------------------
HOGE=$(cat<<TEXT
BACKSPACE="guess"
XKBMODEL="pc105"
XKBLAYOUT="jp"
XKBVARIANT=""
XKBOPTIONS="ctrl:nocaps"
TEXT
)
sudo echo "$HOGE" | sudo tee /etc/default/keyboard
MOGE=$(cat<<TEXT
<component>
  <version>2.23.2815.102+dfsg-8ubuntu1</version>
  <name>com.google.IBus.Mozc</name>
  <license>New BSD</license>
  <exec>/usr/lib/ibus-mozc/ibus-engine-mozc --ibus</exec>
  <textdomain>ibus-mozc</textdomain>
  <author>Google Inc.</author>
  <homepage>https://github.com/google/mozc</homepage>
  <description>Mozc Component</description>
<engines>
<engine>
  <description>Mozc (Japanese Input Method)</description>
  <language>ja</language>
  <symbol>&#x3042;</symbol>
  <rank>80</rank>
  <icon_prop_key>InputMode</icon_prop_key>
  <icon>/usr/share/ibus-mozc/product_icon.png</icon>
  <setup>/usr/lib/mozc/mozc_tool --mode=config_dialog</setup>
  <layout>jp</layout>
  <name>mozc-jp</name>
  <longname>Mozc</longname>
</engine>
</engines>
</component>
TEXT
)
sudo echo "$MOGE" | sudo tee /usr/share/ibus/component/mozc.xml ;

#-----------------------------------------------------------------------------------------------------------------------
# setting jp
#-----------------------------------------------------------------------------------------------------------------------
sudo update-locale LANG=ja_JP.UTF8 ;
sudo apt install -y manpages-ja manpages-ja-dev ;
sudo update-locale LANG=ja_JP.UTF8 ;
sudo ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime ;
sudo mkdir /usr/share/locale-langpack/ja ;
sudo apt install -y ibus-mozc language-pack-gnome-ja language-pack-gnome-ja-base language-pack-ja language-pack-ja-base fonts-takao-gothic fonts-takao-mincho $(check-language-support) ;

#-----------------------------------------------------------------------------------------------------------------------
# create 8GB swap
#-----------------------------------------------------------------------------------------------------------------------
cd ;
git clone https://github.com/JetsonHacksNano/installSwapfile ;
cd installSwapfile ;
./installSwapfile.sh ;

#-----------------------------------------------------------------------------------------------------------------------
# vscode
#-----------------------------------------------------------------------------------------------------------------------
cd ;
wget -O insider.deb https://update.code.visualstudio.com/latest/linux-deb-arm64/insider ;
sudo apt install -y ./insider.deb ;
sudo mv /usr/bin/code-insiders /usr/bin/code ;

#-----------------------------------------------------------------------------------------------------------------------
# ai world
#-----------------------------------------------------------------------------------------------------------------------
sudo apt install -y git cmake libpython3-dev python3-numpy ;
cd ;
git clone --recursive https://github.com/dusty-nv/jetson-inference ;
cd jetson-inference ;
mkdir build ;
cd build ;
cmake ../ ;
make -j$(nproc) ;
sudo make install ;
sudo ldconfig ;

#-----------------------------------------------------------------------------------------------------------------------
# reboot
#-----------------------------------------------------------------------------------------------------------------------
sudo apt autoremove -y ;
sudo reboot now ;
````