1、输入法
① “Language Support” 中将”Language“栏目最底下的“Chinese(China)”拖动到最上方,再点击“Apply System-Wide”,保存退出。
② “setting”中点击“Region & Language”,将Language设置为中文,Input Source添加智能拼音。
2、设置cuda环境变量并安装jtop
2.1 、cuda环境变量
在桌面 的.bashrc文件后添加:
export CUDA_HOME=/usr/local/cuda-10.2
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH
export PATH=/usr/local/cuda-10.2/bin:$PATH
nvcc --version
python --version
nvcc -V
2.2、安装jtop
sudo apt install python3-pip
sudo -H pip3 install -U jetson-stats
sudo jtop
3、VNC ubuntu上网
3、1 英伟达VNC设置官方链接
cd /usr/lib/systemd/user/graphical-session.target.wants
sudo ln -s ../vino-server.service ./.
gsettings set org.gnome.Vino prompt-enabled false
gsettings set org.gnome.Vino require-encryption false
gsettings set org.gnome.Vino authentication-methods "['vnc']"
# 将thepassword改为自己密码
gsettings set org.gnome.Vino vnc-password $(echo -n 'thepassword'|base64)
sudo reboot
参考官方步骤,设置完成后找到setting->sharing 开启桌面共享
3.2 安装clash
先将打开电脑上clash的配置文件,复制到ubuntu主机,将最大的文件(里面有很多节点)重命名为config.yml。
sudo wget https://raw.githubusercontent.com/17870119463/opencv4.5/main/clash-linux-armv7-v1.9.0.gz
sudo gunzip clash-linux-armv7-v1.9.0.gz
sudo chmod +x clash-linux-armv7-v1.9.0
sudo mv clash-linux-armv7-v1.9.0 clash
sudo ./clash -f config.yml
sudo gedit ~/.bashrc
sudo gedit /etc/systemd/system/clash.service
sudo systemctl start clash
sudo wget https://github.com/Dreamacro/clash-dashboard/archive/refs/heads/gh-pages.zip
sudo gunzip gh-pages.zip
sudo mv gh-pages ui
# 编辑config.yml,添加:
# external-ui: /opt/clash/ui
sudo systemctl restart clash
bashrc添加:
alias proxy="export http_proxy=http://127.0.0.1:7890;export https_proxy=http://127.0.0.1:7890;"
alias unproxy="unset http_proxy;unset https_proxy;"
export SOCKS_PROXY="socks5://127.0.0.1:7891"
function enable_socks_proxy() {
export ALL_PROXY=$SOCKS_PROXY
echo "SOCKS start"
}
function disable_socks_proxy() {
unset ALL_PROXY
echo "SOCKS stop"
}
clash.service中添加:
[Unit]
Description=clash-core
[Service]
Type=simple
ExecStart=/opt/clash/clash -f /opt/clash/config.yml
最后将setting->network->proxy IP设置为127.0.0.1,端口查看clash配置,浏览器登陆localhost:9090,或者自己的IP地址:9090。
# 开启终端sock代理 :
enable_socks_proxy
# 关闭终端sock代理:
disable_socks_proxy
# 开启终端http代理:
proxy
# 关闭终端http代理:
unproxy
3.3 设置系统代理,让docker脚本也可以使用代理
sudo nano /etc/environment
添加:注意IP和端口号改为自己的
http_proxy="http://127.0.0.1:7890"
https_proxy="http://127.0.0.1:7890"
source /etc/environment
3.4 安装启动v2raya服务
#安装前将源换回ubuntu官方镜像源,否则无法下载curl
sudo apt install curl
#v2rayA 提供的镜像脚本(推荐)#
curl -Ls https://mirrors.v2raya.org/go.sh | sudo bash
#安装后可以关掉服务,因为 v2rayA 不依赖于该 systemd 服务。
sudo systemctl disable v2ray --now
#手动启动
systemctl restart v2raya.service
#自启动
systemctl enable --now v2raya.service
4、换源
4.1、脚本
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
sudo gedit /etc/apt/sources.list
sudo apt-get update
sudo apt-get -f install
sudo apt-get upgrade
4.2、删除sources.list内容,用下面的替换
# Linux20.04:
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
5、安装ros2
方法一
①确保3.2成功,能访问youtube.com,curl google.com有返回。
②为python3.9安装PyQt5,注意将链接教程的路径替换为自己的路径,python3替换为python3.9,这样才能为python3.9安装PyQt5。arm64 平台PyQt5安装教程
③ros2 humble安装官方指导,中间可能会出现网络问题,多试几次或者切换延迟低的代理能解决。
方法二未成功
英伟达ROS2安装脚本github项目地址
在NVIDIA Jetson 上使用 ROS 2 构建机器人应用程序
切换python
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.9 3
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 2
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 3
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python2.7 1
sudo update-alternatives --config python
sudo update-alternatives --config python3
6、自动赋予串口权限
lsusb
# Bus 001 Device 009: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
# 根据ID 1a86:7523修改文件
sudo nano /etc/udev/rules.d/99-usb-serial.rules
SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", MODE="0666", GROUP="dialout"
sudo udevadm control --reload-rules
# 重新插入USB串口设备,udev规则会自动为/dev/ttyUSB*赋予权限。
7、自动挂载
sudo gedit /etc/fstab
.host:/ /mnt/hgfs fuse.vmhgfs-fuse allow_other 0 0
missing: Python3_LIBRARIES Python3_INCLUDE_DIRS Development
根据报错提示的python版本,将python3.x改为提示的版本后执行指令:
sudo apt install python3.x-dev
错误原因是缺少libpython3.x.so等动态链接库
bug
① Cannot connect to the Docker daemon at unix
先将/etc/docker/daemon.json的最后一行内容删除
sudo gedit /etc/docker/daemon.json
{
"runtimes": {
"nvidia": {
"path": "nvidia-container-runtime",
"runtimeArgs": []
}
},
"default-runtime": "nvidia" #删除这一行
}
sudo systemctl unmask docker
systemctl start docker
systemctl status docker
② 无法下载OpenCV-4.5.0-aarch64.tar.gz
将
wget --quiet --show-progress --progress=bar:force:noscroll --no-check-certificate ${OPENCV_URL} -O ${OPENCV_DEB}
改为:
wget https://raw.githubusercontent.com/17870119463/opencv4.5/main/OpenCV-4.5.0-aarch64.tar.gz
③无法下载pytorch
将:
RUN wget --quiet --show-progress --progress=bar:force:noscroll --no-check-certificate ${PYTORCH_URL} -O ${PYTORCH_WHL} && \
pip3 install --no-cache-dir --verbose ${PYTORCH_WHL} && \
rm ${PYTORCH_WHL}
改为,设置了代理,IP和端口改为自己的
RUN http_proxy=http://127.0.0.1:7890 \
https_proxy=http://127.0.0.1:7890 \
wget --quiet --show-progress --progress=bar:force:noscroll --no-check-certificate ${PYTORCH_URL} -O ${PYTORCH_WHL} && \
pip3 install --no-cache-dir --verbose ${PYTORCH_WHL} && \
rm ${PYTORCH_WHL}
100、常用国内源
阿里
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
## Pre-released source, not recommended.
# deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
中科大
deb https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse
## Pre-released source, not recommended.
# deb https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
清华
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
## Pre-released source, not recommended.
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https:mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse