Deploying GreenRADIUS On Bare Metal Ubuntu 20.04 Instance

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Deploying GreenRADIUS on bare metal Ubuntu

20.04 instance

For deployment on bare metal Ubuntu 20.04 instance:

1. Pre-requisites:

a. Login as a user with sudo permissions to the bare metal Ubuntu instance

b. Configure a static IP, netmask, gateway and DNS servers for the server

c. Execute command:
$ sudo apt-get update

d. Install the following packages (see the commands below):

i. docker-ce, docker-ce-cli, containerd.io

$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

$ sudo apt-get install docker-ce docker-ce-cli containerd.io

ii. docker-compose

$ sudo curl -L "https://github.com/docker/compose/releases/download/1.28.2/docker-compose-Linux-x86_64" -o


/usr/local/bin/docker-compose

$ sudo chmod +x /usr/local/bin/docker-compose

iii. unzip

$ sudo apt-get install unzip

iv. incron

$ sudo apt-get install incron


v. net-tools

$ sudo apt-get install net-tools

e. Create gradmin user


$ adduser gradmin

f. Add gradmin to the sudo group


$ adduser gradmin sudo

g. Set permission to the /home/gradmin directory


$ chmod -R 750 /home/gradmin
$ chown -R gradmin:gradmin /home/gradmin

h. Reboot and login as 'gradmin' user.

i. Copy the GreenRADIUS update package to /tmp/ directory of the Ubuntu instance

2. Extract container images from update package (note xxxx in the commands below denotes
the GreenRADIUS version number):
$ sudo unzip /tmp/GreenRADIUS_xxxx_Update.zip -d /tmp/
$ sudo tar -xvzf /tmp/GreenRADIUS_xxxx_Update/images.tgz -C /tmp/

3. Extract docker-compose.yml from update


$ sudo tar -xvzf /tmp/GreenRADIUS_xxxx_Update/others.tgz -C /tmp/

4. Setup incron

$ sudo mkdir -p /opt/grs/scripts

$ sudo cp /tmp/others/vm_incron_scripts/* /opt/grs/scripts/

$ cd /opt/grs/scripts && sudo chown root:root *.sh && sudo chmod 511
freeradius_restart.sh get_host_info.sh incron_script.sh openldap_cmd_template_3.sh
openldap_restart.sh openldap_update_ca_certificates.sh rsyslog_restart.sh && cd -

$ sudo bash -c "echo 'gradmin ALL=(root) NOPASSWD:/opt/grs/scripts/get_host_info.sh


, /opt/grs/scripts/incron_script.sh , /opt/grs/scripts/rsyslog_restart.sh ,
/opt/grs/scripts/freeradius_restart.sh , /opt/grs/scripts/openldap_restart.sh ,
/opt/grs/scripts/openldap_update_ca_certificates.sh ,
/opt/grs/scripts/openldap_cmd_template_3.sh' > /etc/sudoers.d/grs"
$ sudo mkdir -p /opt/grs/host-comm/request

$ sudo mkdir -p /opt/grs/host-comm/response

$ sudo chown -R gradmin:gradmin /opt/grs/host-comm

$ sudo bash -c "echo 'gradmin' > /etc/incron.allow"

$ sudo bash -c "echo '/opt/grs/host-comm/request IN_CLOSE_WRITE sudo


/opt/grs/scripts/incron_script.sh \$#' > /var/spool/incron/gradmin"

$ sudo service incron restart

5. Load the container images on the server (note xxxx in the commands below denotes the
GreenRADIUS version number):
$ sudo docker load -i /tmp/images/greenradius_xxxx_init_image
$ sudo docker load -i /tmp/images/greenradius_xxxx_main_image
$ sudo docker load -i /tmp/images/greenradius_xxxx_openldap_image
$ sudo docker load -i /tmp/images/greenradius_xxxx_postgres_image
$ sudo docker load -i /tmp/images/greenradius_xxxx_rsyslog_image
$ sudo docker load -i /tmp/images/greenradius_xxxx_freeradius_image

6. Create the grs-docker-compose directory.


$ sudo mkdir -p /home/gradmin/grs-docker-compose

7. Copy the new docker-compose.yml file to grs-docker-compose directory.


$ sudo cp /tmp/others/docker-compose.yml /home/gradmin/grs-docker-compose/

8. Start the containers


$ cd /home/gradmin/grs-docker-compose
$ sudo docker-compose up -d

9. Enable container auto-start

a. Create a file grs-docker-compose-app.service in /etc/systemd/system/


$ sudo touch /etc/systemd/system/grs-docker-compose-app.service

b. Add the following lines to the grs-docker-compose-app.service file and save the file:

# /etc/systemd/system/grs-docker-compose-app.service

[Unit]
Description=Docker Compose Application Service
Requires=docker.service
After=docker.service

[Service]
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/home/gradmin/grs-docker-compose
ExecStart=/usr/local/bin/docker-compose up -d
ExecStop=/usr/local/bin/docker-compose down
TimeoutStartSec=0

[Install]
WantedBy=multi-user.target

c. Enable the service


$ sudo systemctl enable grs-docker-compose-app

d. Start the service


$ sudo systemctl start grs-docker-compose-app.service

This completes installation of GreenRADIUS on a bare metal Ubuntu server.

For installing subsequent GreenRADIUS updates:

1. Pre-requisites:

a. Copy the GreenRADIUS update package to /tmp/ directory of the bare metal Ubuntu
instance

b. Login as gradmin to Ubuntu instance.

c. Execute the below commands:


$ sudo apt-get update
$ sudo apt-get upgrade

2. Extract container images from update package (note xxxx in the commands below denotes
the GreenRADIUS version number):
$ sudo unzip /tmp/GreenRADIUS_xxxx_Update.zip -d /tmp/
$ sudo tar -xvzf /tmp/GreenRADIUS_xxxx_Update/images.tgz -C /tmp/

3. Extract docker-compose.yml from update (note xxxx in the commands below denotes the
GreenRADIUS version number)
$ sudo tar -xvzf /tmp/GreenRADIUS_xxxx_Update/others.tgz -C /tmp/
4. Load the images on the server (note xxxx in the commands below denotes the
GreenRADIUS version number):
$ sudo docker load -i /tmp/images/greenradius_xxxx_init_image
$ sudo docker load -i /tmp/images/greenradius_xxxx_main_image
$ sudo docker load -i /tmp/images/greenradius_xxxx_openldap_image
$ sudo docker load -i /tmp/images/greenradius_xxxx_postgres_image
$ sudo docker load -i /tmp/images/greenradius_xxxx_rsyslog_image
$ sudo docker load -i /tmp/images/greenradius_xxxx_freeradius_image

5. Stop the running containers


$ cd /home/gradmin/grs-docker-compose
$ sudo docker-compose down

6. Copy the new docker-compose.yml file to grs-docker-compose directory.


$ sudo cp /tmp/others/docker-compose.yml /home/gradmin/grs-docker-compose/

7. Start the containers


$ cd /home/gradmin/grs-docker-compose
$ sudo docker-compose up -d

Steps to start/stop containers:

1. Change directory to grs-docker-compose


$ cd /home/gradmin/grs-docker-compose/

2. Start the container


$ sudo docker-compose up -d

Stop the container


$ sudo docker-compose down

You might also like