ubuntu安装、配置与备份

安装源配置

  • 首先,将之前的软件源进行备份
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup 
  • 打开 Sources.list 文件,比如本人使用 vim打开,命令如下
vim /etc/apt/sources.list 
  • 打开清华镜像源官网,在搜索框中,输入
    Ubuntu,窗口紧接着会筛选出关于 Ubuntu 的链接
  • 在筛选出来的链接中,会发现链接 Ubuntu 右边有个 ?,点击它,进入如下界面
    在这里插入图片描述

ubuntu 22.04LTS

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse # # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse # deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse # 预发布软件源,不建议启用 # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse # # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse 

ubuntu 20.04LTS

# 默认注释了源码镜像以提高 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 http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse # deb-src http://security.ubuntu.com/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 

ubuntu 18.04LTS

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse # # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse deb http://security.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse # deb-src http://security.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse # 预发布软件源,不建议启用 # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse # # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse 
  • 复制输出的镜像源链接列表,然后将复制的内容全部替换 Sources.list 文件中的全部内容,保存修改
  • 最后,打开终端(在哪打开都可以),输入下列命令对软件进行刷新
sudo apt-get update 

##安装net-tools

sudo apt install net-tools ssh 

安装SSH

sudo apt-get install openssh-server 

CSI摄像头驱动

sudo apt-get update sudo apt-get install -y raspi-config git curl sudo raspi-config 
sudo apt-get install -y v4l-utils 
vcgencmd get_camera 

如果返回“supported=1 detected=1”,则表示摄像头已被识别。

使用mplayer播放(推荐)

mplayer tv:// -tv driver=v4l2:device=/dev/video0:input=0:outfmt=bgr24:width=640:height=480:fps=25 -vo x11 

#查看video设备

ls -l /dev/video* 

使用VLC播放

sudo apt-get install -y vlc vlc v4l2:///dev/video0 

文件(夹)权限修改

sudo chmod -R 777 dir 

输入以下命令,以查看外部存储设备的名称:

sudo fdisk -l 

例如,如果你的磁盘和分区信息如下:

系统所在的SD卡磁盘分区
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 * 2048 526335 524288 256M c W95 FAT32 (LBA)
/dev/mmcblk0p2 526336 60526558 60000223 28.6G 83 Linux

另一个SD卡
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 31129599 31127552 14.8G 7 HPFS/NTFS/exFAT

挂载另一个SD卡

sudo mount /dev/sda1 /mnt/usb1

将备份保存在您的主目录中,则可以使用以下命令:

sudo dd if=/dev/mmcblk0 bs=1M | gzip -c > ~/ubuntu_backup.img.gz #只备份SD卡中实际使用的空间,而不是整个SD卡 

将备份保存在另一个SD卡或U盘中,则可以使用以下命令:

sudo dd if=/dev/mmcblk0 bs=1M | gzip -c > /mnt/usb1/ubuntu_backup.img.gz #只备份SD卡中实际使用的空间,而不是整个SD卡 
sudo dd if=/dev/mmcblk0 of=/mnt/usb1/ubuntu_backup.img bs=1M #备份整个SD卡到另一个SD卡上(不推荐) 

注意:放备份文件的SD卡或U盘的文件系统类型为exFAT或NTFS,FAT32文件系统最大文件大小限制为4GB,备份文件大小只能在这个限制内。

原文链接:https://blog.csdn.net/qq_18677445/article/details/130806214

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享