# Set up Julia and Gurobi on a Raspberry Pi 400

**URL:** <https://forum.ysang.org/t/set-up-julia-and-gurobi-on-a-raspberry-pi-400/45>\
**Category:** Julia\
**Created:** [August 30, 2022, 10:18pm UTC](https://forum.ysang.org/t/set-up-julia-and-gurobi-on-a-raspberry-pi-400/45 "2022-08-30T22:18:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuanruisang](https://avatars.discourse-cdn.com/v4/letter/y/65b543/32.png) [@yuanruisang](https://forum.ysang.org/u/yuanruisang)\
**Post date:** [August 30, 2022, 10:18pm UTC](https://forum.ysang.org/t/set-up-julia-and-gurobi-on-a-raspberry-pi-400/45/1 "2022-08-30T22:18:10Z")

</div>

## Install a 64-bit Ubuntu OS (Gurobi requires a 64-bit OS):

1. Download Raspberry Pi Imager at [https://www.raspberrypi.com/software/](https://www.raspberrypi.com/software/) and install it on a regular computer.
2. Download the Ubuntu Image for Raspberry Pi at [Install Ubuntu on a Raspberry Pi | Ubuntu](https://ubuntu.com/download/raspberry-pi) onto the regular computer that you just installed the Raspberry Pi Imager. I chose the 64-bit Ubuntu Desktop 22.04.1 LTS. The Server version is good too, but it only operates on command lines and it will be less intuitive to set up wifi connections and copy commands from online tutorials.
3. Insert the SD card into the regular computer, run the Imager, erase the previous OS on the SD card, and flash the Ubuntu image into the SD card.
4. Power on your Raspberry Pi and the installation process will start automatically. You will be asked to change the root password. The initial username and password are both _ubuntu_.

## Install Julia

```auto
cd /opt
sudo wget https://julialang-s3.julialang.org/bin/linux/aarch64/1.8/julia-1.8.0-linux-aarch64.tar.gz
sudo tar zxvf julia-1.8.0-linux-aarch64.tar.gz
sudo nano ~/.bashrc

```

Add the following sentence to the end of the ~/.bashrc file:

```auto
export PATH="$PATH:/opt/julia-1.8.0/bin"

```

## Install JuMP and GLPK Solver

```auto
julia
import Pkg
Pkg.add("JuMP")
Pkg.add("GLPK")

```

Now you have the GLPK solver, you don’t have to have the Gurobi solver, but you could still install Gurobi for fun.

## Install Gurobi

1. Download the Gurobi Optimizer for arm64 Linux at [https://www.gurobi.com/downloads/gurobi-software/](https://www.gurobi.com/downloads/gurobi-software/)
2. Save the file with the .tar.gz extension to the /opt folder.
3. Use the following command to extract the files (please pay attention to the file name, it changes depending on the version):

```auto
tar xvfz gurobi9.5.2_armlinux64.tar.gz

```

1. Add the environment variables by using the following command:

```auto
sudo nano ~/.bashrc

```

Then add the following lines to the end of the file and save the file.

```auto
export GUROBI_HOME="/opt/gurobi952/armlinux64"
export PATH="${PATH}:${GUROBI_HOME}/bin"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"

```

1. Apply for a Gurobi academic license, and enter the grbgetkey XXXXXXXXXXXXXXXXX command into the command window. Activate the key and save the license in the default folder.
2. Restart your Raspberry Pi.
3. Open the terminal, run Julia and add the Gurobi package to Julia:

```auto
julia
import Pkg
Pkg.add("Gurobi")
Pkg.build("Gurobi")

```

1. Now you should be able to run a Julia JuMP problem with a Gurobi solver.
