If you want to freeze all packages (as per your previous thread) and don’t need users changing anything in the environment, you might consider using PackageCompiler to simply compile all packages into the sysimage - which would also give you quicker startup times!
To expand on what @bjarthur said, the location where packages are installed are defined using a variable called DEPOT_PATH. It can be a list of paths, where packages are written to the first element of the list, and read from all the paths in the list.
So on my machine, the default depot path is as follows:
So if you popfirst!(DEPOT_PATH), then your packages will get installed in a location inside your julia install directory, rather than in the user’s home dir.
Now, given this, you can of course set your DEPOT_PATH to any other location on your disk. When you set it from the shell, the environment variable is called JULIA_DEPOT_PATH. To see an example of an install script that does that, look here
Note that generally you would want to make the DEPOT_PATH writeable by any user that runs Julia, since the results of package precompilation (and artifacts) are written to the DEPOT_PATH. For similar reasons, you should not run multiple julia processes simultaneously looking at the same DEPOT_PATH while packages are precompiling. The solution to both is to ensure your packages are precompiled and loaded at install time (with Pkg.precompile() and/or using). Or just run your testsuite at install time.
Thanks @bjarthur for the quick solution & @avik for the explanation. I tried on my machine and got the concept. Problem is everything works on my machine
I will try both styles(popfirst and setting JULIA_DEPOT_PATH) on Servers (Linux environment) and update this ticket, but will take some time.
@nilshg - The sysimage is some kind of Julia package image? Complete OS image is not a solution for me.
Yes it’s basically a version of Julia with the packages you’re using built-in, similar to the standard library - so the same way you can just do using LinearAlgebra in a fresh Julia install without having to install package, you could do that for every package in your sysimage.