Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.

Commit 5a4ad12

Browse files
author
Release Manager
committed
Trac #31138: Document WSL Installation
In reponse to an [https://ask.sagemath.org/question/53294/installing- optional-packages-infinite-loop/#54977 ask.sagemath question] about package installation on windows, I linked to my documentation for a from-source installation on WSL. Emmanuel Charpentier requested that I added this to the official documentation. I've added a section on setting up WSL to en/installation/source.rst and a section which covers the steps needed to launch sage in WSL from the windows desktop or start menu to en/installation/launching.rst URL: https://trac.sagemath.org/31138 Reported by: gh-sandyscott Ticket author(s): Sandy Scott Reviewer(s): Tobias Diez
2 parents c8a7960 + ec25daf commit 5a4ad12

File tree

2 files changed

+92
-1
lines changed

2 files changed

+92
-1
lines changed

src/doc/en/installation/launching.rst

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,69 @@ Note that this assumes that a firewall which might be present between server
4848
and client allows connections on port 8888. See details on port forwarding on
4949
the internet, e.g. https://www.ssh.com/ssh/tunneling/example.
5050

51+
.. _sec-launching-wsl-post-installation:
52+
53+
WSL Post-installation steps
54+
---------------------------
55+
56+
If you've installed Sage Math from source on WSL, there are a couple of extra steps you can do to make your life easier:
57+
58+
Create a notebook launch script
59+
"""""""""""""""""""""""""""""""
60+
61+
If you plan to use JupyterLab, install that first.
62+
63+
Now create a script called ``~/sage_nb.sh`` containing the following lines, and fill in the correct paths for your desired starting directory and ``SAGE_ROOT``
64+
65+
66+
.. CODE-BLOCK:: bash
67+
68+
#!/bin/bash
69+
# Switch to desired windows directory
70+
cd /mnt/c/path/to/desired/starting/directory
71+
# Start the Jupyter notebook
72+
SAGE_ROOT/sage --notebook
73+
# Alternatively you can run JupyterLab - delete the line above, and uncomment the line below
74+
#SAGE_ROOT/sage --notebook jupyterlab
75+
76+
Make it executable:
77+
78+
.. CODE-BLOCK:: bash
79+
80+
chmod ug+x ~/sage_nb.sh
81+
82+
Run it to test:
83+
84+
.. CODE-BLOCK:: bash
85+
86+
cd ~
87+
./sage_nb.sh
88+
89+
The Jupyter(Lab) server should start in the terminal window, and you windows browser should open a page showing the Jupyter or JupyterLab starting page, at the directory you specified.
90+
91+
Create a shortcut
92+
"""""""""""""""""
93+
94+
This is a final nicety that lets you start the Jupyter or JupyterLab server in one click:
95+
96+
* Open Windows explorer, and type ``%APPDATA%\Microsoft\Windows\Start Menu\Programs`` in the address bar and press enter. This is the folder that contains you start menu shortcuts. If you want the sage shortcut somewhere else (like your desktop), open that folder instead.
97+
* Open a separate window and go to ``%LOCALAPPDATA%\Microsoft\WindowsApps\``
98+
* Right-click-drag the ``ubuntu.exe`` icon from the second window into the first, then choose ``Create shortcuts here`` from the context menu when you drop it.
99+
* To customize this shortcut, right-click on it and choose properties.
100+
101+
* On the General tab:
102+
103+
* Change the name to whatever you want, e.g. "Sage 9.2 JupyterLab"
104+
105+
* On the Shortcut tab:
106+
107+
* Change Target to: ``ubuntu.exe run ~/sage_nb.sh``
108+
* Change Start in to: ``%USERPROFILE%``
109+
* Change Run to: Minimised
110+
* Change the icon if you want
111+
112+
Now hit the start button or key and type the name you gave it. it should appear in the list, and should load the server and fire up your browser when you click on it.
113+
51114
------------------------------------------------------------------------
52115

53116
For further reading you can have a look at the other documents in the

src/doc/en/installation/source.rst

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ on the command line. If it gives an error (or returns nothing), then
229229
either ``perl`` is not installed, or it is installed but not in your
230230
`PATH <https://en.wikipedia.org/wiki/PATH_%28variable%29>`_.
231231

232+
.. _sec-installation-from-sources-linux-recommended-installation:
233+
232234
Linux recommended installation
233235
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
234236

@@ -401,6 +403,32 @@ include:
401403

402404
.. literalinclude:: cygwin-optional.txt
403405

406+
Ubuntu on Windows Subsystem for Linux (WSL) prerequisite installation
407+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
408+
409+
Sage can be installed onto linux running on Windows Subsystem for Linux (WSL). These instructions describe a fresh install of Ubuntu 20.10, but other distibutions or installation methods should work too, though have not been tested.
410+
411+
- Enable hardware-assisted virtualization in the EFI or BIOS of your system. Refer to your system (or motherboard) maker's documentation for instructions on how to do this.
412+
413+
- Set up WSL by following the `official WSL setup guide <https://docs.microsoft.com/en-us/windows/wsl/install-win10>`_. Be sure to do the steps to install WSL2 and set it as default.
414+
415+
- Go to the Microsoft Store and install Ubuntu.
416+
417+
- Start Ubuntu from the start menu. Update all packages to the latest version.
418+
419+
- Reboot the all running WSL instances one of the following ways:
420+
421+
- Open Windows Services and restart the LxssManager service.
422+
- Open the Command Prompt or Powershell and enter this command::
423+
424+
wsl --shutdown
425+
426+
- `Upgrade to the Ubuntu 20.10 <https://linuxconfig.org/how-to-upgrade-ubuntu-to-20-10>`_. This step will not be necessary once Ubuntu 20.10 is available in the Microsoft Store.
427+
428+
From this point on, follow the instructions in the :ref:`sec-installation-from-sources-linux-recommended-installation` section.
429+
430+
When the installation is complete, you may be interested in :ref:`sec-launching-wsl-post-installation`.
431+
404432
Other platforms
405433
^^^^^^^^^^^^^^^
406434

@@ -1613,4 +1641,4 @@ the directory where you want to install Sage.
16131641

16141642

16151643

1616-
**This page was last updated in May 2020 (Sage 9.1).**
1644+
**This page was last updated in December 2020 (Sage 9.3).**

0 commit comments

Comments
 (0)