How to Install Debian Offline from Your Local Mirror

Share your own howto's etc. Not for support questions!

How to Install Debian Offline from Your Local Mirror

Postby timbgo » 2014-02-21 09:22

EDIT Sat 27 Dec 21h CET
This wouldn't work out of the box on the newer Apache2 deployment anymore. It's not wrong what you see here, but it is, currently, incomplete.

But there is my new guide which is much more complete and deals with these issues:
#######################################
Air-Gapped Debian Install for Newbies
viewtopic.php?f=16&t=119648

It also contains complete guide for serving the local mirror in your own, even only one computer, not SOHO.
#######################################
EDIT END
This Tips page is part of my Poor User's Defences Set of Tips.

It is needed for installing Debian, from Jigdo DVDs previously
downloaded, completely offline in a safe environment, and not while
connected to the Internet, necessary in the anti-surveillance business
;-)

LINK HERE Jigdo Tips

If you haven't yet, install apache, probably this command will pull
all that's necessary:

# apt-get install apache2

Well, probably a good idea is also:

# apt-get install apache2-doc

in case you need some familiarizing with it, in which case, after
installing these docs, you can go and study a little on:

http://localhost/manual/

Next, we'll put, actually keep, in case you followed my Jigdo Tips and
use my script to automate jigdo download, the DVDs in:

/home/your_user_name/Debian/Old/

In such way that if you are user joe (the poor user ;-), it should
look like this:

root@yourbox:/home/joe# ls -l /home/joe/Debian/Old/
total 52551540
-rw-r--r-- 1 joe joe 4683745280 Feb 18 07:58 debian-testing-amd64-DVD-10.iso
-rw-r--r-- 1 joe joe 4639787008 Feb 18 09:17 debian-testing-amd64-DVD-11.iso
-rw-r--r-- 1 joe joe 3385694208 Feb 18 10:21 debian-testing-amd64-DVD-12.iso
-rw-r--r-- 1 joe joe 3998007296 Feb 18 00:34 debian-testing-amd64-DVD-1.iso
-rw-r--r-- 1 joe joe 4699787264 Feb 18 01:09 debian-testing-amd64-DVD-2.iso
-rw-r--r-- 1 joe joe 4664788992 Feb 18 01:27 debian-testing-amd64-DVD-3.iso
-rw-r--r-- 1 joe joe 4515536896 Feb 18 02:03 debian-testing-amd64-DVD-4.iso
-rw-r--r-- 1 joe joe 4694423552 Feb 18 02:38 debian-testing-amd64-DVD-5.iso
-rw-r--r-- 1 joe joe 4619849728 Feb 18 03:35 debian-testing-amd64-DVD-6.iso
-rw-r--r-- 1 joe joe 4694810624 Feb 18 04:29 debian-testing-amd64-DVD-7.iso
-rw-r--r-- 1 joe joe 4663046144 Feb 18 05:38 debian-testing-amd64-DVD-8.iso
-rw-r--r-- 1 joe joe 4553240576 Feb 18 06:39 debian-testing-amd64-DVD-9.iso
root@yourbox:/home/joe#

Next, create a dir in what will show, if defaults are not messed with, as:

http://localhost/Debian/

and that is:
# mkdir /var/www/Debian/

Try to open http://localhost/Debian/ It will be empty, but it will
exist. We'll populate it soon.

If you, joe (surely substitute your username for joe wherever you
locate the man below, mecilessly, as mecilessly as some freaky crappy,
but very dangerous people would like to lay hands on my hero, Edward
Snowden, here though joe must go!, more than Yanukovich, absolutely,
else it won't work at all,

Спава Укrаине!

Glory to Ukraine!,
Yanukovich out!)...

But I was saying, if you, joe, have those ISOs in
/home/joe/Debian/Old/ as shown above, only newer if you're reading
this much later, but hey, this is a target hopefully moving more
slowly than the kernel, where my huge work to make Debian packaged
Grsecurity patched kernel publically available for anyone to try, is
outdated in a few weeks:

LINK HERE

This Tips page I probably won't need to update so soon, and generally
not so often...

Now, here are the scripts to mount and serve the Testing branch
Debian, the bleeding edge of Debian development (which you have
previously downloaded), to update your system locally, without any
more need to connect to Internet for the installation.

Code: Select all
mkdir -p deb-1  && \
 mount -o loop /home/joe/Debian/Old/debian-testing-amd64-DVD-1.iso deb-1
mkdir -p deb-2  && \
 mount -o loop /home/joe/Debian/Old/debian-testing-amd64-DVD-2.iso deb-2
mkdir -p deb-3  && \
 mount -o loop /home/joe/Debian/Old/debian-testing-amd64-DVD-3.iso deb-3
mkdir -p deb-4  && \
 mount -o loop /home/joe/Debian/Old/debian-testing-amd64-DVD-4.iso deb-4
mkdir -p deb-5  && \
 mount -o loop /home/joe/Debian/Old/debian-testing-amd64-DVD-5.iso deb-5
mkdir -p deb-6  && \
 mount -o loop /home/joe/Debian/Old/debian-testing-amd64-DVD-6.iso deb-6
mkdir -p deb-7  && \
 mount -o loop /home/joe/Debian/Old/debian-testing-amd64-DVD-7.iso deb-7
mkdir -p deb-8  && \
 mount -o loop /home/joe/Debian/Old/debian-testing-amd64-DVD-8.iso deb-8
mkdir -p deb-9  && \
 mount -o loop /home/joe/Debian/Old/debian-testing-amd64-DVD-9.iso deb-9
mkdir -p deb-10 && \
 mount -o loop /home/joe/Debian/Old/debian-testing-amd64-DVD-10.iso deb-10
mkdir -p deb-11 && \
 mount -o loop /home/joe/Debian/Old/debian-testing-amd64-DVD-11.iso deb-11
mkdir -p deb-12 && \
 mount -o loop /home/joe/Debian/Old/debian-testing-amd64-DVD-12.iso deb-12


Select this code with the mouse (simply the usual left mouse button
and dragging it from the beginning to the end of the script until it
changes color, indicating that it is selected). It'll now be in your
mouse clipboard (unless your configuration is not typical, in which
case do the next step in some other way). Paste this code carefully,
after typing, as root, "cat > /var/www/Debian/mnt.sh" by pressing the
middle mouse button (upon which pressing what you just a few seconds
ago selected with the mouse, will appear in your console, and hitting
Enter, like so:

Code: Select all
# cat > /var/www/Debian/mnt.sh
HERE THE CODE APPEARS UPON YOUR PRESSING THE MIDDLE MOUSE BUTTON


Now if the code did get pasted, to finish the cat'ing mode you need to
issue another command, Ctrl-D, which is keeping the Ctrl butten
pressed and while it is still pressed, hitting letter d shortly.

Ctrl-D

The command prompt will return.

Now:

# /var/www/Debian/
# chmod 755 mnt.sh

Did you remember to replace all the Yanukovich's, pardon, joe with the
good Ukrainian leaders, pardon your username in the script?

Well, if you didn't there's a simpler way. Say your username is
ukrainian.

What you can do is:

# sed 's/joe/ukrainian/g' mnt.sh

Have a look at the output of that command now. It should read:

Code: Select all
 mount -o loop /home/ukrainian/Debian/Old/debian-testing-amd64-DVD-1.iso deb-1
mkdir -p deb-2  && \
 mount -o loop /home/ukrainian/Debian/Old/debian-testing-amd64-DVD-2.iso deb-2
mkdir -p deb-3  && \
 mount -o loop /home/ukrainian/Debian/Old/debian-testing-amd64-DVD-3.iso deb-3
mkdir -p deb-4  && \
 mount -o loop /home/ukrainian/Debian/Old/debian-testing-amd64-DVD-4.iso deb-4
mkdir -p deb-5  && \
 mount -o loop /home/ukrainian/Debian/Old/debian-testing-amd64-DVD-5.iso deb-5
mkdir -p deb-6  && \
 mount -o loop /home/ukrainian/Debian/Old/debian-testing-amd64-DVD-6.iso deb-6
mkdir -p deb-7  && \
 mount -o loop /home/ukrainian/Debian/Old/debian-testing-amd64-DVD-7.iso deb-7
mkdir -p deb-8  && \
 mount -o loop /home/ukrainian/Debian/Old/debian-testing-amd64-DVD-8.iso deb-8
mkdir -p deb-9  && \
 mount -o loop /home/ukrainian/Debian/Old/debian-testing-amd64-DVD-9.iso deb-9
mkdir -p deb-10 && \
 mount -o loop /home/ukrainian/Debian/Old/debian-testing-amd64-DVD-10.iso deb-10
mkdir -p deb-11 && \
 mount -o loop /home/ukrainian/Debian/Old/debian-testing-amd64-DVD-11.iso deb-11
mkdir -p deb-12 && \
 mount -o loop /home/ukrainian/Debian/Old/debian-testing-amd64-DVD-12.iso deb-12


So you could go copying with the mouse and pasting and renaming et
cetera, but there is a simpler way to do it.

The sed ("the Stream EDitor", man sed) command above didn't change ths
script, but we wish to have a script with our name in it, and not joe,
we can run the following different sed command:

# sed -i.bak 's/joe/ukrainian/g' mnt.sh

If you now

# cat mnt.sh

you will see that it has all the lines that had the
string 'joe' in them changed to have exactly what we need, the string
'ukrainian' instead.

If all is well, meaning actually here, if I didn't forget something,
or you didn't follow me corectly, then now (we've been all this time
in /var/www/Debian directory) if we run that script, we will get our
jigdo's mounted!

root@yourbox:/var/www/Debian# pwd
/var/www/Debian
root@yourbox:/var/www/Debian# ./mnt.sh
mount: block device /mnt/g0-C/dLo/Debian/Jigdo/debian-testing-amd64-DVD-1.iso is write-protected, mounting read-only
mount: block device /mnt/g0-C/dLo/Debian/Jigdo/debian-testing-amd64-DVD-2.iso is write-protected, mounting read-only
mount: block device /mnt/g0-C/dLo/Debian/Jigdo/debian-testing-amd64-DVD-3.iso is write-protected, mounting read-only
mount: block device /mnt/g0-C/dLo/Debian/Jigdo/debian-testing-amd64-DVD-4.iso is write-protected, mounting read-only
mount: block device /mnt/g0-C/dLo/Debian/Jigdo/debian-testing-amd64-DVD-5.iso is write-protected, mounting read-only
mount: block device /mnt/g0-C/dLo/Debian/Jigdo/debian-testing-amd64-DVD-6.iso is write-protected, mounting read-only
mount: block device /mnt/g0-C/dLo/Debian/Jigdo/debian-testing-amd64-DVD-7.iso is write-protected, mounting read-only
mount: block device /mnt/g0-C/dLo/Debian/Jigdo/debian-testing-amd64-DVD-8.iso is write-protected, mounting read-only
mount: block device /mnt/g0-C/dLo/Debian/Jigdo/debian-testing-amd64-DVD-9.iso is write-protected, mounting read-only
mount: block device /mnt/g0-C/dLo/Debian/Jigdo/debian-testing-amd64-DVD-10.iso is write-protected, mounting read-only
mount: block device /mnt/g0-C/dLo/Debian/Jigdo/debian-testing-amd64-DVD-11.iso is write-protected, mounting read-only
mount: block device /mnt/g0-C/dLo/Debian/Jigdo/debian-testing-amd64-DVD-12.iso is write-protected, mounting read-only
root@yourbox:/var/www/Debian#

You may not have sufficient number of loop devices available. You do
have if you used my newest config files to compile the Grsecurity
patched kernel. Head there to see what you have missing, search for
loop or LOOP, can't remember now:

LINK HERE

And if you now look up, in the Iceweasel (support DuckDuckGo.com,
Google out!, get that freaking Surveillance Engine first thing to open
away from Iceweasel, please!, From stock repo packages out!, I know it
can be done for anyone personally, but I care other users, not just
me! For the love of God, offer it as choice if you will, don't impose
it on users, Debian Dear Leaders!)...

But I was saying, and if you now look up, in the Iceweasel, you should
have a fine list of all the nine deb-X and three deb-XX jigdo DVD
local repo direcories to serve for your standalone box!

If you now look up, in Firefox-renamed-Iceweasel, this page:

http://localhost/Debian/

The next thing to do is serve them really with writing them down in
/etc/apt/sources.list

Backup, such as just copy that file somewhere safe, in case you want
to revert to Internet installation for some reason later.

Code: Select all
deb http://localhost/Debian/deb-1/ jessie contrib main
deb http://localhost/Debian/deb-2/ jessie contrib main
deb http://localhost/Debian/deb-3/ jessie contrib main
deb http://localhost/Debian/deb-4/ jessie contrib main
deb http://localhost/Debian/deb-5/ jessie contrib main
deb http://localhost/Debian/deb-6/ jessie contrib main
deb http://localhost/Debian/deb-7/ jessie contrib main
deb http://localhost/Debian/deb-8/ jessie contrib main
deb http://localhost/Debian/deb-9/ jessie contrib main
deb http://localhost/Debian/deb-10/ jessie contrib main
deb http://localhost/Debian/deb-11/ jessie contrib main
deb http://localhost/Debian/deb-12/ jessie contrib main

deb http://localhost/Debian/deb-mm jessie main


Ah, this line:

deb http://localhost/Debian/deb-mm jessie main

if it causes problems to you, just comment it out, like this:

#deb http://localhost/Debian/deb-mm jessie main

But I advise you to read my Tips page:

How to Use the Arguably Superior Deb-Multimedia Repository

LINK HERE

Tired. Have a few more Tips to finish and publish, and I didn't need
this, but I feel passionate about GNU/Linux and can't see it getting
ruined...

Спава Укrаине!

Glory to Ukraine!, Yanukovich out!

Miroslav Rovis
Zagreb, Croatia

#################################################
Pls. let me know if you find any errors or typos so that I can
correct this Tips page A.S.A.P.
#################################################
But if some 'LINK HERE' are left as they are, that is less
urgent. Readers should be able to easily find all my Tips pages even
without a direct link.
#################################################
timbgo
 
Posts: 265
Joined: 2013-04-14 12:17

Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable