Upgrading Alpine - v1.9.x: Difference between revisions
(Notes how to upgrade to 2.2 and later) |
|||
Line 12: | Line 12: | ||
{{Cmd|apk add -u apk-tools}} | {{Cmd|apk add -u apk-tools}} | ||
=== Upgrading to Alpine Linux 2.2 and later from 2.1 | === Upgrading to Alpine Linux 2.2 and later from 2.1 === | ||
Since '''apk''' tool has been significantly changed | Since '''apk''' tool has been significantly changed first make sure you have upgraded ''apk-tools'' package to latest version available in 2.1 repositories: | ||
{{Cmd|apk update --update-cache | |||
apk add --upgrade apk-tools}} | |||
Change repositories: | |||
{{Cmd|vi /etc/apk/repositories}} | |||
http://nl.alpinelinux.org/alpine/v2.2/main | |||
# or any other mirror | |||
Proceed with update and upgrade: | |||
{{Cmd|apk update --update-cache | |||
apk upgrade --available --update-cache}} | |||
Reboot the system to load new kernel | |||
{{Cmd|sync | |||
reboot}} | |||
=== Upgrading to Alpine Linux 2.2 and later from 2.0 or 1.10.x === | |||
Since '''apk''' tool has been significantly changed you need to download and install manually the latest version of ''apk-tools'' package. | |||
If current version is 1.10.x remove GNU Wget before attempting an upgrade: | |||
{{Cmd|apk del wget}} | {{Cmd|apk del wget}} | ||
Download latest apk-tools package and install it: | Download latest apk-tools package and install it: | ||
{{Cmd|wget http://nl.alpinelinux.org/alpine/v2.2/main/x86/apk-tools-2.1.0_rc1-r2.apk | {{Cmd|wget http://nl.alpinelinux.org/alpine/v2.2/main/x86/apk-tools-2.1.0_rc1-r2.apk | ||
apk add apk-tools-2.1.0_rc1-r2.apk}} | apk add apk-tools-2.1.0_rc1-r2.apk --update-cache}} | ||
Change repositories: | Change repositories: | ||
Line 26: | Line 46: | ||
http://nl.alpinelinux.org/alpine/v2.2/main | http://nl.alpinelinux.org/alpine/v2.2/main | ||
# or any other mirror | |||
Proceed with update and upgrade: | Proceed with update and upgrade: | ||
{{Cmd|apk update | {{Cmd|apk update --update-cache | ||
apk upgrade --available}} | apk upgrade --available --update-cache}} | ||
Reboot the system to load new kernel | Reboot the system to load new kernel |
Revision as of 05:50, 5 May 2011
This document covers upgrading for Alpine Linux version 1.9 and later. Thanks to many improvements in Alpine Linux 1.9 and later, it is possible to easily upgrade in most scenarios.
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 Linux is installed to hard drive, upgrading the installation is simple.
Edit the /etc/apk/repositories file using an editor (nano for instance) and if necessary, add references to the Alpine package repositories. In the example below, the file references the Alpine CD, so that if a 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
To upgrade, in this example, from version 3.3 to 3.2, simply change:
http://dl-3.alpinelinux.org/alpine/v3.3/main
to
http://dl-3.alpinelinux.org/alpine/v3.2/main
So that the file will look like this:
Contents of /etc/apk/repositories
http://dl-3.alpinelinux.org/alpine/v3.2/community
Above, only one possible repository is shown, however, http://dl-3.alpinelinux.org/alpine/
may also be replaced with any geographically close mirror from:
http://rsync.alpinelinux.org/alpine/MIRRORS.txt
Updating package lists
With the correct repositories file in place, the latest index list of available packages can be obtained with:
apk update
--update-cache
or -U
to another apk command, as in apk add -U ...
or apk upgrade -U
, has the same effect as always running apk update
immediately before the other apk command. Instead of auto-update it only if the index has not been updated recently.Ensure you have the latest available version of the Alpine Linux Package Manager first before upgrading anything else:
apk add -u apk-tools
Upgrading to Alpine Linux 2.2 and later from 2.1
Since apk tool has been significantly changed first make sure you have upgraded apk-tools package to latest version available in 2.1 repositories:
apk update --update-cache apk add --upgrade apk-tools
Change repositories:
vi /etc/apk/repositories
http://nl.alpinelinux.org/alpine/v2.2/main # or any other mirror
Proceed with update and upgrade:
apk update --update-cache apk upgrade --available --update-cache
Reboot the system to load new kernel
sync reboot
Upgrading to Alpine Linux 2.2 and later from 2.0 or 1.10.x
Since apk tool has been significantly changed you need to download and install manually the latest version of apk-tools package.
If current version is 1.10.x remove GNU Wget before attempting an upgrade:
apk del wget
Download latest apk-tools package and install it:
wget http://nl.alpinelinux.org/alpine/v2.2/main/x86/apk-tools-2.1.0_rc1-r2.apk apk add apk-tools-2.1.0_rc1-r2.apk --update-cache
Change repositories:
vi /etc/apk/repositories
http://nl.alpinelinux.org/alpine/v2.2/main # or any other mirror
Proceed with update and upgrade:
apk update --update-cache apk upgrade --available --update-cache
Reboot the system to load new kernel
sync reboot
Upgrading to Alpine Linux 2.x from earlier versions
For upgrading to Alpine Linux 2.x from earlier versions, the following steps apply.
Remove GNU Wget before attempting an upgrade:
apk del wget
Upgrade all remaining packages, including the kernel. The --available switch is used to force all packages to be upgraded, even if they have the same version number, due to changes in uClibc:
apk upgrade --update-cache --available sync
All Other Upgrades
Upgrade all remaining packages, including the kernel if applicable:
apk upgrade sync
Upgrading Separate 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 Linux box.
If you are using APK caching you should also upgrade to the latest packages and update the cache by following the Alpine Linux Hard-disk Installation upgrade procedures described above.
Upgrading Alpine Linux on CF/USB
Your installation may consist of Alpine Linux running on Compact Flash or USB media. In most cases, it should be sufficient to upgrade most packages using the Alpine Linux Hard-disk Installation upgrade procedures described above. However, for new packages to survive after a reboot, you should enable APK caching.
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 Step-by-Step
Start by checking that you have enough space on your media.
You need at least 400MB available space.
df -h
Download and verify new release
Start downloading a new '.iso' and a '.sha1' file
cd /media/$LBU_MEDIA wget -c {{#latestalp:alpine|url}} wget {{#latestalp:alpine|url}}.sha1
Check integrity of the downloaded files (it might take some time)
sha1sum -c {{#latestalp:alpine|file}}.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
setup-bootable -u {{#latestalp:alpine|file}} /media/$LBU_MEDIA
Mount the ISO.
mount -t iso9660 {{#latestalp:alpine|file}} /mnt
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
Install the rsync package if necessary, and copy the files:
cd /mnt apk add rsync 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
cd .. umount /mnt rm /media/$LBU_MEDIA/{{#latestalp:alpine|file}} rm /media/$LBU_MEDIA/{{#latestalp:alpine|file}}.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
Load new kernel
In most cases you will need to reboot Alpine Linux (especially if there are changes in the kernel):
reboot
Update remaining packages from Web repository
If you are using APK caching you should also upgrade to the latest packages and update the cache by following the Alpine Linux Hard-disk Installation upgrade procedures described above.