How to install network-manager without internet access?

Solution 1:

You don't need NetworkManager to connect to a network. Assuming you're using automatic configuration (probably you are) you just need to sudo dhclient eth0 to get an IP address (replace eth0 with your network device if that's the case).

Solution 2:

sudo apt-get install network-manager

Will fail. Note what dependencies are needed to install the package. Mine were-

The following NEW packages will be installed:
  iputils-arping libnl-route-3-200 modemmanager network-manager network-manager-gnome usb-modeswitch usb-modeswitch-data wpasupplicant

The download will fail obviously with error:

Failed to fetch
http://us.archive.ubuntu.com/ubuntu/pool/main/libn/libnl3/libnl-route-3-200_3.2.3-2ubuntu2_amd64.deb
Could not resolve 'us.archive.ubuntu.com

Download all such links which gives above error including network-manager by some other system. I downloaded the following links-

http://us.archive.ubuntu.com/ubuntu/pool/main/libn/libnl3/libnl-route-3-200_3.2.3-2ubuntu2_amd64.deb
http://us.archive.ubuntu.com/ubuntu/pool/main/w/wpasupplicant/wpasupplicant_0.7.3-6ubuntu2.2_amd64.deb
http://us.archive.ubuntu.com/ubuntu/pool/main/i/iputils/iputils-arping_20101006-1ubuntu1_amd64.deb
http://us.archive.ubuntu.com/ubuntu/pool/main/u/usb-modeswitch-data/usb-modeswitch-data_20120120-0ubuntu1_all.deb
http://us.archive.ubuntu.com/ubuntu/pool/main/u/usb-modeswitch/usb-modeswitch_1.2.3+repack0-1ubuntu2_amd64.deb
http://us.archive.ubuntu.com/ubuntu/pool/main/m/modemmanager/modemmanager_0.5.2.0-0ubuntu2_amd64.deb
http://us.archive.ubuntu.com/ubuntu/pool/main/n/network-manager-applet/network-manager-gnome_0.9.4.1-0ubuntu2.3_amd64.deb

The links above does not contain the link of network-manager itself. You can download it from here; from a software mirror close to you. Take care to choose the appropriate architecture (amd64 for 64-bit, i386 for 32-bit), and release version of your installed OS.

Now copy the deb files to /var/cache/apt/archives/

Run sudo-apt-get install network-manager in terminal. Now it will pick up deb files from cache and will not prompt to download them. If all goes well network-manager will be installed.

Finally reboot the system.