News:

alphaMELTS 2.3 standalone & for MATLAB/Python is now open source and available on GitHub (https://github.com/magmasource/alphaMELTS).
alphaMELTS 1.9 is available at the legacy download and information site.
For news of all MELTS software see the MELTS Facebook page.

Main Menu

Enabling the Windows Subsystem for Linux and installing the Rhyolite-MELTS GUI

Started by Paula, November 17, 2017, 04:08:40 PM

Previous topic - Next topic

Paula

Note: this post was first written when Ubuntu 16.04 LTS was the only version available in the Microsoft store. If you have downloaded rhyolite-MELTS from the OFM website and followed the link from there to here, note that Ubuntu 16.04 LTS is no longer available so these instructions will almost certainly not work. We recommend you download the latest rhyolite-MELTS for Linux version and use the instructions on the newest version of this post.

For 64-bit Windows 10 with the Fall Creators update (version 1709; released October 17th, 2017), it is possible to enable the 'Windows Subsystem for Linux' (WSL) and use the latest rhyolite-MELTS version linked on the Linux Download site. Things that you should type at the command line are in bold in quote boxes; names you should substitute are in italics and comments are preceded by ellipsis (...). Note that by 'command line', we mean the Ubuntu bash shell that opens when you click the 'ubuntu 16.04' program and not the Windows Command Prompt (cmd.exe).

Enable the WSL and install ubuntu
  • Open Settings (click either the Start button in the bottom LH corner or the Notification icon in the bottom RH corner; then click the cog icon). Type 'Windows features' in the search box and then select 'Turn Windows features on or off'. Scroll down and check the box beside 'Windows Subsystem for Linux'; click OK and reboot. If 'Windows Subsystem for Linux' has '(beta)' next to it then you do not have the Fall Creators update installed.
  • Open the Windows Store and search for 'ubuntu 16.04 LTS'. Select 'Get'. If you have any installation issues then consult this slightly out of date installation guide for troubleshooting (predates Fall Creators update).
  • Select 'Launch'. You will be prompted to enter a username and password for Linux. The username is case sensitive; it may, or may not, be the same as your Windows username but you should avoid spaces or special characters in it. The password should be different to your Windows password; you will need to enter it when installing or updating software at the Linux command line.
  • We recommend you select 'Pin to Start' and/or 'Pin to taskbar' for the ubuntu 16.04 executable. If you want to do 'Pin to Start' at a later date, just open the Windows Store and search for 'ubuntu 16.04 LTS' again.
Set up the ubuntu command line
  • Open ubuntu 16.04, if it is not already open. Right-click on the ubuntu icon in the upper left-hand corner and choose Properties. Make sure that 'QuickEdit Mode' is checked. Now you can select text, including commands in these instructions (using control-c) and then paste them to the command line by right-clicking the mouse or trackpad in the ubuntu window.
  • Note that you can use ubuntu commands and Linux software to modify your regular files on Windows. Generally, you should not use Windows programs to modify the ubuntu files (by which we mean the ubuntu system files and the files in your ubuntu home space). So, it's a good idea to keep all your working files in your usual Windows folders and set up links so that you can access them from the command line:
    Quoteln -sf /mnt/c/Users/your_windows_username/Downloads .
    ... the space between 'Downloads' and '.' is required
    ... if you copy and paste the command then use the left arrow and delete to replace 'your_windows_username' with the actual name of the folder that your Windows files are stored in
    ... if the 'your_windows_username' folder has spaces in its name you need to put a '\' before each one e.g:
    ln -sf /mnt/c/Users/your\ windows\ username/Downloads .
    You can now switch to the folder by typing 'cd Downloads'. If you don't want the link to be called 'Downloads' then replace '.' with your choice of link name e.g. 'MyFiles'. 'ln' stands for 'link'; '-s' is for 'symbolic', so if you delete the link you do not delete the original file (much like Windows shortcuts); '-f' is for 'force', which makes no difference at this point but should you change your mind about where you want the 'MyFiles' link to point to, then is required to overwrite the original.
  • Substitute 'Downloads' and repeat the above for any other folders that you would like to be able to access from the command line while running rhyolite-MELTS, such as 'Documents' or 'Desktop'.
Install alphaMELTS (optional)

If you want to install alphaMELTS, then if you do that now it will do the next steps for you. Download the alphamelts_wsl_version.zip file. You should be able to unzip it on Windows. Put the extracted folder in 'Downloads' (or your choice of folder, as long as you have set up a link to it in ubuntu 16.04). Open ubuntu 16.04, if it is not already open. Navigate to the folder where alphamelts_wsl_version.zip is using 'cd' (which stands for 'change directory'). E.g:
Quotecd Downloads
cd alphamelts_

... if you press the 'tab' key at this point it should complete the folder name
... depending how you extracted the files, you may to repeat the previous command to descend into the folder where the .command scripts are
./install.command
Choose the default settings offered by install.command (press 'enter' to each folder suggestion, and then 'y' when it asks whether to continue with the installation). This means it will make a 'bin' folder for you (to put links in), set the Path to include the 'bin' folder, and set up the DISPLAY variable that rhyolite-MELTS will need. Close ubuntu 16.04 (type 'exit' or use the X in the top right hand corner) and open it again.

If you did not install alphaMELTS

This step make a 'bin' folder, which is short for 'binary' and is a folder where we will put a link (shortcut) to rhyolite-MELTS. It will set the Path to include the 'bin' folder,  so that you can run rhyolite-MELTS from anywhere on the system. It also sets up the DISPLAY variable that rhyolite-MELTS will need. Open ubuntu 16.04, if it is not already open:
Quotecd
... this just ensures that you are in your ubuntu home directory
mkdir bin
... which means make a directory called 'bin' (where 'directory' is what is called 'folder' on Windows)
wget magmasource.caltech.edu/gitlist/alphaMELTS.git/raw/master/profile
... this downloads a settings file because going through a Windows-based browser causes problems with line-endings etc.
cat profile
This last command just prints the file we just downloaded, so we can check that it downloaded OK before using it. The output should look like this:
Quote# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
    export PATH
fi

# For the Rhyolite-MELTS graphical user interface on the Windows Subsystem for Linux with Xming
if [[ $(uname -r) =~ Microsoft ]] ; then
   export DISPLAY=:0
fi

# For the Rhyolite-MELTS graphical user interface on Macs, using the 10.8+ or 10.12+ executable:
# If you get "Segmentation fault: 11" (10.8+) or "Illegal instruction: 4" (10.12+)
# then include the following and try the 10.8+ executable.
if [[ $(uname) =~ Darwin ]] ; then
   export DYLD_LIBRARY_PATH=/opt/X11/lib/flat_namespace:$DYLD_LIBRARY_PATH
fi
If it does then type you can continue:
Quotemv profile .profile
... where there is a space before the '.' but not after; a file beginning with with '.' is a hidden file in Linux
exit
... this closes ubuntu 16.04; when you next open it the settings file will be read and acted upon

Download and set up rhyolite-MELTS and some helper software
  • If you haven't already, then download the 64-bit Ubuntu 14.04 rhyolite-MELTS/pMELTS executable. You should be able to unzip it on Windows. Put the extracted file in 'Downloads' (or your choice of folder, as long as you have set up a link to it in ubuntu). Open ubuntu 16.04, if it is not already open:
    Quotecd ~/bin
    ... '~' is shorthand for your home space on ubuntu
    ln -sf ../Downloads/Melts-rhyolite-public Melts-rhyolite
    ... see the 'Set up the ubuntu command line' section for an explanation of the 'ln' command; note that '..' means up one directory level
    Since we added the 'bin' folder to the Path you will be able to open rhyolite-MELTS from any folder by typing 'Melts-rhyolite'. (Without these settings you would need to navigate to the folder containing Melts-rhyolite-public and type './Melts-rhyolite-public', where '.' means the current directory.)
  • We need to install two libraries that are not included in the default ubuntu installation, as Microsoft intended the WSL to be command line only. Open ubuntu, if it is not already open:
    Quotesudo apt install libxft2 libxt6
    ... enter your Linux password when prompted and choose 'y' to install the necessary packages
    'apt' is the ubuntu package manager; you will also use it for updating ubuntu when needed. If you get a message about updates being available then type the following:
    Quotesudo apt update
    ... enter your password
    sudo apt upgrade
    sudo apt full-upgrade

    ... choose 'y' as appropriate
  • You will need to install an X server. We use Xming, which requires a small donation. There are free alternatives but we have not tried them out (and do not intend to). The Xming donation (approx. $15 US) is made via PayPal, but you do not need to have a PayPal account. You will receive a Donor Password via email, though bear in mind that the developer is located in the UK so there may be a few hours delay, due to the time difference.
  • Once you have a Donor Password, go to Releases. Download and run the Xming-64 installer. Next download and install the Xming-fonts installer; make sure to install to the same location (should be 'C:\Program Files\Xming' by default).
  • Start Xming by double-clicking. Test rhyolite-MELTS by typing 'Melts-rhyolite' at the command line and 'n' to select version 1.0.2. If the display is very small then follow the guidelines in this post.
You will not need to repeat all these steps next time. Just open the ubuntu program, navigate to the folder where your input (.melts) files are, and type 'Melts-rhyolite'.

Any problems, please let me know,
Paula