Environment Installition

20241101

[TOC]

Python3.8

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.8
ls /usr/bin/python* #查看已安装版本
sudo rm /usr/bin/python3 # 删除原来的软连接
~~sudo ln -s /usr/bin/python3.8 /usr/bin/python3~~ #不要添加python3的软连接,终端打不开,需要进tty终端修复
sudo ln -s /usr/bin/python3.8 /usr/bin/python #添加python新的软连接
python3 --version #查看版本
sudo apt-get install python3-pip #设置一下pip
mkdir ~/.pip&&cd ~/.pip
sudo gedit pip.conf
# [global]
# index-url = https://pypi.tuna.tsinghua.edu.cn/simple
# index-index-url = https://mirrors.aliyun.com/pypi/simple/
# [install]
# trusted-host =
# pypi.tuna.tsinghua.edu.cn
sudo pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple #或者

1
2
3
4
5
# 安装Anaconda之后默认python和python的版本会出现问题,系统将使用Anaconda的python作为默认python,所以,所以我出现了本地安装了python3.8和python3.10后但是默认python是3.7且无法通过软连接改变,所以需要在软连接下进行修改:
# https://blog.csdn.net/littlexiaoshuishui/article/details/82504880
# 暂时找到的方法是在某个终端echo $PATH然后重新通过以下命令赋值,其中删除Anaconda的部分
PATH=/opt/ros/humble/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin

搜狗拼音

1
2
3
4
5
6
7
8
# 语言中将汉语安装并提到第一位
sudo apt-get install -f
sudo apt install fcitx # 设置语言从ibus到fcitx4
sudo cp /usr/share/applications/fcitx.desktop /etc/xdg/autostart/#设置fcitx为自动开启
sudo dpkg -i sogoupinyin_4.0.1.2800_x86_64.deb
sudo apt install libqt5qml5 libqt5quick5 libqt5quickwidgets5 qml-module-qtquick2 libgsettings-qt1
reboot
# 在右上角设置

Kernel5.15

更换版本之后网卡丢失,所以不要降级内核了而启用docker,该部分已弃用

1
2
3
4
5
6
7
8
uname -r #查看当前内核
dpkg --get-selections | grep linux-image #查看可用内核
sudo apt-get install linux-image-5.15-83 linux-headers-5.15-83 linux-image-extra-5.15-83
grep menuentry /boot/grub/grub.cfg #查看所有可用内核
sudo gedit /etc/default/grub #更改默认内核
sudo update-grub#更新内核文件
reboot #查看是否更新成功
sudo dpkg --purge linux-image-4.15.0-88-generic #卸载其他内核

Nvidia

据说现在deb安装,可以直接安装对应版本的nvudia driver,并且不会掉驱动

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 笔记本显示屏幕是核显
# 外接屏幕是独显
lsmod | grep nouveau #查看系统是否启用了nouveau显卡驱动,有内容输出,则说明nouveau已被启用
sudo vim /etc/modprobe.d/blacklist.conf
#---save the following info into file blacklist.conf---
blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off
#---end of the info saved----
sudo update-initramfs -u # 更新内核
reboot #查看是否更新成功
lsmod | grep nouveau #查看系统是否禁用了nouveau显卡驱动
lshw -c video # 查看显卡型号,在官网https://www.nvidia.cn/Download/index.aspx查找对应的驱动,如果内核不对那就是下载错了,需要下载最新版
# 如果发现编译失败,看一下vim /var/log/nvidia-installer.log,常见错误是使用了gcc11,不符合安装要求,要安装gcc12,不要把gcc卸载了
sudo apt install gcc-12# 但是更重要的是更新Gcc版本,基本上ubuntu都安装了gcc11和gcc12,所以关键是切换版本
sudo ./NVIDIA-Linux-x86_64-535.161.07.run -no-x-check #安装驱动,并且取消x查看,要安装32适配库
nvidia-smi # nvidia驱动版本号和最大cuda版本,安装驱动后才有
# 之后不要通过software更新驱动
# 独显有用核显有用:删除/etc/X11/xorg.conf
#

CUDA和CUDNN

据说现在deb安装,可以直接安装对应版本的nvudia driver,并且不会掉驱动

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
用.run的版本的安装方法
以下为部分安装提示
Do you accept the previously read EULA?
accept/decline/quit: accept# #这一条提示不用管它
You are attempting to install on an unsupported configuration. Do you wish to continue?
(y)es/(n)o [ default is no ]: y
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81?
(y)es/(n)o/(q)uit: n # 如果在这之前已经安装好更高版本的显卡驱动就不需要再重复安装,如果需要重复安装就选择 yes,此外还需要关闭图形界面。
Install the CUDA 9.0 Toolkit?
(y)es/(n)o/(q)uit: y
Enter Toolkit Location
[ default is /usr/local/cuda-9.0 ]:/home/usrname/usr/local/cuda-9.0
/usr/local/cuda-9.0 is not writable.
Do you wish to run the installation with ‘sudo’?
(y)es/(n)o: y

Please enter your password:
Do you want to install a symbolic link at /usr/local/cuda? # 是否将安装目录通过软连接的方式 link 到 /usr/local/cuda,yes or no 都可以,取决于你是否使用 /usr/local/cuda 为默认的 cuda 目录。
(y)es/(n)o/(q)uit: n
Install the CUDA 9.0 Samples? #安装与否没有影响
(y)es/(n)o/(q)uit: n

# 安装的时候需要切换G++GCC版本
# cuda去官网找sh文件
# 正式开始安装cuda
# cudnn下载deb,dpkg下载

# 添加环境变量到.bashrc
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

比如:export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

1
2
3
4
5
6
7
8
9
10
11
12
#卸载
# cuda安装时就已经准备好了卸载的接口,卸载程序在`/usr/local/cuda-xx.x/bin`下,需要注意的是cuda10.0及之前的版本卸载程序名为`uninstall_cuda_xx.x.pl`,而cuda10.1及之后的版本卸载程序名为`cuda-uninstaller`
cd /usr/local/cuda-xx.x/bin/
sudo ./cuda-uninstaller#或者sudo ./uninstall_cuda_xx.x.pl
sudo rm -rf /usr/local/cuda-xx.x
#使用dpkg卸载cudnn
sudo dpkg -l | grep cudnn
sudo dpkg -r libcudnn8-samples
sudo dpkg -r libcudnn8-dev
sudo dpkg -r libcudnn8

最后边加了一句sudo rm -rf /usr/local/cuda-xx.x,这是因为一般情况下cuda都配置了cudnn,在运行卸载程序时只会卸载cuda而不会一并删除cudnn的文件。因为cudnn文件还在的缘故,自己的cuda-xx.x文件夹仍然在,需要手动删除。

切换GCCG++版本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
gcc --version
g++ --version # 版本为11.4,gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

# 下载低版本gcc g++,并进行设置,tensorflow和pytorch一般使用4.8
sudo gedit /etc/apt/sources.list

增加

deb http://dk.archive.ubuntu.com/ubuntu/ xenial main
deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe

sudo apt install gcc-4.8 g++-4.8
# 使用update-alternatives管理多个版本的gcc g++ python,最后一位是优先级
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 1
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 1

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 2
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11.4 2
# 可以通过以下命令来切换使用的gcc和g++版本
sudo update-alternatives --config g++
sudo update-alternatives --config gcc

Docker卸载

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 删除docker残留物,没有就不用卸载了
dpkg -l | grep -i docker
# 删除io ce
sudo apt-get purge -y docker-engine docker docker.io docker-ce
sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce
# 删除参数
sudo rm -rf /var/lib/docker /etc/docker
sudo rm /etc/apparmor.d/docker
sudo groupdel docker
sudo rm -rf /var/run/docker.sock
# 如果使用dpkg的方式安装 发现还未清除docker残留
sudo find / -name "*docker*"
# rm 这些项
cd /var/lib/dpkg/
sudo gedit status
# 在status与status-old 文件里查找docker相关的项,删除相关内容。

Docker Desktop(deb安装,更新只需要重新安装deb)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# 安装地址:https://docs.docker.com/desktop/install/linux-install/
# for non-Gnome Desktop environments, gnome-terminal must be installed:
# sudo apt install gnome-terminal
# 卸载干净了
sudo apt-get remove docker docker-engine docker.io containerd runc
# 首先添加Docker Desktop的apt源
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc #a+r表示将读权限授予所有用户,最后的路径则是要修改权限的文件路径。该命令的目的是将GPG密钥文件的读权限授予所有用户,以确保所有用户都能够读取该文件中的密钥信息。

# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

# 第二,下载deb包
# 去官网下载
# 第三,安装deb包
sudo apt-get update
sudo dkpg -i ./docker-desktop-4.28.0-amd64.deb

# 第三,添加用户
sudo usermod -aG docker $USER # 将当前用户添加到 docker 用户组中,以便您可以在不使用 sudo 的情况下运行 Docker 命令
newgrp docker #此命令用于切换到 docker 用户组。当您运行此命令后,您的 shell 将具有 docker 用户组的权限,建议写到zsh里面

systemctl --user start docker-desktop # --user 参数用于明确指定您希望在用户级别运行 systemctl 命令
systemctl status docker-desktop
systemctl --user stop docker-desktop
docker version
# 记住一定要加--user,而且不能用sudo,不能用docker(service)沃日,搞了一个下午~!!!!!!!!!!!!!!!!!!!!!!!!!!!!


## sign in 登录,现在登录需要pass才行,参考https://docs.docker.com/desktop/get-started/#credentials-management-for-linux-users
gpg --generate-key
# 真实姓名: outbreak
# 您选定了此用户标识:“outbreak <1023786231@qq.com>”
# 我们需要生成大量的随机字节。在质数生成期间做些其他操作(敲打键盘、移动鼠标、读写硬盘之类的)将会是一个不错的主意;这会让随机数发生器有更好的机会获得足够的熵。
# gpg: /home/outbreak/.gnupg/trustdb.gpg:建立了信任度数据库
# gpg: 密钥 10B61AB8A00B94FC 被标记为绝对信任
# gpg: 目录‘/home/outbreak/.gnupg/openpgp-revocs.d’已创建
# gpg: 吊销证书已被存储为‘/home/outbreak/.gnupg/openpgp-revocs.d/951E377343482D391981EF4910B61AB8A00B94FC.rev’
# 公钥和私钥已经生成并被签名。
# pub rsa3072 2024-04-03 [SC] [有效至:2026-04-03]
# 951E377343482D391981EF4910B61AB8A00B94FC
# uid outbreak <1023786231@qq.com>
# sub rsa3072 2024-04-03 [E] [有效至:2026-04-03]
# 然后运行,后面接上pub
pass init 951E377343482D391981EF4910B61AB8A00B94FC

#卸载 Docker Desktop
sudo apt purge docker-desktop
rm -r $HOME/.docker/desktop
sudo rm /usr/local/bin/com.docker.cli

GPG蜜月

1
2
3
4
5
sudo apt-get install ca-certificates curl gnupg
# 其中,ca-certificates是一个软件包名称,它包含了一组根证书和中间证书,用于验证HTTPS连接的安全性
# 安装ca-certificates软件包可以确保系统具有最新的根证书列表。
# curl是一个用于在命令行中进行网络请求的工具,它支持多种协议,如HTTP、HTTPS、FTP等;安装curl软件包可以让我们在终端中方便地进行网络请求和下载文件。gnupg是GNU隐私卫士

NVIDIADocker(APT)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 可以通过apt,yun,zypper安装
# 参考https://docs.nvidia.com/datacenter/cloud-native/containertoolkit/latest/install-guide.html
# 安装nvidia驱动,运行nvidia-smi会有输出,
# 查看显卡是否存在 lspci | grep -i nvidia
# /////// 框内是一个命令
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
# /////// 框内是一个命令
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit



# 配置Docker Configure the container runtime by using the nvidia-ctk command:
sudo nvidia-ctk runtime configure --runtime=docker
# nvidia-ctk命令修改了/etc/docker/daemon.json中的内容,文件中的内容更新之后Docker就可以使用NVIDIA Container Runtime.
sudo systemctl restart docker#Restart the Docker daemon


## 如需在没有 sudo 的情况下运行 docker 命令,请创建 docker 组并添加您的用户。
sudo groupadd docker
sudo usermod -aG docker $USER
# 测试 docker run --runtime=nvidia -rm nvidia/cuda:9.0-base nvidia-smi

# 验证 nvidia-docker 安装效果
docker run --gpus all --rm nvidia/cuda nvidia-smi
# 会自动下载nvidia、cuda
# 注意:nvidia-docker v2 使用 --runtime=nvidia,而不是 --gpus all。nvidia-docker v1
# 使用 nvidia-docker 别名,而不是 --runtime=nvidia 或 --gpus all 命令行标记。

TensorFlow Docker

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 在本地主机上安装 Docker。
# 如需在 Linux 上启用 GPU 支持,请安装 NVIDIA Docker 支持。
# 通过 docker -v 检查 Docker 版本。对于 19.03 之前的版本,您需要使用 nvidia-docker2 和 -- runtime=nvidia 标记;对于 19.03 及之后的版本,您将需要使用 nvidia-container-toolkit 软件包和 --gpus all 标记。

# 以下的tag为latest-gpu-jupyter
docker pull tensorflow/tensorflow:latest-gpu-jupyter

# latest:TensorFlow CPU 二进制映像的最新版本。(默认版本)
# nightly:TensorFlow 映像的每夜版。(不稳定)
# version:指定 TensorFlow 二进制映像的版本,例如:2.1.0
# devel :TensorFlow master 开发环境的每夜版。包含 TensorFlow 源代码。devel and custom-op 版本不再支持
# custom-op:于开发 TF 自定义操作的特殊实验性映像。详见此处。devel and custom-op 版本不再支持
# 版本<= 1.15.0 (1.x) and <= 2.1.0 (2.x) 的如果带有-py3的镜像里面有python3(3.5 for Ubuntu 16-based images; 3.6 for Ubuntu 18-based images; 3.8 for Ubuntu 20-based images)
# 版本<= 1.15.0 (1.x) and <= 2.1.0 (2.x) 的如果没有带有-py3的镜像里面只有Python 2.7
# -gpu tags are based on Nvidia CUDA. You need nvidia-docker to run them.

# 上述标记下还有二级的tag
# 每个基本标记都有会添加或更改功能的变体:
# 标记变体 说明
# tag-gpu 支持 GPU 的指定标记版本
# tag-jupyter 针对 Jupyter 的指定标记版本

如需在容器内运行在主机上开发的 TensorFlow 程序,请装载主机目录并更改容器的工作目录 (-v hostDir:containerDir -w workDir)
docker run -it --rm -v $PWD:/tmp -w /tmp tensorflow/tensorflow python ./script.py

cmake

1
2
3
4
5
6
7
8
9
sudo apt install build-essential libncurses5-dev ninja-build libssl-dev libarchive13 libcurl4 librhash0 libuv1
# source下载地址https://cmake.org/files/,其中cmake-3.21.4-linux-x86_64.tar.gz是已编译好的,我们要用cmake-3.21.4.tar.gz,里面有bootstrap文件
# 千万不要sudo apt-get autoremove cmake
tar -zxvf cmake-3.21.4.tar.gz
cd cmake-3.21.4
./bootstrap --generator=Ninja
ninja
sudo ninja install
cmake --version

QT

1
2
3
#sudo权限进入安装(安装在/opt目录下),软件所在目录:/opt/Qt5.12.9/Tools/QtCreator/bin/
chmod +x qt-opensource-linux-x64-5.12.9.run
sudo ./qt-opensource-linux-x64-5.12.9.run#只安装其中的qtcreator和QT5.12里的source就可以了

或者以下的方式安装两个就可以

1
2
sudo apt install qt5* qttools5-dev

gflags

1
2
3
4
5
6
7
8
9
10
# apt安装
sudo apt-get install libgflags-dev

# source安装
cd gflags
mkdir build && cd build
cmake -DGFLAGS_NAMESPACE=google -DCMAKE_CXX_FLAGS=-fPIC -DBUILD_SHARED_LIBS=ON ..
make -j4
sudo make install
sudo ldconfig

glog

1
2
3
4
5
6
7
8
9
10
11
12
# apt安装
sudo apt-get install libgoogle-glog-dev

# source安装
git clone https://github.com/google/glog
cd glog
mkdir build && cd build
cmake -DGFLAGS_NAMESPACE=google -DCMAKE_CXX_FLAGS=-fPIC -DBUILD_SHARED_LIBS=ON ..

cmakelists-----option (WITH_GTEST "Use googletest" OFF)
make
sudo make install

eigen

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# apt安装
sudo apt-get install libeigen3-dev #默认安装路径/usr/include/eigen3
sudo ln -s /usr/include/eigen3/Eigen /usr/include/Eigen
sudo cp -r /usr/include/eigen3/Eigen /usr/include
sudo cp -r /usr/include/eigen3/signature_of_eigen3_matrix_library /usr/include
sudo cp -r /usr/include/eigen3/unsupported /usr/include
# source安装
tar -xvf eigen-3.4.0.tar.gz
mkdir build && cd build
cmake ..
sudo make install
sudo ln -s /usr/include/eigen3/Eigen /usr/include/Eigen

sudo ln -s /usr/include/eigen3/Eigen /usr/include
sudo ln -s /usr/include/eigen3/signature_of_eigen3_matrix_library /usr/include
sudo ln -s /usr/include/eigen3/unsupported /usr/include

ceres

1
2
3
4
5
6
7
8
# 依赖glog和eigen
# 除此之外还依赖 Use ATLAS for BLAS & LAPACK
sudo apt-get install libatlas-base-dev
mkdir build&&cd build
cmake ../
make -j5注意制定内核数,直接-j会导致内存不足而宕机
make test
sudo make install #不sudo就找不到

Zsh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 安装zsh
sudo apt install zsh
# 然后将zsh设置为默认shell:
chsh -s /bin/zsh
echo $SHELL

#安装oh-my-zsh
# gitee安装
sudo apt install curl git
sh -c "$(curl -fsSL https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh)"
# 外网安装
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh

# 安装Powerlevel10k主题
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
# 配置Powerlevel10k
# vim ~/.zshrc编辑.zshrc,将ZSH_THEME项改为:
ZSH_THEME="powerlevel10k/powerlevel10k"

#安装各种插件
#zsh-autosuggestions
git clone https://gitee.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
#zsh-syntax-highlighting
git clone https://gitee.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
#使插件生效,上述插件安装完成后,需要修改.zshrc文件,编辑plugins项,修改如下:
# 值得注意的是,根据官方文档,zsh-syntax-highlighting 插件需放在最后
plugins=(
git extract zsh-autosuggestions zsh-syntax-highlighting
)
#使用source ~/.zshrc命令更新。
# vim ~/.zshrc编辑,添加以下一行
setopt no_nomatch #解决无法识别*问题

Clash

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
将 Clash for Windows.zip 和 subconverter.zip解压到主目录.
cd Clash for Windows
./cfw
cd ../subconverter
./subconverter #运行后不要关闭

#TUN模式
打开Clash,点击General中Service Mode右边Manage,点击install,地球图标变为绿色后说明安装成功
点击TUN Mode右边的开关,启用TUN模式,现在可以打开终端(终端没有设置代理),查看是否成功,上下两条命令的执行结果分别是开启TUN模式前后(代理为全局模式)的结果

## global里设置7890,自动开机,proxy设置
点击一下sytem proxy
127.0.0.1 7890
127.0.0.1 7890
127.0.0.1 8889
127.0.0.1 1089

经过调研,现在使用clash verge,

opencv3+contrib

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
sudo apt install build-essential cmake-curses-gui ninja-build libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg-dev libswscale-dev libtiff5-dev pkg-config libgtk-3*
# https://github.com/opencv/opencv/releases?page=1
# https://github.com/opencv/opencv_contrib/tags
# 分别下载两个同版本的文件,分别解压,在opencv文件夹下
mkdir build && cd build
ccmake -G Ninja ..
BUILD_EXAMPLES#编译示例代码
BUILD_PNG(JPEG,TIFF,WEBP,OPENJPEG,JASPER,OPENEXR)#使opencv可以读取相应格式的图片
WITH_QT#使用QT绘制窗口,会提供很多功能,建议开启,需要安装QT5
OPENCV_EXTRA_MODULES_PATH=.opencv_contrib/modules#contrib 的目录,到modules,module可筛选
OPENCV_GENERATE_PKGCONFIG#启用.pc文件生成以及标准 CMake 包,建议开启
OPENCV_sfm设置为OFF因为会因为glog版本报错
ninja
sudo ninja install
sudo ninja uninstall

#卸载时sudo ninja uninstall
#标定板下载https://calib.io/pages/camera-calibration-pattern-generator

Ros2-humble

1
2
3
4
# 使用fishros,其脚本跑的是官方的安装流程
wget http://fishros.com/install -O fishros && . ./fishros
# 在~/.zshrc中加入
source /opt/ros/humble/setup.zsh

moveit-humble

realsense2

Galaxy相机驱动

1
2
3
4
sudo ./Galaxy_camera.run
cd Galaxy_camera/inc
sudo cp DxImageProc.h /usr/include
sudo cp GxIAPI.h /usr/include

Openvino

1
2
3
4
5
6
7
# 一、Openvino2022安装 ubuntu 20.04
./l_openvino_toolkit_p_2022.1.0.643_offline.sh
vim ~/.bashrc
#将.sh文件source
#如果python路径报错,修改setupvars.sh中
#SCRIPT_DIR改为
SCRIPT_DIR="$(abs_path "${(%):-%N}")" >/dev/null 2>&1

Openvino2023安装 ubuntu22.04

wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
echo “deb https://apt.repos.intel.com/openvino/2023 ubuntu22 main” | sudo tee /etc/apt/sources.list.d/intel-openvino-2023.list
sudo apt update
apt-cache search openvino
sudo apt install openvino-2023.2.0

Anaconda

1
2
3
4
./Anaconda3-2021.11-Linux-x86_64.sh# no sudo
vim ~/.bashrc
vim ~/.zshrc
#调整$PATH的位置

Conda换源

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# 方法一
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

# 方法二
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

PIP换源

1
2
pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

VScode

为了解决下载太慢的问题:

https://blog.csdn.net/weixin_46621570/article/details/128007351

VLC

1
sudo apt-get install vlc

QQ

1
sudo dpkg -i linuxqq_3.2.0-16605_amd64.deb

飞书

1
sudo dpkg -i Feishu-linux_x64-6.9.16.deb

libjpeg-turbo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 默认安装位置/opt/libjpeg-turbo
mkdir build && cd build
cmake -G"Unix Makefiles" ..
make
sudo make install
make uninstall

# 使用时libjpeg-turbo的安装包没有提供用于CONFIG模式查找包(find_package)的cmake脚本,所以需要自己写
set(CMAKE_PREFIX_PATH /opt/libjpeg-turbo)
find_package(PkgConfig REQUIRED)
pkg_search_module(TURBOJPEG REQUIRED libturbojpeg)
link_directories(${TURBOJPEG_LIBDIR})
add_executable(tjexample tjexample.c)
target_include_directories(tjexample PUBLIC ${TURBOJPEG_INCLUDE_DIRS})
target_link_libraries(tjexample ${TURBOJPEG_LIBRARIES})

LabelRobomaster

1
sudo apt install libfuse2 #22.04不再默认安装fuse

Colmap

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
sudo apt-get install \
git \
cmake \
build-essential \
libboost-program-options-dev \
libboost-filesystem-dev \
libboost-graph-dev \
libboost-system-dev \
libboost-test-dev \
libeigen3-dev \
libsuitesparse-dev \
libfreeimage-dev \
libmetis-dev \
libgoogle-glog-dev \
libgflags-dev \
libglew-dev \
qtbase5-dev \
libqt5opengl5-dev \
libcgal-dev
因为之前已经安装了所以只需要运行:

git clone https://github.com/colmap/colmap.git
cd colmap
git checkout dev
mkdir build
cd build
cmake .. -DQt5_DIR=/opt/homebrew/opt/qt@5/lib/cmake/Qt5
make
sudo make install

meshLab

1
2
3
4
5
# 源码安装,弃用
cd /home/outbreak/MVS/meshlab_folder/meshlab/scripts/Linux
zsh 0_setup_env.sh --dont_install_qt # 已经安装了Qt
# 直接登录https://www.meshlab.net/#download下载appImage
sudo apt install libfuse2

MVE

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 依赖:
# libjpeg (for MVE, http://www.ijg.org/)
# libpng (for MVE, http://www.libpng.org/pub/png/libpng.html)
# libtiff (for MVE, http://www.libtiff.org/)
# OpenGL (for libogl in MVE and UMVE)
# Qt 5 (for UMVE, http://www.qt.io)
sudo apt-get install libjpeg-dev
sudo apt-get install libtiff-dev
sudo apt-get install libpng-devopenGL
01--首先不可或缺的就是编译器与基本的函式库
sudo apt-get install build-essential
02--安装OpenGL Library
sudo apt-get install libgl1-mesa-dev
03--安装OpenGL Utilities
// OpenGL Utilities 是一组建构于 OpenGL Library 之上的工具组,
// 提供许多很方便的函式,使 OpenGL 更强大且更容易使用
sudo apt-get install libglu1-mesa-dev
04--安装OpenGL Utility Toolkit
// OpenGL Utility Toolkit 是建立在 OpenGL Utilities 上面的工具箱,
// 除了强化了 OpenGL Utilities 的不足之外,也增加了 OpenGL 对于视窗介面支援。
sudo apt-get install freeglut3-dev
最后
sudo apt-get install libglew-dev libsdl2-dev libsdl2-image-dev libglm-dev libfreetype6-dev
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# To download and build MVE, type:
git clone https://github.com/simonfuhrmann/mve.git
cd mve
make -j8
# 将命令写在shell中才可以用其命令行运行
# 一共14个
export PATH="/home/outbreak/MVS/MVE_folder/mve/apps/bundle2pset:$PATH"
export PATH="/home/outbreak/MVS/MVE_folder/mve/apps/dmrecon:$PATH"
export PATH="/home/outbreak/MVS/MVE_folder/mve/apps/featurerecon:$PATH"
export PATH="/home/outbreak/MVS/MVE_folder/mve/apps/fssrecon:$PATH"
export PATH="/home/outbreak/MVS/MVE_folder/mve/apps/makescene:$PATH"
export PATH="/home/outbreak/MVS/MVE_folder/mve/apps/mesh2pset:$PATH"
export PATH="/home/outbreak/MVS/MVE_folder/mve/apps/meshalign:$PATH"
export PATH="/home/outbreak/MVS/MVE_folder/mve/apps/meshclean:$PATH"
export PATH="/home/outbreak/MVS/MVE_folder/mve/apps/meshconvert:$PATH"
export PATH="/home/outbreak/MVS/MVE_folder/mve/apps/prebundle:$PATH"
export PATH="/home/outbreak/MVS/MVE_folder/mve/apps/scene2pset:$PATH"
export PATH="/home/outbreak/MVS/MVE_folder/mve/apps/sceneupgrade:$PATH"
export PATH="/home/outbreak/MVS/MVE_folder/mve/apps/sfmrecon:$PATH"
export PATH="/home/outbreak/MVS/MVE_folder/mve/apps/umve:$PATH"

# UMVE是QT界面的GUI界面,没有UMVE就只能用命令行
cd apps/umve/
qmake && make -j8
./umve
# 其运行的pipeline请看对应下的笔记

OpenMVS

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# 最后出现报错,所以未能安装成功
需要:
Eigen version 3.4 or higher
OpenCV version 2.4 or higher
Ceres version 1.10 or higher (optional)
CGAL version 4.2 or higher
Boost version 1.56 or higher
VCG VCGLib(注意要安装2020年的版本,参考教程)
CUDA (optional)
GLFW (optional)
运行:
sudo apt-get update -qq && sudo apt-get install -qq
#安装Eigen (必需)
git clone https://gitlab.com/libeigen/eigen.git --branch 3.2
mkdir eigen_build && cd eigen_build
cmake . ../eigen make && sudo make install
cd ..
#安装Boost (必需)
sudo apt-get -y install libboost-iostreams-dev libboost-program-options-dev libboost-system-dev libboost-serialization-dev
#安装OpenCV (必需)
sudo apt-get -y install libopencv-dev
#安装CGAL (必需) 是一个开源软件项目,以C++库的形式提供对高效可靠几何算法的轻松访问。CGAL用于各种需要几何计算的领域,如地理信息系统、计算机辅助设计、分子生物学、医学成像、计算机图形学和机器人。该库提供数据结构和算法,如三角图、Voronoi图、多边形和多面体的布尔运算、点集处理、曲线排列、曲面和体积网格生成、几何处理、阿尔法形状、凸包算法、形状重建、AABB和KD树
sudo apt-get -y install libcgal-dev libcgal-qt5-dev
#安装VCGLib (必需) 可视化与计算机图形库(简称VCG)是一个开源的可移植C++模板库,用于利用OpenGL对三角形和四面体网格进行操作、处理和显示。VCGLib使用github托管的git存储库
git clone https://github.com/cdcseacave/VCG.git VCG
cd VCG && git log
git reset --hard 88f12f212a1645d1fa6416592a434c29e63b57f0
VCG库主要由头文件构成(核心部分完全是头文件)而不依赖额外的东西. 只需下载压缩包并解压到一个
文件夹. 例如, 解压到命名为 vcg 的文件夹, 并且设置为编译器的 include 目录. 以后, 你只需要
像 app/sample/ 中的例子那样包含你需要的头文件即可
#安装Ceres (可选)
sudo apt-get -y install libatlas-base-dev libsuitesparse-dev
git clone https://ceres-solver.googlesource.com/ceres-solver ceres-solver
mkdir ceres_build && cd ceres_build
cmake . ../ceres-solver/ -DMINIGLOG=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF
make -j2 && sudo make install
cd ..
#安装GLFW3 (可选)
sudo apt-get -y install freeglut3-dev libglew-dev libglfw3-dev
#安装OpenMVS
git clone https://github.com/electech6/openMVS_comments.git openMVS
## OpenMVS的中文注释版
git clone https://github.com/electech6/openMVS_comments
mkdir openMVS_build && cd openMVS_build
cmake . ../openMVS -DCMAKE_BUILD_TYPE=Release -DVCG_ROOT="/home/outbreak/DriverCollection/VCG"

#如果想生成共享库,可以在cmake加如下命令:
-DBUILD_SHARED_LIBS=ON
#生成 OpenMVS 库文件:
sudo make -j2 && sudo make install

OpenMVG

1
2
3
4
5
6
7
8
9
# 最后出现add_library cannot create imported target "Qt5::QSvgIconPlugin" because another target with the same name already exists,所以未能安装成功

sudo apt-get install libpng-dev libjpeg-dev libtiff-dev libxxf86vm1 libxxf86vm-dev libxi-dev libxrandr-dev graphviz
git clone --recursive https://github.com/openMVG/openMVG.git && cd openMVG
mkdir build &&cd build
cmake -DCMAKE_BUILD_TYPE=RELEASE ../src/ -DOpenMVG_BUILD_TESTS=ON
sudo cmake --build . --target install
# test make test ctest --output-on-failure -j
# .bashrcexport PATH=$PATH:/home/work/tools/openMVG_Build/Linux-x86_64-RELEASE/

Bundler

1
2
3
4
5
6
7
8
9
10
11
12
13
# 安装依赖
sudo apt-get install liblapack-dev libblas-dev minpack-dev f2c gfortran jhead imagemagick
sudo apt-get install libc6-dev-i386#一个用于编译和链接 C 程序的软件包,SIFT依赖
git clone https://github.com/snavely/bundler_sfm.git
cd bundler_sfm
make #最后make[1]: Leaving directory
## 下载的SIFT程序,解压之后将里边的siftDemoV4/sift可执行文件拷贝到bundler_sfm下的bin目录下

## 将jhead文件拷贝到bundler_sfm下的bin目录下
sudo cp /usr/bin/jhead bin/ 
## 将bundler_sfm/bin/目录下生成的libANN_char.so文件拷贝到系统库
sudo cp bin/libANN_char.so /usr/lib/ 

CMVS-PMVS

1
2
3
4
5
6
7
8
9
10
11
    PMVS(patch-based multi-view stereo) 是 Yasutaka Furukama 博士写的已知由一组图片和图片对应的相机参数生成 dense reconstruction (稠密的三维模型)的算法。
CMVS(Clustering Views for Multi-view Stereo) 是 PMVS 的改进版,里面包含PMVS。
# 安装依赖
sudo apt-get install libgtk2.0-dev libdevil-dev libboost-all-dev libatlas-cpp-0.6-dev libatlas-dev libcminpack-dev libgfortran3 libmetis-edf-dev libparmetis-dev freeglut3-dev libgsl0-dev

git clone https://github.com/pmoulon/CMVS-PMVS.git
cd CMVS-PMVS/program/
mkdir build && cd build
cmake ..
make
## 生成的可执行文件位于build目录下的main目录中。为了接下来运行方便,我们将生成的可执行文件cmvs、genOption、pmvs2这三个文件拷贝到bundler_sfm目录的bin下

Node.js

官网没有apt安装,实际上有。但是安装出来的不是最新的

1
sudo apt install -y nodejs

Hexo需要14以下版本才能正常显示localhost

要安装制定版本在官网下载tar文件node-v20.18.0-linux-x64.tar.xz

1
2
3
4
5
6
7
8
9
10
11
# 直接解压到 /usr/local/ 目录
sudo tar -xvf node-v14.18.0-linux-x64.tar.xz -C /usr/local/
# nodejs下bin目录是否有node 和npm文件
# 在zsh下
export PATH=/usr/local/node-v14.18.0-linux-x64/bin:$PATH
# 建立符号链接
cd node-v14.18.0-linux-x64
sudo ln -s ./bin/npm /usr/local/bin/
ln -s ./bin/node /usr/local/bin/
# 安装完成
node -v

不知道怎么了失败了,于是决定nvm安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
# zsh中
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion


source ~/.zshrc
# 下载并安装 Node.js(可能需要重启终端)
nvm install 22
nvm use 22
# 验证环境中是否存在正确的 Node.js 版本
node -v # 应该打印 `v22.11.0`

# 验证环境中是否存在正确的 npm 版本
npm -v # 应该打印 `10.9.0`

# 逝世使用nvm下载hexo

npm uninstall -g hexo-cli
npm install -g hexo-cli
npm install hexo-deployer-git --save
hexo -v

SSH 服务器

1
2
3
4
用户名 houbosen
密码 Xw2dAOgsBk
端口 1938
14号机ip 10.68.154.94

疑难杂症解决

  1. ssh connection refused
1
2
sudo apt install openssh-server 
sudo apt install openssh-client
  1. ssh permission denied
1
有没有可能你们两个的静态IP一样
  1. From 192.168.50.6 icmp_seq=1 Destination Host Unreachable
1
2
rm /var/lib/NetworkManager/NetworkManager.state
reboot
  1. /usr/bin/ld: /lib/x86_64-linux-gnu/librsvg-2.so.2: undefined reference to pango_attr_insert_hyphens_new' /usr/bin/ld: /lib/x86_64-linux-gnu/librsvg-2.so.2: undefined reference to pango_attr_overline_new’
    /usr/bin/ld: /lib/x86_64-linux-gnu/librsvg-2.so.2: undefined reference to pango_coverage_get_type' /usr/bin/ld: /lib/x86_64-linux-gnu/librsvg-2.so.2: undefined reference to pango_item_apply_attrs’
    /usr/bin/ld: /lib/x86_64-linux-gnu/librsvg-2.so.2: undefined reference to cairo_tag_end' /usr/bin/ld: /lib/x86_64-linux-gnu/librsvg-2.so.2: undefined reference to pango_attr_list_update’
    /usr/bin/ld: /lib/x86_64-linux-gnu/librsvg-2.so.2: undefined reference to pango_show_flags_get_type' /usr/bin/ld: /lib/x86_64-linux-gnu/librsvg-2.so.2: undefined reference to cairo_svg_surface_get_document_unit’
    爆了一堆librsvg找不到pango和cairo的包,然后重新装

不知道会出什么问题,所以想直接冲了,

sudo apt remove librsvg2-2:amd64

sudo apt remove librsvg2-common:amd64

sudo apt remove librsvg2-bin

sudo apt install librsvg2-2:amd64

sudo apt install librsvg2-common:amd64

sudo apt install librsvg2-bin