Adjustments, apt key and repo line fixes. Added OpenSearch service parameters.
This commit is contained in:
parent
c7500358a0
commit
e1858b60a8
@ -14,9 +14,8 @@ echo "Installing dependencies..."
|
|||||||
# Install prerequisites for Graylog, OpenSearch, and MongoDB
|
# Install prerequisites for Graylog, OpenSearch, and MongoDB
|
||||||
apt install -y apt-transport-https openjdk-11-jre-headless uuid-runtime pwgen wget gnupg
|
apt install -y apt-transport-https openjdk-11-jre-headless uuid-runtime pwgen wget gnupg
|
||||||
|
|
||||||
# Function to check if the system meets the minimum requirements for Graylog
|
|
||||||
check_system_requirements() {
|
check_system_requirements() {
|
||||||
echo "Checking system requirements for Graylog..."
|
echo "Checking the minimum system requirements for Graylog..."1
|
||||||
|
|
||||||
# Minimum required RAM (in MB)
|
# Minimum required RAM (in MB)
|
||||||
minimum_ram=4096
|
minimum_ram=4096
|
||||||
@ -60,8 +59,8 @@ echo "vm.max_map_count=262144" >> /etc/sysctl.conf
|
|||||||
|
|
||||||
# Add the OpenSearch repository and its GPG key
|
# Add the OpenSearch repository and its GPG key
|
||||||
echo "Adding OpenSearch repository..."
|
echo "Adding OpenSearch repository..."
|
||||||
wget -qO - https://d3g5vo6xdbdb9a.cloudfront.net/GPG-KEY-opensearch | apt-key add -
|
curl -o- https://artifacts.opensearch.org/publickeys/opensearch.pgp | gpg --dearmor --batch --yes -o /usr/share/keyrings/opensearch-keyring
|
||||||
echo "deb https://d3g5vo6xdbdb9a.cloudfront.net/debian stable main" | tee /etc/apt/sources.list.d/opensearch.list
|
echo "deb [signed-by=/usr/share/keyrings/opensearch-keyring] https://artifacts.opensearch.org/releases/bundle/opensearch/2.x/apt stable main" | tee /etc/apt/sources.list.d/opensearch-2.x.list
|
||||||
|
|
||||||
# Add the MongoDB repository
|
# Add the MongoDB repository
|
||||||
echo "Adding MongoDB repository..."
|
echo "Adding MongoDB repository..."
|
||||||
@ -101,6 +100,11 @@ chown -R opensearch:opensearch /var/log/opensearch
|
|||||||
chmod -R 2750 /graylog/opensearch/
|
chmod -R 2750 /graylog/opensearch/
|
||||||
chmod -R 2750 /var/log/opensearch/
|
chmod -R 2750 /var/log/opensearch/
|
||||||
|
|
||||||
|
# Add OpenSearch service and set it to start automatically
|
||||||
|
echo "Adding OpenSearch service and enabling autostart..."
|
||||||
|
systemctl enable opensearch
|
||||||
|
systemctl start opensearch
|
||||||
|
|
||||||
#Install MongoDB
|
#Install MongoDB
|
||||||
echo "Installing MongoDB"
|
echo "Installing MongoDB"
|
||||||
sudo apt install -y MongoDB
|
sudo apt install -y MongoDB
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
# Requirements:
|
||||||
|
|
||||||
|
This script makes no additional requirments other than the following. The script will automatically install all dependencies and make the additional required system modifications.
|
||||||
|
|
||||||
|
# Installation:
|
||||||
|
|
||||||
To run this script:
|
To run this script:
|
||||||
|
|
||||||
1. Use wget to grab the latest version:
|
1. Use wget to grab the latest version:
|
||||||
@ -6,10 +12,40 @@ To run this script:
|
|||||||
|
|
||||||
2. CHMOD the script to make it executable:
|
2. CHMOD the script to make it executable:
|
||||||
|
|
||||||
`chmod +x install.sh`
|
`sudo chmod +x install.sh`
|
||||||
|
|
||||||
3. Run the script:
|
3. Run the script:
|
||||||
|
|
||||||
`./install.sh`
|
`sudo ./install.sh`
|
||||||
|
|
||||||
|
# Script Process:
|
||||||
|
|
||||||
|
This script makes the following checks (in order):
|
||||||
|
|
||||||
|
Checks the script is being run as root.
|
||||||
|
|
||||||
|
Installs required dependencies.
|
||||||
|
|
||||||
|
Checks the system meets the minimum system requirements.
|
||||||
|
|
||||||
|
Disables Huge Pages Support if Enabled (OpenSearch).
|
||||||
|
|
||||||
|
Sets Maximum File Count (OpenSearch).
|
||||||
|
|
||||||
|
Adds all required respitory keys & Updates the package index.
|
||||||
|
|
||||||
|
Adds the OpenSearch user.
|
||||||
|
|
||||||
|
Installs OpenSearch.
|
||||||
|
|
||||||
|
Creates required OpenSearch directories & log file. Ensures their permissions.
|
||||||
|
|
||||||
|
Installs MongoDB.
|
||||||
|
|
||||||
|
Installs Graylog
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ if [[ $PYTHON_CONFIRM != "y" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Check other system requirements
|
# Check other system requirements
|
||||||
echo "Checking other system requirements..."
|
echo "Checking the system meets the minimum requirements..."
|
||||||
RAM=$(free -m | awk '/Mem/ {print $2}')
|
RAM=$(free -m | awk '/Mem/ {print $2}')
|
||||||
CPU=$(grep -c ^processor /proc/cpuinfo)
|
CPU=$(grep -c ^processor /proc/cpuinfo)
|
||||||
DISK=$(df -h / | awk 'NR==2 {print $4}')
|
DISK=$(df -h / | awk 'NR==2 {print $4}')
|
||||||
@ -55,7 +55,7 @@ if [ "$DISK_UNIT" == "G" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Error: Unsupported disk space unit. Please ensure disk space is in GB."
|
echo "Error: Unsupported disk space unit. Please ensure disk space is at least 10GB."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -137,6 +137,22 @@ fi
|
|||||||
echo "Collecting static files..."
|
echo "Collecting static files..."
|
||||||
sudo -u netbox /opt/netbox/manage.py collectstatic --no-input
|
sudo -u netbox /opt/netbox/manage.py collectstatic --no-input
|
||||||
|
|
||||||
|
# Enable plugin support
|
||||||
|
echo "Enabling plugin support..."
|
||||||
|
echo "PLUGINS = []" >> /opt/netbox/netbox/configuration.py
|
||||||
|
|
||||||
|
# Prompt user to enter plugin names
|
||||||
|
read -p "Enter names of plugins to add (separated by commas, leave empty to skip): " PLUGIN_NAMES
|
||||||
|
|
||||||
|
# Add plugins to configuration file
|
||||||
|
if [ -n "$PLUGIN_NAMES" ]; then
|
||||||
|
IFS=',' read -ra PLUGINS <<< "$PLUGIN_NAMES"
|
||||||
|
for PLUGIN in "${PLUGINS[@]}"; do
|
||||||
|
echo "Adding plugin: $PLUGIN"
|
||||||
|
echo " '$PLUGIN'," >> /opt/netbox/netbox/configuration.py
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# Set file and directory permissions
|
# Set file and directory permissions
|
||||||
echo "Setting file permissions..."
|
echo "Setting file permissions..."
|
||||||
chown -R netbox:netbox /opt/netbox/netbox/media
|
chown -R netbox:netbox /opt/netbox/netbox/media
|
||||||
|
Loading…
Reference in New Issue
Block a user