SAS Installation wsl2 - XMM-Newton
Running directly SAS on Windows using the Windows Subsystem for Linux 2 (WSL 2)
In 2016 Microsoft released a new tool known as the Windows Subsystem for Linux, or WSL, as its first attempt to include a usable Linux system within Windows. WSL provided access to the Linux standard Bash shell but could not offer access to Dynamic Linking (DL) of ELF (Executable and Linkable Format) binaries.
In September 2020, Microsoft released version 2 of WSL and named the previous one as WSL 1. WSL 2 is fully based on the Linux Ubuntu 20.04LTS distribution, providing a full fledged Linux OS, capable of providing Windows users not only access to the Bash shell but full support for Dynamic Linking of ELF binaries and full access to the Linux kernel.
We have tested installing and running the SAS 21.0.0 built on Ubuntu 20.04LTS, directly on WSL 2 with successful results. The following section provide a detailed description on how to install and use SAS 21.0.0 on Windows 10, under the WSL v2 tool.
Assuming you have a Windows 10 system, please do as follows:
- Proceed to this web site, to get the list of requirements and the steps you must follow to transform the existing WSL 1 to WSL 2.Once in the web site, select and install the Linux Ubuntu 22.04LTS distribution.
- Windows 10 does not provide yet direct support to display X11 clients running on WSL 2. It has announced it will do it in Windows 11 (click here for information on that announcement). Then, to be able to display X11 clients running in WSL 2, on Windows 10 you must install an X11 Server.
- For X11 on Windows we have found useful the MobaXterm software, which includes both the X11 Server and clients. You can download MobaXterm from here. Please download and install it.
- Normally WSL 2 comes already with perl installed in /usr/bin/perl (this is Perl v5.34.1 native for Ubuntu 22.04LTS).
- However, python might not be installed. Please install it using the apt tool. To do it you will need to use sudo, typically as
# sudo apt update
# sudo apt install python3
# sudo apt python3-pip
# sudo apt install python-is-python3
- Download SAS 21.0.0 built on Ubuntu 22.04LTS and install it using the standard procedure described here. Do not forget to define SAS_PERL=/usr/bin/perl and install all python required packages using
# sudo pip install -r sas_21.0.0_python_packages.txt
- Now launch the MobaXterm X11 server. Before launching any X11 client, you must allow display coming from any X11 client. To do it, look in the MobaXterm preferences and set the X11 tab -> Settings -> set "X11 Remote access" to "Full". You can now do a quick test to run the SAS GUI, by executing the following commands:
# export LHEASOFT=1 (simulate Heasoft init is done)
# sas &
The SAS GUI should come up on your Windows desktop.
- To complete the installation you should install Heasoft-6.30. If you do not want to build Heasoft from source code, you can download and install a pre-compiled binary distribution of Heasoft-6.30 built for PC - Ubuntu Linux 22.04" from here. Download and install it.
- Finally, do not forget to download an updated set of valid CCFs which you may put in a directory of your choice.
Note that, if you have defined a username to work with WSL 2 as user, your home directory is typically set to
where "c" represents the Windows disk "C:\". You may install your software locally under that directory or choose the system directories below /usr, which are also available in WSL 2.
You should also complement the installation of SAS and Heasoft with the remaining required tools like ds9 (+xpa), xmgrace, etc. All them can be either directly installed using apt or downloaded binary and installed (e.g. ds9 and xpa) from their respective producers.
We have successfully tested also the Python interface to SAS via Jupyter Notebook(which you must install via python pip).