I am using Alpine Linux v3.7 or v3.8 with my LXD server. How do I upgrade Alpine Linux v3.8 to Alpine Linux v3.9? How can I upgrade Alpine Linux v3.8 to Alpine Linux v3.9?
Before you type any one of the following command make sure that you have a backup of your important data before continuing to update your system. It is important that you keep full backup of your system. Alpine Linux is built around musl libc and busybox. This makes it smaller and more resource efficient than traditional GNU/Linux distributions. A container requires no more than 8 MB and a minimal installation to disk requires around 130 MB of storage. Not only do you get a fully-fledged Linux environment but a large selection of packages from the repository.
Alpine Linux was designed with security in mind. The kernel is patched with an unofficial port of grsecurity/PaX, and all userland binaries are compiled as Position Independent Executables (PIE) with stack smashing protection. These proactive security features prevent exploitation of entire classes of zero-day and other vulnerabilities. When Alpine Linux is installed to hard drive or as LXD VM, upgrading to a newer stable version is straightforward.
Make a backup of your LXD container
Type the following command to create container snapshots: $ lxc snapshot alpine-www01 "JUNE272018" Verify it: $ lxc info alpine-www01 Sample outputs:
Now login to your Alpine Linux box/LXD VM using ssh command or lxc command.
Find out your Alpine Linux version
Type the following command: $ cat /etc/alpine-release 3.8.0
How to upgrading to latest release
Edit /etc/apk/repositories file, enter: # vi /etc/apk/repositories Change the version number by hand. For example, the default entry for 3.4 is as follows: http://dl-3.alpinelinux.org/alpine/v3.4/main To update to 3.5.xx, enter: http://dl-3.alpinelinux.org/alpine/v3.5/main Change the version number by hand. For example, the default entry for 3.5 is as follows: http://dl-3.alpinelinux.org/alpine/v3.5/main To update to 3.5.xx, enter: http://dl-3.alpinelinux.org/alpine/v3.6/main Change the version number by hand. For example, the default entry for 3.6 is as follows: http://dl-cdn.alpinelinux.org/alpine/v3.6/main Make sure you change the version number by hand. For example, the default entry for 3.7 is as follows: http://dl-cdn.alpinelinux.org/alpine/v3.7/main To update to 3.8.xx, enter: http://dl-cdn.alpinelinux.org/alpine/v3.8/main Make upgrade to to 3.9.xx, enter: http://dl-cdn.alpinelinux.org/alpine/v3.9/main Save and close the file. Here is my sample config file displayed using cat command: # cat /etc/apk/repositories Sample outputs:
The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.