• 1-ubuntu基础——换源第一步


    1、换源第一步

    安装好ubuntu操作系统之后的第一步就是换源!!!

    由于墙的原因,后续我们需要使用各种命令去下载东西,为了下载方便,这里我们提前换源。

    1.1 备份系统默认源

    第一个参数时拷贝的文件路径和文件名称,第二个是拷贝到(粘贴)的文件路径和文件名

    sudo cp /etc/apt/sources.list /etc/apt/sources.bak1
    
    • 1

    1.2 使用gedit编辑文件换源

    由于还没有换源,加上系统可能没有vim软件,这个时候我们可以用ubuntu自带的gedit编辑器打开,然后江sources.list文件里的内容清空,再复制相应的国内源进去。

    gedit 编辑器打开代码:

    sudo gedit /etc/apt/sources.list
    
    • 1

    这个时候我们可以从网上找到相应的国内源,如常见的是阿里源、清华源、中科大源,这里我给出阿里源,我自己使用的:

    #添加阿里源
    deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    注意!!!!
    上面的源也是有区分的,我也是后面报错了才知道。可以看到,上面的的源都有一个叫做focal的单词,这取决于你的系统是focal还是bionic,去网上找一下,有相应的命令。
    还有的源是bionic:

    #阿里源
    deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    sudo apt-get update
    #这个命令,会访问源列表里的每个网址,并读取软件列表,然后保存在本地电脑。我们在新立得软件包管理器里看到的软件列表,都是通过update命令更新的。
    
    sudo apt-get upgrade
    #这个命令,会把本地已安装的软件,与刚下载的软件列表里对应软件进行对比,如果发现已安装的软件版本太低,就会提示你更新。如果你的软件都是最新版本,会提示:
      		#升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    上面如果没用报错【E,W】开头啥的错误的话,就表示换源成功,此时可以好好安装。

  • 相关阅读:
    kivy教程之在 Kivy 中支持中文以构建跨平台应用程序(教程含源码)
    Android 弹幕功能实现
    web前端-javascript-function函数(函数说明,创建和调用函数,其他方法函数声明创建函数、函数表达式创建函数)
    小鹏汽车的“未来”故事有点性感
    PowerBI_一分钟了解POWERBI计算组_基础运用篇(环同比分析)
    pandas使用isin函数和any函数筛选dataframe数据中所有数据列中至少有一列包含指定数值的数据行(in any of the columns)
    八、自定义映射resultMap
    如何在CentOS7上搭建自己的GitLab仓库
    Stable Diffusion webui 常用启动参数
    LeetCode 48. 旋转图像
  • 原文地址:https://blog.csdn.net/qq_41286751/article/details/125540832