diff --git a/install/librenms-install.sh b/install/librenms-install.sh index 000af3b..74db4c1 100644 --- a/install/librenms-install.sh +++ b/install/librenms-install.sh @@ -21,8 +21,6 @@ $STD apt-get install -y \ fping \ graphviz \ imagemagick \ - mariadb-client \ - mariadb-server \ mtr-tiny \ nginx \ nmap \ @@ -34,16 +32,14 @@ $STD apt-get install -y \ msg_ok "Installed Dependencies" install_php +install_mariadb +install_composer msg_info "Installing Python" $STD apt-get install -y \ python3-{dotenv,pymysql,redis,setuptools,systemd,pip} msg_ok "Installed Python" -msg_info "Add User" -$STD useradd librenms -d /opt/librenms -M -r -s "$(which bash)" -msg_ok "Add User" - msg_info "Configuring Database" DB_NAME=librenms DB_USER=librenms @@ -60,6 +56,7 @@ $STD mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUS msg_ok "Configured Database" msg_info "Setup Librenms" +$STD useradd librenms -d /opt/librenms -M -r -s "$(which bash)" tmp_file=$(mktemp) RELEASE=$(curl -fsSL https://api.github.com/repos/librenms/librenms/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') curl -fsSL https://github.com/librenms/librenms/archive/refs/tags/${RELEASE}.tar.gz -o $tmp_file @@ -76,25 +73,18 @@ sed -i "s/^#DB_DATABASE=.*/DB_DATABASE=${DB_NAME}/" /opt/librenms/.env sed -i "s/^#DB_USERNAME=.*/DB_USERNAME=${DB_USER}/" /opt/librenms/.env sed -i "s/^#DB_PASSWORD=.*/DB_PASSWORD=${DB_PASS}/" /opt/librenms/.env -msg_ok "Setup Librenms" -msg_info "Setup Composer" -cd /opt -curl -fsSL https://getcomposer.org/composer-stable.phar -o /usr/bin/composer -chmod +x /usr/bin/composer -cd /opt/librenms -$STD composer install --no-dev -o --no-interaction chown -R librenms:librenms /opt/librenms chmod 771 /opt/librenms setfacl -d -m g::rwx /opt/librenms/bootstrap/cache /opt/librenms/storage /opt/librenms/logs /opt/librenms/rrd chmod -R ug=rwX /opt/librenms/bootstrap/cache /opt/librenms/storage /opt/librenms/logs /opt/librenms/rrd -msg_ok "Setup Composer" +msg_ok "Setup LibreNMS" -msg_info "Setup MariaDB" +msg_info "Configure MariaDB" sed -i "/\[mysqld\]/a innodb_file_per_table=1\nlower_case_table_names=0" /etc/mysql/mariadb.conf.d/50-server.cnf systemctl enable -q --now mariadb -msg_ok "Setup MariaDB" +msg_ok "Configured MariaDB" msg_info "Configure PHP-FPM" cp /etc/php/8.2/fpm/pool.d/www.conf /etc/php/8.2/fpm/pool.d/librenms.conf