Install SageMath in Ubuntu 22.04

In this article, we would discuss how to install SageMath in Ubuntu 22.04 release. It is basically a free and open-source mathematics application. It combines the functionality of different open-source packages. The application is written in Python and Cython.

It was first released on February 24, 2005. And, at the time of writing, v9.5 is its latest stable release. We would like to mention here that, at this point in time, v9.4 can only be installed from standard Ubuntu repository. It can be updated later.

We will also discuss a bit about how to use the application after its installed. This will be done in Additional Info section.

Note: Following operations require you to have superuser privileges. In case you don’t have one then, we advise you to contact your System Administrator for assistance.

Install SageMath in Ubuntu 22.04

Since the package is available through standard Ubuntu repository. Therefore, we need to update the repository first. This ensures we get to have the latest version of the package available. Hence, open a terminal and issue the following –

sudo apt update

Next, to install SageMath –

sudo apt install sagemath

The package size is around 950 MBs in size. It will vary for you depending on related packages required.

After its installed, we can launch the application from our Systems’ main menu or from terminal.

From terminal we need to issue the following –


Also, it will launch the application in the terminal itself. From the GUI, it will start the Sage Jupyter Notebook server.

To exit from terminal, issue –


In conclusion, we have discussed how to install SageMath in Ubuntu 22.04 release.

Additional Info –

As already discussed, this section mainly deals with the basic usage part. Here, we will see how SageMath can be utilised to solve mathematical equations –

Problem 1: Solve equations with two variables –

sage: a, b = var('a, b') 
sage: solve([a+b==7, a-b==3], a, b)

It will return with the output –

[[a == 5, b == 2]]

Problem 2: To plot graphs –

sage: plot(x^2, (x,-3,7))

It will show us the output in a png file format.

SageMath application looks pretty interesting. We will cover more on it coming articles.