# Install packages on machine not connected to internet

**URL:** https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650
**Category:** General Usage
**Tags:** question, package
**Created:** [June 21, 2023, 1:15pm UTC](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650 "2023-06-21T13:15:34Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![gitboy16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gitboy16/32/24906_2.png) [@gitboy16](https://discourse.julialang.org/u/gitboy16)
#### Post date: [June 21, 2023, 1:15pm UTC](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650/1 "2023-06-21T13:15:35Z")

</div>

Hi,

I work on a windows machine connected to internet. (I can’t use Docker on it)  
From that machine I can connect to a ubuntu server which is not connected to internet.  
I manage to install Julia on the server by downloading the right binary on the windows machine and moving it (and unzipping it) on the ubuntu server.

The issue is that I would like to install packages on the ubuntu server. Does anyone know how I can do that?

Is there a way to download a package (example: DataFrames.jl) and all its dependencies (including the right jll packages) and then move them to the server ?

Thank you

---

<div class="post-metadata">

### Author: ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)
#### Post date: [June 21, 2023, 3:53pm UTC](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650/2 "2023-06-21T15:53:13Z")

</div>

I work on secure (dark) sites also.  
One thing to ask - I had a customer who assured me that they had a secure network. It turns out hey have a proxy so can easily install software.  
So ask if there is a proxy.

---

<div class="post-metadata">

### Author: ![gitboy16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gitboy16/32/24906_2.png) [@gitboy16](https://discourse.julialang.org/u/gitboy16)
#### Post date: [June 21, 2023, 4:00pm UTC](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650/3 "2023-06-21T16:00:15Z")

</div>

Lol, it is just my IT which is a pain in the back. It is a dev server which is not allowed to be connected to internet or any production environment. On windows I do indeed need a proxy to access internet but on the server I am not aware of anything and if I ask they will likely chop my head off.

---

<div class="post-metadata">

### Author: ![runjaj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/runjaj/32/23628_2.png) [@runjaj](https://discourse.julialang.org/u/runjaj)
#### Post date: [June 21, 2023, 4:59pm UTC](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650/4 "2023-06-21T16:59:48Z")

</div>

I have no idea if this could help: [LocalPackageServer](https://github.com/GunnarFarneback/LocalPackageServer.jl)

---

<div class="post-metadata">

### Author: ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)
#### Post date: [June 21, 2023, 7:17pm UTC](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650/5 "2023-06-21T19:17:54Z")

</div>

Sort of, but it has no real advantages over [GitHub - JuliaPackaging/PkgServer.jl](https://github.com/JuliaPackaging/PkgServer.jl) for this purpose. See [JuliaRegistries setup for air gapped network - #21 by GunnarFarneback](https://discourse.julialang.org/t/juliaregistries-setup-for-air-gapped-network/94313/21) for some earlier discussion in this area. I should add that to get the right artifacts you should populate from the same platform you use on the air-gapped network.

---

<div class="post-metadata">

### Author: ![HanD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hand/32/213908_2.png) [@HanD](https://discourse.julialang.org/u/HanD)
#### Post date: [June 22, 2023, 2:24pm UTC](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650/6 "2023-06-22T14:24:32Z")

</div>

You can try the following.

First, on the machine which has internet connection, run the following:

```julia
$ JULIA_DEPOT_PATH=offline_depot julia
julia> ]
pkg> add StatsBase MultivariateStats # these are just examples, add all the packages you will need here
pkg> <Ctrl-D>

```

Then copy the `offline_depot` directory (created by Julia in the previous step) onto the machine you will use in offline mode. Then start Julia like this:

```julia
$ JULIA_DEPOT_PATH=<path-to-your>/offline_depot JULIA_PKG_OFFLINE=true julia
julia> using MultivariateStats # use the preinstalled packages here

```

Hope that helps.

---

<div class="post-metadata">

### Author: ![gitboy16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gitboy16/32/24906_2.png) [@gitboy16](https://discourse.julialang.org/u/gitboy16)
#### Post date: [June 22, 2023, 8:12pm UTC](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650/7 "2023-06-22T20:12:06Z")

</div>

Thanks but that only works if both machines are running the same operating system.

---

<div class="post-metadata">

### Author: ![HanD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hand/32/213908_2.png) [@HanD](https://discourse.julialang.org/u/HanD)
#### Post date: [June 23, 2023, 6:55am UTC](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650/8 "2023-06-23T06:55:43Z")

</div>

Right, sorry, I ignored that part of the question.

I assume you connect to the Ubuntu server via ssh. If that is the case, you can set up ssh as a proxy server and use it to access the internet from the server.

```julia
windows> ssh -R8080 ubuntu-server.local # edited from: ssh -D8080 ubuntu-server.local
ubuntu$ git config --global http.proxy 'socks5://127.0.0.1:8080'
ubuntu$ export JULIA_PKG_USE_CLI_GIT=true
ubuntu$ julia
julia> ]registry up

```

I haven’t tested this, bit it should work, as long as you fetch registries and packages using HTTP.

Alternatively, you can set up WSL on your Windows machine, install Julia there, and then you are on the same platform as your server, so the depot copying solution will work.

---

<div class="post-metadata">

### Author: ![jbrea](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbrea/32/3879_2.png) [@jbrea](https://discourse.julialang.org/u/jbrea)
#### Post date: [June 23, 2023, 7:07am UTC](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650/9 "2023-06-23T07:07:30Z")

</div>

> [@gitboy16](#):
>
> The issue is that I would like to install packages on the ubuntu server. Does anyone know how I can do that?

Maybe it works with an [ssh tunnel and port forwarding](https://unix.stackexchange.com/questions/116191/give-server-access-to-internet-via-client-connecting-by-ssh), but I’ve never tried this myself.

EDIT: This is essentially the same approach as the one described by @HanD above.

---

<div class="post-metadata">

### Author: ![gitboy16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gitboy16/32/24906_2.png) [@gitboy16](https://discourse.julialang.org/u/gitboy16)
#### Post date: [June 23, 2023, 12:51pm UTC](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650/10 "2023-06-23T12:51:07Z")

</div>

I get the following error for both @HanD and @jbrea suggestions:

```julia
(@v1.9) pkg> registry up
┌ Warning: could not download https://pkg.julialang.org/registries
│ exception = RequestError: Could not resolve host: pkg.julialang.org while requesting https://pkg.julialang.org/registries
└ @ Pkg.Registry ~/julia/share/julia/stdlib/v1.9/Pkg/src/Registry/Registry.jl:69

(@v1.9) pkg> add DataFrames
  Installing known registries into `~/.julia`
┌ Warning: could not download https://pkg.julialang.org/registries
│ exception = RequestError: Could not resolve host: pkg.julialang.org while requesting https://pkg.julialang.org/registries
└ @ Pkg.Registry ~/julia/share/julia/stdlib/v1.9/Pkg/src/Registry/Registry.jl:69
┌ Warning: could not download https://pkg.julialang.org/registries
│ exception = RequestError: Could not resolve host: pkg.julialang.org while requesting https://pkg.julialang.org/registries
└ @ Pkg.Registry ~/julia/share/julia/stdlib/v1.9/Pkg/src/Registry/Registry.jl:69
     Cloning registry from "https://github.com/JuliaRegistries/General.git"
fatal: unable to access 'https://github.com/JuliaRegistries/General.git/': Failed to connect to 127.0.0.1 port 8080: Connection refused

```

---

<div class="post-metadata">

### Author: ![HanD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hand/32/213908_2.png) [@HanD](https://discourse.julialang.org/u/HanD)
#### Post date: [June 23, 2023, 12:55pm UTC](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650/11 "2023-06-23T12:55:16Z")

</div>

My bad, `-D` proxies _local_ connections to the remote server, you need the opposite, proxy remote connections to the local machine with `-R`. So the correct ssh command would look like this:

```julia
$ ssh -R8080 ubuntu-server.local

```

I now tested this in my own local environment, and it seems to do the trick.

---

<div class="post-metadata">

### Author: ![gitboy16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gitboy16/32/24906_2.png) [@gitboy16](https://discourse.julialang.org/u/gitboy16)
#### Post date: [June 23, 2023, 1:06pm UTC](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650/12 "2023-06-23T13:06:23Z")

</div>

When I run this on the windows machine I get:

```julia
Warning: remote port forwarding failed for listen port 8080

```

Then it asks me for my password, which I enter and then connect. When I try to install a package I still get the same error `Connection refused`

---

<div class="post-metadata">

### Author: ![gitboy16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gitboy16/32/24906_2.png) [@gitboy16](https://discourse.julialang.org/u/gitboy16)
#### Post date: [June 23, 2023, 1:26pm UTC](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650/13 "2023-06-23T13:26:33Z")

</div>

I think the issue is port forwardimg is not allowed. In the following file on the ubuntu machine: `/etc/ssh/sshd_config` I found that `AllowTcpForwarding no` and I am not going to change that file otherwise I will really get my head chopped off… Is that something you can test on your side if you set that variable? Thank you

---

<div class="post-metadata">

### Author: ![frylock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frylock/32/50213_2.png) [@frylock](https://discourse.julialang.org/u/frylock)
#### Post date: [June 23, 2023, 1:38pm UTC](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650/14 "2023-06-23T13:38:37Z")

</div>

Doesn’t solve the `Connection Refused` problem, but you can eliminate the password login by setting up PKI for SSH:

> **[How to Setup Passwordless SSH Login](https://linuxize.com/post/how-to-setup-passwordless-ssh-login/)**
>
> In this article we will show you how to setup an SSH key-based authentication and connect to your Linux servers without a entering password.

---

<div class="post-metadata">

### Author: ![jbrea](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbrea/32/3879_2.png) [@jbrea](https://discourse.julialang.org/u/jbrea)
#### Post date: [June 23, 2023, 1:39pm UTC](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650/15 "2023-06-23T13:39:33Z")

</div>

Maybe [this](https://unix.stackexchange.com/questions/406695/how-to-ssh-forwarding-with-allowtcpforwarding-set-to-no) helps?

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [June 23, 2023, 2:12pm UTC](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650/16 "2023-06-23T14:12:16Z")

</div>

It’s similar to what had been suggested above, but this thread

> [@Installing packages via an SSH SOCKS proxy on a compute cluster](https://discourse.julialang.org/t/installing-packages-via-an-ssh-socks-proxy-on-a-compute-cluster/71735):
>
> I have spent the better part of a day figuring this out, so I thought it might be interesting to share for others: In my case, I would like to run Julia on a university cluster with very restricted internet access from inside. That is, most websites and services are not directly reachable from the login nodes (I am not even talking about the compute nodes). This makes it impossible to, e.g., just run Julia and install packages using Pkg, since the package servers and other locations are not ava…

has been around for about a couple of years.

---

<div class="post-metadata">

### Author: ![HanD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hand/32/213908_2.png) [@HanD](https://discourse.julialang.org/u/HanD)
#### Post date: [June 23, 2023, 3:38pm UTC](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650/17 "2023-06-23T15:38:04Z")

</div>

The 8080 port is probably taken by some other process. You can use any number between 1024 and 65535. Just make sure to use the same number in the git config.

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [June 23, 2023, 6:23pm UTC](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650/18 "2023-06-23T18:23:41Z")

</div>

But why git? Registered packages aren’t installed via git.

---

<div class="post-metadata">

### Author: ![gitboy16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gitboy16/32/24906_2.png) [@gitboy16](https://discourse.julialang.org/u/gitboy16)
#### Post date: [June 23, 2023, 9:17pm UTC](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650/19 "2023-06-23T21:17:51Z")

</div>

I have checked with `netstat` and the port is not used. I have tried with various other port and I get the same error.

---

<div class="post-metadata">

### Author: ![gitboy16](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gitboy16/32/24906_2.png) [@gitboy16](https://discourse.julialang.org/u/gitboy16)
#### Post date: [June 23, 2023, 9:19pm UTC](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650/20 "2023-06-23T21:19:14Z")

</div>

Thanks but I am a bit struggling with the exact steps.

[Next page](https://discourse.julialang.org/t/install-packages-on-machine-not-connected-to-internet/100650.md?page=2)
