【Ubuntu 1】ubuntu的軟件包及便攜系列 記錄


這個系列最開始是19年9月份自己第一次使用ROS 也是第一次使用ubuntu寫的,很多都是前人用過的 然后幫我調試的過程中告訴我的,感覺所有的存在在這里的都是我不止一遍 用過的;十分OK,希望這個筆記能幫助到不少人 更便捷的使用Ubuntu ;
更新:大哥們跟我說:當你不知道一條命令的含義的時候最好不用運行 所以在此篇中 我寫下的每條帶sudo的命令行我都進行了注釋 共同學習【當然有不對的地方希望能指出】
如果也有想分享的 可以留言 讓更多人知道~,此版本同步CSDN的博客,由於CSDN最近的... 廣告有點太多了 所以開始一步步把之前的博文轉過來
CHANGELOG:
2021/10/31

  1. 添加新的微信和qq 安裝方式
    2021/4/25
  2. flameshot截圖軟件的加入
  3. 修改錯誤的字母

命令行補充【備注記錄】

1. ROSCORE WARNING
WARNING: disk usage in log directory [/home/mohammad/.ros/log] is over 1GB. It's recommended that you use the 'rosclean' command.

rosclean purge

==2.ROS小插件 ==

2.1 imu姿態漂移校准

sudo apt install ros-kinetic-rviz-imu-plugin
sudo apt install ros-melodic-rviz-imu-plugin

2.2 查看plotjuggler數據圖形

sudo apt-get install ros-kinetic-plotjuggler 
sudo apt install ros-melodic-plotjuggler 

運行成功看一下:

rosrun plotjuggler PlotJuggler

3. 刪除文件夾 ubuntu【慎用 在你不知道你刪掉的是什么東西的情況下 請不要用】

sudo rm -rf 文件夾名

4. 單獨編譯一個包

  1. catkin_make -DCATKIN_WHITELIST_PACKAGES=
  2. 【這個情況下會保存只編譯此包的指令 如果要返回全局的命令是?】
    在https://answers.ros.org/question/54178/how-to-build-just-one-package-using-catkin_make/ 這個鏈接中,大神提供了另外的幾種單獨編譯某個包的方法:
    1.使用 --only-pkg-with-deps
catkin_make --only-pkg-with-deps <target_package>

5.刪除二進制包

  1. 首先卸載包
sudo apt-get purge ros-kinetic-**
sudo apt-get purge ros-melodic-**
  1. 然后卸載依賴包
sudo apt-get autoremove

6.查詢空間
linux -- 查看磁盤空間的大小
命令格式: df -hl
顯示格式為:
  文件系統 容量 已用 可用 已用% 掛載點
Filesystem Size Used Avail Use% Mounted on
/dev/hda2 45G 19G 24G 44% / /dev/hda1 494

8.Ubuntu查看系統任務管理器(cpu+內存資源占用)
在終端輸入:gnome-system-monitor
打開ubuntu下的任務管理器,啟動桌面管理,顯示系統cpu,內存占用情況,如圖所示
在這里插入圖片描述
9.查看電腦配置——linux系

  1. uname -a 查看內核版本與系統
  2. cat /proc/version查看內核版本號、編譯器版本號、Ubuntu版本號
  3. cat /proc/cpuinfo 查看cpu信息
  4. free -m 查看運行內存量

10.復制命令行
-v的含義:Cp command can explain what is being done with -v option:

cp  -v foo.txt bar.doc resume.pdf /media/backup/

此句的含義:將 foo.txt bar.doc resume.pdf 文件復制到/media/bakcup文件夾下,並且輸出狀態信息(就是復制到哪一步了


-r的含義:Pass the -r (recursive) option to cp command.

cp -r ~/Documents/ /media/usbpen/

此句的含義:將整個Documents文件夾復制到/media/usbpen文件夾下

11.解壓命令行
As of the options,
c – Telling “tar” tool to create an archive
z – Use “gunzip” compression. That’s why the file extension – GZ.
v – Verbose mode. Tar will log each of its activity into the screen.
f – Allows you specifying a file name for the output file.
x – Tells “tar” to extract an archive

tar -xzvf test.tar.gz -C ~/Desktop/testDir1/

12.解鎖文件夾
主要是HDD 機械硬盤裝上去的時候,他總是需要sudo權限,所幸直接解鎖掉好了

sudo chmod -R 777 *

777是可讀可寫,-R是整個文件夾下的所有文件都生效

不想每次----

source /devel/setup.bash

在home文件夾下,ctrl+H顯示出了隱藏文件(再按一次ctrl+H就能又隱藏了)雙擊打開.bashrc文件:
不出意外,你可以看到一行

source /opt/ros/kinetic/setup.bash

這就是ROS自身的功能包所在位置,已經在你安裝的時候的某個步驟添加了進來,所以你可以直接調用到ROS的自帶功能包

最后一行添入

source ~/tutorial_ws/devel/setup.bash
source /mnt/hgfs/Share/Kin_ws/devel/setup.bash
source ~/kin_ws/devel/setup.bash

例如,博主這里就是添加了自己的三個工作空間供大家參考,注意需要將****這里改成自己的工作空間哦

source ~/****/devel/setup.bash

sudo chomd 777 /dev/ttyUSB*

調試ROS的時候開了比較多的傳感器,每次開機都得chomd的一次,跟着以前步驟,添加進用戶名組即可。

sudo gedit /etc/group

然后可以發現有這么一行:

dialout:x:20:

冒號后面填入自己的用戶名,你可能可以看到有些:后面有熟悉的你的用戶名,沒錯,那就是你的,例如:

root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:syslog,kin
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:kin

kin就是博主的用戶名

安裝區 --- 強推!Synergy

Chromium Web Browser

這是簡易版的,也可以視為精簡版

sudo apt install chromium-browser

oh-my-zsh

首先安裝zsh

sudo apt install zsh

然后再:

wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
sh install.sh

建議打開修改一下gitee源:https://gitee.com/mirrors/oh-my-zsh.git
可以看到安裝完成后已經設置了默認主題:
在這里插入圖片描述

參考:oh-my-zsh github官網
主題列表在github上:oh-my-zsh wiki 主題

比較好用的幾個插件建議安裝:
~/.oh-my-zsh/custom/plugins/zsh-autosuggestions 注意一下這里是自己的路徑哈,如果你是按着這個安裝的 默認就是這個,不是的話 記得改一下

zsh-autosuggestions :根據你的歷史信息自動補全

git clone https://gitee.com/kin_zhang/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions 

zsh-syntax-highlighting:高亮

git clone https://gitee.com/jklash1996/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting

最后:

gedit ~/.zshrc

在plugins的那一行加一下:

plugins=(git z web-search extract zsh-autosuggestions zsh-syntax-highlighting)

中文輸入法 - 搜狗

官方介紹及下載鏈接:https://pinyin.sogou.com/linux/?r=pinyin

官方readme:https://pinyin.sogou.com/linux/help.php 需要補充以下幾點:
在這里插入圖片描述
在完成這步之后,還需要添加:
在這里插入圖片描述
點擊+后,然后消除掉only
在這里插入圖片描述
然后搜索以下sogou點OK即可
在這里插入圖片描述
然后按CTRL+空格就能切換英文和搜狗了,搜狗本身內部Shift也可以有英文

微信&QQ

2021/10/28 最新更新:由阿翔推薦的優麒麟 對中文適配極好!

安裝地址為:https://www.ubuntukylin.com/applications/106-cn.html

跟着上面地址所示的安裝方法(步驟哈 不是任選其一,一步步安裝就ok了)
在這里插入圖片描述
在這里插入圖片描述
然后到軟件目錄直接就能看到安裝好的微信了。

以前老版:
一開始這個話題我查過很多... 都是說用electronic-wechat 就可以 但是我一直沒成功,后面是wine也沒成功,再到現在是yq哥告訴我的用docker 才發現
Ubuntu安裝QQ/微信(超級穩定版)

docker的安裝:【走ubuntu倉庫安裝 一般都很慢 所以需要換國內的源】
申請阿里雲加速器
在這里插入圖片描述

鍵盤鼠標共享軟件 - Synergy

軟件介紹:Synergy允許你輕松地在你辦公桌上多台計算機之間共享你的鼠標和鍵盤。你只要將鼠標(指針)從一台計算機的屏幕邊緣移出到另 一個屏幕就行了。甚至可以共享你的剪貼板。你所需要的僅僅是一個網絡連接。Synergy是跨平台的(可以運行於Windows,Mac OS X和Linux)。

最新更新:相關bug... 在付費版的更新里都更新過了,連接也更穩定,雖然界面沒啥改進 hhhh 沒錯花了200大洋支持了一下synergy團隊(買了是無限制設備的,所以算是終身的)

首先看一下使用效果:
在這里插入圖片描述

雙邊的安裝包 由鏈接給出:CSDN段下載鏈接BDYP下載鏈接 -> 對應BDYP提取碼:h5de

  • 無破解問題 雖然synergy的團隊除了付費的但是在1.8.8-stabe的上是免費的
  • window這邊的安裝就不說了 點擊安裝包安裝完成后,打開,會出現如下圖所示(這個是配置好了的)
    在這里插入圖片描述
    我是window是server【也就是用的哪台機器的鼠標和鍵盤】
  • ubuntu 安裝命令:sudo dpkg -i synergy-v1.8.8-stable-25a8cb2-Linux-x86_64.deb;安裝完成后直接搜索synergy打開
  • ubuntu的界面(18的安裝了 打開總是報錯 但是不影響使用) 就是需要勾選client然后在服務端IP填寫這邊Server的加粗的那個IP地址
    比如這樣的報錯: 直接點確認之后進入主界面,這里填的服務端IP就是剛剛Server那邊的
    在這里插入圖片描述
  • 在執行完上面的步驟后,其實還沒有成功就是需要在Server這端 有個交互配置 點擊設置服務端,然后將剛剛Client那邊的屏幕名給添加進來,如下圖 1,2,3,4步
  • 最后 點擊開始 就可以發現鍵盤和鼠標都可以共享 甚至是截屏的復制到了剪切板的所有東西(文字和圖片 單獨的復制圖片不行 只能從截圖端的copy to clipboard才行) 十分方便!【就是一開始設置麻煩點】
    在這里插入圖片描述

這一塊我又遇到了:Failed to connect secure socket

這時候請打開ubuntu那段的 編輯 -> 設置 -> 將這里的Network Security給勾選掉。【沒錯 新的主機重新裝遇到的位置 上一個都沒遇到啥問題】
在這里插入圖片描述

flameshot 截圖軟件

我覺得賊好用,不止是Ubuntu Window也可以【就是沒有Ubuntu的設置快捷截屏】
具體的github鏈接:
在這里插入圖片描述
真的很爽的截屏軟件,滾輪是放大放小哈,然后最新版又添加了可以移動的框(雖然wechat早就實現了 hhh)
安裝方式為:https://github.com/flameshot-org/flameshot/releases

然后選擇好版本和安裝系統就ok,基本上覆蓋了所有系統

在這里插入圖片描述
然后安裝就ok了:

sudo dpkg -i flameshot-0.10.1-1.ubuntu-18.04.amd64.deb

RoBoWare 【屬於ROS的VSCode】

  1. 首先給一下github地址 這個地址望周知!太多人去官網發現下載不了
    https://github.com/TonyRobotics/RoboWare
    RoboWare下載地址
  2. 下載流程 千萬不要下載完 雙擊安裝,因為那樣會失敗 正確安裝流程

這里要注意啊! 首先是下載的版本,反正我第一次是下載錯了的,下載amd64的用的比較多,如果是不確定自己多少位,終端輸入命令,雖然我這里吧 是x86_64但是把反正另一個版本我沒安裝成功。

uname -a

這里明顯的太明顯了
如圖是我自己下載的同一個系列的兩個版本,我是amd64安裝成功了
roboware安裝

sudo dpkg -i roboware-studio_1.1.0-1514335284_amd64.deb

注意執行這條安裝命令的時候 請進入你的安裝包所在位置,或者進入文件夾后,鼠標點右鍵,在終端打開;執行此命令;
顯示,協議的按esc退出,並確認是,就安裝啦!

roboware-studio

然后就打開啦!

Jupyter-notebook【分割數據的好幫手!】

參考鏈接:How to install and execute Jupyter Notebook on Ubuntu 18.04

這個其實沒啥坑,我一直猶豫是直接裝還是走Anaconda,后面發現還是直接安裝快的多
萬事第步:看一看自己的python版本有那些 ls -ls /usr/bin/python*
在這里插入圖片描述
這是我截圖的樣子(最新的應該是python3.8 如果你想再裝的話sudo apt-get install python3.8


注意這里的jupyter-notebook中間是-橫杠(不知道多少人和我一樣第一次命令行jupyter notebook hhhh)

sudo apt install jupyter-notebook


直接打開即可,就像圖中所示

jupyter-notebook

在這里插入圖片描述
四:附加
運行Notebook里的代碼時要添加conda環境,進入自己新加的環境(例如這里的環境名為cs285)

conda install ipykernel
python -m ipykernel install --user --name=cs285

然后再進去jupyter-notebook就可以選擇運行的環境了

NVIDIA 顯卡驅動

整合到另一篇文章內了 Ubuntu下的NVIDIA顯卡【安裝與卸載、CUDA安裝】

Anaconda Navigator

參考資料:官方文檔:Installing on Linux

1.是為了運行這樣的GUI界面所需要的依賴:
在這里插入圖片描述
Debian系列 裝依賴

apt-get install libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6

2.For x86 systems.
In your browser, download the 官方下載渠道 有點慢
在這里插入圖片描述
3.下載完成后:
注意名字是要弄自己的,在我的這個時候是2020.11的版本

bash ~/Downloads/Anaconda3-2020.11-Linux-x86_64.sh

4.同意一系列的license 就enter,yes等等等
The installer prompts “In order to continue the installation process, please review the license agreement.” Click Enter to view license terms.

5.Close and open your terminal window for the installation to take effect, or you can enter the command source ~/.bashrc.

6.To control whether or not each shell session has the base environment activated or not, run conda config --set auto_activate_base False or True. To run conda from anywhere without having the base environment activated by default, use conda config --set auto_activate_base False. This only works if you have run conda init first.

5.6就是配置環境變量 和 啟動時是否選擇base作為默認(我就默認了)

7.打開GUI界面 也就是此節的第一張圖所示的:

anaconda-navigator

OVER! (但是好像有這樣的錯誤 ,但是並不影響你打開它)

Traceback (most recent call last):
  File "/home/udi-kin/anaconda3/lib/python3.8/site-packages/anaconda_navigator/widgets/main_window.py", line 1617, in check_package_cache
    repodata = self.api._conda_api.get_repodata()
  File "/home/udi-kin/anaconda3/lib/python3.8/site-packages/anaconda_navigator/api/conda_api.py", line 1860, in get_repodata
    raw_data = f.read()
  File "/home/udi-kin/anaconda3/lib/python3.8/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xba in position 3119765: invalid start byte

這是打開spyder的界面
在這里插入圖片描述

換源:

sudo gedit ~/.condarc

將下面的直接復制替代原來的:

channels:
  - defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

安裝pytorch

請先在.condarc的地方把源換掉,另外NVIDIA的驅動需要裝好,請參閱上面步驟,一定要顯示看清楚CUDA的版本

channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
  - defaults
show_channel_urls: true
auto_activate_base: true
ssl_verify: true

如果要使用清華源對pytorch進行下載 需要把官方給的安裝命令行改一下:

conda install pytorch torchvision torchaudio cudatoolkit=11.0 -c pytorch

將后面從pytorch那邊提取的刪掉即可

conda install pytorch torchvision torchaudio cudatoolkit=11.0=

在這里插入圖片描述
然后看到了done!就完成了
再運行python,import看一下 cuda GPU是否有效可以使用,顯示True就OK了
在這里插入圖片描述

問題合集

ubuntu-derivers devices 沒有Output

I had the same problem. Software & Updates > Ubuntu software > check 'Proprietary drivers for devices' option. Then update from gui or sudo apt update

Software & Update 軟件與更新不能打開

這個問題是出現在ubuntu16.04不能打開
Ubuntu16.04 的軟件和更新,好像需要默認 python3.5來開。將3.5升級到3.6后,就打不開了。嘗試將版本鏈接回退到3.5,可以正常打開。

# 1. 這條指令是進root權限
sudo -su
# 2. 這條指令是移除現在軟鏈接的python版本(16的話是指向python2.7)
rm /usr/bin/python
# 3. 這句話是建立軟鏈接將系統python默認版本指向python3.5 如果想指回python2.7只需改成2.7即可
ln -s /usr/bin/python3.5 /usr/bin/python

然后可以正常打開了。鏈接更新會3.6就又打不開了,可能暫時沒有找到根本原因

參考:ubuntu16.04“軟件和更新”打不開,沒有任何反應,這是什么原因?

Encountered a section with no Package: header" Error In Ubuntu

*號是出現在上面的文件

sudo rm /var/lib/apt/lists/* -vf

/dev/nvme0n1p3 requires a manual fsck

自動修復/dev/sda2硬盤

fsck -y /dev/sda2

The following packages have unmet dependencies:

【有風險慎用 因為他在幫你自動處理依賴 但是這樣依賴的鏈接容易出現問題】

sudo apt install aptitude
sudo apt-get install ***你要安裝的包名稱***

終端http

export http_proxy="http://127.0.0.1:12333"
curl www.google.com
curl www.baidu.com

docker和wine的不同

reddit上的原回答

WINE is taking windows file structures and calls and translating them to Linux.
Docker containers are isolating Linux commands. If you install Docker for windows it still uses a VM for the Linux kernel, docker then just uses this VM as the underlying kernel. So docker is isolating linux commands to run on linux,
WINE is trying to allow windows commands on linux. You can run Linux containers on Linux, Windows, or OS X.
You can run Windows containers on Windows.

Unable to access 'git/attributes'

I ran into this situation myself. After verifying that it was looking in ~/.config/ I noticed the owner of that folder was root. I changed this to my_user_name and it worked.

cd ~/
ls -al
<Noticed .config was owned by root, unlike everything else in $HOME>
sudo chown -R $(whoami) .config


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM