The Sage Virtual Machine

This page describes how to use the Sage appliance that you can download from This page covers Sage versions 4.8 and older; For newer versions see the new manual.


The Sage appliance (packaged virtual machine) can be used on any operating system that supports the free VirtualBox player, for example Microsoft Windows. Your computer must have at least 2.5 GB (!) of free disk space and at least 512 MB of RAM. The virtual machine can also be used with other hypervisors like VMware. However, unless you are already familiar with VMware, we recommend that you use VirtualBox. In our experience, it is easier for non-technical users.


  1. Download VirtualBox (available at Install it anywhere you want. Version 4 or later is required.

  2. Download the file sage-x.y.z.ova (for example, sage-4.7.2.ova) from (select the location nearest to you).

    Sage webpage download

  3. Open VirtualBox. Your screen should look like this:


  4. Import sage-x.y.z.ova by clicking File, then Import Appliance:


  5. You should see an Appliance Import Wizard window open:


  6. Import the Sage appliance by clicking Choose then browsing for the file sage-x.y.z.ova downloaded earlier. Select the file and click Next.

  7. It is recommended that you accept the settings that appear on the next window by clicking Finish:


  8. The import will now begin. You should see a progress window:


  9. Once the import is complete, your VirtualBox manager should now look like one of the following images:



Using the Sage Notebook

  1. Start VirtualBox.

  2. To start the Sage notebook server, power on Sage-x.y.z by selecting it and clicking 'Start'. (This may take awhile. You may see some warning messages you can safely ignore.)
  3. You may see an Information window explaining how to integrate the mouse pointer with the virtual machine:


  4. Wait a few moments until the running VirtualBox window displays a message saying Open your web browser to .... Now open the web browser that you usually use (it's best to use Firefox or Chrome) and go to the address http://localhost:8000.


    Note: Starting with Sage-5.0 the virtual machine opens a graphical notebook. Updated instructions are here. You can either use the web browser that you usually use, or you can use the notebook directly within the VirtualBox window. Either way, the following page should appear:

    Empty Sage notebook

  5. If you would like other users to be able to create additional accounts on the same local virtual machine, you will first need to complete some further steps. See the advanced options section below.
  6. When you are finished working with Sage, close your browser

    as usual (it is not necessary to Sign Out). In the running VirtualBox window, click Machine, then Close:


    Select Send the shutdown signal then click OK:


    The running window will closed automatically, and then you may close VirtualBox.

Sharing files between Sage and Windows

If you want to enable shared folders between Sage and your Windows system, complete the following steps:

  1. In the running VirtualBox window, click Devices, then Shared Folders:


  2. Click on the icon with a green + in the upper right corner:


  3. Under Folder Path, browse to select the path of the Windows folder that you want to share using the pull-down menu and selecting Other:


  4. Check Auto-mount and Make Permanent. Click OK, then click OK again.

  5. From the menu, select Machine, then Reset:


The files will be in /media/sf_<volume name>.

Using the Sage shell

  1. Start VirtualBox if you have not already done so.

  2. Power on sage-x.y.z (if you have not already done so) by selecting it and clicking Start.

  3. Once the virtual machine is powered on, press Ctrl C to quit the Sage notebook.

  4. Type
    on the command line to start a shell interface in Sage.
  5. To work with files attached in a shared folder (if you have shared folders enabled), type
    attach /media/sf_<volume name>/filename
    in the Sage command line session.


Advanced Options

Changing the keyboard layout

To temporarily change the keyboard layout (for example, French AZERTY), you can drop to the shell and run the command

sudo loadkeys azerty

To make this change permanent, you have to edit a configuration file. Run

sudo nano /etc/sysconfig/keyboard

and set it to the following:


Giving Others Access to the Sage Virtual Machine

You can run the Sage appliance as a server on the network, so that others can access it similar to In this case, you have to make some changes to the virtual machine such that not everybody can log in.

  1. Log into the virtual machine as root: In the virtual machine, press Alt-F1, log in as user root with password sage. See the advanced options section for more details.

  2. Once you are logged in as root, change the password for both the root and sage user account:
    [[email protected] ~]# passwd root
    Changing password for user root.
    Retype new password: 
    passwd: all authentication tokens updated successfully.
    [[email protected] ~]# passwd sage
    Changing password for user sage.
    Retype new password: 
    passwd: all authentication tokens updated successfully.
  3. Now switch to the sage account. You can either log in as sage with the new password, or type
    [[email protected] ~]# su sage
    [[email protected] root]$ cd
    [[email protected] ~]$
  4. Configure the notebook server to start in a secure mode. For this, you have to edit the .bash_profile file in the sage account. For example, type

    [[email protected] ~]$ nano .bash_profile
    and replace the line
    ./sage -notebook interface=\'\' port=8000 open_viewer=False require_login=False
    ./sage -notebook interface=\'\' port=8000 open_viewer=False require_login=True secure=True

    Then press Ctrl X to exit, and y when nano asks you to save the file before exiting (save it again as .bash_profile).

  5. Now reboot the virtual appliance:
    [[email protected] ~]$ exit
    [[email protected] ~]# reboot
  6. Upon the reboot, Sage will ask for some further information. You will find the following in the VirtualBox window:

    | Sage Version ..., Release Date: ...                                |
    | Type notebook() for the GUI, and license() for information.        |
    Please wait while the Sage Notebook server starts...
    The notebook files are stored in: sage_notebook.sagenb
    In order to use an SECURE encrypted notebook, you must first run notebook.setup().
    Now running notebook.setup()
    Domain name [localhost]: 
    Simply press return to use the default domain name. A SSL cryptographic key is then automatic created with this hostname.
  7. Now set up an admin password for the Sage notebook server. Unless you have set up such an account previously, Sage will ask you for a password automatically:
    Please choose a new password for the Sage Notebook 'admin' user.
    Do _not_ choose a stupid password, since anybody who could guess your password
    and connect to your machine could access or delete your files.
    NOTE: Only the md5 hash of the password you type is stored by Sage.
    You can change your password by typing notebook(reset=True).
    Enter new password: 
    Please enter a new password following the instructions.
  8. Optional: Once your Sage server is secured, you can make it accessible from the network. For this, you have to stop the virtual machine (not just suspend it). Then, in the VirtualBox window, go to Settings -> Network -> Adapter 1. It does say Attached to: NAT. Switch it to Bridged Adapter. Click OK and restart the virtual machine. Note: This makes your virtual machine accessible from the network. Only perform this step after you have changed passwords and configured the notebook server to be secure, as described above.

  9. Optional: Give the Sage virtual machine more resources, so it can server more clients. Go to Settings -> System. On the Motherboard tab, increase Base Memory to about half of the physical ram of your host computer. On the Processor tab, increase the number of processors to your host CPU number of cores. Finally, on the Acceleration tab, enable VT-x/AMD-V if your CPU supports this.

To connect to the Sage server, you have to use https://... instead of http://.... For example, on the host computer where the virtual machine is running, the Sage server listens at https://localhost:8000. Since our SSL key is not signed by a certificate authority (which you can do, but it does cost money) web browsers will show a warning that the authority of the key cannot be verified. While a signed SSL key would provide a higher level of security, the network data between the browser and the Sage server is nevertheless encrypted.

How to become a Sage developer

Some Unix familiarity is assumed below. If you've never used anything but Windows, some of this won't make sense.

  1. Change to the $SAGE_ROOT directory:

    [[email protected] directory]$ cd
    [[email protected] ~]$ cd sage
    [[email protected] sage]$ 
  2. To actually edit files, you'll perhaps want to install the editor of your choice. For example, to install Emacs do this:
    [[email protected] sage]$ sudo yum install emacs
    The nano editor is included.
  3. Now type, for example,
    [[email protected] sage]$ cd devel/sage/sage/rings/
    [[email protected] rings]$ emacs
    [[email protected] rings]$ nano
    and edit the file to your heart's content.
  4. Save the file and type sage -br to build the changes and install them:

    [[email protected] rings]$ cd
    [[email protected] ~]$ cd sage
    [[email protected] sage]$ sage -br
    sage: Building and installing modified SAGE library files.
    | SAGE Version x.y.z, Release Date: .........         

SageAppliance/Sage-4 (last edited 2016-01-27 15:24:56 by slelievre)