当前位置 : 主页 > 操作系统 > centos >

ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号

来源:互联网 收集:自由互联 发布时间:2022-06-20
1.访问地址​​https://ubuntu.com/download/server​​ 2.选中【option 2】 选择【download now】 4. 重点来了,默认情况下,ubuntu server 是不装ssh server的,只有一个ssh client ,所以按空格选中它,安装

1.访问地址​​https://ubuntu.com/download/server​​

2.选中【option 2】

ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_离线下载deb包


  • 选择【download now】
  • ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_hive_02

    4.

    ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_g++_03

    ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_ubuntu_04

    ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_ubuntu_05

    ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_g++_06

    ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_hive_07

    ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_g++_08

    ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_ubuntu_09

    ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_ubuntu_10


    ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_g++_11


    ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_g++_12



    重点来了,默认情况下,ubuntu server 是不装ssh server的,只有一个ssh client ,所以按空格选中它,安装

    openssh server

    ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_ubuntu_13


    这个啥都不选,直接选中done

    ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_g++_14

    ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_hive_15

    ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_g++_16

    ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_ubuntu_17


    安装结束。

    ==========================================================================

    下载离线安装的deb包

    1.首先把缓存文件夹里的deb包清理掉

    ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_ubuntu_18

    test@test:~$ sudo apt-get clean
    [sudo] password for test:

    2.例如下载g++以及它的所有依赖包

    test@test:~$ sudo apt-get install -d g++
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following additional packages will be installed:
    binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-9 g++-9 gcc gcc-9
    gcc-9-base libasan5 libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0
    libcrypt-dev libctf-nobfd0 libctf0 libgcc-9-dev libgomp1 libisl22 libitm1
    liblsan0 libmpc3 libquadmath0 libstdc++-9-dev libtsan0 libubsan1
    linux-libc-dev manpages-dev
    Suggested packages:
    binutils-doc cpp-doc gcc-9-locales g++-multilib g++-9-multilib gcc-9-doc
    gcc-multilib make autoconf automake libtool flex bison gdb gcc-doc
    gcc-9-multilib glibc-doc libstdc++-9-doc
    The following NEW packages will be installed:
    binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-9 g++ g++-9 gcc
    gcc-9 gcc-9-base libasan5 libatomic1 libbinutils libc-dev-bin libc6-dev
    libcc1-0 libcrypt-dev libctf-nobfd0 libctf0 libgcc-9-dev libgomp1 libisl22
    libitm1 liblsan0 libmpc3 libquadmath0 libstdc++-9-dev libtsan0 libubsan1
    linux-libc-dev manpages-dev
    0 upgraded, 31 newly installed, 0 to remove and 10 not upgraded.
    Need to get 44.1 MB of archives.
    After this operation, 197 MB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    Get:1 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 binutils-comm on amd64 2.34-6ubuntu1.3 [207 kB]
    Get:2 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 libbinutils a md64 2.34-6ubuntu1.3 [474 kB]
    Get:3 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 libctf-nobfd0 amd64 2.34-6ubuntu1.3 [47.4 kB]
    Get:4 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 libctf0 amd64 2.34-6ubuntu1.3 [46.6 kB]
    Get:5 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 binutils-x86- 64-linux-gnu amd64 2.34-6ubuntu1.3 [1,613 kB]
    Get:6 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 binutils amd6 4 2.34-6ubuntu1.3 [3,380 B]
    Get:7 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 gcc-9-base am d64 9.4.0-1ubuntu1~20.04 [19.4 kB]
    Get:8 http://cn.archive.ubuntu.com/ubuntu focal/main amd64 libisl22 amd64 0.22.1 -1 [592 kB]
    Get:9 http://cn.archive.ubuntu.com/ubuntu focal/main amd64 libmpc3 amd64 1.1.0-1 [40.8 kB]
    Get:10 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 cpp-9 amd64 9.4.0-1ubuntu1~20.04 [7,501 kB]
    Get:11 http://cn.archive.ubuntu.com/ubuntu focal/main amd64 cpp amd64 4:9.3.0-1u buntu2 [27.6 kB]
    Get:12 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 libcc1-0 amd 64 10.3.0-1ubuntu1~20.04 [48.8 kB]
    Get:13 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 libgomp1 amd 64 10.3.0-1ubuntu1~20.04 [102 kB]
    Get:14 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 libitm1 amd6 4 10.3.0-1ubuntu1~20.04 [26.2 kB]
    Get:15 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 libatomic1 a md64 10.3.0-1ubuntu1~20.04 [9,284 B]
    Get:16 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 libasan5 amd 64 9.4.0-1ubuntu1~20.04 [2,752 kB]
    Get:17 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 liblsan0 amd 64 10.3.0-1ubuntu1~20.04 [835 kB]
    Get:18 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 libtsan0 amd 64 10.3.0-1ubuntu1~20.04 [2,009 kB]
    Get:19 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 libubsan1 am d64 10.3.0-1ubuntu1~20.04 [784 kB]
    Get:20 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 libquadmath0 amd64 10.3.0-1ubuntu1~20.04 [146 kB]
    Get:21 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 libgcc-9-dev amd64 9.4.0-1ubuntu1~20.04 [2,360 kB]
    Get:22 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 gcc-9 amd64 9.4.0-1ubuntu1~20.04 [8,275 kB]
    Get:23 http://cn.archive.ubuntu.com/ubuntu focal/main amd64 gcc amd64 4:9.3.0-1u buntu2 [5,208 B]
    Get:24 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 libc-dev-bin amd64 2.31-0ubuntu9.7 [71.6 kB]
    Get:25 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-libc-d ev amd64 5.4.0-104.118 [1,117 kB]
    Get:26 http://cn.archive.ubuntu.com/ubuntu focal/main amd64 libcrypt-dev amd64 1 :4.4.10-10ubuntu4 [104 kB]
    Get:27 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 libc6-dev am d64 2.31-0ubuntu9.7 [2,518 kB]
    Get:28 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 libstdc++-9- dev amd64 9.4.0-1ubuntu1~20.04 [1,722 kB]
    Get:29 http://cn.archive.ubuntu.com/ubuntu focal-updates/main amd64 g++-9 amd64 9.4.0-1ubuntu1~20.04 [8,421 kB]
    Get:30 http://cn.archive.ubuntu.com/ubuntu focal/main amd64 g++ amd64 4:9.3.0-1u buntu2 [1,604 B]
    Get:31 http://cn.archive.ubuntu.com/ubuntu focal/main amd64 manpages-dev all 5.0 5-1 [2,266 kB]
    Fetched 44.1 MB in 7s (6,295 kB/s)




    Download complete and in download only mode

    进入缓存文件夹  /var/cache/apt/archives 查看:

    test@test:~$ cd /var/cache/apt/archives
    test@test:/var/cache/apt/archives$ ll
    total 43176
    drwxr-xr-x 3 root root 4096 Mar 16 11:51 ./
    drwxr-xr-x 3 root root 4096 Mar 16 11:50 ../
    -rw-r--r-- 1 root root 3380 Oct 25 16:15 binutils_2.34-6ubuntu1.3_amd64.deb
    -rw-r--r-- 1 root root 207032 Oct 25 16:15 binutils-common_2.34-6ubuntu1.3_amd64.deb
    -rw-r--r-- 1 root root 1613160 Oct 25 16:15 binutils-x86-64-linux-gnu_2.34-6ubuntu1.3_amd64.deb
    -rw-r--r-- 1 root root 27588 Mar 24 2020 cpp_4%3a9.3.0-1ubuntu2_amd64.deb
    -rw-r--r-- 1 root root 7500604 Nov 8 16:54 cpp-9_9.4.0-1ubuntu1~20.04_amd64.deb
    -rw-r--r-- 1 root root 1604 Mar 24 2020 g++_4%3a9.3.0-1ubuntu2_amd64.deb
    -rw-r--r-- 1 root root 8420748 Nov 8 16:54 g++-9_9.4.0-1ubuntu1~20.04_amd64.deb
    -rw-r--r-- 1 root root 5208 Mar 24 2020 gcc_4%3a9.3.0-1ubuntu2_amd64.deb
    -rw-r--r-- 1 root root 8274520 Nov 8 16:55 gcc-9_9.4.0-1ubuntu1~20.04_amd64.deb
    -rw-r--r-- 1 root root 19364 Nov 8 16:54 gcc-9-base_9.4.0-1ubuntu1~20.04_amd64.deb
    -rw-r--r-- 1 root root 2752088 Nov 8 16:54 libasan5_9.4.0-1ubuntu1~20.04_amd64.deb
    -rw-r--r-- 1 root root 9284 Jun 14 2021 libatomic1_10.3.0-1ubuntu1~20.04_amd64.deb
    -rw-r--r-- 1 root root 473972 Oct 25 16:15 libbinutils_2.34-6ubuntu1.3_amd64.deb
    -rw-r--r-- 1 root root 2517900 Mar 1 15:24 libc6-dev_2.31-0ubuntu9.7_amd64.deb
    -rw-r--r-- 1 root root 48788 Jun 14 2021 libcc1-0_10.3.0-1ubuntu1~20.04_amd64.deb
    -rw-r--r-- 1 root root 71636 Mar 1 15:24 libc-dev-bin_2.31-0ubuntu9.7_amd64.deb
    -rw-r--r-- 1 root root 104104 Mar 10 2020 libcrypt-dev_1%3a4.4.10-10ubuntu4_amd64.deb
    -rw-r--r-- 1 root root 46636 Oct 25 16:15 libctf0_2.34-6ubuntu1.3_amd64.deb
    -rw-r--r-- 1 root root 47420 Oct 25 16:15 libctf-nobfd0_2.34-6ubuntu1.3_amd64.deb
    -rw-r--r-- 1 root root 2359512 Nov 8 16:54 libgcc-9-dev_9.4.0-1ubuntu1~20.04_amd64.deb
    -rw-r--r-- 1 root root 101584 Jun 14 2021 libgomp1_10.3.0-1ubuntu1~20.04_amd64.deb
    -rw-r--r-- 1 root root 591960 Feb 18 2020 libisl22_0.22.1-1_amd64.deb
    -rw-r--r-- 1 root root 26196 Jun 14 2021 libitm1_10.3.0-1ubuntu1~20.04_amd64.deb
    -rw-r--r-- 1 root root 834692 Jun 14 2021 liblsan0_10.3.0-1ubuntu1~20.04_amd64.deb
    -rw-r--r-- 1 root root 40784 Jan 23 2018 libmpc3_1.1.0-1_amd64.deb
    -rw-r--r-- 1 root root 146072 Jun 14 2021 libquadmath0_10.3.0-1ubuntu1~20.04_amd64.deb
    -rw-r--r-- 1 root root 1722428 Nov 8 16:54 libstdc++-9-dev_9.4.0-1ubuntu1~20.04_amd64.deb
    -rw-r--r-- 1 root root 2008872 Jun 14 2021 libtsan0_10.3.0-1ubuntu1~20.04_amd64.deb
    -rw-r--r-- 1 root root 784116 Jun 14 2021 libubsan1_10.3.0-1ubuntu1~20.04_amd64.deb
    -rw-r--r-- 1 root root 1117248 Mar 8 18:35 linux-libc-dev_5.4.0-104.118_amd64.deb
    -rw-r----- 1 root root 0 Feb 23 08:57 lock
    -rw-r--r-- 1 root root 2265524 Feb 10 2020 manpages-dev_5.05-1_all.deb
    drwx------ 2 _apt root 4096 Mar 16 11:51 partial/


    安装所有的离线deb包:

    dpkg -i   *.deb

    test@test:/var/cache/apt/archives$ sudo dpkg -i *.deb
    Selecting previously unselected package binutils.
    (Reading database ... 71718 files and directories currently installed.)
    Preparing to unpack binutils_2.34-6ubuntu1.3_amd64.deb ...
    Unpacking binutils (2.34-6ubuntu1.3) ...
    Selecting previously unselected package binutils-common:amd64.
    Preparing to unpack binutils-common_2.34-6ubuntu1.3_amd64.deb ...
    Unpacking binutils-common:amd64 (2.34-6ubuntu1.3) ...
    Selecting previously unselected package binutils-x86-64-linux-gnu.
    Preparing to unpack binutils-x86-64-linux-gnu_2.34-6ubuntu1.3_amd64.deb ...
    Unpacking binutils-x86-64-linux-gnu (2.34-6ubuntu1.3) ...
    Selecting previously unselected package cpp.
    Preparing to unpack cpp_4%3a9.3.0-1ubuntu2_amd64.deb ...
    Unpacking cpp (4:9.3.0-1ubuntu2) ...
    Selecting previously unselected package cpp-9.
    Preparing to unpack cpp-9_9.4.0-1ubuntu1~20.04_amd64.deb ...
    Unpacking cpp-9 (9.4.0-1ubuntu1~20.04) ...
    Selecting previously unselected package g++.
    Preparing to unpack g++_4%3a9.3.0-1ubuntu2_amd64.deb ...
    Unpacking g++ (4:9.3.0-1ubuntu2) ...
    Selecting previously unselected package g++-9.
    Preparing to unpack g++-9_9.4.0-1ubuntu1~20.04_amd64.deb ...
    Unpacking g++-9 (9.4.0-1ubuntu1~20.04) ...
    Selecting previously unselected package gcc.
    Preparing to unpack gcc_4%3a9.3.0-1ubuntu2_amd64.deb ...
    Unpacking gcc (4:9.3.0-1ubuntu2) ...
    Selecting previously unselected package gcc-9.
    Preparing to unpack gcc-9_9.4.0-1ubuntu1~20.04_amd64.deb ...
    Unpacking gcc-9 (9.4.0-1ubuntu1~20.04) ...
    Selecting previously unselected package gcc-9-base:amd64.
    Preparing to unpack gcc-9-base_9.4.0-1ubuntu1~20.04_amd64.deb ...
    Unpacking gcc-9-base:amd64 (9.4.0-1ubuntu1~20.04) ...
    Selecting previously unselected package libasan5:amd64.
    Preparing to unpack libasan5_9.4.0-1ubuntu1~20.04_amd64.deb ...
    Unpacking libasan5:amd64 (9.4.0-1ubuntu1~20.04) ...
    Selecting previously unselected package libatomic1:amd64.
    Preparing to unpack libatomic1_10.3.0-1ubuntu1~20.04_amd64.deb ...
    Unpacking libatomic1:amd64 (10.3.0-1ubuntu1~20.04) ...
    Selecting previously unselected package libbinutils:amd64.
    Preparing to unpack libbinutils_2.34-6ubuntu1.3_amd64.deb ...
    Unpacking libbinutils:amd64 (2.34-6ubuntu1.3) ...
    Selecting previously unselected package libc6-dev:amd64.
    Preparing to unpack libc6-dev_2.31-0ubuntu9.7_amd64.deb ...
    Unpacking libc6-dev:amd64 (2.31-0ubuntu9.7) ...
    Selecting previously unselected package libcc1-0:amd64.
    Preparing to unpack libcc1-0_10.3.0-1ubuntu1~20.04_amd64.deb ...
    Unpacking libcc1-0:amd64 (10.3.0-1ubuntu1~20.04) ...
    Selecting previously unselected package libc-dev-bin.
    Preparing to unpack libc-dev-bin_2.31-0ubuntu9.7_amd64.deb ...
    Unpacking libc-dev-bin (2.31-0ubuntu9.7) ...
    Selecting previously unselected package libcrypt-dev:amd64.
    Preparing to unpack libcrypt-dev_1%3a4.4.10-10ubuntu4_amd64.deb ...
    Unpacking libcrypt-dev:amd64 (1:4.4.10-10ubuntu4) ...
    Selecting previously unselected package libctf0:amd64.
    Preparing to unpack libctf0_2.34-6ubuntu1.3_amd64.deb ...
    Unpacking libctf0:amd64 (2.34-6ubuntu1.3) ...
    Selecting previously unselected package libctf-nobfd0:amd64.
    Preparing to unpack libctf-nobfd0_2.34-6ubuntu1.3_amd64.deb ...
    Unpacking libctf-nobfd0:amd64 (2.34-6ubuntu1.3) ...
    Selecting previously unselected package libgcc-9-dev:amd64.
    Preparing to unpack libgcc-9-dev_9.4.0-1ubuntu1~20.04_amd64.deb ...
    Unpacking libgcc-9-dev:amd64 (9.4.0-1ubuntu1~20.04) ...
    Selecting previously unselected package libgomp1:amd64.
    Preparing to unpack libgomp1_10.3.0-1ubuntu1~20.04_amd64.deb ...
    Unpacking libgomp1:amd64 (10.3.0-1ubuntu1~20.04) ...
    Selecting previously unselected package libisl22:amd64.
    Preparing to unpack libisl22_0.22.1-1_amd64.deb ...
    Unpacking libisl22:amd64 (0.22.1-1) ...
    Selecting previously unselected package libitm1:amd64.
    Preparing to unpack libitm1_10.3.0-1ubuntu1~20.04_amd64.deb ...
    Unpacking libitm1:amd64 (10.3.0-1ubuntu1~20.04) ...
    Selecting previously unselected package liblsan0:amd64.
    Preparing to unpack liblsan0_10.3.0-1ubuntu1~20.04_amd64.deb ...
    Unpacking liblsan0:amd64 (10.3.0-1ubuntu1~20.04) ...
    Selecting previously unselected package libmpc3:amd64.
    Preparing to unpack libmpc3_1.1.0-1_amd64.deb ...
    Unpacking libmpc3:amd64 (1.1.0-1) ...
    Selecting previously unselected package libquadmath0:amd64.
    Preparing to unpack libquadmath0_10.3.0-1ubuntu1~20.04_amd64.deb ...
    Unpacking libquadmath0:amd64 (10.3.0-1ubuntu1~20.04) ...
    Selecting previously unselected package libstdc++-9-dev:amd64.
    Preparing to unpack libstdc++-9-dev_9.4.0-1ubuntu1~20.04_amd64.deb ...
    Unpacking libstdc++-9-dev:amd64 (9.4.0-1ubuntu1~20.04) ...
    Selecting previously unselected package libtsan0:amd64.
    Preparing to unpack libtsan0_10.3.0-1ubuntu1~20.04_amd64.deb ...
    Unpacking libtsan0:amd64 (10.3.0-1ubuntu1~20.04) ...
    Selecting previously unselected package libubsan1:amd64.
    Preparing to unpack libubsan1_10.3.0-1ubuntu1~20.04_amd64.deb ...
    Unpacking libubsan1:amd64 (10.3.0-1ubuntu1~20.04) ...
    Selecting previously unselected package linux-libc-dev:amd64.
    Preparing to unpack linux-libc-dev_5.4.0-104.118_amd64.deb ...
    Unpacking linux-libc-dev:amd64 (5.4.0-104.118) ...
    Selecting previously unselected package manpages-dev.
    Preparing to unpack manpages-dev_5.05-1_all.deb ...
    Unpacking manpages-dev (5.05-1) ...
    Setting up binutils-common:amd64 (2.34-6ubuntu1.3) ...
    Setting up gcc-9-base:amd64 (9.4.0-1ubuntu1~20.04) ...
    Setting up libasan5:amd64 (9.4.0-1ubuntu1~20.04) ...
    Setting up libatomic1:amd64 (10.3.0-1ubuntu1~20.04) ...
    Setting up libbinutils:amd64 (2.34-6ubuntu1.3) ...
    Setting up libcc1-0:amd64 (10.3.0-1ubuntu1~20.04) ...
    Setting up libc-dev-bin (2.31-0ubuntu9.7) ...
    Setting up libcrypt-dev:amd64 (1:4.4.10-10ubuntu4) ...
    Setting up libctf0:amd64 (2.34-6ubuntu1.3) ...
    Setting up libctf-nobfd0:amd64 (2.34-6ubuntu1.3) ...
    Setting up libgomp1:amd64 (10.3.0-1ubuntu1~20.04) ...
    Setting up libisl22:amd64 (0.22.1-1) ...
    Setting up libitm1:amd64 (10.3.0-1ubuntu1~20.04) ...
    Setting up liblsan0:amd64 (10.3.0-1ubuntu1~20.04) ...
    Setting up libmpc3:amd64 (1.1.0-1) ...
    Setting up libquadmath0:amd64 (10.3.0-1ubuntu1~20.04) ...
    Setting up libtsan0:amd64 (10.3.0-1ubuntu1~20.04) ...
    Setting up libubsan1:amd64 (10.3.0-1ubuntu1~20.04) ...
    Setting up linux-libc-dev:amd64 (5.4.0-104.118) ...
    Setting up manpages-dev (5.05-1) ...
    Setting up binutils-x86-64-linux-gnu (2.34-6ubuntu1.3) ...
    Setting up cpp-9 (9.4.0-1ubuntu1~20.04) ...
    Setting up libc6-dev:amd64 (2.31-0ubuntu9.7) ...
    Setting up libgcc-9-dev:amd64 (9.4.0-1ubuntu1~20.04) ...
    Setting up libstdc++-9-dev:amd64 (9.4.0-1ubuntu1~20.04) ...
    Setting up binutils (2.34-6ubuntu1.3) ...
    Setting up cpp (4:9.3.0-1ubuntu2) ...
    Setting up gcc-9 (9.4.0-1ubuntu1~20.04) ...
    Setting up g++-9 (9.4.0-1ubuntu1~20.04) ...
    Setting up gcc (4:9.3.0-1ubuntu2) ...
    Setting up g++ (4:9.3.0-1ubuntu2) ...
    update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode
    Processing triggers for man-db (2.9.1-1) ...
    Processing triggers for libc-bin (2.31-0ubuntu9.7) ...
    test@test:/var/cache/apt/archives$test@test:/var/cache/apt/archives$ which g++
    /usr/bin/g++
    test@test:/var/cache/apt/archives$

    =============================================================

    因为netstat 这个命令是默认不自带的,很不方便,所以我们离线下载一下它的deb包

    1.首先清理deb缓存文件夹

    test@test:/var/cache/apt/archives$​ sudo apt-get clean

    test@test:/var/cache/apt/archives$ cd /var/cache/apt/archives
    test@test:/var/cache/apt/archives$ ll
    total 12
    drwxr-xr-x 3 root root 4096 Mar 16 11:58 ./
    drwxr-xr-x 3 root root 4096 Mar 16 11:58 ../
    -rw-r----- 1 root root 0 Feb 23 08:57 lock
    drwx------ 2 _apt root 4096 Mar 16 11:51 partial/

    test@test:/var/cache/apt/archives$ ​sudo apt-get install -d net-tools

    test@test:/var/cache/apt/archives$ sudo apt-get install -d net-tools
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following NEW packages will be installed:
    net-tools
    0 upgraded, 1 newly installed, 0 to remove and 10 not upgraded.
    Need to get 196 kB of archives.
    After this operation, 864 kB of additional disk space will be used.
    Get:1 http://cn.archive.ubuntu.com/ubuntu focal/main amd64 net-tools amd64 1.60+git20180626.aeb d88e-1ubuntu1 [196 kB]
    Fetched 196 kB in 2s (118 kB/s)
    Download complete and in download only mode
    test@test:/var/cache/apt/archives$ ll
    total 204
    drwxr-xr-x 3 root root 4096 Mar 16 12:00 ./
    drwxr-xr-x 3 root root 4096 Mar 16 11:59 ../
    -rw-r----- 1 root root 0 Feb 23 08:57 lock
    -rw-r--r-- 1 root root 196392 Feb 1 2019 net-tools_1.60+git20180626.aebd88e-1ubuntu1_amd64.de b
    drwx------ 2 _apt root 4096 Mar 16 12:00 partial/
    test@test:/var/cache/apt/archives$

    2.离线安装net-tools离线deb包


    test@test:/var/cache/apt/archives$ ​sudo dpkg -i *.deb

    3.检查能否使用net-tools中的 netstat 命令

    test@test:/var/cache/apt/archives$ sudo netstat -tlunp | grep ssh
    tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1447/sshd: /usr/sbi
    tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 1820/sshd: test@pts
    tcp6 0 0 :::22 :::* LISTEN 1447/sshd: /usr/sbi
    tcp6 0 0 ::1:6010 :::* LISTEN 1820/sshd: test@pts
    test@test:/var/cache/apt/archives$

    安装成功!!!

    =================================================================================

    【修改SSH server 端口号】

    ssh server 的默认的配置文件是ssd_config 

    test@test:/var/cache/apt/archives$ ​sudo vi /etc/ssh/sshd_config

    1.例如将ssh端口改为2222,

    ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_hive_19


    2.修改配置文件,默认允许root登录,但是禁止root用密码登录。我们把它改掉,允许root 用密码登录

    ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_hive_20


    ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_hive_21

    上图所示,ssh改为了2222端口,

    重新用root登录,检查一下:

    ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_hive_22

    ubuntu server 20.04下载以及安装,离线下载deb包以及依赖,修改ssh端口号_hive_23


    成功了!!!




    网友评论