Minor fixes for netbox install script, addition of docker and portainer install script
This commit is contained in:
parent
ec354fb93e
commit
ee82719851
42
docker-with-portainer/install.sh
Normal file
42
docker-with-portainer/install.sh
Normal file
@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Update and upgrade the system
|
||||
sudo apt update
|
||||
sudo apt upgrade -y
|
||||
|
||||
# Add a new user to run Docker
|
||||
echo "Adding a new user to run Docker (username 'docker' is recommended)..."
|
||||
read -p "Enter username for the new Docker user: " USERNAME
|
||||
sudo useradd -m -s /bin/bash $USERNAME
|
||||
sudo usermod -aG docker $USERNAME
|
||||
echo "New user $USERNAME added to the docker group."
|
||||
|
||||
# Install required dependencies
|
||||
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
|
||||
|
||||
# Add Docker's official GPG key
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
|
||||
|
||||
# Add Docker repository
|
||||
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
|
||||
|
||||
# Update package index again after adding Docker repository
|
||||
sudo apt update
|
||||
|
||||
# Install Docker
|
||||
sudo apt install -y docker-ce
|
||||
|
||||
# Install Docker Compose
|
||||
sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
||||
sudo chmod +x /usr/local/bin/docker-compose
|
||||
|
||||
# Install Portainer
|
||||
sudo docker volume create portainer_data
|
||||
sudo docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data --restart always --name=portainer portainer/portainer-ce
|
||||
|
||||
# Check if Portainer container is running
|
||||
if sudo docker ps | grep -q portainer; then
|
||||
echo "Portainer container is running successfully."
|
||||
else
|
||||
echo "Failed to start Portainer container."
|
||||
fi
|
0
docker-with-portainer/readme.md
Normal file
0
docker-with-portainer/readme.md
Normal file
@ -75,8 +75,8 @@ echo "Parsing the entered information to configuration.py..."
|
||||
sed -i "s/ALLOWED_HOSTS = \[\]/ALLOWED_HOSTS = \[$ALLOWED_HOSTS\]/g" configuration.py
|
||||
sed -i "s/SECRET_KEY = ''/SECRET_KEY = '$SECRET_KEY'/g" configuration.py
|
||||
|
||||
# Perform initial database migration
|
||||
echo "Performing initial database migration..."
|
||||
# Perform initial Netbox database migration
|
||||
echo "Performing initial Netbox database migration..."
|
||||
sudo -u netbox /opt/netbox/upgrade.sh
|
||||
|
||||
# Create directory for Netbox reports
|
||||
|
Loading…
Reference in New Issue
Block a user