镜像下载地址
1、基础设置 1.1、使用sudo免密码1.打开终端,输入命令:
sudo visudo
2.在文档最后一行添加如下内容:
xxx ALL=(ALL) NOPASSWD:ALL jetson ALL=(ALL) NOPASSWD:ALL 保存退出即可,其中XXX为登入用户名1.2、终端输出IP地址
打开.bashrc文件
sudo vim .bashrc
最后面添加以下内容
alias python=python3 ip=$(ip addr show eth0 | grep -o 'inet [0-9]+.[0-9]+.[0-9]+.[0-9]+' | grep -o [0-9].*) if [ -z $ip ]; then ip=$(ip addr show wlan0 | grep -o 'inet [0-9]+.[0-9]+.[0-9]+.[0-9]+' | grep -o [0-9].*) fi if [ -z $ip ]; then ip=$(ip addr show lo | grep -o 'inet [0-9]+.[0-9]+.[0-9]+.[0-9]+' | grep -o [0-9].*) fi export ROS_IP=$ip export ROS_MASTER_URI=http://$ROS_IP:11311 echo "-----------------------" echo -e "MY_IP: 33[32m$ROS_IP 33[0m" echo -e "ROS_MASTER_URI: " echo -e " 33[32m$ROS_MASTER_URI 33[0m" echo "-----------------------"1.3、system program problem detected
如何解决Ubuntu下的的“system program problem detected”
删除crash文件
sudo rm /var/crash/*
关闭pop up功能
sudo gedit /etc/default/apport sudo vim /etc/default/apport
将其中的enable=1改为enable=0即可
2、移除无用软件移除LibreOffice会为系统省很多空间,这个软件对做深度学习和计算机视觉算法也没有太多用
sudo apt-get --purge remove docker* libopencv* libreoffice* thunderbird totem rhythmbox empathy brasero simple-scan gnome-mahjongg aisleriot gnome-mines cheese transmission-common gnome-orca webbrowser-app gnome-sudoku
清除
sudo rm -rf /etc/systemd/system/docker.service.d /var/lib/docker /var/run/docker sudo ifconfig docker0 down sudo brctl delbr docker0 sudo apt-get clean sudo apt-get update sudo apt-get upgrade sudo apt autoremove
这样系统就基本上干净了。
- 卸载火狐firefox浏览器
查看火狐浏览器相关内容
dpkg --get-selections |grep firefox
卸载上述指令中的所有文件
sudo apt-get purge firefox unity-scope-firefoxbookmarks
执行结果如下,便成功卸载火狐浏览器。
3、更换国内源清华源链接
sudo gedit /etc/apt/sources.list sudo vim /etc/apt/sources.list sudo vi /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
中科大的镜像源
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-updates main restricted deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic universe deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-updates universe deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic multiverse deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-updates multiverse deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security main restricted deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security universe deb http://mirrors.ustc.edu.cn/ubuntu-ports/ bionic-security multiverse
到sources.list后保存,之后打开终端输入
sudo apt-get update sudo apt-get upgrade4、安装必要软件
安装vim、terminator、fast、pip、rar、zip、nmap等。
添加软件源和秘钥
sudo apt-add-repository ppa:apt-fast/stable
安装
sudo apt install vim terminator libopencv* net-tools python-pip nano python3-pip ffmpeg v4l2loopback-dkms unar rarunrar p7zip* apt-fast nmap tree
卸载pip的方法
python -m pip uninstall pip python3 -m pip uninstall pip
升级 pip
python2 -m pip install -U pip python3 -m pip install -U pip
- pip永久加速
创建 ~/.pip/pip.conf配置文件,
mkdir ~/.pip vim ~/.pip/pip.conf
内容如下:
[global] timeout = 6000 index-url = https://pypi.tuna.tsinghua.edu.cn/simple [install] trusted-host = https://pypi.tuna.tsinghua.edu.cn5、安装jupyter lab
1、添加依赖
sudo apt install nodejs libssl1.0-dev nodejs-dev node-gyp npm libffi-dev
2、安装jupyter/jupyterlab
pip3 install jupyter jupyterlab
3、生成相应配置文件
jupyter server --generate-config
4、设置密码(这里会设置两次,第二次为确认输入的密码)
jupyter server password
5、修改配置文件
首先输入ipython生成秘钥
ipython from notebook.auth import passwd passwd()
打开配置文件
sudo vim ~/.jupyter/jupyter_server_config.py
找到下面的三句语句,修改成相应的变化
#c.ServerApp.ip = 'localhost' #c.ServerApp.open_browser = True #c.ServerApp.port = 8888 #c.ServerApp.notebook_dir = ‘’
修改为
# 允许远程访问 c.ServerApp.allow_remote_access = True #82行 c.ServerApp.ip='0.0.0.0' #194行 c.ServerApp.open_browser = False #255行 c.ServerApp.password = u'argon2:$argon2id$v=19$m=10240,t=10,p=8$RMkLlF34taue89xXnsmP4w$fhJAmY0eVS989lGeUJJsEw' #264行 c.ServerApp.port =8888 #275行
6、开启服务
jupyter lab --port 8080 --ip=0.0.0.0
7、设置开机启动Jupyter lab
方法一:
创建jupyterlab.service文件
sudo vim /etc/systemd/system/jupyterlab.service
删除命令
sudo rm /etc/systemd/system/jupyterlab.service
加入以下内容
------------------------------------- jupyterlab -------------------------------------- [Unit] Description=jupyter lab start service After=multi-user.target [Service] Type=idle User=ubuntu ExecStart=/bin/sh -c "jupyter lab" WorkingDirectory=/home/jetson [Install] WantedBy=multi-user.target [Unit] Description=jupyter lab start service After=multi-user.target
更新|启动
sudo systemctl daemon-reload sudo systemctl start jupyterlab.service sudo systemctl enable jupyterlab.service sudo systemctl status jupyterlab.service
方法二:
sudo vim ~/.config/autostart/jupyterlab.desktop
添加
[Desktop Entry] Type=Application Name=jupyter lab server Exec=jupyter lab NoDisplay=true
方法三:
- 首先创建一个jupyterlab.sh
sudo vim ~/jupyterlab.sh
- 添加如下内容
export PATH="$PATH:~/.local/bin/" jupyter lab
- 修改/etc/rc.local,在 exit 0 之前 添加
sudo vim /etc/rc.local su pi -c 'bash ~/jupyterlab.sh'
例如如下:
#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. # Print the IP address _IP=$(hostname -I) || true if [ "$_IP" ]; then printf "My IP address is %sn" "$_IP" fi # Start Jupyter Notebook Server at boot su pi -c 'bash /home/pi/lingshunlabboot.sh’ exit 0
sudo apt-get install libopencv* libzbar-dev python-sklearn python-scikits-learn python3-scipy python-scipy python3 -m pip install qrcode pyzbar scikit-image python3 -m pip install --upgrade --force pip numpy==1.19.3 protobuf python3 -m pip install opencv-python==3.4.13.47 opencv-contrib-python==3.4.13.47 python2 -m pip install opencv-python==3.4.13.47 opencv-contrib-python==3.4.13.47 python3 -m pip uninstall opencv-python opencv-contrib-python numpy protobuf6、安装VNC
树莓派和jetson nano的VNC远程桌面配置流程完全一样,只需按以下步骤依次执行即可。
6.1、安装vinosudo apt install vino6.2、配置VNC 服务
(此时手动可打开vnc server)
sudo ln -s ../vino-server.service /usr/lib/systemd/user/graphical-session.target.wants
配置VNC server:
gsettings set org.gnome.Vino prompt-enabled false gsettings set org.gnome.Vino require-encryption false
编辑org.gnome,恢复丢失的“enabled”参数,输入一下命令进入文件,将下方key内容添加到文件的最后面。保存并退出。
sudo vim /usr/share/glib-2.0/schemas/org.gnome.Vino.gschema.xml
格式要对齐
Enable remote access to the desktop 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 false
设置为Gnome编译模式
sudo glib-compile-schemas /usr/share/glib-2.0/schemas
将网卡加入VINO服务 ; 执行,查看网卡UUID
nmcli connection show
将UUID拷贝粘贴到如下命令的单引号[‘ ’]之间,并执行
dconf write /org/gnome/settings-daemon/plugins/sharing/vino-server/enabled-connections "['e27c8ddd-b660-4e0b-a70d-78a39fd5c9c3 ']" export DISPLAY=:06.4、设置VNC登陆密码
(此处密码设置为‘yahboom’)
gsettings set org.gnome.Vino authentication-methods "['vnc']" gsettings set org.gnome.Vino vnc-password $(echo -n 'yahboom'|base64)6.5、启动VNC Server
- 手动启动
/usr/lib/vino/vino-server
- 开机自启动
VNC服务器只有在您本地登录到Jetson之后才可用。如果您希望VNC自动可用,请使用系统设置应用程序来启用自动登录。
gsettings set org.gnome.Vino enabled true mkdir -p ~/.config/autostart sudo vim ~/.config/autostart/vino-server.desktop
将下面的内容添加到该文件中,保存并退出。
[Desktop Entry] Type=Application Name=Vino VNC server Exec=/usr/lib/vino/vino-server NoDisplay=true
如果系统设置为需要输入用户密码才可以进入桌面,以上的改脚本需要等进入桌面后才会启动,建议将系统设置为用户自动登录到桌面。
- 关闭
ps -ef | grep vino
得到以下信息
jetbot 7096 1 0 13:39 pts/0 00:00:00 /usr/lib/vino/vino-server jetbot 10082 6770 0 13:48 pts/0 00:00:00 grep --color=auto vino
kill掉当前vnc服务程序运行的编号7096:
kill 7096
- 重启测试
验证是否设置vnc 成功
sudo reboot
使用vnc viewer软件远程连接,,输入IP地址后点击键盘【Enter】,双击对应的VNC用户输入密码,选中记住密码,下次IP不变的情况下无需再次输入密码。最后进入到VNC界面。
6.6、调整分辨率- Jetson nano
命令行调整,只是在本次启动中有效。
xrandr --fb 1920x1080 xrandr --fb 800x600 xrandr --fb 1024x600 xrandr --fb 1900x1000
设置开机启动,点击右上角,搜索中找到启动应用程序
打开启动应用程序后,点击添加;添加名称,命令以及注释
在这里我们输入分辨率的修改指令,其中1920x1080是分辨率,可根据自己的需求进行改变
xrandr --fb 1920x1080
开机重启即可。
- 树莓派
修改config.txt文件,永久有效
sudo vim /boot/firmware/config.txt
例如在最下面添加(设置分辨率为1920x1080)
--------------------1920x1080----------------------- hdmi_force_hotplug=1 config_hdmi_boost=4 hdmi_group=2 hdmi_mode=82 hdmi_drive=2 hdmi_ignore_edid=0xa5000080 disable_overscan=1 --------------------1024x600----------------------- max_usb_current=1 hdmi_group=2 hdmi_mode=1 hdmi_mode=87 hdmi_drive=1 hdmi_cvt 1024 600 60 6 0 0 0
参考链接
7、中文输入法安装 7.1、pinyinsudo apt-get install ibus-pinyin
然后打开系统设置选择language support,选择ibus,点击应用到整个系统,重启系统后,输入
ibus-setup
输入法界面点击添加汉语,intelligent Pinyin,完成后输入
ibus restart7.2、googlepinyin
sudo apt-get install fcitx-googlepinyin fcitx-module-cloudpinyin fcitx-sunpinyin -y 或者 sudo apt-get install fcitx-googlepinyin -y
安装完成后,在ubuntu右上角的系统设置里面点击 语言支持,选择fcitx,系统初始默认为ibus;在终端输入 reboot
配置 fcitx:
点击右上方小键盘,左键单击 配置 fcitx
切换输入法时:按 shift 或者 ctrl+ space
查看cuda版本
ll /usr/local/cuda
打开.bashrc
sudo vim ~/.bashrc
在最后添加
export PATH=/usr/local/cuda-10.2/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export CUDA_ROOT=/usr/local/cuda
激活
source ~/.bashrc
查看cuda版本
nvcc -V9、配置jtop实现nvidia-smi教程
jetson nano 是arm架构的,实现nvidia-smi查看GPU占用情况可以安装jtop!!!
安装
sudo pip3 install jetson-stats
查看使用情况
sudo jtop
开启服务
sudo systemctl restart jetson_stats.service
关闭服务
sudo systemctl disable jetson_stats.service
存在路径
cd /etc/systemd/system/ 或者 cd /usr/lib/systemd
查看服务列表
systemctl list-sockets10、显示管理器
gdm3,kdm 和 lightdm 都是显示管理器。 它们提供图形化登录并处理用户身份验证。显示管理器向用户显示登录屏幕。 当用户成功输入用户名和密码的有效组合时,会话开始。
KDM,SDDM是KDE系列的图形管理器;kdm 是kde管理器的显示。 但在KDE5中,它被否决为 SDDM,它更适合作为显示管理器,因此在默认情况下,它是在屏幕。
LightDM用于显示管理器的规范解决方案。 它应该是轻量级的,默认情况下是 Ubuntu。Xubuntu和 Lubuntu。 它是可以配置的,有多种欢迎主题可用。
sudo apt-get install gdm3 lightdm sddm
卸载命令,系统中至少存在一个显示管理器,否则无法进入图形化界面。
sudo apt-get --purge remove gdm3 lightdm sddm
配置和切换,可在它们之间进行选择。 必须重新启动才生效。
sudo dpkg-reconfigure gdm3
检查当前正在使用的显示管理器
cat /etc/X11/default-display-manager
查看当前系统安装了几个桌面
ls /usr/share/xsessions11、问题收集 11.1、错误 apt
Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
- 找到并且杀掉所有的apt-get 和apt进程
ps -A | grep apt
找出所有的 apt 以及 apt-get 进程
sudo kill -9 进程ID
- 删除锁定文件
sudo rm -r /var/lib/dpkg/lock-frontend /var/lib/dpkg/lock11.2、添加串口到用户名
sudo adduser jetson tty sudo adduser xtark tty sudo gpasswd --add jetson dialout
linux下/dev/ttyUSB*添加权限
sudo usermod -aG dialout $USER12、乱码问题 12.1、vim乱码
修改.vimrc文件
sudo gedit .vimrc sudo vim .vimrc
添加下面一行代码
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin112.2、gedit乱码
gsettings set org.gnome.gedit.preferences.encodings candidate-encodings "['GB18030', 'UTF-8', 'CURRENT', 'ISO-8859-15', 'UTF-16']"
参考:https://www.linuxidc.com/Linux/2012-07/65713.htm
12.3、zip解压乱码修改环境变量
sudo vim /etc/environment
最下面添加
UNZIP="-O CP936" ZIPINFO="-O CP936"
命令lsar查看压缩文件内文件名
lsar 智能.zip
命令unar解压
unar 智能.zip
命令unzip解压
unzip -O CP936 xxx.zip (用GBK, GB18030也可以)12.4、系统中文乱码
首先,安装中文支持包language-pack-zh-hans:
sudo apt-get install language-pack-zh-hans
然后,修改
sudo gedit /etc/environment
在末尾追加
LANG="zh_CN.UTF-8" LANGUAGE="zh_CN:zh:en_US:en"
再修改
sudo gedit /var/lib/locales/supported.d/local
在末尾追加
en_US.UTF-8 UTF-8 zh_CN.UTF-8 UTF-8 zh_CN.GBK GBK zh_CN GB2312
最后,执行命令:
sudo locale-gen



