Common operations on ubuntu

1. Install ubuntu18.04

Reference: https://blog.csdn.net/baidu_36602427/article/details/86548203

Install graphics driver:

Install Ubuntu-drivers:
sudo apt install ubuntu-drivers-common
Check the recommended version of this computer:
ubuntu-drivers devices
Return:

The recommended driver model is nvidia-driver-470, here you need to install it according to the actual situation of your system, just change the following "470, install the driver:

sudo apt install nvidia-driver-470

Note: The Nvidia driver installs the OpenGL desktop by default, but this conflicts with the GNOME desktop. In order not to crash the system, you need to disable the OpenGL of nvidia. The Linux system generally installs the open-source nouvea graphics card driver by default, which conflicts with the nvidia graphics card driver. If you want to install nvidia, you must disable nouvea! Disable nouveau driver:

sudo gedit /etc/modprobe.d/blacklist.conf, insert at the end of the file:

blacklist nouveau

Save and run:

sudo update-initramfs -u
restart the computer after installation: sudo reboot

After restarting open a terminal:

lsmod | grep nouveau, if there is no output, nouveau is disabled

nvidia-smi

Test if the installation was successful, this will return information about all your graphics cards:

driver   : nvidia-driver-510 - distro non-free
driver   : nvidia-driver-515 - distro non-free
driver   : nvidia-driver-515-server - distro non-free
driver   : nvidia-driver-510-server - distro non-free
driver   : nvidia-driver-450-server - distro non-free
driver   : nvidia-driver-470 - distro non-free recommended
driver   : nvidia-driver-520 - distro non-free
driver   : nvidia-driver-470-server - distro non-free
driver   : xserver-xorg-video-nouveau - distro free builtin

2. Install ROS (one-click installation)

wget http://fishros.com/install -O fishros && . fishros

Enter 1; 2 (continue to install without changing the source); 1 (ROS1); n; y; y; the installation is complete

After the installation is complete, you need to initialize rosdep. The above command executes 3, and then enters

rosdepc update

Test: Open three terminals and execute the following commands respectively

roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key

Refer to: https://blog.csdn.net/jin15203846657/article/details/125849049?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_baidulandingword~default-0-125849049-blog-1235451 30. pc_relevant_3mothn_strategy_and_data_recovery&spm =1001.2101.3001.4242.1&utm_relevant_index=3

3. Ubuntu cannot enter the desktop after installing the nvidia driver (loop into the login interface)

1. Immediately after booting, press the F2 button until the Grub screen appears;

2. At this time, press the "e" key to enter the modification screen, and add "nomodeset" after "quiet splash". After the modification is completed, press F10 to let it enter Boot. It is currently measured in Ubuntu 20.04 and can enter the system once; (Note: the current modification can only allow this operation to enter the system, but after the system restarts, the screen is still black, so the current After entering the system, follow-up modification is required);

3. After entering the system, modify the following two files: /boot/grub/grub.cfg and /etc/default/grub

You can use the commands sudo gedit /boot/grub/grub.cfg and sudo gedit /etc/default/grub to open;

4. The key point of the modification is to add "nomodeset" after "quiet splash"; (If there are multiple kernels in the current Ubuntu, you can add "nomodeset" to multiple kernels;)

After opening /boot/grub/grub.cfg, do the same as above.

5. After the above modification is completed and saved, execute sudo update-grub update, then shut down and restart;

4. Uninstall ubuntu

https://www.diskgenius.cn/download.php

Delete the boot entry:

Download EasyUefi, share the link (cracked version):

Link: https://pan.baidu.com/s/1Kh3mab7qsYFZ4qTunRRRYw

Extraction code: 43sr

--Sharing from Baidu Netdisk super member V4

Five. Install python3.8

1. Install dependencies

sudo apt-get install -y  zlib1g-dev libbz2-dev libssl-dev libncurses5-dev libsqlite3-dev
分别给两个Python版本安装好pip:
sudo apt-get install python-pip
pip install --upgrade pip

sudo apt-get install python3-pip
pip3 install --upgrade pip
查看版本:
pip2 -V
pip3 -V

2. Download the source code:

wget https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tar.xz

Unzip:

tar -xvJf Python-3.8.1.tar.xz

into the file:

cd Python-3.8.1/

Create and configure the installation directory:

mkdir /usr/local/python3.8.1
./configure --prefix=/usr/local/python3.8.1

Compile and install:

make && make install may not have enough permissions to enter:

sudo -s

Modify the ubuntu soft link:

删除原来软链接:
rm -rf /usr/bin/python3
rm -rf /usr/bin/pip3
添加:
ln -s /usr/local/python3.8.1/bin/python3 /usr/bin/python3
ln -s /usr/local/python3.8.1/bin/pip3 /usr/bin/pip3
查看版本:python --version

Six: Install cuda11.4

Official website: https://developer.nvidia.com/cuda-downloads

1. Configure environment variables:

sudo runs ~/.bashrc

2. insert

export CUDA_HOME=/usr/local/cuda
export PATH=$PATH:$CUDA_HOME/bin
export LD_LIBRARY_PATH=/usr/local/cuda-11.4/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

3.nvcc -V查看版本

七.安装cudnn:

官网:https://developer.nvidia.com/rdp/cudnn-download

  1. 分别复制以下文件cuda/include/cudnn.h与cuda/lib64/libcudnn*到CUDA Toolkit目录的include/下与lib64/下(如果没有lib64就改成lib):

sudo cp cuda/include/cudnn.h /usr/local/cuda/include/  
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/  
  1. 修改访问权限:

sudo chmod a+r  /usr/local/cuda/include/cudnn.h  
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
  1. 查看cudnn版本:

cudnn8以下版本终端输入:cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
cudnn8及以上版本版本信息放到了上面指令中路径的另一个cudnn_version.h中,因此在系统中安装了8及以上版本的终端输入上一条指令没有反应,应输入如下指令:cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2

八.安装opencv,参考:https://bokai.blog.csdn.net/article/details/119133337

安装anaconda,参考:https://blog.csdn.net/KIK9973/article/details/118772450

Guess you like

Origin blog.csdn.net/weixin_64043217/article/details/128881695