Upgrading Alpine
Contents |
Upgrading an Alpine Linux Hard-disk installation
Upgrading to latest release
When Alpine Linux is installed to hard drive, upgrading to a newer stable version is straightforward.
To begin, you need to update your /etc/apk/repositories file. Here are some shortcuts for doing so:
- Launch
setup-apkrepos
Enter e to edit /etc/apk/repositories. Change the version number by hand. - Or, edit the file in place. This is how you'd change v2.4 to v2.5:
sed -i -e 's/v2\.4/v2.5/g' /etc/apk/repositories
- Launch
Or you could do this manually: 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:
Contents of /etc/apk/repositories
Only one repository is shown above; however, you may also replace http://dl-3.alpinelinux.org/alpine/ with any of these (if you wish to use another version, also replace v2.5 with the desired version):
- http://nl.alpinelinux.org/alpine/
- http://dl-2.alpinelinux.org/alpine/
- http://dl-3.alpinelinux.org/alpine/
- http://dl-4.alpinelinux.org/alpine/
- http://dl-5.alpinelinux.org/alpine/
- http://distrib-coffee.ipsl.jussieu.fr/pub/linux/alpine/alpine/
- http://mirror.yandex.ru/mirrors/alpine/
- http://mirrors.giganet.com/alpinelinux/
- http://repos.lax-noc.com/alpine/
After updating the repositories file, obtain the latest index of available packages:
apk update
-U/--update-cache to another apk command, as in apk add -U ... or apk upgrade -U, has the same effect as running apk update before the other apk command.If you're upgrading from a version of Alpine before 2.3.0_rc1, ensure you have the latest available version of the Alpine Linux Package Manager first before upgrading anything else:
apk add --upgrade apk-tools
Next, upgrade all your packages:apk upgrade --available
The --available switch is used to force all packages to be upgraded, even if they have the same version numbers. Sometimes changes in uClibc require doing this.
sync reboot
Upgrading to Edge
An upgrade of Alpine Linux from a stable version to the rolling development version, edge can be done in a few simple steps. (These instructions assume that Alpine Linux is installed to a hard drive, rather than run-from-RAM.)
To begin, you need to update your /etc/apk/repositories file. Here are some shortcuts for doing so:
- Launch
setup-apkrepos
Enter e to edit /etc/apk/repositories. Change the version number (such as v2.5) to edge. - Or, edit the file in place:
sed -i -e 's/v2\.5/edge/g' /etc/apk/repositories
- Launch
The result should look like this:
Contents of /etc/apk/repositories
apk upgrade --update-cache --available
The --available switch is used to force all packages to be upgraded, even if they have the same version numbers. Sometimes changes in uClibc have required doing this.
sync reboot
cat /etc/alpine-release
You will see the build date attached to the release.Upgrading from older versions
See Upgrading from older versions.
Upgrading Alpine Linux on CD
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 Linux box.
Update remaining packages from Web repository
If you are using APK caching you should also perform the following steps. 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:
Contents of /etc/apk/repositories
Only one repository is shown above; however, you may also replace http://dl-3.alpinelinux.org/alpine/ with any of these (if you wish to use another version, also replace v2.5 with the desired version):
- http://nl.alpinelinux.org/alpine/
- http://dl-2.alpinelinux.org/alpine/
- http://dl-3.alpinelinux.org/alpine/
- http://dl-4.alpinelinux.org/alpine/
- http://dl-5.alpinelinux.org/alpine/
- http://distrib-coffee.ipsl.jussieu.fr/pub/linux/alpine/alpine/
- http://mirror.yandex.ru/mirrors/alpine/
- http://mirrors.giganet.com/alpinelinux/
- http://repos.lax-noc.com/alpine/
After updating the repositories file, obtain the latest index of available packages:
apk update
-U/--update-cache to another apk command, as in apk add -U ... or apk upgrade -U, has the same effect as running apk update before the other apk command.If you're upgrading from a version of Alpine before 2.3.0_rc1, ensure you have the latest available version of the Alpine Linux Package Manager first before upgrading anything else:
apk add --upgrade apk-tools
Next, upgrade all your packages:
apk upgrade --available sync
The --available switch is used to force all packages to be upgraded, even if they have the same version numbers. Sometimes changes in uClibc require doing this.
After upgrading packages, save any configuration changes (you should have backed up your earlier configuration prior to upgrading).
lbu ci
Upgrading Alpine Linux on other removable media (such as CF/USB)
The following instructions are for run-from-RAM Alpine installations running on Compact Flash or USB media. Updating your repositories using the procedures detailed above, then running:
apk upgrade --update-cache --available
will suffice for some purposes. (If you want the new packages to be used after a reboot, you should enable APK caching.)
However, this is not an adequate general solution because it won't honor any kernel upgrades and the like. For the general solution, you'll need to upgrade your boot medium (Compact Flash or USB). That is what the following steps describe how to do.
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.
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
Upgrade Operating System
Start by checking that you have enough space on your media. For a standard Alpine image, you need at least 400MB available space.
df -h | grep "Filesystem\|$LBU_MEDIA"
Download and verify new release
Make sure the media that holds your Alpine system is mounted readwrite.
mount -oremount,rw /media/$LBU_MEDIA
If using Alpine Linux 2.2.3 or newer: use the following command to download, mount and copy files as needed for you:setup-bootable -u http://wiki.alpinelinux.org/cgi-bin/dl.cgi/v2.6/releases/x86/alpine-2.6.1-x86.iso /media/$LBU_MEDIA
Once the command completes, proceed to the Save changes section.For older versions of Alpine
Start downloading a new '.iso' and a '.sha1' file
cd /media/$LBU_MEDIA wget -c http://wiki.alpinelinux.org/cgi-bin/dl.cgi/v2.6/releases/x86/alpine-2.6.1-x86.iso wget http://wiki.alpinelinux.org/cgi-bin/dl.cgi/v2.6/releases/x86/alpine-2.6.1-x86.iso.sha1
Check integrity of the downloaded files (it might take some time):
sha1sum -c alpine-2.6.1-x86.iso.sha1
The output of the above command should say 'OK'.
If says 'FAILED', delete the iso file and download it again.
setup-bootable -u alpine-2.6.1-x86.iso /media/$LBU_MEDIA
Instructions for older versions of Alpine are located elsewhere.
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
Load new kernel
In most cases you will need to reboot Alpine Linux (especially if there are changes in the kernel):
sync reboot
Update remaining packages from Web repository
If you are using APK caching you should follow the instructions to Update remaining packages from Web repository, above.