ubuntu-nautobot/setup_nautobot.sh
2025-11-14 23:39:07 +00:00

30 lines
961 B
Bash

#!/bin/sh
# Setup basic programs
sh /setup_programs.sh
# Setup environment
apt install -y python3 python3.10-venv python3-pip
# Create user
useradd --system --shell /bin/bash --create-home --home-dir /opt/nautobot nautobot
chown nautobot /opt/nautobot
# Create the Virtual Environment
su -c "python3 -m venv /opt/nautobot/" nautobot
# Add NAUTOBOT_ROOT to the nautobot user .bashrc file
echo "export NAUTOBOT_ROOT=/opt/nautobot" | tee -a ~nautobot/.bashrc
# Update Python Pip and Wheel
su -c "pip3 install --upgrade pip wheel" nautobot
# Pip install Nautobot
su -c "pip3 install --no-binary=pyuwsgi nautobot" nautobot
# Verify
su -c "/opt/nautobot/.local/bin/nautobot-server --version" nautobot
# Setup Config
wget https://git.dfosd.synology.me/docker/ubuntu-nautobot/raw/branch/main/nautobot_config.py -O /opt/nautobot/.nautobot/nautobot_config.py
sed -i "s/SECRET_KEY_VALUE/$(sed 's/-//g' <<< $(uuidgen))/g" /opt/nautobot/.nautobot/nautobot_config.py