Alpine Apk Curl

2/12/2022by admin

Apk add alpine-desktop; apk add xfce4; reboot; Other useful packages: apk add git; apk add curl; At this point, you have two options. The first one is to manually start the desktop environment by using exec startxfce4 every time you want the desktop environment. The second is to continue with this sequence of commands, to have it start. Alpine Linux 3.7. Run apk add curl. Verify installation of Curl. Apk search curl. Curl is the backbone of internet data transfer for thousands of.

Last active Jul 26, 2021
alpine-essentials-setup.sh
#!/bin/ash
#
# Alpine Linux Essentials Packages
# By Dimas Restu Hidayanto <[email protected]>
#
# WARNING PLEASE DO WITH YOUR OWN RISK
#
# This instruction will guide you to install
# essentials packages that might be useful for your systems
# or your opeartions
#
# Please do the following command before applying
# ...
# sudo -i
# -- Or --
# su
# ...
#
# Install GLIBC Packages
GLIBC_VERSION=2.31-r0
&& wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
&& wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk
&& wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk
&& wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-i18n-${GLIBC_VERSION}.apk
&& apk add --no-cache glibc-${GLIBC_VERSION}.apk glibc-bin-${GLIBC_VERSION}.apk glibc-i18n-${GLIBC_VERSION}.apk
&& unlink /usr/glibc-compat/lib64/ld-linux-x86-64.so.2
&& mv /usr/glibc-compat/lib/ld-linux-x86-64.so.2 /usr/glibc-compat/lib/ld-linux-x86-64.so
&& ln -sf /usr/glibc-compat/lib/ld-linux-x86-64.so /usr/glibc-compat/lib/ld-linux-x86-64.so.2
&& ln -sf /usr/glibc-compat/lib/ld-linux-x86-64.so /usr/glibc-compat/lib64/ld-linux-x86-64.so.2
&& rm -f glibc-${GLIBC_VERSION}.apk glibc-bin-${GLIBC_VERSION}.apk glibc-i18n-${GLIBC_VERSION}.apk
&& rm -f /etc/apk/keys/sgerrand.rsa.pub
&& rm -f /root/.wget-hsts
&&echo'export LANG=$LANG'> /etc/profile.d/locale.sh
&& /usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 '$LANG'true
# Install and Upgrade Base Packages
apk upgrade --no-cache --update
apk add --no-cache --update bash bash-completion
apk add --no-cache --update ca-certificates tzdata
apk add --no-cache --update sudo dpkg busybox-extras openssh-client
apk add --no-cache --update binutils iputils bridge-utils util-linux net-tools bind-tools
apk add --no-cache --update curl wget grep sed rsync socat netcat-openbsd run-parts htop nano vim
apk add --no-cache --update tar gzip bzip2 xz zip unzip
# Install Development Tools Packages
apk add --no-cache --update python2 python2-dev
apk add --no-cache --update python3 python3-dev
apk add --no-cache --update git
# Install Python 2 PIP
wget -q -O - https://bootstrap.pypa.io/pip/2.7/get-pip.py python2 -
pip2 install --no-cache-dir --upgrade pip setuptools wheel
pip2 install --no-cache-dir virtualenv pipreqs pylint
# Install Python 3 PIP
wget -q -O - https://bootstrap.pypa.io/get-pip.py python3 -
pip3 install --no-cache-dir --upgrade pip setuptools wheel
pip3 install --no-cache-dir virtualenv pipreqs pylint
# Configure Vim as Vi
mv /usr/bin/vi /usr/bin/vi.orig~
ln -sf /usr/bin/vim /usr/bin/vi
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
April 30, 2021

Early on in my career I would seek novel solutions to problems, particularly the newest, hottest or most en vogue. As I grew more senior I tended to pick the most dependable or enterprise preferred solutions. One thing that never waivered no matter what was my dedication to developer experience.

My passion for making sure environments and toolchains are easy to set up and get started with has inspired me to record what I call my 'workflow' settings. Though I have been exclusively a Mac Developer, Windows workflows have finally started to catch up (that is, until I get my hands on a blazing fast M1 Chip in the new MacBook Pros).

Today's guide has a focus on setting up your machine with Windows Subsystem For Linux, Windows Terminal, Alpine, and ohmyZSH. This guide could also be considered a fork of NillsF blog here

Here's a sneak peek at our results!

From 'scratch', a blank Windows installation, we'll be getting:

  • WSL2
  • Alpine
  • Windows Terminal
  • ohMyZSH

First, we'll need to get WSL2, turn it on, and update it.We'll use the 'manual' section of this guide. https://docs.microsoft.com/en-us/windows/wsl/install-win10

Enable the Windows Subsystem for Linux (WSL) feature, starting a CMD prompt (right click and run as administrator to prevent permission issues):

You may also do this via the 'Turn Windows Features on or off' settings GUI, by searching for that phrase after pressing the Windows key and checking the WSL box.

Alpine Linux

Curl

The next two steps I found are required specifically for Alpine Linux. For this use case and many others, it's my go-to distro by virture of being super lightwieght, but you're welcome to use Ubuntu or anything else.

Alpine step 1: enable VirtualMachinePlatform

Alpine step 2: Download and install the kernel updatehttps://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

Restart your machine. I found out the hard way that this is the point where a restart seems to be required. You now have WSL2 enabled.

Downloading your Linux distro and Windows Terminal

Before your downloads, open CMD again and set WSL to use version 2, which we just enabled.

Step by Step

  • Hit the Windows key, search: Microsoft Store and search: Alpine WSL
  • Install
  • Launch
  • Provide Enter new UNIX username and password, remember this password, we'll use it to gain root later.
  • Close Alpine.
  • Go to the Microsoft Store again, install Windows Terminal
  • Open Windows Terminal
  • Click the arrow in the top menu and choose settings.

Here you'll have a new interface where you can set the default profile as Alpine. Save in the bottom right. You can also edit the JSON, which will come in handy later.

To use the JSON method: find Alpine's guid from the list and paste into the default profile at the top. The next screenshot shows this step as complete.

Save, close and then open Windows Terminal, you should have an Alpine environment running, try ls -a

Working with Alpine Linux

We can't really do anything yet, since our user has no permissions, by intention! apk update fails, You can't even sudo: try sudo apk update. We'll need to follow Alpine's Post Installation Recommendations.

Create a normal user, in this case 'alrund'. (The name is from MtG for those curious.)

Enter password for the user.Once created, you need a new root session to do the next steps. Follow these commands:

You'll need a new session to get out of root. Close the window and restart, do whoami, you should be the user you just finished setting up, not root.

Time for ZSH and other essential packages. Alpine uses 'apk' in this format:

More basics (Alpine lacks these, you may be able to skip this if you are using a different distro)

Oh My ZSH Theme, Fonts, and Final Touches

Now we can do the fun and easy parts: Install Oh My ZSH and all the good stuff:

Alpine

Let's enable a theme. A very popular one that I use is: agnoster. To do that, you can edit ~/.zshrc. At this point you may want to pin your home folder for your user. To get there, you can open a Windows File Explorer window and type in the bar: wsl$, from there you can access the files on your WSL2 and pin the appropriate folder to your sidebar.

Editing ~/.zshrc:

Next, we'll add some color. Use the drop down to access Settings in Windows Terminal, then Open up the JSON in the bottom left corner and find the schemes section and paste in our theme:

We'll also need some cool fonts for our Windows Terminal. This repo on GitHub https://github.com/powerline/fonts has some awesome choices that come pre-patched with the glyphs we'll need to work with the Agnoster theme that we chose. Since you're installing these fonts on Windows installation, you can head over to the releases and download the zip. Extract the and open the folder using WinRar, then use the PowerShell script inside.

Alpine

To enable your theme and add your font choice, open the JSON in the settings and find your Alpine or other distro section and add these 3 keys:

(After a recent update to Windows Terminal, you can also do this through the Settings interface by selecting your profile and selecting the Appearance tab)

One of the great options in the Settings interface is the default folder. Update it by selecting your profile and chosing the /home/username

Back in your .zshrc, you can add lots of handy things. Some fun, others useful. One of the best things to do is to update your prompt_context and add some aliases:

Docker alpine apk curl

Have fun! And check out Andrew's Workflow on GitHub for more tips and tricks, I'll be updating it soon!

Final Thoughts, Resources, and Articles

Alpine Linux Apk Curl

While development on Windows has gotten tremendously better and we have some great choices that make it a reasonably good place to get work done, there are some oddities that come with 'mixing' file systems between WSL and Windows. You'll notice you need to right-click 'Refresh' a folder when saving new files or folders from within WSL before you can see them. To see new changes in Sublime, use the top bar: Project -> Refresh Folders. There are also some oddities around 'watching for changes' to files that can occasionally break certain libraries or devtools that depend on inotify. Best of luck and thanks for reading!

Alpine Apk Clean Cache

  • Troubleshooting: 'WSL 2 requires an update to its kernel component.' Try https://aka.ms/wsl2kernel
Comments are closed.