Friday 13 December 2019

Running SAP NW 7.52 SP4 trial in docker in Windows Subsystem for Linux 2

On top of that I’m very interested in running Linux on my Windows machine, since some development stuff just works better on Linux

Depending on your preferences, you can choose between these 3 options:

In option 1 I updated the original blog to make it run on Docker Desktop for Windows with the SAP NW 7.52 SP4 trial.

In option 2 I used Docker Desktop for Windows with Windows Subsytem for Linux 2 as backend.

In option 3 I cheated and ran Docker directly on Ubuntu using Windows Subsytem for Linux 2 (this without Docker Desktop for Windows).

Windows Subsystem for Linux (WSL)?


The title already gives it away: WSL allows you to run Linux on your Windows 10 machine without a virtualisation tool like e.g. Hyper-V, VMWare, Parallels…

Version 1 of WSL does not support Docker so I used version 2 of WSL which will come out in a few months. Version 2 has a Linux kernel on board.

Prerequisites


For option 1 I used Windows 10 v1909 OS build 18363.476 and Docker Desktop for Windows v2.1.0.5 (40693)

For option 2 and 3 I used Windows 10 v2004 OS build 19037.1 (Insider version) and Docker Desktop for Windows v2.1.6.1 (40900)

Option 1


After making some adjustments to the instructions writtten on the original blog, this is the result:

1. Install the stable release of Docker Desktop for Windows

2. Increase the Disc Image Size in your Docker preferences (add 100 GB disk size and at least 6 GB RAM):

SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam

3. Install Git and clone this repo:

git clone https://github.com/nzamani/sap-nw-abap-trial-docker.git

4. Download SAP NW ABAP 7.52 SP04 Trial from SAP (search for 7.52)

5. Create a new folder sapdownloads in sap-nw-abap-trial-docker and extract all downloaded files. The result should look like this:

SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam
SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam

6. Create and start a container. Note: here we have an important difference with the original post. The privileged attribute allows the container to change the vm.max_map_count setting. Therefore we don’t need to change it in advance.

docker run --privileged -p 8000:8000 -p 44300:44300 -p 3300:3300 -p 3200:3200 -h vhcalnplci --name nwabap752 -it nwabap:7.52 /bin/bash

7. Now start the installation of SAP NW ABAP 7.52 Trial

/usr/sbin/uuidd

./install.sh

8. The installation is successful when you see the following message: Installation of NPL successful

9. Check the original post to start/stop and perform post installation steps.

Option 2


Since we now have a working docker container, let’s change scenery and use WSL 2.

To run Windows Subsystem for Linux 2 we need to update Windows 10 to the latest Insider version. Please keep in mind that the Insider version of Windows 10 might not be stable. I used a spare laptop to test this.

Enable Insider version

In Windows, go to settings – update & security – Windows Insider Program and hit the “Get started” button. Login with a Microsoft account.

SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam

Choose the Fast ring:

SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam

Check for updates after rebooting the system and install them. In that way you will get the latest version of Windows 10.

Enable WSL2

Open a powershell terminal in admin mode and execute the following statements:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam

Reboot the system.

Install Ubuntu

Go to the Microsoft Store and install Ubuntu 18.04 LTS:

SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam

Download and install Ubuntu:

SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam

Start Ubuntu:

SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam

SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam

Enter a username and password that is not related to your Windows user/pass:

SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam

Ubuntu is now up and running!

SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam

Set Ubuntu to use with WSL2

Open a powershell terminal in admin mode:

wsl --set-version Ubuntu-18.04 2

hint: with wsl -l you can see all distro’s installed on your system

Update Ubuntu

Execute the following statement in your Ubuntu terminal to update it:

sudo apt-get update && sudo apt-get -f install && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt-get autoclean && sudo apt-get autoremove

Install Docker in Windows

Install the edge version of Docker Desktop for Windows (make sure to install the update as well).

Enable the WSL2 engine:

SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam

Select the Ubuntu installation as a resource to use with WSL2:

SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam

Press “Apply & Restart”.

Back to option 1

Repeat only the following steps from option 1. The disk and memory settings can be skipped since WSL2 provides all available resources to Ubuntu.

In folder sap-nw-abap-trial-docker execute:

docker run --privileged -p 8000:8000 -p 44300:44300 -p 3300:3300 -p 3200:3200 -h vhcalnplci --name nwabap752 -it nwabap:7.52 /bin/bash

After executing this statement, you will get an error: ‘image not found’. In order to solve it, you will have to make the image first by running this statement:

docker image build -t nwabap:7.52 .

Now repeat the initial command and the container will automatically start:

docker run --privileged -p 8000:8000 -p 44300:44300 -p 3300:3300 -p 3200:3200 -h vhcalnplci --name nwabap752 -it nwabap:7.52 /bin/bash

You can see that it’s running in Docker:

SAP ABAP Tutorial and Materials, SAP ABAP Guides, SAP ABAP Learning, SAP ABAP Certifications, SAP ABAP Online Exam

Now you are able to install the SAP NW 7.52 system in the Docker container as seen in option 1.

Option 3

Follow the instructions as written in option 2 up to the step “install Docker Desktop for Windows” in order to run Docker without Docker Desktop for Windows.

To get your files in Ubuntu you can copy them using the following mount point:

cd /mnt/c/Users/bart/Downloads

Now go to option 1 and follow the instructions starting from step 6.

Some remarks

Docker Desktop for Windows uses Hyper-V to run the containers, while Docker Desktop for Windows with a WSL2 backend runs the containers in Ubuntu itself.

While playing around with WSL I noticed a remarkable improvement in performance between version 1 and 2.

The end?

Have fun with your local SAP system in a Docker container!

No comments:

Post a Comment