SageMath : Installation


Before you read on further :-

WARNINGThe blog series is an internal monologue of a tech loving teenager who loves to experiment. This is no tutorial but she’s gonna adopt this style cuz it’s fun to read and you always understand something better when you teach and it’s just what worked for me. Kindly refer to official documents if you’re stuck somewhere and this blog could not offer you sufficient explanation.

I do not have much experience in contributing to open-source. However I’ve been playing CTFs as part of my club’s Crypto Team for around 2-3 years. Sagemath has been a wonderful tool in performing a wide range of attacks especially when it comes to stuff involving Finite Fields and Group Theory. The most common challenges I use sage for are the ones based on Coppersmith attack for RSA and the challenges based on Elliptic Curve Cryptography.It’s always a handy tool and something people find a little difficult to install. Here I’ll be guiding you through how to install it.

Step 1 : Installing sage locally

If you are someone who hasn’t tried installing sage before, believe me it takes patience. It’s kind of a pretty big package and dont do `sudo apt install sage-math`. It won’t work that way.

Let me just summarise the easiest efficient way to do it on a Linux system. (My system just crashed a few days ago, so I’m using a brand new Ubuntu 20.04 environment) :-

  1. Download sage from source :

Download from your nearest server

  1. One it is extract the file(will take a while)
tar xvfz sage-*.tar.xvz

You’ll get a directory with the name  sage*

(* stands for the version you have downloaded)

  1. Navigate to sage*/build/pkgs and do  cat debian.txt . This will show you all the packages you need in a debian based system to install and run sage. 

As specified in the :-

”  We have collected lists of system packages that provide these build
  prerequisites. See [build/pkgs/arch.txt](build/pkgs/arch.txt),
  [debian.txt](build/pkgs/debian.txt) (also for Ubuntu, Linux Mint,
  etc.), [fedora.txt](build/pkgs/fedora.txt) (also for Red Hat,
  CentOS), and [slackware.txt](build/pkgs/slackware.txt). “

So check that out if you are on another OS.

  1. The configure binary would review and set the configuration options. You can view configure –help, for extra configuration options but I’ll just proceed without any extra flags
  1. Now run `make`.
  2. Now ..Patience. Yes Patience. It takes time from a few hours to a few days to get it done. So don’t worry if you’re stuck on this part for a few days. It’s normal.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s