Enable SSH in Ubuntu 18

 If you need to install OpenSSH on an offline Ubuntu machine without using sudo apt install, you can follow these steps to manually download the necessary packages on another machine (with internet access) and transfer them to the offline machine.

Steps to Install OpenSSH Offline

Step 1: Download the Required Packages on an Online Machine

  1. Check your Ubuntu version:

    • Run the following command on the offline machine to know the version of Ubuntu you are running (this is important to download compatible packages):
      bash
      lsb_release -a
  2. Download the required packages:

    • On a machine with internet access, go to the official Ubuntu Packages website.
    • Search for the openssh-server package and note the dependencies for the version that matches your Ubuntu version.
  3. Download the required .deb packages:

    • On the online machine, download the necessary .deb files for openssh-server and its dependencies. You can either manually download them from the Ubuntu Packages website or use apt on an online machine to download the packages:
    bash
    sudo apt update sudo apt download openssh-server

    This command will download the openssh-server package and save the .deb file in the current directory. However, the dependencies also need to be downloaded separately. Use the following command to download all the dependencies at once:

    bash
    sudo apt-get download openssh-server

    This will download the .deb files for openssh-server and all its dependencies to the current directory.

  4. Transfer the downloaded .deb files:

    • Use a USB drive or other methods to transfer the .deb files from the online machine to the offline machine.

Step 2: Install the Packages on the Offline Machine

  1. Copy the files to the offline machine:

    • Copy all the downloaded .deb files from your USB drive (or another medium) to a directory on the offline machine (e.g., /tmp/openssh).
  2. Install the packages:

    • On the offline machine, navigate to the directory where you copied the .deb files and install them using dpkg:
    bash
    cd /path/to/deb/files sudo dpkg -i *.deb

    This command will install the OpenSSH server along with its dependencies.

  3. Fix missing dependencies (if necessary):

    • If there are any missing dependencies, dpkg might throw errors. You can resolve them by downloading the required dependencies manually (in the same way as above) or, if the dependencies are already available on the system, you can try fixing them with:
    bash
    sudo apt-get install -f

Step 3: Enable and Start OpenSSH Server

Once the installation is successful, you can start and enable the SSH service:

  1. Start the SSH service:

    bash
    sudo systemctl start ssh
  2. Enable SSH to start on boot:

    bash
    sudo systemctl enable ssh
  3. Check the status of SSH:

    bash
    sudo systemctl status ssh

Verifying the Installation

  • To verify that the OpenSSH server is running, you can check the listening ports:

    bash
    sudo netstat -tuln | grep 22
  • Try connecting to your machine using ssh from another machine in the network:

    bash
    ssh username@remote_ip_address

By manually downloading and installing the required .deb packages, you should now have an offline Ubuntu machine running OpenSSH without using the apt package manager.

Ulasan

Catatan popular daripada blog ini

SISTEM PENGOPERASIAN KOMPUTER (OS)

JENIS-JENIS SISTEM PENGOPERASIAN KOMPUTER

APA ITU ASCII (AMERICAN STANDARD CODE FOR INFORMATION INTERCHANGE) ?