Download Local Emacs Packages

[James Dyer] : Jul 15, 2022 : 190 words
emacs linux 🏷️ org melpa emacs elpa 2022

Steps to locally download emacs packages for offline installation.

— TOC


Local ELPA MELPA ORG

cd ~ mkdir -p emacs-pkgs/melpa mkdir -p emacs-pkgs/elpa

# mirror the melpa emacs archive
echo
echo "updating MELPA..."
echo
rsync -avz --delete --progress rsync://melpa.org/packages/ ~/emacs-pkgs/melpa/.

# elpa
echo
echo "updating ELPA..."
echo
rsync -avz --delete --progress elpa.gnu.org::elpa/. ~/emacs-pkgs/elpa

# org (currently no rsync support)
echo
echo "updating ORG..."
echo
cd ~/emacs-pkgs
git clone https://git.savannah.gnu.org/git/emacs/org-mode.git

I then copy the emacs-pkgs directory to the offline target machine and change the default package manager archives to point to these packages.

Modify .emacs in the following manner commenting out the online package communication:

;; (setq package-archives '(("melpa" . "https://melpa.org/packages/")
;;                          ("org" . "https://orgmode.org/elpa/")
;;                          ("elpa" . "https://elpa.gnu.org/packages/")))

(setq package-archives '(("melpa". "~/emacs-pkgs/melpa")
                          ("org" . "~/emacs-pkgs/elpa")
                          ("elpa" . "~/emacs-pkgs/org-mode/lisp")))

Local from Mirror

First, you need to clone this repository.

git clone --depth 1 git@gitlab.com:d12frosted/elpa-mirror.git ~/.elpa-mirror

And then setup package-archives in your init.el file.

(setq package-archives
  `(("melpa" . ,(concat user-home-directory ".elpa-mirror/melpa/"))
     ("org"   . ,(concat user-home-directory ".elpa-mirror/org/"))
     ("gnu"   . ,(concat user-home-directory ".elpa-mirror/gnu/"))))

https://github.com/d12frosted/elpa-mirror

Extra

ada-mode

ada-mode.el version 4.0 before AdaCore

(add-to-list 'load-path "~/emacs-pkgs/old/ada-mode-4.1")
(require 'ada-mode)