Follow along this post to see how to install Magma in a virtual environment on Ubuntu 20.04 and set up a basic LTE connection.
Note 1:The Magma gateway cannot be set upon Apple computers with the M1 chip. Using Rosetta or even double virtualization will not do the trick. On MacOS, the installation of most prerequisites can be done relatively easily, especially with the help of brew. While brew can be set up for Ubuntu, a more roundabout approach will be taken here.
Note 2:When choosing a host machine, ensure that it has enough RAM and memory. Insufficient RAM will lead to errors such as the host closing the connection to the gateway VM when building the gateway.
Docker
- Remove any existing installation of docker on system using the commands givenin this guide on uninstalling docker engineandthis guide on uninstalling old docker versions.
- Install docker engine using the instructionsin this guide on installing docker using the repository.
- If you are unable to run docker using
sudo docker run hello-world
due to an inability to connect to the Docker daemon, then try running (based on the instructionsin this Stack Overflow post on connecting to docker):
systemctl start docker
- To stop having to use
sudo
before all docker commands, follow the instructionsin this guide on post-installation steps for Docker on Linux. The link outlines steps to create a new Unix group that can run the docker command withoutsudo
and add users to it.
Installing docker compose
- Install docker compose version1.29.2using the instructionsin this guide on installing Docker Compose.
- Setup command completion using the steps describedin this guide on Command-line completion.
Setting up Virtualbox
- Install Virtualbox fromthe Downloads page. Usethis blog post on installing VirtualBox from Oracle’s repositoriesandthis similar postfor reference.
- During the installation, you will run into the following message
- Click on
<Ok>
and create a new passphrase. - To finish setting up Virtualbox, you need to complete two more steps
- Restarting the system will take you to a screen asking for the passphrase generated above. Suppy this and the start the system.
- If errors such as the following are produced, you will also have to log into the BIOS and disable secure boot.
Installing Vagrant
Vagrant helps manage virtual machines and allows users to interact with them in a uniform way across systems.
- Install vagrant following the instructionsin the documentation on installationandthe downloads pageusing the following commands
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"sudo apt-get update && sudo apt-get install vagrant
Setting up Go
The command given in theMagma prerequisites pageindicates that Go 1.13 is necessary.
- Obtain the compressed file from the archived versions fromthe Go downloads page.
- Run
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.13.15.linuxamd64.tar.gz
- Add Go to the path in
~/.profile
as below
export PATH=$PATH:/usr/local/go/bin
The Magma prerequisites page asks for the path to added to~/.bash_profile
instead of~/.bashrc
. Look at this medium post and this Stack Exchange question for the difference between~/.bash_profile
,~/.bashrc
and~/.profile
.
- To check the correctness of the Go installation run
source ~/.profilego version
The output should be similar to that below
go version go1.13.15 linux/amd64
- This will however not apply to any new terminals you create as the change is not in
~/.bashrc
. Therefore, restart the system (interchangeably used withhostfrom now on) for this change to take hold.
Setting up Python 3.7.3
TheMagma prerequisites pagerecommends that pyenv be installed to set up Python 3.7.3. However, we will usecondain this setup instead as we were unable to proceed with the following steps using pyenv on Ubuntu 20.04. A global installation of Python 3.7.3 is not recommended as discussedin this post on Python best practices.
- Miniconda can be installed following the instructions on theconda installation page.
- Set
conda config --set auto_activate_base false
to prevent the base environment from activating by default when a terminal starts.
- Created a conda environment named
magma_python
withPython 3.7.3andpip 21.2.2. Refer tothis conda cheat sheetfor conda commands. - Activate the environment using
conda activate magma_python
- Install the remaining libraries in this environment as given in theprerequisites page.
vagrant-vbguest
Install as in theprerequisites page.
Magma
Magma can be cloned from the repositoryon the official GitHub page.
Prerequisites for deployment
- Set up aws-iam-authenticator using the instructions in theofficial documentation for aws-iam authenticator
- Install kubectl using apt from the officialdocumentation on kubectl installation
- Install helm using apt using the steps in theofficial documentation on installing Helm
- Set up terraform using the instructions in theofficial documentation on installing Terraform
- Open two terminal tabs as directed in theQuick Start Guide(called guide from here on).
- Activate the conda environment created previously in each terminal
conda activate magma_python
- Check out the branch you want to use. If you want to use, say,v1.6, you would navigate to the magma git repository and do
git checkout v1.6
- Provision the AGW VM as directed in the guide using one of the terminals.
- As the Magma Quick Start Guide mentions, the development VMs are in the 192.168.60.0/24, 192.168.128.0/24 and 192.168.129.0/24 address spaces. These need to be made allowed ranges. If not,
vagrant up magma
will terminate with an error similar to the one below - Follow the instructions in theVirtualBox manual on Host-Only Networkingand add
* 192.168.60.0/24 192.168.128.0/24 192.168.129.0/24
to/etc/vbox/networks.conf
creating it in the process if necessary.
- Further, in order to set up the magma VM, virtualization needs to be enabled on the host system. If it is not, it will produce an error such as that below
To fix this, log in to your BIOS (the method to do this varies from host to host) and enableVirtualization Technology. You will likely find this inSystem Configuration
orSecurity
. If this option is not available, then virtualization is not possible on your machine and you will require an new one.
- Upon making these changes,
vagrant up magma
should finish with an output similar to that shown below. It is important that the number of failures be zero i.e failed = 0.
- The first time around, provisioning the AGW VM (the whole process from
vagrant up magma
) took34 minuteson the author’s host machine. - 192.168.60.0/24 192.168.128.0/24 192.168.129.0/24
- Now, follow the instructions in the guide to ssh into the VM and build the AGW.
- To set up the Orchestrator, once again follow the instructions in theBuild Orchestratorsection of the guide. This took around29 minuteson the author’s machine.
- Start the Orchestrator as directed in the guide. If run with metrics, this should terminate with an output similar to that below
- Navigating to the
magma/cache/test_certs
folder (open usingnautilus/magma/cache/test_certs
) and double clicking on theadmin_operator.pfx
and supplying the password“magma”produces the following dialog box
Add the certificate to Firefox by navigating toPreferencesand looking for“View certificates”and adding the.pfx
file to the“Your certificates”tab of Certificate manager. As this has to be imported from the sytem and.cache
is a hidden folder, transfer the.pfx
file to a visible directory outside the repository and import it from there. This results in the following dialog box
Upon openinghttps://localhost:9443/swagger/v1/uiin Firefox, you will see the following warning (as mentioned in the guide)
Click onAdvancedand then choose to continue. This will open the following
- Attempting to connect the Orc8r and LTE Gateway using
fab -f dev_tools.py register_vm
might produce an error such as the one below
...PermissionError: [Errno 13] Permission denied:'./../../.cache/test_certs/admin_operator.key.pem'...
- Run the following command (from the magma directory) to provide the necessary permissions (refer tothis Stack Overflow post on permissionsfor more details).
sudo chown -R $USER .cache/test_certs/
- Start the magmad service as directed in the guide. Note that you might see errors relating to
td-agent-bit
. These are to be expected as the Quick Start Guide doesn’t enable this service. Refer to thisissue about FluentBitfor more details. - Finally run the NMS UI as directed in the guide. Note that if theGateway Error 502persists, check the status of the
magmalte
docker container using
docker container ls
and kill it if it is unhealthy using
docker kill <container_id>
and set up the NMS UI again.
- If your Orchestrator (Orc8r) and AGW are connected and the magma services are running on the AGW, then the health of the gateway in the NMS UI (navigate to the Equipment tab on the left of the NMS UI and scroll down to Gateways) should readGood. This health status is based on how often the gateway checks in. Look atthis comment on the gateway health.
- The Orc8r can be shut down using
docker-compose down
. If this fails, try
HOST [magma/orc8r/cloud/docker]$ ./run.py
and thendocker-compose down
.
If you would like to learn more about the project and get involved check thewebsitefor more information ordownload the codeand start to experiment with the platform.