# Install Docker-based Access Gateway on Ubuntu
###### tags: `Docker` `Access gateway` `Magma`
[TOC]
---
## Deployment
### Step 1: Create boot USB stick and install Ubuntu on your AGW host
* Download the Ubuntu Server 20.04 LTS .iso image from the Ubuntu website
* Create a bootable USB using this Etcher tutorial
* Boot your AGW host from USB
* Press F11 to select boot sequence. WARNING: This might be different for your machine.
* If you see two options to boot from USB, select the non-UEFI option.
* Install and configure your Access Gateway according to your network defaults.
* Make sure to enable ssh server and utilities (untick every other).
* Connect your SGi interface to the internet and select this port during the installation process to get an IP using DHCP.
*
---
### Step 2: Deploy magma on the AGW_HOST
**Do pre-installation steps**
Become root user:
```
sudo -i
```
Copy your `rootCA.pem` file from orc8r to the following location:
```
mkdir -p /var/opt/magma/certs
vim /var/opt/magma/certs/rootCA.pem
```

**Run AGW installation**
Download AGW docker install script
```
wget https://github.com/magma/magma/raw/v1.8/lte/gateway/deploy/agw_install_docker.sh
bash agw_install_docker.sh
```


**Configure AGW**
Once you see the output `Reboot this machine to apply kernel settings`, reboot your AGW host.
Create `control_proxy.yml` file with your orc8r details:
```
cat << EOF | sudo tee /var/opt/magma/configs/control_proxy.yml
cloud_address: controller.orc8r.magmacore.link
cloud_port: 443
bootstrap_address: bootstrapper-controller.orc8r.magmacore.link
bootstrap_port: 443
fluentd_address: fluentd.orc8r.magmacore.link
fluentd_port: 24224
rootca_cert: /var/opt/magma/certs/rootCA.pem
EOF
```
Start your access gateway:
```
cd /var/opt/magma/docker
sudo docker-compose up -d
```
Now get Hardware ID and Challenge key and add AGW in your orc8r:
`docker exec magmad show_gateway_info.py`
Then restart your access gateway:
`sudo docker-compose up -d --force-recreate`
---
### Reference
https://magma.github.io/magma/docs/lte/deploy_install_docker