Upgrading Alpine - v1.9.x: Difference between revisions

From Alpine Linux
m (Upgrading Alpine - HD v1.9.x moved to Upgrading Alpine - v1.9.x: Inaccurate page name. Also feel it's easier to have one page handling all the upgrade scenerios.)
No edit summary
Line 1: Line 1:
== Upgrading Alpine 1.9.x that runs on HD/CF/USB ==
== Upgrading Alpine 1.9.x that runs on HD/CF/USB ==
This document applies to alpine which is installed on HardDisk(HD), CompactFlash(CF) or USB.<BR>
 
This document covers upgrading from a previous version of Alpine 1.9 to newer versions of 1.9. Thanks to many improvements in 1.9, it is possible to easily upgrade in most scenerios.


All examples/instructions/actions mentioned in this document should be executed on the box that you are planning to upgrade (unless you are instructed otherwise).
All examples/instructions/actions mentioned in this document should be executed on the box that you are planning to upgrade (unless you are instructed otherwise).
== Upgrading an Alpine Linux Hard-disk installation ==
When Alpine is installed to hard drive, upgrading the installation is simple.
Edit the '''/etc/apk/repositories''' file and if necessary, add references to the Alpine package repositories. In the example below, the reference to the Alpine CD is maintained, so that if the requested package is available on the local media, it will be obtained from there instead of being downloaded from the remote repository:
/media/cdrom/apk
http://dl-3.alpinelinux.org/alpine/v1.9/packages/main
Only one repository is shown above, however, you may also use these:
http://dl-4.alpinelinux.org/alpine/v1.9/packages/main
http://distrib-coffee.ipsl.jussieu.fr/pub/linux/alpine/alpine/v1.9/packages/main
After updating the repositories file, obtain the latest index of available packages:
apk update
Ensure you have the latest available version of the Alpine Package Manager first before upgrading anything else:
apk add -u apk-tools
Finally, upgrade all remaining packages, including the kernel if applicable:
apk upgrade
== Other Installations ==
=== Upgrading Boot Media ===
You may have an installation where the boot media being used (such as a CD, for example) is separate from the media used to store the configuration information. In this case, simply download the latest ISO, and replace the boot media contents with the contents of the latest ISO. If you are booting from a CD, this would simply mean replacing the CD with a CD made from the new image and rebooting the Alpine box.
=== Upgrading Alpine on CF/USB ===
Your installation may consist of Alpine running on Compact Flash or USB media. In most cases, it should be sufficient to upgrade most packages using the '''Alpine Hard-disk Installation''' upgrade procedures described above. However, for new packages to survive after a reboot, you should enable [[How_to_enable_APK_caching|APK caching]].
'''Please note:''' As newer version of alpine may include kernel upgrades, simply pointing the Alpine Package Manager to an internet-based repository and running ''apk upgrade'' will not be enough, as kernel components are not upgraded when Alpine is run from memory.


{{Upgrading_Alpine_environmentvars}}
{{Upgrading_Alpine_environmentvars}}


== Download a new Alpine Linux release ==
Start by checking that you have enough space on your media.<BR>
Start by checking that you have enough space on your media.<BR>
You need at least 400MB available space.
You need at least 400MB available space.
Line 21: Line 55:
''If says 'FAILED', delete the iso file and download it again.''
''If says 'FAILED', delete the iso file and download it again.''


== Copy the new release  ==
==== Copy the new release  ====


Mount the ISO.
Mount the ISO.
Line 28: Line 62:
  mount -t iso9660 {{Latest_1.9_alpine_iso-filename}} /tmp/alpine-new
  mount -t iso9660 {{Latest_1.9_alpine_iso-filename}} /tmp/alpine-new
   
   
 
Back up files that you have modified. For example, you might have modified ''syslinux.cfg'' to show console output on a serial port.<BR>
Back up file that you have modified ''(below is a list of files that might need backing up)''<BR>
'''''syslinux.cfg:''' You might have modified it to show console on a serial port''


  cp /media/$LBU_MEDIA/syslinux.cfg /media/$LBU_MEDIA/syslinux.cfg.my
  cp /media/$LBU_MEDIA/syslinux.cfg /media/$LBU_MEDIA/syslinux.cfg.my
Line 47: Line 79:
  sync
  sync


{{Upgrading_Alpine_executeupgradescript}}
==== Clean up ====
 
== Clean up ==
Clean up the downloaded/unpacked files
Clean up the downloaded/unpacked files
  umount /tmp/alpine-new
  umount /tmp/alpine-new
Line 56: Line 86:
  rm /media/$LBU_MEDIA/{{Latest_1.9_alpine_iso-filename}}.sha1
  rm /media/$LBU_MEDIA/{{Latest_1.9_alpine_iso-filename}}.sha1


== Save changes ==
=== Save changes ===
Now that all upgrades are done, we should save our settings to our media (which you hopefully have backed up).
Now that all upgrades are done, we should save our settings to our media (which you hopefully have backed up prior to doing this upgrade).
  lbu ci
  lbu ci


Line 63: Line 93:
In most cases you will need to reboot Alpine (especially if there are changes in the kernel):
In most cases you will need to reboot Alpine (especially if there are changes in the kernel):
  reboot
  reboot
'''''Note:''' If you know what you are doing, you might not need to reboot.<BR>But make sure that all services affected by the upgrade are restarted.''
'''''Note:''' If you know what you are doing, you might not need to reboot. But make sure that all services affected by the upgrade are restarted.''

Revision as of 09:10, 16 October 2009

Upgrading Alpine 1.9.x that runs on HD/CF/USB

This document covers upgrading from a previous version of Alpine 1.9 to newer versions of 1.9. Thanks to many improvements in 1.9, it is possible to easily upgrade in most scenerios.

All examples/instructions/actions mentioned in this document should be executed on the box that you are planning to upgrade (unless you are instructed otherwise).

Upgrading an Alpine Linux Hard-disk installation

When Alpine is installed to hard drive, upgrading the installation is simple.

Edit the /etc/apk/repositories file and if necessary, add references to the Alpine package repositories. In the example below, the reference to the Alpine CD is maintained, so that if the requested package is available on the local media, it will be obtained from there instead of being downloaded from the remote repository:

/media/cdrom/apk
http://dl-3.alpinelinux.org/alpine/v1.9/packages/main

Only one repository is shown above, however, you may also use these:

http://dl-4.alpinelinux.org/alpine/v1.9/packages/main
http://distrib-coffee.ipsl.jussieu.fr/pub/linux/alpine/alpine/v1.9/packages/main

After updating the repositories file, obtain the latest index of available packages:

apk update

Ensure you have the latest available version of the Alpine Package Manager first before upgrading anything else:

apk add -u apk-tools

Finally, upgrade all remaining packages, including the kernel if applicable:

apk upgrade

Other Installations

Upgrading Boot Media

You may have an installation where the boot media being used (such as a CD, for example) is separate from the media used to store the configuration information. In this case, simply download the latest ISO, and replace the boot media contents with the contents of the latest ISO. If you are booting from a CD, this would simply mean replacing the CD with a CD made from the new image and rebooting the Alpine box.

Upgrading Alpine on CF/USB

Your installation may consist of Alpine running on Compact Flash or USB media. In most cases, it should be sufficient to upgrade most packages using the Alpine Hard-disk Installation upgrade procedures described above. However, for new packages to survive after a reboot, you should enable APK caching.

Please note: As newer version of alpine may include kernel upgrades, simply pointing the Alpine Package Manager to an internet-based repository and running apk upgrade will not be enough, as kernel components are not upgraded when Alpine is run from memory.

Setup environment variables

To make the documentation a bit more "generic" we start by setting some environment variables.

vi /etc/lbu/lbu.conf

Make sure that the variable LBU_MEDIA is not commented (by removing the leading '#').

You also need to set a appropriate value for your LBU_MEDIA. The media you choose will be the media where you store your settings/configuration.

Note: Even if you have you alpine installed on CF, HD or USB you can still choose to save your config on some other media that suits your needs. But remember that both the media where you have your Alpine system AND the media where you have your config need to be in your box when booting it.

Examples:

LBU_MEDIA=usb

or:

LBU_MEDIA=sda1

Now that you have your /etc/lbu/lbu.conf configured for your needs, we will set the environment variables (note the leading .).

. /etc/lbu/lbu.conf

You can test if your environment variable was set:

echo $LBU_MEDIA

It should output something like usb, sda1, or whatever you just configured.

Back up your config

Before starting to upgrade, it's wise to save your configuration.

lbu ci

Start by checking that you have enough space on your media.
You need at least 400MB available space.

df -h | grep "Filesystem\|$LBU_MEDIA"

Start downloading a new '.iso' and a '.sha1' file

cd /media/$LBU_MEDIA
wget -c Template:Latest 1.9 alpine iso-mirroralpine-1.9.3-x86.iso
wget http://dev.alpinelinux.org/alpine/v1.9/iso/alpine-1.9.3-x86.iso.sha1

Check integrity of the downloaded files (it might take some time)

sha1sum -c alpine-1.9.3-x86.iso.sha1

The output of the above command should say 'OK'.
If says 'FAILED', delete the iso file and download it again.

Copy the new release

Mount the ISO.

mkdir /tmp/alpine-new
mount -t iso9660 alpine-1.9.3-x86.iso /tmp/alpine-new

Back up files that you have modified. For example, you might have modified syslinux.cfg to show console output on a serial port.

cp /media/$LBU_MEDIA/syslinux.cfg /media/$LBU_MEDIA/syslinux.cfg.my

Copy the files:

cd /tmp/alpine-new
rsync --delete -rltv .alpine-release * /media/$LBU_MEDIA/ 

Restore your backed up files (in case you had any)

mv -f /media/$LBU_MEDIA/syslinux.cfg.my /media/$LBU_MEDIA/syslinux.cfg

Make sure that all files are permanently saved in right place

sync

Clean up

Clean up the downloaded/unpacked files

umount /tmp/alpine-new
rmdir /tmp/alpine-new
rm /media/$LBU_MEDIA/alpine-1.9.3-x86.iso
rm /media/$LBU_MEDIA/alpine-1.9.3-x86.iso.sha1

Save changes

Now that all upgrades are done, we should save our settings to our media (which you hopefully have backed up prior to doing this upgrade).

lbu ci

Rebooting

In most cases you will need to reboot Alpine (especially if there are changes in the kernel):

reboot

Note: If you know what you are doing, you might not need to reboot. But make sure that all services affected by the upgrade are restarted.