From Mageia wiki
Jump to: navigation, search
m (Post install: add loopback mount of ISO install image)
m (Step-2: Download Mageia install ISO file: l10n neutral link fix)
Line 84: Line 84:
 
== Step-2: Download Mageia install ISO file ==
 
== Step-2: Download Mageia install ISO file ==
  
Connect to https://www.mageia.org/en/downloads/ and select your download ISO image for installing Mageia.
+
Connect to https://www.mageia.org/downloads/ and select your download ISO image for installing Mageia.
 
Choose the 32 or 64 bit image to match your computer's processor.
 
Choose the 32 or 64 bit image to match your computer's processor.
 
In this example, the 64bit Mageia install image is downloaded.
 
In this example, the 64bit Mageia install image is downloaded.
Line 155: Line 155:
 
Mageia-7.1-x86_64.iso: OK
 
Mageia-7.1-x86_64.iso: OK
 
</pre>
 
</pre>
 
  
 
== Step-3: Download Mageia <i>Network Install</i> ISO image ==
 
== Step-3: Download Mageia <i>Network Install</i> ISO image ==

Revision as of 13:29, 12 March 2020


Introduction

This page describes how to configure grub2 to install Mageia from a Mageia install ISO saved on disk.

No install CD, DVD or USB are needed.

Acknowledgements

Thanks to Philippe Makowski for suggesting this idea.


Assumptions and scope

The method described here depends on having:

  1. grub2 for booting. This is the default in Mageia 6.
  2. A separate disk filesystem partition /mnt/install-iso/
  3. A copy of Mageia install ISO file in /mnt/install-iso/
  4. A copy of Mageia network install ISO also in /mnt/install-iso/


Benefits

Firstly, no install media is needed: not CD, DVD nor USB.

Secondly, it is a fast method of installing limited only by disk speed.

Thirdly, post install, the install ISO can be loop mounted for further package installing.


Overview

  1. Create a partition /mnt/install-iso for storing install ISO files (can also use existing partiton if enough space)
  2. Download and verify two Mageia install ISO files: 1) network install 2) Mageia install
  3. Create ${HOME}/etc_grub.d_40_custom and append to /etc/grub.d/40_custom
  4. Run drakboot
  5. Reboot and select your new grub boot option for "network install". Note: this allows complete flexibility and includes option for installing from ISO on disk.
  6. From booted network install image, select install from disk
  7. Identify the partition (with the install ISO) and specify the ISO file image to boot
  8. Complete install process (as normal)
  9. Post-install: loop mount the Mageia install ISO to speed package installation


Preparation

Step-1: Create local disk filesystem partition /mnt/install-iso/

Use /usr/sbin/diskdrake to create a new partition mounted at /mnt/install-iso/ on your disk drive.

It will need to be large enough for at least one (eg 5gb), possibly two install ISO images (9gb).

Label the partition "INSTALL-ISO" to make it easier to find and reference.

For example:

[user@localhost]$ df /mnt/install-iso
Filesystem               Size  Used Avail Use% Mounted on
/dev/sda1                5.9G   24M  5.6G   1% /mnt/install-iso

Label the partition "INSTALL-ISO" (for example, using the gparted program).

[root@localhost ~]# lsblk -o NAME,LABEL /dev/sda
NAME           LABEL
sda            
├─sda1         INSTALL-ISO
├─sda2         
├─sda5         BOOT
├─sda6         
│ └─crypt_sda6 SWAP
├─sda7         
│ └─crypt_sda7 ROOT
├─sda8         
│ └─crypt_sda8 USR-LOCAL
└─sda9         
  └─crypt_sda9 HOME

Step-2: Download Mageia install ISO file

Connect to https://www.mageia.org/downloads/ and select your download ISO image for installing Mageia. Choose the 32 or 64 bit image to match your computer's processor. In this example, the 64bit Mageia install image is downloaded.


Download sha512 checksum file

wget http://www.mirrorservice.org/sites/mageia.org/pub/mageia/iso/7/Mageia-7-x86_64/Mageia-7-x86_64.iso.sha512

Example:

[root@localhost install-iso]# cd /mnt/install-iso && wget http://www.mirrorservice.org/sites/mageia.org/pub/mageia/iso/7/Mageia-7-x86_64/Mageia-7-x86_64.iso.sha512
--2019-07-14 18:29:29--  http://www.mirrorservice.org/sites/mageia.org/pub/mageia/iso/7/Mageia-7-x86_64/Mageia-7-x86_64.iso.sha512
Resolving www.mirrorservice.org (www.mirrorservice.org)... 212.219.56.184, 2001:630:341:12::184
Connecting to www.mirrorservice.org (www.mirrorservice.org)|212.219.56.184|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 150 [application/x-iso9660-image]
Saving to: ‘Mageia-7-x86_64.iso.sha512’

Mageia-7-x86_64.iso.sha512                       100%[======================================================================>]     150  --.-KB/s    in 0s      

2019-07-14 18:29:30 (19.8 MB/s) - ‘Mageia-7-x86_64.iso.sha512’ saved [150/150]


Download Mageia install ISO file

Next, we download the install ISO file. this is over 4gb and will take a while to download:

wget http://www.mirrorservice.org/sites/mageia.org/pub/mageia/iso/7/Mageia-7-x86_64/Mageia-7-x86_64.iso

Example:

[root@localhost install-iso]# wget http://www.mirrorservice.org/sites/mageia.org/pub/mageia/iso/7/Mageia-7-x86_64/Mageia-7-x86_64.iso
--2019-07-14 18:44:53--  http://www.mirrorservice.org/sites/mageia.org/pub/mageia/iso/7/Mageia-7-x86_64/Mageia-7-x86_64.iso
Resolving www.mirrorservice.org (www.mirrorservice.org)... 212.219.56.184, 2001:630:341:12::184
Connecting to www.mirrorservice.org (www.mirrorservice.org)|212.219.56.184|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4447385600 (4.1G) [application/x-iso9660-image]
Saving to: ‘Mageia-7-x86_64.iso’

Mageia-7-x86_64.iso                                                                                      ]   2.96M   414KB/s    eta 3h 5m  


Verify the downloaded ISO file

sha512sum -c Mageia-7.1-x86_64.iso.sha512

Example:

[root@localhost install-iso]# pwd
/mnt/install-iso

[root@localhost install-iso]# ls -al
total 4397008
drwxr-xr-x 3 mpb  mpb        4096 Jul 14 18:39 ./
drwxr-xr-x 5 root root       4096 Jul 12 16:47 ../
drwx------ 2 root root      16384 Jul 11 17:54 lost+found/
-rw-r--r-- 1 mpb  mpb  4502501376 Jul 13 00:10 Mageia-7.1-x86_64.iso
-rw-r--r-- 1 mpb  mpb         152 Jul 13 00:10 Mageia-7.1-x86_64.iso.sha512

[root@localhost install-iso]# sha512sum -c Mageia-7.1-x86_64.iso.sha512   # verify ISO image
Mageia-7.1-x86_64.iso: OK

Step-3: Download Mageia Network Install ISO image

Connect to https://www.mageia.org/en/downloads/ and select the appropriate network install image for your system. First select "Network Installation". Choose from 32 or 64 bit according to your computer processor. Finally, select either "Free Software CD" or "Nonfree firmware CD".


download the sha512 checksum file

wget ftp://www.mirrorservice.org/sites/mageia.org/pub/mageia/distrib/7/x86_64/install/images/Mageia-7-netinstall-nonfree-x86_64.iso.sha512

Example:

[root@localhost install-iso]# wget ftp://www.mirrorservice.org/sites/mageia.org/pub/mageia/distrib/7/x86_64/install/images/Mageia-7-netinstall-nonfree-x86_64.iso.sha512
--2019-07-14 19:11:53--  ftp://www.mirrorservice.org/sites/mageia.org/pub/mageia/distrib/7/x86_64/install/images/Mageia-7-netinstall-nonfree-x86_64.iso.sha512
           => ‘Mageia-7-netinstall-nonfree-x86_64.iso.sha512’
Resolving www.mirrorservice.org (www.mirrorservice.org)... 212.219.56.184, 2001:630:341:12::184
Connecting to www.mirrorservice.org (www.mirrorservice.org)|212.219.56.184|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD (1) /sites/mageia.org/pub/mageia/distrib/7/x86_64/install/images ... done.
==> SIZE Mageia-7-netinstall-nonfree-x86_64.iso.sha512 ... 169
==> PASV ... done.    ==> RETR Mageia-7-netinstall-nonfree-x86_64.iso.sha512 ... done.
Length: 169 (unauthoritative)

Mageia-7-netinstall-nonfree-x86_64.iso.sha512    100%[====================================================================================>]     169  --.-KB/s    in 0s      

2019-07-14 19:11:55 (20.1 MB/s) - ‘Mageia-7-netinstall-nonfree-x86_64.iso.sha512’ saved [169]


download network install ISO

wget ftp://www.mirrorservice.org/sites/mageia.org/pub/mageia/distrib/7/x86_64/install/images/Mageia-7-netinstall-nonfree-x86_64.iso

Example:

[root@localhost install-iso]# wget ftp://www.mirrorservice.org/sites/mageia.org/pub/mageia/distrib/7/x86_64/install/images/Mageia-7-netinstall-nonfree-x86_64.iso
--2019-07-14 19:14:15--  ftp://www.mirrorservice.org/sites/mageia.org/pub/mageia/distrib/7/x86_64/install/images/Mageia-7-netinstall-nonfree-x86_64.iso
           => ‘Mageia-7-netinstall-nonfree-x86_64.iso’
Resolving www.mirrorservice.org (www.mirrorservice.org)... 212.219.56.184, 2001:630:341:12::184
Connecting to www.mirrorservice.org (www.mirrorservice.org)|212.219.56.184|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD (1) /sites/mageia.org/pub/mageia/distrib/7/x86_64/install/images ... done.
==> SIZE Mageia-7-netinstall-nonfree-x86_64.iso ... 84934656
==> PASV ... done.    ==> RETR Mageia-7-netinstall-nonfree-x86_64.iso ... done.
Length: 84934656 (81M) (unauthoritative)

Mageia-7-netinstall-nonfree-x86_64.iso           100%[========================================================================>]  81.00M   443KB/s    in 2m 52s  

2019-07-14 19:17:07 (483 KB/s) - ‘Mageia-7-netinstall-nonfree-x86_64.iso’ saved [84934656]


Verify the download

sha512 -c Mageia-7-netinstall-nonfree-x86_64.iso.sha512

Example:

[root@localhost install-iso]# sha512sum -c Mageia-7-netinstall-nonfree-x86_64.iso.sha512
Mageia-7-netinstall-nonfree-x86_64.iso: OK


Step-4: Add entry to grub2 configuration file for booting Mageia Network Install ISO image

Note that the process of installing from an ISO image on disk is in two stages. The first stage is to boot the "Network Install" iso image and that is what we configure in grub2 (in this step).

The second stage is when we have booted "network Install" we select the install method to boot from disk and then specify the Mageia install iso image.

Here is an example of: /etc/grub.d/40_custom where the ISO install image is "Mageia-6-netinstall-nonfree-x86_64.iso" in partition /dev/sda12 mounted at /mnt/install-iso/

Take care to define the correct values for:

  1. set isofile=
  2. set root=
  3. loopback loop

In the examples shown here for 64-bit, these are:

  1. set isofile="Mageia-7-netinstall-nonfree-x86_64.iso"
  2. set root='hd0,1'
  3. loopback loop (hd0,1)$isofile

Explanation:

  1. "Mageia-7-netinstall-nonfree-x86_64.iso" is the name of the Mageia Network Install image we downloaded.
  2. 'hd0,1' means the first disk /dev/sda and the 1st partition. /dev/sda1 in this example (mounted as /mnt/install-iso/ ).

Nota bene: When the install is done it is likely that /etc/grub.d/40_custom will be lost.
For this reason, create ${HOME}/etc_grub.d_40_custom on the assumption that /home/ will be preserved during the install then append ${HOME}/etc_grub.d_40_custom to /etc/grub.d/40_custom.

NB: do *not* overwrite any existing /etc/grub.d/40_custom. In Mageia 7, the default contains:

#!/usr/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

The following is the part we are appending to /etc/grub.d/40_custom. NB in this example (below), we use "\$isofile" to prevent the shell from interpreting "$isofile" as an empty shell variable.

$ cat << EEOOFF >> ${HOME}/etc_grub.d_40_custom

# --------------------------------------------- added on $(date "+%Y_%m_%d at %H:%M")
# Example for adding to /etc/grub.d/40_custom
# 
# Reference: https://wiki.mageia.org/en/Installing_Mageia_from_ISO_images_on_disk_using_grub2
#
# NB ensure correct values set for your configuration below:
#
#    1) set isofile=
#       example: set isofile="/Mageia-7-netinstall-nonfree-x86_64.iso"
#       NB leading "/"
#
#    2) set root=
#       example: set root="hd0,1"
#       This is for /dev/sda1. Other examples:
#        /mnt/install-iso/ mounted at /dev/sda12 is "hd0,12"
#        /mnt/install-iso/ mounted at /dev/sdb9 is "hd1,9"
#
#    3) loopback loop
#       example: loopback loop (hd0,1)\$isofile
#       NB "hd0,1" is /dev/sda1 and no "/" before "\$isofile"
#
#   

# 64-bit example: 

 menuentry "Mageia 7 Network Install nonfree 64-bit iso" {
         insmod gzio
         insmod part_msdos
         insmod ext2
         insmod xfs
         insmod loopback
         insmod iso9660
         insmod udf
         set isofile="/Mageia-7-netinstall-nonfree-x86_64.iso"
         set root="hd0,1"
         loopback loop (hd0,1)\$isofile
         linux (loop)/isolinux/x86_64/vmlinuz isofile=\$isofile
         initrd (loop)/isolinux/x86_64/all.rdz
 }

# 32-bit example:
# NB: for the 32-bit version, the ISO filename has "i586"
#     but the "linux" and "loop" paths use "i386".
#     (Can verify by loop mounting the network install ISO and checking paths.)

 menuentry "Mageia 7 Network Install nonfree 32-bit iso" {
         insmod gzio
         insmod part_msdos
         insmod ext2
         insmod xfs
         insmod loopback
         insmod iso9660
         insmod udf
         set isofile="/Mageia-7-netinstall-nonfree-i586.iso"
         set root="hd0,1"
         loopback loop (hd0,1)\$isofile
         linux (loop)/isolinux/i386/vmlinuz isofile=\$isofile
         initrd (loop)/isolinux/i386/all.rdz
 }

EEOOFF

Review your ${HOME}/etc_grub.d_40_custom and verify that it is correct. In particular check the "loopback" and "linux" lines are not missing "$isofile".


NB IMPORTANT:
Verify that the settings for "set isofile=", "set root=", and "loopback loop" are correct for your system.
Note that the "set isofile=" value must begin with a "/" symbol followed by the name of the ISO file.

Append the grub2 configuration file to /etc/grub.d/40_custom. NB, modify user to match your login user.

# Run as root
# modify "user" for your login

# cat /home/user/etc_grub.d_40_custom >> /etc/grub.d/40_custom

Step-5: run "drakboot"

Now, as root, run "drakboot" to make this configuration active for next reboot.

Example:

/usr/bin/drakboot

The following drakboot windows will appear:

2019 07 14 drakboot a.png

2019 07 14 drakboot b.png


Step-6: Make a note of your disk partition layout

It is very useful to have a list of the partitions on your disk with the mount points when you reach the install stage.
It is also helpful to label partitions which can easily be done using, for example, gparted.

For example: the root partition mounted at "/" can be labelled "ROOT", the home partition mounted at /home labelled "HOME" etc

It can be useful to either make a printout or take screen shots and copy to another device of the output from "df" and/or print the partition layout shown in gparted.

Example: from "df" command showing partition names, partition sizes and mount points:

[root@localhost install-iso]# df
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 2.9G     0  2.9G   0% /dev
tmpfs                    2.9G  509M  2.5G  18% /dev/shm
tmpfs                    2.9G  1.5M  2.9G   1% /run
/dev/mapper/crypt_sda7    20G  7.3G   12G  40% /
tmpfs                    2.9G     0  2.9G   0% /sys/fs/cgroup
tmpfs                    2.9G  6.5M  2.9G   1% /tmp
/dev/mapper/crypt_sda8   2.0G  6.1M  1.8G   1% /usr/local
/dev/mapper/crypt_sda9   877G  259G  618G  30% /home
/dev/sda5                484M   35M  420M   8% /boot
/dev/sda1                5.9G  4.3G  1.3G  78% /mnt/install-iso
tmpfs                    594M   72K  594M   1% /run/user/1000


Example from gparted: showing partition names, mount points, labels, and sizes
2019 07 214 gparted example.png

If you have a printer connected (and assuming you have a single disk /dev/sda) you could make a record of the disk layout with this:

(date; echo; df; echo; lsblk -o NAME,LABEL /dev/sda) | lp

Install process

Reboot. On the grub2 boot screen, select Mageia 7 Network Install nonfree 64-bit iso (following the example here) or whatever name you have put when you defined the grub2 "menuentry" field in /etc/grub.d/40_custom.

After booting the network install image, select "boot from disk" and identify the partition where you stored the Mageia install ISO and the name of the mageia install ISO file.

Complete install as normal.


Post install: add loopback mount of ISO install image

One of the advantages of having the Mageia install ISO file on hard disk is that we can loop mount it and add it to the URPMI configuration. This makes installing of additional packages much faster (than going out across the network).


In the example shown on this page, partition /dev/sda1 was mounted at /mnt/install-iso/. This will not have been automatically mounted during the install but will instead be mounted as /mnt/hd/.

# df /mnt/hd/
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda12      7.9G  3.8G  3.8G  50% /mnt/hd

By examining the filesystems table /etc/fstab it will be clear that there is an entry for the Mageia install ISO.

For example:

$ grep ".iso" /etc/fstab
/mnt/hd/Mageia-7.1-x86_64.iso /mnt/Mageia-7.1-x86_64 iso9660 noauto,loop 0 0

Notice that "noauto" is defined meaning that the install ISO image is not automatically mounted. We edit /etc/fstab and remove the noauto from the Mageia-7.1-x86_64.iso line.

$ grep ".iso" /etc/fstab
/mnt/hd/Mageia-7.1-x86_64.iso /mnt/Mageia-7.1-x86_64 iso9660 loop 0 0

We can check it mounts OK with:

# mount /mnt/Mageia-7.1-x86_64

# df /mnt/Mageia-7.1-x86_64
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0      4.2G  4.2G     0 100% /mnt/Mageia-7.1-x86_64

Since the install ISO image loop mounts correctly we can also remove the "noauto," from the /etc/fstab entry so that the mount will automatically happen on reboot.

Now the Mageia install image is mounted, we can add it as a URPMI source to install any further packages. In this example, we are using a 64-bit install ISO image so we append "x86_64/" to the urpmi.addmedia command (below):

# urpmi.addmedia --distrib /mnt/Mageia-7.1-x86_64/x86_64/
adding medium "Core Release (Installer)" before remote medium "Core Release"
adding medium "Nonfree Release (Installer)" before remote medium "Core Release"

Example:

[root@zbook ~]# urpmi.addmedia --distrib /mnt/Mageia-7.1-x86_64/x86_64/
adding medium "Core Release (Installer)" before remote medium "Core Release"
adding medium "Nonfree Release (Installer)" before remote medium "Core Release"

Run a system update to confirm loopback install ISO image urpmi source included. Note the keyword "(Installer)":

[root@zbook ~]# urpmi --auto-update
medium "Core Release (Installer)" is up-to-date
medium "Nonfree Release (Installer)" is up-to-date
medium "Core Release" is up-to-date
medium "Core Updates" is up-to-date
medium "Nonfree Release" is up-to-date
medium "Nonfree Updates" is up-to-date
medium "nonfree" is up-to-date
medium "non-free-updates" is up-to-date
medium "tainted" is up-to-date
medium "tainted-updates" is up-to-date
medium "google-talkplugin" is up-to-date
medium "google-chrome" is up-to-date
Packages are up to date

Appendix 1: 64 bit version of append for /etc/grub.d/40_custom

Note, keep your own modified copy of this in your ${HOME}/etc_grub.d_40_custom for future reference because the copy that is created in /etc/grub.d/40_custom will be overwritten in the install process.


# Example for adding to /etc/grub.d/40_custom
# 
# Reference: https://wiki.mageia.org/en/Installing_Mageia_from_ISO_images_on_disk_using_grub2
#
# NB ensure correct values set for your configuration below:
#
#    1) set isofile=
#       example: set isofile="/Mageia-7-netinstall-nonfree-x86_64.iso"
#       NB leading "/"
#
#    2) set root=
#       example: set root="hd0,1"
#       This is for /dev/sda1. Other examples:
#        /mnt/install-iso/ mounted at /dev/sda12 is "hd0,12"
#        /mnt/install-iso/ mounted at /dev/sdb9 is "hd1,9"
#
#    3) loopback loop
#       example: loopback loop (hd0,1)$isofile
#       NB "hd0,1" is /dev/sda1 and no "/" before "$isofile"
#
#    

 menuentry "Mageia 7 Network Install nonfree 64-bit iso" {
         insmod gzio
         insmod part_msdos
         insmod ext2
         insmod xfs
         insmod loopback
         insmod iso9660
         insmod udf
         set isofile="/Mageia-7-netinstall-nonfree-x86_64.iso"
         set root="hd0,1"
         loopback loop (hd0,1)$isofile
         linux (loop)/isolinux/x86_64/vmlinuz isofile=$isofile
         initrd (loop)/isolinux/x86_64/all.rdz
 }


Appendix 2: 32-bit version of append for /etc/grub.d/40_custom


# 32-bit example:
# NB: for the 32-bit version, the ISO filename has "i586"
#     but the "linux" and "loop" paths use "i386".
#     (Can verify by loop mounting the network install ISO and checking paths.)

 menuentry "Mageia 7 Network Install nonfree 32-bit iso" {
         insmod gzio
         insmod part_msdos
         insmod ext2
         insmod xfs
         insmod loopback
         insmod iso9660
         insmod udf
         set isofile="/Mageia-7-netinstall-nonfree-i586.iso"
         set root="hd0,1"
         loopback loop (hd0,1)$isofile
         linux (loop)/isolinux/i386/vmlinuz isofile=$isofile
         initrd (loop)/isolinux/i386/all.rdz
 }