Ubuntu 介绍

Ubuntu(友帮拓、优般图、乌班图)是一个以桌面应用为主的开源 GNU/Linux 操作系统,Ubuntu 是基于 GNU/Linux, 支持 x86、amd64(即 x64)和 ppc 架构,由全球化的专业开发团队(Canonical Ltd)打造的。
专业的 Python 开发者一般会选择 Ubuntu 这款 Linux 系统作为生产平台.
温馨提示:Ubuntu 和 Centos 都是基于 GNU/Linux 内核的,因此基本使用和Centos 是几乎一样的,它们的各种指令可以通用,同学们在学习和使用 Ubuntu 的过程中,会发现各种操作指令在前面学习CentOS 都使用过。只是界面和预安装的软件有所差别。
Ubuntu 下载地址:http://cn.ubuntu.com/download/
image.png

安装Ubuntu

image.png

设置中文

  1. 默认安装的 ubuntu 中只有英文语言,因此是不能显示汉字的。要正确显示汉字,需要安装中文语言包。安装中文支持步骤:单击左侧图标栏打开 Language Support 菜单,点击打开 Language Support(语言支持)选项卡。
  2. 点击 Install / Remove Languages,在弹出的选项卡中下拉找到 Chinese(Simplified),即中文简体,在后面的选项框中打勾。然后点击 Apply Changes 提交,系统会自动联网下载中文语言包。(保证 ubuntu 是联网的)。
  3. 这时“汉语(中国)”在最后一位因为当前第一位是”English”,所以默认显示都是英文。我们如果希望默认显示 用中文,则应该将“汉语(中国)”设置为第一位。设置方法是拖动,鼠标单击“汉语(中国)”,当底色变化(表 示选中了)后,按住鼠标左键不松手,向上拖动放置到第一位。
  4. 设置后不会即刻生效,需要下一次登录时才会生效

image.png

Ubuntu 的 root 用户

介绍

安装 ubuntu 成功后,都是普通用户权限,并没有最高 root 权限,如果需要使用 root 权限的时候,通常都会在命令前面加上 sudo 。有的时候感觉很麻烦。
我们一般使用 su 命令来直接切换到 root 用户的,但是如果没有给 root 设置初始密码,就会抛出 su : Authentication failure 这样的问题。所以,我们只要给 root 用户设置一个初始密码就好了。

给root 用户设置密码并使用

  1. 输入 sudo passwd 命令,设定 root 用户密码。
  2. 设定 root 密码成功后,输入 su 命令,并输入刚才设定的 root 密码,就可以切换成 root 了。
  3. 提示符$代表一般用户, 提示符#代表 root 用户。以后就可以使用 root 用户了
  4. 输入 exit 命令,退出 root 并返回一般用户
    1. wenchang@ubuntu:~/Desktop$ sudo passwd
    2. 新的 密码:
    3. 重新输入新的 密码:
    4. passwd:已成功更新密码
    5. wenchang@ubuntu:~/Desktop$ su root
    6. 密码:
    7. root@ubuntu:/home/wenchang/Desktop# exit
    8. exit
    9. wenchang@ubuntu:~/Desktop$

    Ubuntu 下开发Python

    说明

    安装好 Ubuntu 后,默认就已经安装好 Python 的开发环境。
    image.png

    在Ubuntu 下开发一个 Python 程序

    1. wenchang@ubuntu:~/Desktop$ vim hello.py
    2. wenchang@ubuntu:~/Desktop$ cat hello.py
    3. print("hello,python")
    4. wenchang@ubuntu:~/Desktop$ python3 hello.py
    5. hello,python

    APT 软件管理

    apt 介绍

    apt 是 Advanced Packaging Tool 的简称,是一款安装包管理工具。在 Ubuntu 下,我们可以使用 apt 命令进行软件包的安装、删除、清理等,类似于 Windows 中的软件管理工具。
    apt-cache和apt-get是apt包的管理工具,他们根据/etc/apt/sources.list里的软件源地址列表搜索目标软件、并通过维护本地软件包列表来安装和卸载软件。

    Ubuntu 软件操作的相关命令

    ```shell 1.搜索软件 sudo apt-cache search package_name 其中还可以使用正则表达式 sudo apt-cache search sof* 这样就可以搜索到源上面所有以sof开头的软件包。

2.查看软件包信息 sudo apt-cache show package_name

3.查看软件包依赖关系 sudo apt-cache show depends package_name

4.查看每个软件包的简要信息 sudo apt-cache dump

5.安装软件 sudo apt-get install package_name

6.更新已安装的软件包 sudo apt-get upgrade

7.更新软件包列表 sudo apt-get update

8.卸载一个软件包但是保留相关的配置文件 sudo apt-get remove package_name

9.卸载一个软件包同时删除配置文件 apt-get -purge remove package_name

10.删除软件包的备份 apt-get clean

  1. <a name="AD4Bt"></a>
  2. ## 更新 Ubuntu 软件下载地址
  3. <a name="zWQSK"></a>
  4. ### 原理介绍
  5. Ubuntu自带包管理器apt,但是由于众所周知的原因,国内通过apt默认的源下载/更新软件相当慢。更换apt使用国内的镜像源可以使更新更快更稳定,这是Ubuntu换源最主要的目的。
  6. <a name="kRc9x"></a>
  7. ### 寻找国内镜像源
  8. [清华大学开源软件镜像站: https://mirrors.tuna.tsinghua.edu.cn/](https://mirrors.tuna.tsinghua.edu.cn/)<br />所谓的镜像源:可以理解为提供下载软件的地方,比如 Android 手机上可以下载软件的安卓市场;iOS 手机上可以下载软件的 AppStore<br />![image.png](https://cdn.nlark.com/yuque/0/2022/png/2608713/1642736206285-3a14ce6a-1179-4a90-8dc9-f60681815898.png#clientId=u8076309e-2011-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=414&id=ud802cf02&margin=%5Bobject%20Object%5D&name=image.png&originHeight=518&originWidth=1041&originalType=binary&ratio=1&rotation=0&showTitle=false&size=61570&status=done&style=none&taskId=ue9409455-db08-404f-a2fb-8d66742d11f&title=&width=832.8)<br />![image.png](https://cdn.nlark.com/yuque/0/2022/png/2608713/1642736217107-728aedf3-862a-4425-accc-94663f112c4a.png#clientId=u8076309e-2011-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=722&id=uad5e1c85&margin=%5Bobject%20Object%5D&name=image.png&originHeight=902&originWidth=1920&originalType=binary&ratio=1&rotation=0&showTitle=false&size=151097&status=done&style=none&taskId=u3972e18a-c210-4805-88d7-1e28710a2ae&title=&width=1536)
  9. ```shell
  10. # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
  11. deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
  12. # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
  13. deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
  14. # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
  15. deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
  16. # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
  17. deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
  18. # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
  19. # 预发布软件源,不建议启用
  20. # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
  21. # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse

备份Ubuntu 默认的源地址

  1. wenchang@ubuntu:~/Desktop$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
  2. wenchang@ubuntu:~/Desktop$ cd /etc/apt/
  3. wenchang@ubuntu:/etc/apt$ ll
  4. 总用量 48
  5. drwxr-xr-x 7 root root 4096 Jan 21 11:41 ./
  6. drwxr-xr-x 130 root root 12288 Jan 21 11:41 ../
  7. drwxr-xr-x 2 root root 4096 Jan 21 11:21 apt.conf.d/
  8. drwxr-xr-x 2 root root 4096 Apr 9 2020 auth.conf.d/
  9. drwxr-xr-x 2 root root 4096 Apr 9 2020 preferences.d/
  10. -rw-r--r-- 1 root root 3158 Jan 20 17:26 sources.bak
  11. -rw-rw-r-- 1 root root 3158 Jan 20 17:27 sources.list
  12. -rw-r--r-- 1 root root 3158 Jan 21 11:41 sources.list.backup
  13. drwxr-xr-x 2 root root 4096 Apr 9 2020 sources.list.d/
  14. drwxr-xr-x 2 root root 4096 Aug 1 2020 trusted.gpg.d/
  15. wenchang@ubuntu:/etc/apt$ cat sources.list
  16. #deb cdrom:[Ubuntu 20.04.1 LTS _Focal Fossa_ - Release amd64 (20200731)]/ focal main restricted
  17. # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
  18. # newer versions of the distribution.
  19. deb http://us.archive.ubuntu.com/ubuntu/ focal main restricted
  20. # deb-src http://us.archive.ubuntu.com/ubuntu/ focal main restricted
  21. ## Major bug fix updates produced after the final release of the
  22. ## distribution.
  23. deb http://us.archive.ubuntu.com/ubuntu/ focal-updates main restricted
  24. # deb-src http://us.archive.ubuntu.com/ubuntu/ focal-updates main restricted
  25. ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
  26. ## team. Also, please note that software in universe WILL NOT receive any
  27. ## review or updates from the Ubuntu security team.
  28. deb http://us.archive.ubuntu.com/ubuntu/ focal universe
  29. # deb-src http://us.archive.ubuntu.com/ubuntu/ focal universe
  30. deb http://us.archive.ubuntu.com/ubuntu/ focal-updates universe
  31. # deb-src http://us.archive.ubuntu.com/ubuntu/ focal-updates universe
  32. ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
  33. ## team, and may not be under a free licence. Please satisfy yourself as to
  34. ## your rights to use the software. Also, please note that software in
  35. ## multiverse WILL NOT receive any review or updates from the Ubuntu
  36. ## security team.
  37. deb http://us.archive.ubuntu.com/ubuntu/ focal multiverse
  38. # deb-src http://us.archive.ubuntu.com/ubuntu/ focal multiverse
  39. deb http://us.archive.ubuntu.com/ubuntu/ focal-updates multiverse
  40. # deb-src http://us.archive.ubuntu.com/ubuntu/ focal-updates multiverse
  41. ## N.B. software from this repository may not have been tested as
  42. ## extensively as that contained in the main release, although it includes
  43. ## newer versions of some applications which may provide useful features.
  44. ## Also, please note that software in backports WILL NOT receive any review
  45. ## or updates from the Ubuntu security team.
  46. deb http://us.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
  47. # deb-src http://us.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
  48. ## Uncomment the following two lines to add software from Canonical's
  49. ## 'partner' repository.
  50. ## This software is not part of Ubuntu, but is offered by Canonical and the
  51. ## respective vendors as a service to Ubuntu users.
  52. # deb http://archive.canonical.com/ubuntu focal partner
  53. # deb-src http://archive.canonical.com/ubuntu focal partner
  54. deb http://security.ubuntu.com/ubuntu focal-security main restricted
  55. # deb-src http://security.ubuntu.com/ubuntu focal-security main restricted
  56. deb http://security.ubuntu.com/ubuntu focal-security universe
  57. # deb-src http://security.ubuntu.com/ubuntu focal-security universe
  58. deb http://security.ubuntu.com/ubuntu focal-security multiverse
  59. # deb-src http://security.ubuntu.com/ubuntu focal-security multiverse
  60. # This system was installed using small removable media
  61. # (e.g. netinst, live or single CD). The matching "deb cdrom"
  62. # entries were disabled at the end of the installation process.
  63. # For information about how to configure apt package sources,
  64. # see the sources.list(5) manual.
  65. wenchang@ubuntu:/etc/apt$

更新源服务器列表

  1. #先清空 sources.list 文件
  2. wenchang@ubuntu:/etc/apt$ su
  3. 密码:
  4. root@ubuntu:/etc/apt# echo '' > sources.list
  5. root@ubuntu:/etc/apt# cat sources.list
  6. #复制镜像网站的地址,拷贝到 sources.list 文件
  7. root@ubuntu:/etc/apt# vim sources.list
  8. root@ubuntu:/etc/apt# cat sources.list
  9. # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
  10. deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
  11. # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
  12. deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
  13. # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
  14. deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
  15. # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
  16. deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
  17. # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
  18. # 预发布软件源,不建议启用
  19. # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
  20. # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
  21. #更新源地址
  22. root@ubuntu:/etc/apt# sudo apt-get update
  23. 获取:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal InRelease [265 kB]
  24. 获取:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates InRelease [114 kB]
  25. 获取:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports InRelease [108 kB]
  26. 获取:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security InRelease [114 kB]
  27. 获取:5 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 Packages [970 kB]
  28. 获取:6 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main i386 Packages [718 kB]
  29. 获取:7 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main Translation-zh_CN [113 kB]
  30. 获取:8 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main Translation-en [506 kB]
  31. 获取:9 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 DEP-11 Metadata [494 kB]
  32. 获取:10 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main DEP-11 48x48 Icons [98.4 kB]
  33. 获取:11 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main DEP-11 64x64 Icons [163 kB]
  34. 获取:12 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main DEP-11 64x64@2 Icons [15.8 kB]
  35. 获取:13 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 c-n-f Metadata [29.5 kB]
  36. 获取:14 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/restricted amd64 Packages [22.0 kB]
  37. 获取:15 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/restricted i386 Packages [8,112 B]
  38. 获取:16 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/restricted Translation-zh_CN [1,324 B]
  39. 获取:17 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/restricted Translation-en [6,212 B]
  40. 获取:18 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/restricted amd64 c-n-f Metadata [392 B]
  41. 获取:19 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe i386 Packages [4,642 kB]
  42. 获取:20 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe amd64 Packages [8,628 kB]
  43. 获取:21 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe Translation-zh_CN [388 kB]
  44. 获取:22 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe Translation-en [5,124 kB]
  45. 获取:23 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe amd64 DEP-11 Metadata [3,603 kB]
  46. 获取:24 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe DEP-11 48x48 Icons [3,016 kB]
  47. 获取:25 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe DEP-11 64x64 Icons [7,794 kB]
  48. 获取:26 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe DEP-11 64x64@2 Icons [44.3 kB]
  49. 获取:27 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe amd64 c-n-f Metadata [265 kB]
  50. 获取:28 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/multiverse amd64 Packages [144 kB]
  51. 获取:29 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/multiverse i386 Packages [74.7 kB]
  52. 获取:30 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/multiverse Translation-en [104 kB]
  53. 获取:31 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/multiverse Translation-zh_CN [4,612 B]
  54. 获取:32 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/multiverse amd64 DEP-11 Metadata [48.4 kB]
  55. 获取:33 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/multiverse DEP-11 48x48 Icons [23.1 kB]
  56. 获取:34 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/multiverse DEP-11 64x64 Icons [192 kB]
  57. 获取:35 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/multiverse DEP-11 64x64@2 Icons [214 B]
  58. 获取:36 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/multiverse amd64 c-n-f Metadata [9,136 B]
  59. 获取:37 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main i386 Packages [591 kB]
  60. 获取:38 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 Packages [1,509 kB]
  61. 获取:39 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main Translation-en [296 kB]
  62. 获取:40 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 DEP-11 Metadata [280 kB]
  63. 获取:41 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main DEP-11 48x48 Icons [60.8 kB]
  64. 获取:42 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main DEP-11 64x64 Icons [98.3 kB]
  65. 获取:43 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main DEP-11 64x64@2 Icons [29 B]
  66. 获取:44 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 c-n-f Metadata [14.7 kB]
  67. 获取:45 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/restricted i386 Packages [21.8 kB]
  68. 获取:46 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/restricted amd64 Packages [736 kB]
  69. 获取:47 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/restricted Translation-en [105 kB]
  70. 获取:48 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/restricted amd64 c-n-f Metadata [532 B]
  71. 获取:49 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe i386 Packages [663 kB]
  72. 获取:50 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 Packages [893 kB]
  73. 获取:51 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe Translation-en [196 kB]
  74. 获取:52 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 DEP-11 Metadata [364 kB]
  75. 获取:53 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe DEP-11 48x48 Icons [220 kB]
  76. 获取:54 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe DEP-11 64x64 Icons [394 kB]
  77. 获取:55 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe DEP-11 64x64@2 Icons [29 B]
  78. 获取:56 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 c-n-f Metadata [20.0 kB]
  79. 获取:57 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/multiverse i386 Packages [8,432 B]
  80. 获取:58 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/multiverse amd64 Packages [24.8 kB]
  81. 获取:59 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/multiverse Translation-en [6,928 B]
  82. 获取:60 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/multiverse amd64 DEP-11 Metadata [940 B]
  83. 获取:61 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/multiverse DEP-11 48x48 Icons [1,865 B]
  84. 获取:62 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/multiverse DEP-11 64x64 Icons [2,498 B]
  85. 获取:63 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/multiverse DEP-11 64x64@2 Icons [29 B]
  86. 获取:64 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/multiverse amd64 c-n-f Metadata [620 B]
  87. 获取:65 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/main amd64 Packages [42.0 kB]
  88. 获取:66 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/main i386 Packages [34.5 kB]
  89. 获取:67 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/main Translation-en [10.0 kB]
  90. 获取:68 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/main amd64 DEP-11 Metadata [7,984 B]
  91. 获取:69 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/main DEP-11 48x48 Icons [6,977 B]
  92. 获取:70 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/main DEP-11 64x64 Icons [10.5 kB]
  93. 获取:71 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/main DEP-11 64x64@2 Icons [29 B]
  94. 获取:72 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/main amd64 c-n-f Metadata [864 B]
  95. 获取:73 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/restricted amd64 c-n-f Metadata [116 B]
  96. 获取:74 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/universe amd64 Packages [19.5 kB]
  97. 获取:75 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/universe i386 Packages [11.1 kB]
  98. 获取:76 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/universe Translation-en [13.4 kB]
  99. 获取:77 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/universe amd64 DEP-11 Metadata [11.3 kB]
  100. 获取:78 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/universe DEP-11 48x48 Icons [4,959 B]
  101. 获取:79 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/universe DEP-11 64x64 Icons [8,416 B]
  102. 获取:80 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/universe DEP-11 64x64@2 Icons [29 B]
  103. 获取:81 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/universe amd64 c-n-f Metadata [672 B]
  104. 获取:82 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports/multiverse amd64 c-n-f Metadata [116 B]
  105. 获取:83 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/main amd64 Packages [1,177 kB]
  106. 获取:84 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/main i386 Packages [362 kB]
  107. 获取:85 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/main Translation-en [210 kB]
  108. 获取:86 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/main amd64 DEP-11 Metadata [38.2 kB]
  109. 获取:87 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/main DEP-11 48x48 Icons [18.3 kB]
  110. 获取:88 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/main DEP-11 64x64 Icons [35.5 kB]
  111. 获取:89 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/main DEP-11 64x64@2 Icons [29 B]
  112. 获取:90 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/main amd64 c-n-f Metadata [9,132 B]
  113. 获取:91 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/restricted i386 Packages [20.5 kB]
  114. 获取:92 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/restricted amd64 Packages [686 kB]
  115. 获取:93 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/restricted Translation-en [97.9 kB]
  116. 获取:94 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/restricted amd64 c-n-f Metadata [536 B]
  117. 获取:95 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/universe amd64 Packages [676 kB]
  118. 获取:96 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/universe i386 Packages [532 kB]
  119. 获取:97 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/universe Translation-en [115 kB]
  120. 获取:98 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/universe amd64 DEP-11 Metadata [66.2 kB]
  121. 获取:99 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/universe DEP-11 48x48 Icons [31.6 kB]
  122. 获取:100 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/universe DEP-11 64x64 Icons [70.3 kB]
  123. 获取:101 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/universe DEP-11 64x64@2 Icons [29 B]
  124. 获取:102 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/universe amd64 c-n-f Metadata [13.0 kB]
  125. 获取:103 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/multiverse i386 Packages [7,176 B]
  126. 获取:104 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/multiverse amd64 Packages [21.8 kB]
  127. 获取:105 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/multiverse Translation-en [4,948 B]
  128. 获取:106 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [2,464 B]
  129. 获取:107 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/multiverse DEP-11 48x48 Icons [29 B]
  130. 获取:108 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/multiverse DEP-11 64x64 Icons [2,638 B]
  131. 获取:109 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/multiverse DEP-11 64x64@2 Icons [29 B]
  132. 获取:110 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/multiverse amd64 c-n-f Metadata [536 B]
  133. 已下载 48.7 MB,耗时 14 (3,527 kB/s)
  134. 正在读取软件包列表... 完成
  135. root@ubuntu:/etc/apt#

Ubuntu 软件安装,卸载

使用 apt 完成安装和卸载 vim 软件,并查询 vim 软件的信息

  1. wenchang@ubuntu:/etc/apt$ sudo apt-get remove vim
  2. 正在读取软件包列表... 完成
  3. 正在分析软件包的依赖关系树
  4. 正在读取状态信息... 完成
  5. 下列软件包是自动安装的并且现在不需要了:
  6. vim-runtime
  7. 使用'sudo apt autoremove'来卸载它(它们)。
  8. 下列软件包将被【卸载】:
  9. vim
  10. 升级了 0 个软件包,新安装了 0 个软件包,要卸载 1 个软件包,有 271 个软件包未被升级。
  11. 解压缩后将会空出 3,111 kB 的空间。
  12. 您希望继续执行吗? [Y/n] y
  13. (正在读取数据库 ... 系统当前共安装有 187415 个文件和目录。)
  14. 正在卸载 vim (2:8.1.2269-1ubuntu5.4) ...
  15. update-alternatives: 使用 /usr/bin/vim.tiny 来在自动模式中提供 /usr/bin/vi (vi)
  16. update-alternatives: 使用 /usr/bin/vim.tiny 来在自动模式中提供 /usr/bin/view (view)
  17. update-alternatives: 使用 /usr/bin/vim.tiny 来在自动模式中提供 /usr/bin/ex (ex)
  18. update-alternatives: 使用 /usr/bin/vim.tiny 来在自动模式中提供 /usr/bin/rview (rview)
  19. wenchang@ubuntu:/etc/apt$ sudo apt-cache search vim
  20. exuberant-ctags - build tag file indexes of source code definitions
  21. tmux - terminal multiplexer
  22. vim - Vi 增强版 - 增强的 vi 编辑器
  23. vim-common - Vi IMproved - 共用文件
  24. vim-doc - Vi IMproved - HTML documentation
  25. vim-runtime - Vi IMproved - Runtime files
  26. vim-tiny - Vi IMproved - enhanced vi editor - compact version
  27. acr - autoconf like tool
  28. alot - Text mode MUA using notmuch mail
  29. alot-doc - Text mode MUA using notmuch mail - documentation
  30. biosyntax-vim - Syntax Highlighting for Computational Biology (vim)
  31. cernlib-base - CERNLIB data analysis suite - common files
  32. clang-format-10 - Tool to format C/C++/Obj-C code
  33. clang-format-6.0 - Tool to format C/C++/Obj-C code
  34. clang-format-7 - Tool to format C/C++/Obj-C code
  35. clang-format-8 - Tool to format C/C++/Obj-C code
  36. clang-format-9 - Tool to format C/C++/Obj-C code
  37. colordiff - tool to colorize 'diff' output
  38. context-modules - additional ConTeXt modules
  39. copyq - Advanced clipboard manager with editing and scripting features
  40. copyq-plugins - Plugins for CopyQ
  41. cpl-plugin-vimos - ESO data reduction pipeline for the VIMOS instrument
  42. cpl-plugin-vimos-calib - ESO data reduction pipeline calibration data downloader for VIMOS
  43. cpl-plugin-vimos-doc - ESO data reduction pipeline documentation for VIMOS
  44. cream - VIM macros that make the VIM easier to use for beginners
  45. dh-vim-addon - debhelper addon to help package Vim/Neovim addons
  46. ejabberd-mod-shcommands - execute shell commands via XMPP (dangerous!)
  47. elpa-anzu - show number of matches in mode-line while searching
  48. elpa-bind-map - bind personal keymaps in multiple locations
  49. elpa-color-theme-modern - deftheme reimplementation of classic Emacs color-themes
  50. elpa-evil - extensible vi layer for Emacs
  51. elpa-neotree - directory tree sidebar for Emacs that is like NERDTree for Vim
  52. elpa-powerline - Emacs version of the Vim powerline
  53. elpa-smeargle - highlight region by last updated time
  54. elpa-solarized-theme - port of Solarized theme to Emacs
  55. elpa-vimish-fold - fold text in GNU Emacs like in Vim
  56. elpa-zenburn-theme - low contrast color theme for Emacs
  57. elvis-tiny - Tiny vi compatible editor for the base system
  58. env2 - convert environment variables between scripting languages
  59. fim - scriptable frame buffer, X.org and ascii art image viewer
  60. findent - indents/converts Fortran sources
  61. fonts-powerline - prompt and statusline utility (symbols font)
  62. formiko - reStructuredText and MarkDown editor and live previewer
  63. geany-plugin-vimode - Vim-mode plugin for Geany
  64. get-flash-videos - video downloader for various Flash-based video hosting sites
  65. global - Source code search and browse tools
  66. glogg - Smart interactive log explorer using Qt
  67. golang-github-vimeo-go-magic-dev - Go bindings for libmagic
  68. gramadoir - Irish language grammar checker (integration scripts)
  69. grilo-plugins-0.3-extra - Framework for discovering and browsing media - Extra Plugins
  70. hothasktags - Haskell ctags generator
  71. imediff - interactive full screen 2/3-way merge tool
  72. kakoune - Vim-inspired, selection-oriented code editor
  73. libghc-pandoc-dev - general markup converter - libraries
  74. libghc-pandoc-doc - general markup converter - library documentation
  75. libghc-pandoc-prof - general markup converter - profiling libraries
  76. libghc-yi-keymap-vim-dev - Vim keymap for Yi editor
  77. libghc-yi-keymap-vim-doc - Vim keymap for Yi editor; documentation
  78. libghc-yi-keymap-vim-prof - Vim keymap for Yi editor; profiling libraries
  79. libjs-xterm - terminal front-end component for the browser - browser library
  80. liblatex-table-perl - Perl extension for the automatic generation of LaTeX tables
  81. libocp-indent-ocaml - OCaml indentation tool for emacs and vim - libraries
  82. libocp-indent-ocaml-dev - OCaml indentation tool for emacs and vim - development libraries
  83. libtext-findindent-perl - module to heuristically determine indentation style
  84. libvi-quickfix-perl - Perl support for vim's QuickFix mode
  85. linuxdoc-tools - convert LinuxDoc SGML source into other formats
  86. lua-nvim - Lua client for Neovim
  87. lua-nvim-dev - Lua client for Neovim
  88. movim - decentralised social network fully based on XMPP
  89. neovim - heavily refactored vim fork
  90. neovim-qt - neovim client library and GUI
  91. neovim-runtime - heavily refactored vim fork (runtime files)
  92. nescc - Programming Language for Deeply Networked Systems
  93. netrik - text mode WWW browser with vi like keybindings
  94. node-xterm - terminal front-end component for the browser - NodeJS modules
  95. notmuch-vim - thread-based email index, search and tagging (vim interface)
  96. ocaml-tools - tools for OCaml developers
  97. ocp-indent - OCaml indentation tool for emacs and vim - runtime
  98. otags - tags file generator for OCaml
  99. pacvim - pacman game concept with vim command
  100. pandoc - general markup converter
  101. pandoc-data - general markup converter - data files
  102. php-embed - Get info from any web service or page
  103. pms - Practical Music Search, an MPD client
  104. powerline - prompt and statusline utility
  105. powerline-doc - prompt and statusline utility (documentation)
  106. powerline-gitstatus - Powerline Git segment
  107. pqiv - Powerful image viewer with minimal UI
  108. python-django-allauth-doc - Django app for local and social authentication (Documentation)
  109. python3-django-allauth - Django app for local and social authentication (Python 3 version)
  110. python3-editor - programmatically open an editor, capture the result - Python 3.x
  111. python3-neovim - transitional dummy package
  112. python3-powerline - prompt and statusline utility (Python 3.x module)
  113. python3-powerline-gitstatus - Powerline Git segment for Python (3.x)
  114. python3-pynvim - Python3 library for scripting Neovim processes through its msgpack-rpc API
  115. python3-searx - Privacy-respecting metasearch engine - library package
  116. qutebrowser - Keyboard-driven, vim-like browser based on PyQt5
  117. qutebrowser-qtwebengine - QtWebEngine backend dependency package for qutebrowser
  118. qutebrowser-qtwebkit - QtWebKit backend dependency package for qutebrowser
  119. ruby-ace-rails-ap - ajax.org Cloud9 Editor (Ace) for the Rails asset pipeline
  120. ruby-fuubar - instafailing RSpec progress bar formatter
  121. ruby-neovim - Ruby client for Neovim
  122. searx - Privacy-respecting metasearch engine
  123. sen - Terminal user interface for docker engine
  124. sisu - documents - structuring, publishing in multiple formats and search
  125. supercollider-vim - SuperCollider mode for Vim
  126. tpp - text presentation program
  127. txt2regex - A Regular Expression "wizard", all written with bash2 builtins
  128. vcsh - Version Control System for $HOME - multiple Git repositories in $HOME
  129. vifm - flexible vi-like file manager using ncurses
  130. vim-addon-manager - manager of addons for the Vim editor
  131. vim-addon-mw-utils - Vim funcref library
  132. vim-airline - Lean & mean status/tabline for vim that's light as air
  133. vim-airline-themes - official theme collection for vim-airline
  134. vim-athena - Vi IMproved - enhanced vi editor - with Athena GUI
  135. vim-autopep8 - vim plugin to apply autopep8
  136. vim-bitbake - Vim plugin to interact with Yocto bitbake-based recipes
  137. vim-command-t - open files with a minimum number of keystrokes
  138. vim-ctrlp - fuzzy file, buffer, mru, tag, etc. finder for Vim
  139. vim-editorconfig - EditorConfig Plugin for Vim
  140. vim-fugitive - Vim plugin to work with Git
  141. vim-gocomplete - gocode integration for Vim
  142. vim-gtk - Vi IMproved - enhanced vi editor (dummy package)
  143. vim-gtk3 - Vi IMproved - enhanced vi editor - with GTK3 GUI
  144. vim-gui-common - Vi IMproved - Common GUI files
  145. vim-haproxy - syntax highlighting for HAProxy configuration files
  146. vim-icinga2 - syntax highlighting for Icinga 2 config files in VIM
  147. vim-julia - Vim support for Julia language
  148. vim-khuno - Python flakes Vim plugin
  149. vim-lastplace - Vim script to reopen files at your last edit position
  150. vim-latexsuite - view, edit and compile LaTeX documents from within Vim
  151. vim-ledger - Vim plugin for Ledger
  152. vim-migemo - VIM plugin for C/Migemo
  153. vim-nox - Vi IMproved - enhanced vi editor - with scripting languages support
  154. vim-pathogen - Manage your runtimepath with ease
  155. vim-puppet - syntax highlighting for puppet manifests in vim
  156. vim-python-jedi - autocompletion tool for Python - VIM addon files
  157. vim-rails - vim development tools for Rails development
  158. vim-scripts - plugins for vim, adding bells and whistles
  159. vim-snippets - Snippets files for various programming languages.
  160. vim-syntastic - Syntax checking hacks for vim
  161. vim-syntax-docker - Docker container engine - Vim highlighting syntax files
  162. vim-syntax-gtk - Syntax files to highlight GTK+ keywords in vim
  163. vim-tabular - Vim script for text filtering and alignment
  164. vim-textobj-user - Vim plugin for user-defined text objects
  165. vim-tjp - vim addon for TaskJuggler .tjp files
  166. vim-tlib - Some vim utility functions
  167. vim-ultisnips - snippet solution for Vim
  168. vim-vimerl - Erlang plugin for Vim
  169. vim-vimerl-syntax - Erlang syntax for Vim
  170. vim-voom - Vim two-pane outliner
  171. vim-youcompleteme - fast, as-you-type, fuzzy-search code completion engine for Vim
  172. vis - Modern, legacy free, simple yet efficient vim-like editor
  173. vit - full-screen terminal interface for Taskwarrior
  174. youtube-dl - downloader of videos from YouTube and other sites
  175. zathura - document viewer with a minimalistic interface
  176. zathura-cb - comic book archive support for zathura
  177. zathura-djvu - DjVu support for zathura
  178. zathura-pdf-poppler - PDF support for zathura
  179. zathura-ps - PostScript support for zathura
  180. zeal - Simple offline API documentation browser
  181. zsh-antigen - manage your zsh plugins
  182. apvlv - 类似于 Vim PDF 阅读器
  183. bleachbit - 清除系统中不需要的文件
  184. kdesdk-scripts - scripts and data files for development
  185. nvi - 4.4BSD 中的 vi 实现版本
  186. nvi-doc - 4.4BSD re-implementation of vi - documentation files
  187. openshot-qt - create and edit videos and movies
  188. vim-asciidoc - Vim syntax highlighting files for asciidoc
  189. vim-snipmate - Vim script that implements some of TextMate's snippets features.
  190. u-boot-tools - companion tools for Das U-Boot bootloader
  191. clang-format-11 - Tool to format C/C++/Obj-C code
  192. clang-format-12 - Tool to format C/C++/Obj-C code
  193. yt-dlp - downloader of videos from YouTube and other sites
  194. wenchang@ubuntu:/etc/apt$ sudo apt-get install vim
  195. 正在读取软件包列表... 完成
  196. 正在分析软件包的依赖关系树
  197. 正在读取状态信息... 完成
  198. 建议安装:
  199. ctags vim-doc vim-scripts
  200. 下列【新】软件包将被安装:
  201. vim
  202. 升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 271 个软件包未被升级。
  203. 需要下载 1,239 kB 的归档。
  204. 解压缩后会消耗 3,111 kB 的额外空间。
  205. 获取:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 vim amd64 2:8.1.2269-1ubuntu5.4 [1,239 kB]
  206. 已下载 1,239 kB,耗时 2秒 (798 kB/s)
  207. 正在选中未选择的软件包 vim。
  208. (正在读取数据库 ... 系统当前共安装有 187406 个文件和目录。)
  209. 准备解压 .../vim_2%3a8.1.2269-1ubuntu5.4_amd64.deb ...
  210. 正在解压 vim (2:8.1.2269-1ubuntu5.4) ...
  211. 正在设置 vim (2:8.1.2269-1ubuntu5.4) ...
  212. update-alternatives: 使用 /usr/bin/vim.basic 来在自动模式中提供 /usr/bin/vim (vim)
  213. update-alternatives: 使用 /usr/bin/vim.basic 来在自动模式中提供 /usr/bin/vimdiff (vimdiff)
  214. update-alternatives: 使用 /usr/bin/vim.basic 来在自动模式中提供 /usr/bin/rvim (rvim)
  215. update-alternatives: 使用 /usr/bin/vim.basic 来在自动模式中提供 /usr/bin/rview (rview)
  216. update-alternatives: 使用 /usr/bin/vim.basic 来在自动模式中提供 /usr/bin/vi (vi)
  217. update-alternatives: 使用 /usr/bin/vim.basic 来在自动模式中提供 /usr/bin/view (view)
  218. update-alternatives: 使用 /usr/bin/vim.basic 来在自动模式中提供 /usr/bin/ex (ex)
  219. wenchang@ubuntu:/etc/apt$ sudo apt-cache show vim
  220. Package: vim
  221. Architecture: amd64
  222. Version: 2:8.1.2269-1ubuntu5.4
  223. Priority: optional
  224. Section: editors
  225. Origin: Ubuntu
  226. Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
  227. Original-Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
  228. Bugs: https://bugs.launchpad.net/ubuntu/+filebug
  229. Installed-Size: 3038
  230. Provides: editor
  231. Depends: vim-common (= 2:8.1.2269-1ubuntu5.4), vim-runtime (= 2:8.1.2269-1ubuntu5.4), libacl1 (>= 2.2.23), libc6 (>= 2.29), libcanberra0 (>= 0.2), libgpm2 (>= 1.20.7), libpython3.8 (>= 3.8.2), libselinux1 (>= 1.32), libtinfo6 (>= 6)
  232. Suggests: ctags, vim-doc, vim-scripts
  233. Filename: pool/main/v/vim/vim_8.1.2269-1ubuntu5.4_amd64.deb
  234. Size: 1239120
  235. MD5sum: 8c35debacd94e106f0e72a6bd56b646d
  236. SHA1: 3226d42c6e98c7b7a4fa361d536409986b1d52c9
  237. SHA256: c0a2d158eb8dcadef082755ed41203568c86189b8510714d7cb2144fdb09159d
  238. SHA512: 26a10e3c4d3b72cb7f5d3f909b954349baa03b661354fca9a0bc2949e76e715d6ecf9e34236f20f70237127a1ee8c964c13b3ea8e5de14d1ae34bb6ac7b1dc89
  239. Homepage: https://www.vim.org/
  240. Description-zh_CN: Vi 增强版 - 增强的 vi 编辑器
  241. Vim 是一个与 UNIX 编辑器 Vi 几乎完全兼容的版本。
  242. .
  243. Vim 在 vi 的基础上添加了许多特性:多次撤销、语法高亮、命令行 历史、 在线帮助、文件名补全、块操作、折叠、Unicode 支持等。
  244. .
  245. 此软件包提供了一个带有一系列标准功能的 vim。它不提供 Vim 的 图形界面,如果您需要更多(或更少)的功能,请查看其它 vim-* 软 件包。
  246. Description-md5: 59e8b8f7757db8b53566d5d119872de8
  247. Task: server, cloud-image, lubuntu-desktop
  248. Package: vim
  249. Architecture: amd64
  250. Version: 2:8.1.2269-1ubuntu5
  251. Priority: optional
  252. Section: editors
  253. Origin: Ubuntu
  254. Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
  255. Original-Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
  256. Bugs: https://bugs.launchpad.net/ubuntu/+filebug
  257. Installed-Size: 3038
  258. Provides: editor
  259. Depends: vim-common (= 2:8.1.2269-1ubuntu5), vim-runtime (= 2:8.1.2269-1ubuntu5), libacl1 (>= 2.2.23), libc6 (>= 2.29), libcanberra0 (>= 0.2), libgpm2 (>= 1.20.7), libpython3.8 (>= 3.8.2), libselinux1 (>= 1.32), libtinfo6 (>= 6)
  260. Suggests: ctags, vim-doc, vim-scripts
  261. Filename: pool/main/v/vim/vim_8.1.2269-1ubuntu5_amd64.deb
  262. Size: 1237624
  263. MD5sum: 198ccbb07a9fc8ebe67a213eab6a3e96
  264. SHA1: 796c962d044f99a81b187211e6ce9a0a44b8d5d1
  265. SHA256: 1e38f267bf4c06e424b166e8d666ffd6ce25c657012892d099651bee18a2c834
  266. Homepage: https://www.vim.org/
  267. Description-zh_CN: Vi 增强版 - 增强的 vi 编辑器
  268. Vim 是一个与 UNIX 编辑器 Vi 几乎完全兼容的版本。
  269. .
  270. Vim 在 vi 的基础上添加了许多特性:多次撤销、语法高亮、命令行 历史、 在线帮助、文件名补全、块操作、折叠、Unicode 支持等。
  271. .
  272. 此软件包提供了一个带有一系列标准功能的 vim。它不提供 Vim 的 图形界面,如果您需要更多(或更少)的功能,请查看其它 vim-* 软 件包。
  273. Description-md5: 59e8b8f7757db8b53566d5d119872de8
  274. Task: server, cloud-image, lubuntu-desktop
  275. wenchang@ubuntu:/etc/apt$

远程登录Ubuntu

ssh 介绍

SSH 为 Secure Shell 的缩写,由 IETF 的网络工作小组(Network Working Group)所制定;SSH 为建立在应用层和传输层基础上的安全协议。
SSH 是目前较可靠,专为远程登录会话和其他网络服务提供安全性的协议。常用于远程登录。几乎所有UNIX/LInux平台都可运行 SSH。
使用 SSH 服务,需要安装相应的服务器和客户端。客户端和服务器的关系:如果,A 机器想被 B 机器远程控制, 那么,A 机器需要安装 SSH 服务器,B 机器需要安装 SSH 客户端。
和 CentOS 不一样,Ubuntu 默认没有安装 SSHD 服务(使用 netstat 指令查看: apt install net-tools),因此,我们不能进行远程登录。

安装SSH 和启用

sudo apt-get install openssh-server
执行上面指令后,在当前这台 Linux 上就安装了 SSH 服务端和客户端。
service sshd restart
执行上面的指令,就启动了 sshd 服务。会监听端口 22

  1. wenchang@ubuntu:/etc/apt$ sudo apt-get install openssh-server
  2. [sudo] wenchang 的密码:
  3. 正在读取软件包列表... 完成
  4. 正在分析软件包的依赖关系树
  5. 正在读取状态信息... 完成
  6. 将会同时安装下列软件:
  7. ncurses-term openssh-client openssh-sftp-server ssh-import-id
  8. 建议安装:
  9. keychain libpam-ssh monkeysphere ssh-askpass molly-guard
  10. 下列【新】软件包将被安装:
  11. ncurses-term openssh-server openssh-sftp-server ssh-import-id
  12. 下列软件包将被升级:
  13. openssh-client
  14. 升级了 1 个软件包,新安装了 4 个软件包,要卸载 0 个软件包,有 270 个软件包未被升级。
  15. 需要下载 1,359 kB 的归档。
  16. 解压缩后会消耗 6,010 kB 的额外空间。
  17. 您希望继续执行吗? [Y/n] y
  18. 获取:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 openssh-client amd64 1:8.2p1-4ubuntu0.4 [671 kB]
  19. 获取:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 ncurses-term all 6.2-0ubuntu2 [249 kB]
  20. 获取:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 openssh-sftp-server amd64 1:8.2p1-4ubuntu0.4 [51.5 kB]
  21. 获取:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 openssh-server amd64 1:8.2p1-4ubuntu0.4 [377 kB]
  22. 获取:5 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 ssh-import-id all 5.10-0ubuntu1 [10.0 kB]
  23. 已下载 1,359 kB,耗时 8 (166 kB/s)
  24. 正在预设定软件包 ...
  25. (正在读取数据库 ... 系统当前共安装有 187415 个文件和目录。)
  26. 准备解压 .../openssh-client_1%3a8.2p1-4ubuntu0.4_amd64.deb ...
  27. 正在解压 openssh-client (1:8.2p1-4ubuntu0.4) 并覆盖 (1:8.2p1-4ubuntu0.2) ...
  28. 正在选中未选择的软件包 ncurses-term
  29. 准备解压 .../ncurses-term_6.2-0ubuntu2_all.deb ...
  30. 正在解压 ncurses-term (6.2-0ubuntu2) ...
  31. 正在选中未选择的软件包 openssh-sftp-server
  32. 准备解压 .../openssh-sftp-server_1%3a8.2p1-4ubuntu0.4_amd64.deb ...
  33. 正在解压 openssh-sftp-server (1:8.2p1-4ubuntu0.4) ...
  34. 正在选中未选择的软件包 openssh-server
  35. 准备解压 .../openssh-server_1%3a8.2p1-4ubuntu0.4_amd64.deb ...
  36. 正在解压 openssh-server (1:8.2p1-4ubuntu0.4) ...
  37. 正在选中未选择的软件包 ssh-import-id
  38. 准备解压 .../ssh-import-id_5.10-0ubuntu1_all.deb ...
  39. 正在解压 ssh-import-id (5.10-0ubuntu1) ...
  40. 正在设置 openssh-client (1:8.2p1-4ubuntu0.4) ...
  41. 正在设置 ssh-import-id (5.10-0ubuntu1) ...
  42. Attempting to convert /etc/ssh/ssh_import_id
  43. 正在设置 ncurses-term (6.2-0ubuntu2) ...
  44. 正在设置 openssh-sftp-server (1:8.2p1-4ubuntu0.4) ...
  45. 正在设置 openssh-server (1:8.2p1-4ubuntu0.4) ...
  46. Creating config file /etc/ssh/sshd_config with new version
  47. Creating SSH2 RSA key; this may take some time ...
  48. 3072 SHA256:Rr1fjKz8MN1x+CEb+Uf+jKv19eE43EWKjHZHIIJlL1k root@ubuntu (RSA)
  49. Creating SSH2 ECDSA key; this may take some time ...
  50. 256 SHA256:9QfJ1lxmsUsyALSTksgEc2K3EDm9tgvDBoDKyp0Us6g root@ubuntu (ECDSA)
  51. Creating SSH2 ED25519 key; this may take some time ...
  52. 256 SHA256:rPezrbW+45Hs7ATWB4xngknjw1o7JO9HH8Qmu+1ju1c root@ubuntu (ED25519)
  53. Created symlink /etc/systemd/system/sshd.service /lib/systemd/system/ssh.service.
  54. Created symlink /etc/systemd/system/multi-user.target.wants/ssh.service /lib/systemd/system/ssh.service.
  55. rescue-ssh.target is a disabled or a static unit, not starting it.
  56. 正在处理用于 systemd (245.4-4ubuntu3.15) 的触发器 ...
  57. 正在处理用于 man-db (2.9.1-1) 的触发器 ...
  58. 正在处理用于 ufw (0.36-6) 的触发器 ...
  59. wenchang@ubuntu:/etc/apt$ service sshd restart

在Windows 使用XShell 登录 Ubuntu

使用 普通用户登录,需要的时候再 su - 切换成 root 用户
image.png

从一台linux 系统远程登陆另外一台linux 系统

基本语法

  1. ssh 用户名@IP
  2. 例如:ssh root@192.168.200.130
  3. 使用 ssh 访问,如访问出现错误。可查看是否有该文件 ~/.ssh/known_ssh 尝试删除该文件解决,一般不会有问题

image.png