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

From Alpine Linux
(Propose for merging)
(Merge content into "Upgrading Alpine", make redirect page)
 
Line 1: Line 1:
{{Merge|Upgrading Alpine}}
#REDIRECT [[Upgrading Alpine]]
 
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.
 
{{Using_Internet_Repositories_for_apk-tools}}
 
Ensure you have the latest available version of the Alpine Linux Package Manager first before upgrading anything else:
{{Cmd|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:
 
{{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-static'' package.<BR>
And we install ''busybox-static'' just in case something goes wrong.
 
If current version is 1.10.x remove GNU Wget before attempting an upgrade:
{{Cmd|apk del wget}}
 
Download busybox-static package:
{{Cmd|wget http://nl.alpinelinux.org/alpine/v2.2/main/x86/busybox-static-1.18.4-r2.apk
apk add busybox-static-1.18.4-r2.apk --update-cache}}
 
Download latest apk-tools package and install it:
{{Cmd|wget http://nl.alpinelinux.org/alpine/v2.2/main/x86/apk-tools-static-2.1.0-r1.apk
apk add apk-tools-static-2.1.0-r1.apk --update-cache}}
 
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.static update --update-cache
apk.static upgrade --available --update-cache}}
 
Reboot the system to load new kernel
{{Cmd|sync
reboot}}
 
=== Upgrading to Alpine Linux 2.0 or 2.1 from earlier versions ===
For upgrading to Alpine Linux 2.0 or 2.1 from earlier versions, the following steps apply.
 
Remove GNU Wget before attempting an upgrade:
{{Cmd|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:
{{Cmd|apk upgrade --update-cache --available
sync}}
 
=== All Other Upgrades ===
Upgrade all remaining packages, including the kernel if applicable:
{{Cmd|apk upgrade
sync}}
 
{{Note|You will need to restart any services that have been upgraded to begin using the upgraded versions. If the kernel is upgraded, you will need to reboot to begin using the upgraded version.}}
 
== 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 [[How_to_enable_APK_caching|APK caching]] you should also perform the following steps:
 
{{Using_Internet_Repositories_for_apk-tools}}
 
Ensure you have the latest available version of the Alpine Linux Package Manager first before upgrading anything else:
{{Cmd|apk add -u apk-tools}}
 
{{Cmd|apk upgrade
sync}}
 
== Upgrading Alpine Linux on Flash Memory (such as 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 [[How_to_enable_APK_caching|APK caching]].
 
{{Warning|As the newer version of alpine may include kernel upgrades, simply pointing the Alpine Linux Package Manager to an Internet-based repository and running ''apk upgrade'' will not be enough, as kernel components are not upgraded when Alpine Linux is run from memory.}}
 
{{Upgrading_Alpine_environmentvars}}
 
=== Upgrade Operating System ===
 
Start by checking that you have enough space on your media.<BR>
You need at least 400MB available space.
{{Cmd|df -h | grep "Filesystem\|$LBU_MEDIA"}}
 
==== Download and verify new release ====
 
Make sure the media is mounted readwrite.
{{Cmd|mount --remount rw /media/$LBU_MEDIA}}
 
{{Tip|If using Alpine Linux 2.2.3 or newer, use the following command to download, mount and copy files as needed for you: {{Cmd|setup-bootable -u {{#latestalp:alpine|url}} /media/$LBU_MEDIA}}Once the command completes, proceed to the [[#Load new kernel|Load new kernel]] section. }}
 
Start downloading a new '.iso' and a '.sha1' file
{{Cmd|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)''
{{Cmd|sha1sum -c {{#latestalp:alpine|file}}.sha1}}
''The output of the above command should say 'OK'.<BR>''
''If says 'FAILED', delete the iso file and download it again.''
 
==== Copy the new release  ====
{{Note|There is a tool, ''setup-bootable'', in alpine-1.10.4 and newer, that does the mounting and copying for you. With this tool simply do: {{Cmd|setup-bootable -u {{#latestalp:alpine|file}} /media/$LBU_MEDIA}}Once the command completes, proceed to the [[#Load new kernel|Load new kernel]] section.
}}
 
Mount the ISO.
{{Cmd|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.<BR>
 
{{Cmd|cp /media/$LBU_MEDIA/syslinux.cfg /media/$LBU_MEDIA/syslinux.cfg.my}}
 
Install the '''rsync''' package if necessary, and copy the files:
 
{{Cmd|cd /mnt
apk add rsync
rsync --delete -rltv .alpine-release * /media/$LBU_MEDIA/}}
 
Restore your backed up files ''(in case you had any)''
 
{{Cmd|mv -f /media/$LBU_MEDIA/syslinux.cfg.my /media/$LBU_MEDIA/syslinux.cfg}}
 
Make sure that all files are permanently saved in right place
 
{{Cmd|sync}}
 
==== Clean up ====
Clean up the downloaded/unpacked files
{{Cmd|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).
{{Cmd|lbu ci}}
 
=== Load new kernel ===
In most cases you will need to reboot Alpine Linux (especially if there are changes in the kernel):
{{Cmd|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.}}
 
=== Update remaining packages from Web repository ===
If you are using [[How_to_enable_APK_caching|APK caching]] you should perform the following steps:
 
{{Using_Internet_Repositories_for_apk-tools}}
 
Ensure you have the latest available version of the Alpine Linux Package Manager first before upgrading anything else:
{{Cmd|apk add -u apk-tools}}
{{Cmd|apk upgrade
sync}}
 
[[Category:Installation]]

Latest revision as of 01:07, 29 October 2012

Redirect to: