From 3a72e98a562e32553a7ac4aa89be25a53e65a06a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesus=20Hernando=20Paz=20Bola=C3=B1os?= Date: Tue, 26 Dec 2023 15:44:54 -0500 Subject: [PATCH 1/5] add new scripts in rpm and docs --- .../distribution-support-request.md | 17 ----- .github/workflows/CI.yaml | 4 +- scripts/{ => deb}/nsolid_setup_deb.sh | 0 scripts/rpm/script_generator/README.md | 40 ++++++++++ scripts/rpm/script_generator/base_script.sh | 75 +++++++++++++++++++ scripts/rpm/script_generator/generator.sh | 39 ++++++++++ scripts/rpm/setup_18.x | 75 +++++++++++++++++++ scripts/rpm/setup_20.x | 75 +++++++++++++++++++ scripts/rpm/setup_21.x | 75 +++++++++++++++++++ scripts/rpm/setup_current.x | 75 +++++++++++++++++++ scripts/rpm/setup_lts.x | 75 +++++++++++++++++++ 11 files changed, 531 insertions(+), 19 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/distribution-support-request.md rename scripts/{ => deb}/nsolid_setup_deb.sh (100%) create mode 100644 scripts/rpm/script_generator/README.md create mode 100644 scripts/rpm/script_generator/base_script.sh create mode 100644 scripts/rpm/script_generator/generator.sh create mode 100644 scripts/rpm/setup_18.x create mode 100644 scripts/rpm/setup_20.x create mode 100644 scripts/rpm/setup_21.x create mode 100644 scripts/rpm/setup_current.x create mode 100644 scripts/rpm/setup_lts.x diff --git a/.github/ISSUE_TEMPLATE/distribution-support-request.md b/.github/ISSUE_TEMPLATE/distribution-support-request.md deleted file mode 100644 index a4f79df4..00000000 --- a/.github/ISSUE_TEMPLATE/distribution-support-request.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -name: Distribution Support Request -about: Suggest a distribution to be supported -title: "[DISTRIBUTION] Support for distribution XX" -labels: distribution support -assignees: '' - ---- - -**Describe the distribution information:** - - OS: [e.g. Lubuntu XX] - - Distribution Type: RPM/DEB - - Version [e.g. 20.04] - - Other info if needed - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 13178318..774e7275 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -1,4 +1,4 @@ -name: 'Test Installation Scripts' +name: "Test Installation Scripts" on: push: @@ -81,4 +81,4 @@ jobs: if [[ ${NODE_VERSION} != "v${{ matrix.version }}" ]]; then echo "Node version is not ${{ matrix.version }}. It is $NODE_VERSION" exit 1 - fi \ No newline at end of file + fi diff --git a/scripts/nsolid_setup_deb.sh b/scripts/deb/nsolid_setup_deb.sh similarity index 100% rename from scripts/nsolid_setup_deb.sh rename to scripts/deb/nsolid_setup_deb.sh diff --git a/scripts/rpm/script_generator/README.md b/scripts/rpm/script_generator/README.md new file mode 100644 index 00000000..1656b6ed --- /dev/null +++ b/scripts/rpm/script_generator/README.md @@ -0,0 +1,40 @@ +# Node.js Version Setup Scripts + +This repository contains scripts for setting up different versions of Node.js on RPM-based Linux systems. + +## Modifying the Scripts + +Each script in this repository sets up a specific version of Node.js. The version is specified in the line `NODE_VERSION="XX.x"` in each script. To modify the version, simply replace `"XX.x"` with the desired version, e.g., `"18.x"`. + +For example, to modify the `setup_18.x` script to install Node.js version 20.x instead, you would change the line to `NODE_VERSION="20.x"`. + +## Running the Scripts + +To run a script, navigate to the directory containing the script and run the following command: + +```bash +sudo bash setup_XX.x +``` + +Replace `XX.x` with the version number of the script you want to run. For example, to run the `setup_18.x` script, you would use the command `sudo bash setup_18.x`. + +## How It Works + +Each script in this repository performs the following steps: + +1. Checks if the system is an RPM-based Linux distribution. +2. Configures the NodeSource Node.js RPM repository for the specified version of Node.js. +3. Checks if `dnf` or `yum` is available and updates the system using the available package manager. +4. Logs a message indicating that the repository is configured and updated, and instructs the user to run `dnf install nodejs -y` or `yum install nodejs -y` to complete the installation. + +The `setup_current` and `setup_latest` scripts are special scripts that install the current and latest versions of Node.js, respectively. The current version is 20.x and the latest version is 21.x. + +## Updating the Scripts + +If you make a change to the base script, you can regenerate all the version-specific scripts by running the generator script: + +```bash +bash generator.sh +``` + +This script iterates over a list of versions (currently 18.x, 20.x, and 21.x), and creates a new script for each version with the updated base script. It also creates setup_current and setup_latest scripts for the current and latest versions of Node.js, respectively. diff --git a/scripts/rpm/script_generator/base_script.sh b/scripts/rpm/script_generator/base_script.sh new file mode 100644 index 00000000..2ae2e372 --- /dev/null +++ b/scripts/rpm/script_generator/base_script.sh @@ -0,0 +1,75 @@ +#!/bin/bash + +# Logger Function +log() { + local message="$1" + local type="$2" + local timestamp=$(date '+%Y-%m-%d %H:%M:%S') + local color + local endcolor="\033[0m" + + case "$type" in + "info") color="\033[38;5;79m" ;; + "success") color="\033[1;32m" ;; + "error") color="\033[1;31m" ;; + *) color="\033[1;34m" ;; + esac + + echo -e "${color}${timestamp} - ${message}${endcolor}" +} + +# Error handler function +handle_error() { + local exit_code=$1 + local error_message="$2" + log "Error: $error_message (Exit Code: $exit_code)" "error" + exit $exit_code +} + +# Function to check for command availability +command_exists() { + command -v "$1" &> /dev/null +} + +# Check if we are on an RPM-based system +if ! [ -f /etc/redhat-release ] && ! grep -q "Amazon Linux" /etc/system-release 2>/dev/null; then + handle_error 1 "This script is intended for RPM-based systems. Please run it on an RPM-based system." +fi + +# Define Node.js version +NODE_VERSION="XX.x" + +# Get system architecture +SYS_ARCH=$(uname -m) + +# Validate system architecture +case "$SYS_ARCH" in + aarch64|x86_64) log "Supported architecture: $SYS_ARCH" "info" ;; + *) handle_error 1 "Unsupported architecture: $SYS_ARCH. Only aarch64 and x86_64 are supported." ;; +esac + +# Repository content +REPO_CONTENT="[nodesource-nodejs] +name=Node.js Packages for Linux RPM based distros - $SYS_ARCH +baseurl=https://rpm.nodesource.com/pub_${NODE_VERSION}/nodistro/nodejs/$SYS_ARCH +priority=9 +enabled=1 +gpgcheck=1 +gpgkey=https://rpm.nodesource.com/gpgkey/ns-operations-public.key +module_hotfixes=1" + +echo "$REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nodistro.repo > /dev/null + +# Check for availability of dnf or yum +if command_exists dnf; then + log "dnf available, updating..." "info" + dnf update -y + log "Repository is configured and updated. Run 'dnf install nodejs -y' to complete the installation." "info" + exit 0 +elif command_exists yum; then + log "yum available, updating..." "info" + yum update -y + log "Repository is configured and updated. Run 'yum install nodejs -y' to complete the installation." "info" +else + handle_error 1 "Neither yum nor dnf package manager was found. Please update your system using your package manager." +fi diff --git a/scripts/rpm/script_generator/generator.sh b/scripts/rpm/script_generator/generator.sh new file mode 100644 index 00000000..0379d860 --- /dev/null +++ b/scripts/rpm/script_generator/generator.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Function to create a script for a given Node.js version +create_script() { + local version=$1 + local script_name=$2 + local target_script="../setup_$script_name.x" + + echo "Creating script for Node.js version $version.x" + if sed "s/NODE_VERSION=\"XX.x\"/NODE_VERSION=\"$version.x\"/g" "$base_script" > "$target_script"; then + echo "Script created successfully: $target_script" + else + echo "Error: Failed to create script for version $version.x" + return 1 + fi +} + +# Check if the base script exists +base_script="./base_script.sh" +if [ ! -f "$base_script" ]; then + echo "Error: Base script not found at $base_script" + exit 1 +fi + +# List of versions +versions=("18" "20" "21") + +# Iterate over the versions and create scripts +for version in "${versions[@]}"; do + create_script "$version" "$version" +done + +# Define LTS and current Node.js versions +lts_version="20" +current_version="21" + +# Create setup_lts and setup_current scripts +create_script "$lts_version" "lts" +create_script "$current_version" "current" diff --git a/scripts/rpm/setup_18.x b/scripts/rpm/setup_18.x new file mode 100644 index 00000000..e5586d96 --- /dev/null +++ b/scripts/rpm/setup_18.x @@ -0,0 +1,75 @@ +#!/bin/bash + +# Logger Function +log() { + local message="$1" + local type="$2" + local timestamp=$(date '+%Y-%m-%d %H:%M:%S') + local color + local endcolor="\033[0m" + + case "$type" in + "info") color="\033[38;5;79m" ;; + "success") color="\033[1;32m" ;; + "error") color="\033[1;31m" ;; + *) color="\033[1;34m" ;; + esac + + echo -e "${color}${timestamp} - ${message}${endcolor}" +} + +# Error handler function +handle_error() { + local exit_code=$1 + local error_message="$2" + log "Error: $error_message (Exit Code: $exit_code)" "error" + exit $exit_code +} + +# Function to check for command availability +command_exists() { + command -v "$1" &> /dev/null +} + +# Check if we are on an RPM-based system +if ! [ -f /etc/redhat-release ] && ! grep -q "Amazon Linux" /etc/system-release 2>/dev/null; then + handle_error 1 "This script is intended for RPM-based systems. Please run it on an RPM-based system." +fi + +# Define Node.js version +NODE_VERSION="18.x" + +# Get system architecture +SYS_ARCH=$(uname -m) + +# Validate system architecture +case "$SYS_ARCH" in + aarch64|x86_64) log "Supported architecture: $SYS_ARCH" "info" ;; + *) handle_error 1 "Unsupported architecture: $SYS_ARCH. Only aarch64 and x86_64 are supported." ;; +esac + +# Repository content +REPO_CONTENT="[nodesource-nodejs] +name=Node.js Packages for Linux RPM based distros - $SYS_ARCH +baseurl=https://rpm.nodesource.com/pub_${NODE_VERSION}/nodistro/nodejs/$SYS_ARCH +priority=9 +enabled=1 +gpgcheck=1 +gpgkey=https://rpm.nodesource.com/gpgkey/ns-operations-public.key +module_hotfixes=1" + +echo "$REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nodistro.repo > /dev/null + +# Check for availability of dnf or yum +if command_exists dnf; then + log "dnf available, updating..." "info" + dnf update -y + log "Repository is configured and updated. Run 'dnf install nodejs -y' to complete the installation." "info" + exit 0 +elif command_exists yum; then + log "yum available, updating..." "info" + yum update -y + log "Repository is configured and updated. Run 'yum install nodejs -y' to complete the installation." "info" +else + handle_error 1 "Neither yum nor dnf package manager was found. Please update your system using your package manager." +fi diff --git a/scripts/rpm/setup_20.x b/scripts/rpm/setup_20.x new file mode 100644 index 00000000..fc000ce9 --- /dev/null +++ b/scripts/rpm/setup_20.x @@ -0,0 +1,75 @@ +#!/bin/bash + +# Logger Function +log() { + local message="$1" + local type="$2" + local timestamp=$(date '+%Y-%m-%d %H:%M:%S') + local color + local endcolor="\033[0m" + + case "$type" in + "info") color="\033[38;5;79m" ;; + "success") color="\033[1;32m" ;; + "error") color="\033[1;31m" ;; + *) color="\033[1;34m" ;; + esac + + echo -e "${color}${timestamp} - ${message}${endcolor}" +} + +# Error handler function +handle_error() { + local exit_code=$1 + local error_message="$2" + log "Error: $error_message (Exit Code: $exit_code)" "error" + exit $exit_code +} + +# Function to check for command availability +command_exists() { + command -v "$1" &> /dev/null +} + +# Check if we are on an RPM-based system +if ! [ -f /etc/redhat-release ] && ! grep -q "Amazon Linux" /etc/system-release 2>/dev/null; then + handle_error 1 "This script is intended for RPM-based systems. Please run it on an RPM-based system." +fi + +# Define Node.js version +NODE_VERSION="20.x" + +# Get system architecture +SYS_ARCH=$(uname -m) + +# Validate system architecture +case "$SYS_ARCH" in + aarch64|x86_64) log "Supported architecture: $SYS_ARCH" "info" ;; + *) handle_error 1 "Unsupported architecture: $SYS_ARCH. Only aarch64 and x86_64 are supported." ;; +esac + +# Repository content +REPO_CONTENT="[nodesource-nodejs] +name=Node.js Packages for Linux RPM based distros - $SYS_ARCH +baseurl=https://rpm.nodesource.com/pub_${NODE_VERSION}/nodistro/nodejs/$SYS_ARCH +priority=9 +enabled=1 +gpgcheck=1 +gpgkey=https://rpm.nodesource.com/gpgkey/ns-operations-public.key +module_hotfixes=1" + +echo "$REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nodistro.repo > /dev/null + +# Check for availability of dnf or yum +if command_exists dnf; then + log "dnf available, updating..." "info" + dnf update -y + log "Repository is configured and updated. Run 'dnf install nodejs -y' to complete the installation." "info" + exit 0 +elif command_exists yum; then + log "yum available, updating..." "info" + yum update -y + log "Repository is configured and updated. Run 'yum install nodejs -y' to complete the installation." "info" +else + handle_error 1 "Neither yum nor dnf package manager was found. Please update your system using your package manager." +fi diff --git a/scripts/rpm/setup_21.x b/scripts/rpm/setup_21.x new file mode 100644 index 00000000..0504285f --- /dev/null +++ b/scripts/rpm/setup_21.x @@ -0,0 +1,75 @@ +#!/bin/bash + +# Logger Function +log() { + local message="$1" + local type="$2" + local timestamp=$(date '+%Y-%m-%d %H:%M:%S') + local color + local endcolor="\033[0m" + + case "$type" in + "info") color="\033[38;5;79m" ;; + "success") color="\033[1;32m" ;; + "error") color="\033[1;31m" ;; + *) color="\033[1;34m" ;; + esac + + echo -e "${color}${timestamp} - ${message}${endcolor}" +} + +# Error handler function +handle_error() { + local exit_code=$1 + local error_message="$2" + log "Error: $error_message (Exit Code: $exit_code)" "error" + exit $exit_code +} + +# Function to check for command availability +command_exists() { + command -v "$1" &> /dev/null +} + +# Check if we are on an RPM-based system +if ! [ -f /etc/redhat-release ] && ! grep -q "Amazon Linux" /etc/system-release 2>/dev/null; then + handle_error 1 "This script is intended for RPM-based systems. Please run it on an RPM-based system." +fi + +# Define Node.js version +NODE_VERSION="21.x" + +# Get system architecture +SYS_ARCH=$(uname -m) + +# Validate system architecture +case "$SYS_ARCH" in + aarch64|x86_64) log "Supported architecture: $SYS_ARCH" "info" ;; + *) handle_error 1 "Unsupported architecture: $SYS_ARCH. Only aarch64 and x86_64 are supported." ;; +esac + +# Repository content +REPO_CONTENT="[nodesource-nodejs] +name=Node.js Packages for Linux RPM based distros - $SYS_ARCH +baseurl=https://rpm.nodesource.com/pub_${NODE_VERSION}/nodistro/nodejs/$SYS_ARCH +priority=9 +enabled=1 +gpgcheck=1 +gpgkey=https://rpm.nodesource.com/gpgkey/ns-operations-public.key +module_hotfixes=1" + +echo "$REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nodistro.repo > /dev/null + +# Check for availability of dnf or yum +if command_exists dnf; then + log "dnf available, updating..." "info" + dnf update -y + log "Repository is configured and updated. Run 'dnf install nodejs -y' to complete the installation." "info" + exit 0 +elif command_exists yum; then + log "yum available, updating..." "info" + yum update -y + log "Repository is configured and updated. Run 'yum install nodejs -y' to complete the installation." "info" +else + handle_error 1 "Neither yum nor dnf package manager was found. Please update your system using your package manager." +fi diff --git a/scripts/rpm/setup_current.x b/scripts/rpm/setup_current.x new file mode 100644 index 00000000..0504285f --- /dev/null +++ b/scripts/rpm/setup_current.x @@ -0,0 +1,75 @@ +#!/bin/bash + +# Logger Function +log() { + local message="$1" + local type="$2" + local timestamp=$(date '+%Y-%m-%d %H:%M:%S') + local color + local endcolor="\033[0m" + + case "$type" in + "info") color="\033[38;5;79m" ;; + "success") color="\033[1;32m" ;; + "error") color="\033[1;31m" ;; + *) color="\033[1;34m" ;; + esac + + echo -e "${color}${timestamp} - ${message}${endcolor}" +} + +# Error handler function +handle_error() { + local exit_code=$1 + local error_message="$2" + log "Error: $error_message (Exit Code: $exit_code)" "error" + exit $exit_code +} + +# Function to check for command availability +command_exists() { + command -v "$1" &> /dev/null +} + +# Check if we are on an RPM-based system +if ! [ -f /etc/redhat-release ] && ! grep -q "Amazon Linux" /etc/system-release 2>/dev/null; then + handle_error 1 "This script is intended for RPM-based systems. Please run it on an RPM-based system." +fi + +# Define Node.js version +NODE_VERSION="21.x" + +# Get system architecture +SYS_ARCH=$(uname -m) + +# Validate system architecture +case "$SYS_ARCH" in + aarch64|x86_64) log "Supported architecture: $SYS_ARCH" "info" ;; + *) handle_error 1 "Unsupported architecture: $SYS_ARCH. Only aarch64 and x86_64 are supported." ;; +esac + +# Repository content +REPO_CONTENT="[nodesource-nodejs] +name=Node.js Packages for Linux RPM based distros - $SYS_ARCH +baseurl=https://rpm.nodesource.com/pub_${NODE_VERSION}/nodistro/nodejs/$SYS_ARCH +priority=9 +enabled=1 +gpgcheck=1 +gpgkey=https://rpm.nodesource.com/gpgkey/ns-operations-public.key +module_hotfixes=1" + +echo "$REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nodistro.repo > /dev/null + +# Check for availability of dnf or yum +if command_exists dnf; then + log "dnf available, updating..." "info" + dnf update -y + log "Repository is configured and updated. Run 'dnf install nodejs -y' to complete the installation." "info" + exit 0 +elif command_exists yum; then + log "yum available, updating..." "info" + yum update -y + log "Repository is configured and updated. Run 'yum install nodejs -y' to complete the installation." "info" +else + handle_error 1 "Neither yum nor dnf package manager was found. Please update your system using your package manager." +fi diff --git a/scripts/rpm/setup_lts.x b/scripts/rpm/setup_lts.x new file mode 100644 index 00000000..fc000ce9 --- /dev/null +++ b/scripts/rpm/setup_lts.x @@ -0,0 +1,75 @@ +#!/bin/bash + +# Logger Function +log() { + local message="$1" + local type="$2" + local timestamp=$(date '+%Y-%m-%d %H:%M:%S') + local color + local endcolor="\033[0m" + + case "$type" in + "info") color="\033[38;5;79m" ;; + "success") color="\033[1;32m" ;; + "error") color="\033[1;31m" ;; + *) color="\033[1;34m" ;; + esac + + echo -e "${color}${timestamp} - ${message}${endcolor}" +} + +# Error handler function +handle_error() { + local exit_code=$1 + local error_message="$2" + log "Error: $error_message (Exit Code: $exit_code)" "error" + exit $exit_code +} + +# Function to check for command availability +command_exists() { + command -v "$1" &> /dev/null +} + +# Check if we are on an RPM-based system +if ! [ -f /etc/redhat-release ] && ! grep -q "Amazon Linux" /etc/system-release 2>/dev/null; then + handle_error 1 "This script is intended for RPM-based systems. Please run it on an RPM-based system." +fi + +# Define Node.js version +NODE_VERSION="20.x" + +# Get system architecture +SYS_ARCH=$(uname -m) + +# Validate system architecture +case "$SYS_ARCH" in + aarch64|x86_64) log "Supported architecture: $SYS_ARCH" "info" ;; + *) handle_error 1 "Unsupported architecture: $SYS_ARCH. Only aarch64 and x86_64 are supported." ;; +esac + +# Repository content +REPO_CONTENT="[nodesource-nodejs] +name=Node.js Packages for Linux RPM based distros - $SYS_ARCH +baseurl=https://rpm.nodesource.com/pub_${NODE_VERSION}/nodistro/nodejs/$SYS_ARCH +priority=9 +enabled=1 +gpgcheck=1 +gpgkey=https://rpm.nodesource.com/gpgkey/ns-operations-public.key +module_hotfixes=1" + +echo "$REPO_CONTENT" | tee /etc/yum.repos.d/nodesource-nodistro.repo > /dev/null + +# Check for availability of dnf or yum +if command_exists dnf; then + log "dnf available, updating..." "info" + dnf update -y + log "Repository is configured and updated. Run 'dnf install nodejs -y' to complete the installation." "info" + exit 0 +elif command_exists yum; then + log "yum available, updating..." "info" + yum update -y + log "Repository is configured and updated. Run 'yum install nodejs -y' to complete the installation." "info" +else + handle_error 1 "Neither yum nor dnf package manager was found. Please update your system using your package manager." +fi From 08b2ac00626ec6bc12fe54e55c050d83015240aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesus=20Hernando=20Paz=20Bola=C3=B1os?= Date: Tue, 26 Dec 2023 18:32:19 -0500 Subject: [PATCH 2/5] add script per version --- .github/ISSUE_TEMPLATE/issue-bug-report.md | 11 +- .github/workflows/{CI.yaml => ci.yaml} | 6 +- README.md | 60 +++++------ scripts/deb/nsolid_setup_deb.sh | 109 -------------------- scripts/deb/script_generator/README.md | 49 +++++++++ scripts/deb/script_generator/base_script.sh | 102 ++++++++++++++++++ scripts/deb/script_generator/generator.sh | 39 +++++++ scripts/deb/setup_18.x | 102 ++++++++++++++++++ scripts/deb/setup_20.x | 102 ++++++++++++++++++ scripts/deb/setup_21.x | 102 ++++++++++++++++++ scripts/deb/setup_current.x | 102 ++++++++++++++++++ scripts/deb/setup_lts.x | 102 ++++++++++++++++++ scripts/rpm/script_generator/README.md | 10 ++ 13 files changed, 745 insertions(+), 151 deletions(-) rename .github/workflows/{CI.yaml => ci.yaml} (90%) delete mode 100755 scripts/deb/nsolid_setup_deb.sh create mode 100644 scripts/deb/script_generator/README.md create mode 100644 scripts/deb/script_generator/base_script.sh create mode 100644 scripts/deb/script_generator/generator.sh create mode 100644 scripts/deb/setup_18.x create mode 100644 scripts/deb/setup_20.x create mode 100644 scripts/deb/setup_21.x create mode 100644 scripts/deb/setup_current.x create mode 100644 scripts/deb/setup_lts.x diff --git a/.github/ISSUE_TEMPLATE/issue-bug-report.md b/.github/ISSUE_TEMPLATE/issue-bug-report.md index e26ec4e4..ddc454de 100644 --- a/.github/ISSUE_TEMPLATE/issue-bug-report.md +++ b/.github/ISSUE_TEMPLATE/issue-bug-report.md @@ -11,15 +11,18 @@ assignees: '' A clear and concise description of what the bug is. **Distribution Information:** - - OS: [e.g. Ubuntu] - - Version [e.g. focal (20.04)] - - Other info if applicable [e.g. Docker image XXX, AWS AMI ID] + +- OS: [e.g. Ubuntu] +- Version [e.g. focal (20.04)] +- Other info if applicable [e.g. Docker image XXX, AWS AMI ID] **Node Version:** - - Node: [e.g. Node.js v18.x:] + +- Node: [e.g. Node.js v18.x:] **To Reproduce** Steps to reproduce the behavior: + 1. Execute Ubuntu Docker Image XX 2. Execute Installation instructions for Node.js v1x.x: 3. .... diff --git a/.github/workflows/CI.yaml b/.github/workflows/ci.yaml similarity index 90% rename from .github/workflows/CI.yaml rename to .github/workflows/ci.yaml index 774e7275..41e9b530 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/ci.yaml @@ -31,7 +31,7 @@ jobs: uses: actions/checkout@v4 - name: Run Istallation Script - run: ./scripts/nsolid_setup_deb.sh ${{ matrix.version }} + run: ./scripts/deb/nsolid_setup_deb.sh ${{ matrix.version }} - name: Install Nodejs run: | @@ -68,11 +68,11 @@ jobs: uses: actions/checkout@v4 - name: Run Istallation Script - run: ./scripts/nsolid_setup_rpm.sh ${{ matrix.version }} + run: ./scripts/rpm/setup_${{ matrix.version }}.x - name: Install Nodejs run: | - yum install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1 + yum install nodejs -y - name: Validate Node Version run: | diff --git a/README.md b/README.md index 9e415013..c70b31bd 100644 --- a/README.md +++ b/README.md @@ -24,14 +24,14 @@ Looking for the previous Documentation [README.md](./OLD_README.md) ## Table of Contents -* **[Debian and Ubuntu based distributions](#debian-and-ubuntu-based-distributions)** (deb) +- **[Debian and Ubuntu based distributions](#debian-and-ubuntu-based-distributions)** (deb) - [Available architectures](#available-architectures) - [Supported Versions](#supported-versions) - [Ubuntu versions](#ubuntu-versions) - [Debian versions](#debian-versions) - [Installation instructions](#installation-instructions) - [Uninstall instructions](#uninstall-nodejs-ubuntu--debian-packages) -* **[Enterprise Linux based distributions](#enterprise-linux-based-distributions)** (rpm) +- **[Enterprise Linux based distributions](#enterprise-linux-based-distributions)** (rpm) - [Available architectures](#available-architectures-1) - [Supported Versions](#supported-versions-1) - [Fedora versions](#fedora-versions) @@ -39,10 +39,10 @@ Looking for the previous Documentation [README.md](./OLD_README.md) - [Amazon Linux versions](#amazon-linux-versions) - [Installation instructions](#installation-instructions-1) - [Uninstall instructions](#uninstall-nodejs-enterprise-linux-packages) -* **[Nodejs Release Calendar](#nodejs-release-calendar)** -* [FAQ](#faq) -* [Authors and Contributors](#authors-and-contributors) -* [License](#license) +- **[Nodejs Release Calendar](#nodejs-release-calendar)** +- [FAQ](#faq) +- [Authors and Contributors](#authors-and-contributors) +- [License](#license) ## Debian and Ubuntu based distributions @@ -50,9 +50,9 @@ Looking for the previous Documentation [README.md](./OLD_README.md) NodeSource will continue to maintain the following architectures and may add additional ones in the future. -* **amd64** (64-bit) -* **armhf** (ARM 32-bit hard-float, ARMv7 and up: _arm-linux-gnueabihf_) -* **arm64** (ARM 64-bit, ARMv8 and up: _aarch64-linux-gnu_) +- **amd64** (64-bit) +- **armhf** (ARM 32-bit hard-float, ARMv7 and up: _arm-linux-gnueabihf_) +- **arm64** (ARM 64-bit, ARMv8 and up: _aarch64-linux-gnu_) ### **Supported Versions** @@ -85,8 +85,8 @@ NodeSource will continue to maintain the following architectures and may add add 1. Download and import the Nodesource GPG key ```sh -sudo apt-get update -sudo apt-get install -y ca-certificates curl gnupg +sudo apt-get update && sudo apt-get install curl -y + sudo mkdir -p /etc/apt/keyrings curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg ``` @@ -98,7 +98,7 @@ NODE_MAJOR=20 echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list ``` -> ***Optional***: ``NODE_MAJOR`` can be changed depending on the version you need. +> _**Optional**_: ``NODE_MAJOR`` can be changed depending on the version you need. > > ```sh > NODE_MAJOR=16 @@ -132,8 +132,8 @@ rm -r /etc/apt/keyrings/nodesource.gpg NodeSource will continue to maintain the following architectures and may add additional ones in the future. -* **x86_64** (64-bit) -* **arm64** (ARM 64-bit, ARMv8 and up: _aarch64-linux-gnu_) +- **x86_64** (64-bit) +- **arm64** (ARM 64-bit, ARMv8 and up: _aarch64-linux-gnu_) ### **Supported Versions** @@ -164,7 +164,7 @@ NodeSource will continue to maintain the following architectures and may add add ### Installation Instructions -The Nodesource RPM package signing key is available here: https://rpm.nodesource.com/gpgkey/nodesource.gpg.key +The Nodesource RPM package signing key is available here: > _If you have root access, you can omit the 'sudo' command as you already have full administrative privileges._ @@ -172,31 +172,23 @@ The Nodesource RPM package signing key is available here: https://rpm.nodesource ```sh sudo yum install https://rpm.nodesource.com/pub_21.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm -y -sudo yum install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1 +sudo yum install nodejs -y ``` #### **Node.js v20.x** ```sh sudo yum install https://rpm.nodesource.com/pub_20.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm -y -sudo yum install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1 +sudo yum install nodejs -y ``` #### **Node.js v18.x** ```sh sudo yum install https://rpm.nodesource.com/pub_18.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm -y -sudo yum install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1 +sudo yum install nodejs -y ``` -#### **Node.js v16.x** - -```sh -sudo yum install https://rpm.nodesource.com/pub_16.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm -y -sudo yum install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1 -``` - - ***Optional***: install build tools To compile and install native addons from npm you may also need to install build tools: @@ -225,7 +217,7 @@ We've created some scripts to make easy the repo configuration. #### DEB -> change the version as needed `./nsolid_setup_deb.sh 20` +> change the version as needed `./nsolid_setup_deb.sh 20` ```SHELL curl -SLO https://deb.nodesource.com/nsolid_setup_deb.sh @@ -234,10 +226,9 @@ chmod 500 nsolid_setup_deb.sh apt-get install nodejs -y ``` - #### RPM -> change the version as needed `./nsolid_setup_deb.sh 20` +> change the version as needed `./nsolid_setup_deb.sh 20` ```SHELL curl -SLO https://rpm.nodesource.com/nsolid_setup_rpm.sh @@ -249,7 +240,7 @@ yum install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1 ## Nodejs Release Calendar [![Node Releases Calendar](https://raw.githubusercontent.com/nodejs/Release/main/schedule.svg?sanitize=true)](https://nodejs.dev/en/about/releases) -_source: https://nodejs.dev_ +_source: _ # FAQ @@ -268,16 +259,16 @@ A: Please take a look at [wiki](https://github.com/nodesource/distributions/wiki --- Q: Why is there no folder listing available when I visit the following URLs? - https://deb.nodesource.com/node_XX.x/pool/main/n/ + - https://rpm.nodesource.com/pub_20.x/ + A: This issue may arise because some users utilize the above URLs to download specific versions of Node.js or create mirrors of our repository. For more information and possible solutions, please refer to the following resources: - * [Github issue](https://github.com/nodesource/distributions/issues/1633) - * [Creating a Repository Mirror](https://github.com/nodesource/distributions/wiki/Creating-a-Repository-Mirror:-A-Step%E2%80%90by%E2%80%90Step-Guide) +- [Github issue](https://github.com/nodesource/distributions/issues/1633) +- [Creating a Repository Mirror](https://github.com/nodesource/distributions/wiki/Creating-a-Repository-Mirror:-A-Step%E2%80%90by%E2%80%90Step-Guide) --- @@ -331,4 +322,3 @@ This material is Copyright (c) NodeSource and licensed under the MIT license. Al *Amazon Linux are trademarks of Amazon Web Services, Inc* *CloudLinux is a trademark of Cloud Linux, Inc* - diff --git a/scripts/deb/nsolid_setup_deb.sh b/scripts/deb/nsolid_setup_deb.sh deleted file mode 100755 index 6db3fa08..00000000 --- a/scripts/deb/nsolid_setup_deb.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/sh -set -e - -NSOLID_VERSION=$1 - -################################ -## Logger Function ## -################################ -logger() { - local message="$1" - local type="$2" - local length=${#message} - local line=$(printf "%-${length}s" | tr ' ' '-') - echo "" - case "$type" in - "info") - echo "\033[38;5;79m$line\033[0m" - echo "\033[38;5;79m$message\033[0m" - echo "\033[38;5;79m$line\033[0m" - ;; - "success") - echo "\033[1;32m$line\033[0m" - echo "\033[1;32m$message\033[0m" - echo "\033[1;32m$line\033[0m" - ;; - "error") - echo "\033[1;31m$line\033[0m" - echo "\033[1;31m$message\033[0m" - echo "\033[1;31m$line\033[0m" - ;; - *) - echo "\033[1;34m$line\033[0m" - echo "\033[1;34m$message\033[0m" - echo "\033[1;34m$line\033[0m" - ;; - esac - echo "" -} - - -################################ -## Error handler function ## -################################ -handleError() { - local exit_code=$1 - local error_message="$2" - logger "Error: $error_message (Exit Code: $exit_code)" "error" - exit $exit_code -} - -################################ -##Function to validate version## -################################ -getVersion() { - local NSOLID_VERSION=$1 - regex='^[0-9][0-9]$' - if ! expr "$NSOLID_VERSION" : "$regex" > /dev/null; then - return 1 - fi - logger "Info: Configuring repository for N|solid $NSOLID_VERSION" "info" -} - -################################################# -##Function to Install the script pre-requisites## -################################################# -installPreReqs() { - logger "Info: Installing pre-requisites" "info" - - # Run 'apt-get update' - if ! apt-get update -y; then - handleError "$?" "Failed to run 'apt-get update'" - fi - - # Run 'apt-get install' - if ! apt-get install -y ca-certificates curl gnupg; then - handleError "$?" "Failed to install packages" - fi - - mkdir -p /usr/share/keyrings - - # Run 'curl' and 'gpg' - if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg; then - handleError "$?" "Failed to download and import the NodeSource signing key" - fi -} - -################################## -##Function to configure the Repo## -################################## -configureRepo() { - local NSOLID_VERSION=$1 - echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NSOLID_VERSION.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list - # N|solid Config - echo "Package: nsolid" > /etc/apt/preferences.d/nsolid - echo "Pin: origin deb.nodesource.com" >> /etc/apt/preferences.d/nsolid - echo "Pin-Priority: 600" >> /etc/apt/preferences.d/nsolid - # Nodejs Config - echo "Package: nodejs" > /etc/apt/preferences.d/nodejs - echo "Pin: origin deb.nodesource.com" >> /etc/apt/preferences.d/nodejs - echo "Pin-Priority: 600" >> /etc/apt/preferences.d/nodejs - # Run 'apt-get update' - if ! apt-get update -y; then - handleError "$?" "Failed to run 'apt-get update'" - fi -} - -getVersion $NSOLID_VERSION || handleError $? "Must define a valid N|solid version" -installPreReqs || handleError $? "Failed installing pre-requisites" -configureRepo $NSOLID_VERSION || handleError $? "Failed configuring repository" \ No newline at end of file diff --git a/scripts/deb/script_generator/README.md b/scripts/deb/script_generator/README.md new file mode 100644 index 00000000..676566fe --- /dev/null +++ b/scripts/deb/script_generator/README.md @@ -0,0 +1,49 @@ +# Node.js Version Setup Scripts + +This repository contains scripts for setting up different versions of Node.js on Debian based Linux systems. + +## Modifying the Scripts + +Each script in this repository sets up a specific version of Node.js. The version is specified in the line `NODE_VERSION="XX.x"` in each script. To modify the version, simply replace `"XX.x"` with the desired version, e.g., `"18.x"`. + +For example, to modify the `setup_18.x` script to install Node.js version 20.x instead, you would change the line to `NODE_VERSION="20.x"`. + +## Running the Scripts + +To run a script, navigate to the directory containing the script and run the following command: + +```bash +sudo bash setup_XX.x +``` + +Replace `XX.x` with the version number of the script you want to run. For example, to run the `setup_18.x` script, you would use the command `sudo bash setup_18.x`. + +## How It Works + +Each script in this repository performs the following steps: + +1. Checks if the system is an Debian based Linux distribution. +2. Configures the NodeSource Node.js DEB repository for the specified version of Node.js. +3. Logs a message indicating that the repository is configured and updated, and instructs the user to run `apt-get install nodejs -y` to complete the installation. + +The `setup_current` and `setup_latest` scripts are special scripts that install the current and latest versions of Node.js, respectively. The current version is 20.x and the latest version is 21.x. + +## Updating the Scripts + +If you make a change to the base script, you can regenerate all the version-specific scripts by running the generator script: + +```bash +bash generator.sh +``` + +This script iterates over a list of versions (currently 18.x, 20.x, and 21.x), and creates a new script for each version with the updated base script. It also creates setup_current and setup_latest scripts for the current and latest versions of Node.js, respectively. + +## Deploying the Scripts + +After generating the scripts, you can deploy them to an S3 bucket using the AWS CLI. Here is the command to do so: + +```bash +aws s3 sync scripts/deb/ s3://deb.nodesource.com/ --exclude "*/**" +``` + +This command syncs all the files in the scripts/deb/ directory (but not its subdirectories) with the s3://deb.nodesource.com/ bucket. Make sure to replace s3://deb.nodesource.com/ with the path to your own S3 bucket. diff --git a/scripts/deb/script_generator/base_script.sh b/scripts/deb/script_generator/base_script.sh new file mode 100644 index 00000000..307a6529 --- /dev/null +++ b/scripts/deb/script_generator/base_script.sh @@ -0,0 +1,102 @@ +#!/bin/bash + +# Logger Function +log() { + local message="$1" + local type="$2" + local timestamp=$(date '+%Y-%m-%d %H:%M:%S') + local color + local endcolor="\033[0m" + + case "$type" in + "info") color="\033[38;5;79m" ;; + "success") color="\033[1;32m" ;; + "error") color="\033[1;31m" ;; + *) color="\033[1;34m" ;; + esac + + echo -e "${color}${timestamp} - ${message}${endcolor}" +} + +# Error handler function +handle_error() { + local exit_code=$1 + local error_message="$2" + log "Error: $error_message (Exit Code: $exit_code)" "error" + exit $exit_code +} + +# Function to check for command availability +command_exists() { + command -v "$1" &> /dev/null +} + +check_os() { + if ! [ -f "/etc/debian_version" ]; then + echo "Error: This script is only supported on Debian-based systems." + exit 1 + fi +} + +# Function to Install the script pre-requisites +install_pre_reqs() { + log "Installing pre-requisites" "info" + + # Run 'apt-get update' + if ! apt-get update -y; then + handle_error "$?" "Failed to run 'apt-get update'" + fi + + # Run 'apt-get install' + if ! apt-get install -y ca-certificates curl gnupg; then + handle_error "$?" "Failed to install packages" + fi + + mkdir -p /usr/share/keyrings + rm -f /usr/share/keyrings/nodesource.gpg + rm -f /etc/apt/sources.list.d/nodesource.list + + # Run 'curl' and 'gpg' + if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg; then + handle_error "$?" "Failed to download and import the NodeSource signing key" + fi +} + +# Function to configure the Repo +configure_repo() { + local node_version=$1 + + arch=$(dpkg --print-architecture) + if [ "$arch" != "amd64" ] && [ "$arch" != "arm64" ] && [ "$arch" != "armhf" ]; then + handle_error "1" "Unsupported architecture: $arch. Only amd64, arm64, and armhf are supported." + fi + + echo "deb [arch=$arch signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$node_version nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null + + # N|solid Config + echo "Package: nsolid" | tee /etc/apt/preferences.d/nsolid > /dev/null + echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nsolid > /dev/null + echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nsolid > /dev/null + + # Nodejs Config + echo "Package: nodejs" | tee /etc/apt/preferences.d/nodejs > /dev/null + echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nodejs > /dev/null + echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nodejs > /dev/null + + # Run 'apt-get update' + if ! apt-get update -y; then + handle_error "$?" "Failed to run 'apt-get update'" + else + log "Repository configured successfully. To install Node.js, run: apt-get install nodejs -y" "success" + fi +} + +# Define Node.js version +NODE_VERSION="XX.x" + +# Check OS +check_os + +# Main execution +install_pre_reqs || handle_error $? "Failed installing pre-requisites" +configure_repo "$NODE_VERSION" || handle_error $? "Failed configuring repository" diff --git a/scripts/deb/script_generator/generator.sh b/scripts/deb/script_generator/generator.sh new file mode 100644 index 00000000..0379d860 --- /dev/null +++ b/scripts/deb/script_generator/generator.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Function to create a script for a given Node.js version +create_script() { + local version=$1 + local script_name=$2 + local target_script="../setup_$script_name.x" + + echo "Creating script for Node.js version $version.x" + if sed "s/NODE_VERSION=\"XX.x\"/NODE_VERSION=\"$version.x\"/g" "$base_script" > "$target_script"; then + echo "Script created successfully: $target_script" + else + echo "Error: Failed to create script for version $version.x" + return 1 + fi +} + +# Check if the base script exists +base_script="./base_script.sh" +if [ ! -f "$base_script" ]; then + echo "Error: Base script not found at $base_script" + exit 1 +fi + +# List of versions +versions=("18" "20" "21") + +# Iterate over the versions and create scripts +for version in "${versions[@]}"; do + create_script "$version" "$version" +done + +# Define LTS and current Node.js versions +lts_version="20" +current_version="21" + +# Create setup_lts and setup_current scripts +create_script "$lts_version" "lts" +create_script "$current_version" "current" diff --git a/scripts/deb/setup_18.x b/scripts/deb/setup_18.x new file mode 100644 index 00000000..25015005 --- /dev/null +++ b/scripts/deb/setup_18.x @@ -0,0 +1,102 @@ +#!/bin/bash + +# Logger Function +log() { + local message="$1" + local type="$2" + local timestamp=$(date '+%Y-%m-%d %H:%M:%S') + local color + local endcolor="\033[0m" + + case "$type" in + "info") color="\033[38;5;79m" ;; + "success") color="\033[1;32m" ;; + "error") color="\033[1;31m" ;; + *) color="\033[1;34m" ;; + esac + + echo -e "${color}${timestamp} - ${message}${endcolor}" +} + +# Error handler function +handle_error() { + local exit_code=$1 + local error_message="$2" + log "Error: $error_message (Exit Code: $exit_code)" "error" + exit $exit_code +} + +# Function to check for command availability +command_exists() { + command -v "$1" &> /dev/null +} + +check_os() { + if ! [ -f "/etc/debian_version" ]; then + echo "Error: This script is only supported on Debian-based systems." + exit 1 + fi +} + +# Function to Install the script pre-requisites +install_pre_reqs() { + log "Installing pre-requisites" "info" + + # Run 'apt-get update' + if ! apt-get update -y; then + handle_error "$?" "Failed to run 'apt-get update'" + fi + + # Run 'apt-get install' + if ! apt-get install -y ca-certificates curl gnupg; then + handle_error "$?" "Failed to install packages" + fi + + mkdir -p /usr/share/keyrings + rm -f /usr/share/keyrings/nodesource.gpg + rm -f /etc/apt/sources.list.d/nodesource.list + + # Run 'curl' and 'gpg' + if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg; then + handle_error "$?" "Failed to download and import the NodeSource signing key" + fi +} + +# Function to configure the Repo +configure_repo() { + local node_version=$1 + + arch=$(dpkg --print-architecture) + if [ "$arch" != "amd64" ] && [ "$arch" != "arm64" ] && [ "$arch" != "armhf" ]; then + handle_error "1" "Unsupported architecture: $arch. Only amd64, arm64, and armhf are supported." + fi + + echo "deb [arch=$arch signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$node_version nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null + + # N|solid Config + echo "Package: nsolid" | tee /etc/apt/preferences.d/nsolid > /dev/null + echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nsolid > /dev/null + echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nsolid > /dev/null + + # Nodejs Config + echo "Package: nodejs" | tee /etc/apt/preferences.d/nodejs > /dev/null + echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nodejs > /dev/null + echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nodejs > /dev/null + + # Run 'apt-get update' + if ! apt-get update -y; then + handle_error "$?" "Failed to run 'apt-get update'" + else + log "Repository configured successfully. To install Node.js, run: apt-get install nodejs -y" "success" + fi +} + +# Define Node.js version +NODE_VERSION="18.x" + +# Check OS +check_os + +# Main execution +install_pre_reqs || handle_error $? "Failed installing pre-requisites" +configure_repo "$NODE_VERSION" || handle_error $? "Failed configuring repository" diff --git a/scripts/deb/setup_20.x b/scripts/deb/setup_20.x new file mode 100644 index 00000000..1bb5e818 --- /dev/null +++ b/scripts/deb/setup_20.x @@ -0,0 +1,102 @@ +#!/bin/bash + +# Logger Function +log() { + local message="$1" + local type="$2" + local timestamp=$(date '+%Y-%m-%d %H:%M:%S') + local color + local endcolor="\033[0m" + + case "$type" in + "info") color="\033[38;5;79m" ;; + "success") color="\033[1;32m" ;; + "error") color="\033[1;31m" ;; + *) color="\033[1;34m" ;; + esac + + echo -e "${color}${timestamp} - ${message}${endcolor}" +} + +# Error handler function +handle_error() { + local exit_code=$1 + local error_message="$2" + log "Error: $error_message (Exit Code: $exit_code)" "error" + exit $exit_code +} + +# Function to check for command availability +command_exists() { + command -v "$1" &> /dev/null +} + +check_os() { + if ! [ -f "/etc/debian_version" ]; then + echo "Error: This script is only supported on Debian-based systems." + exit 1 + fi +} + +# Function to Install the script pre-requisites +install_pre_reqs() { + log "Installing pre-requisites" "info" + + # Run 'apt-get update' + if ! apt-get update -y; then + handle_error "$?" "Failed to run 'apt-get update'" + fi + + # Run 'apt-get install' + if ! apt-get install -y ca-certificates curl gnupg; then + handle_error "$?" "Failed to install packages" + fi + + mkdir -p /usr/share/keyrings + rm -f /usr/share/keyrings/nodesource.gpg + rm -f /etc/apt/sources.list.d/nodesource.list + + # Run 'curl' and 'gpg' + if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg; then + handle_error "$?" "Failed to download and import the NodeSource signing key" + fi +} + +# Function to configure the Repo +configure_repo() { + local node_version=$1 + + arch=$(dpkg --print-architecture) + if [ "$arch" != "amd64" ] && [ "$arch" != "arm64" ] && [ "$arch" != "armhf" ]; then + handle_error "1" "Unsupported architecture: $arch. Only amd64, arm64, and armhf are supported." + fi + + echo "deb [arch=$arch signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$node_version nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null + + # N|solid Config + echo "Package: nsolid" | tee /etc/apt/preferences.d/nsolid > /dev/null + echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nsolid > /dev/null + echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nsolid > /dev/null + + # Nodejs Config + echo "Package: nodejs" | tee /etc/apt/preferences.d/nodejs > /dev/null + echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nodejs > /dev/null + echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nodejs > /dev/null + + # Run 'apt-get update' + if ! apt-get update -y; then + handle_error "$?" "Failed to run 'apt-get update'" + else + log "Repository configured successfully. To install Node.js, run: apt-get install nodejs -y" "success" + fi +} + +# Define Node.js version +NODE_VERSION="20.x" + +# Check OS +check_os + +# Main execution +install_pre_reqs || handle_error $? "Failed installing pre-requisites" +configure_repo "$NODE_VERSION" || handle_error $? "Failed configuring repository" diff --git a/scripts/deb/setup_21.x b/scripts/deb/setup_21.x new file mode 100644 index 00000000..863797ec --- /dev/null +++ b/scripts/deb/setup_21.x @@ -0,0 +1,102 @@ +#!/bin/bash + +# Logger Function +log() { + local message="$1" + local type="$2" + local timestamp=$(date '+%Y-%m-%d %H:%M:%S') + local color + local endcolor="\033[0m" + + case "$type" in + "info") color="\033[38;5;79m" ;; + "success") color="\033[1;32m" ;; + "error") color="\033[1;31m" ;; + *) color="\033[1;34m" ;; + esac + + echo -e "${color}${timestamp} - ${message}${endcolor}" +} + +# Error handler function +handle_error() { + local exit_code=$1 + local error_message="$2" + log "Error: $error_message (Exit Code: $exit_code)" "error" + exit $exit_code +} + +# Function to check for command availability +command_exists() { + command -v "$1" &> /dev/null +} + +check_os() { + if ! [ -f "/etc/debian_version" ]; then + echo "Error: This script is only supported on Debian-based systems." + exit 1 + fi +} + +# Function to Install the script pre-requisites +install_pre_reqs() { + log "Installing pre-requisites" "info" + + # Run 'apt-get update' + if ! apt-get update -y; then + handle_error "$?" "Failed to run 'apt-get update'" + fi + + # Run 'apt-get install' + if ! apt-get install -y ca-certificates curl gnupg; then + handle_error "$?" "Failed to install packages" + fi + + mkdir -p /usr/share/keyrings + rm -f /usr/share/keyrings/nodesource.gpg + rm -f /etc/apt/sources.list.d/nodesource.list + + # Run 'curl' and 'gpg' + if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg; then + handle_error "$?" "Failed to download and import the NodeSource signing key" + fi +} + +# Function to configure the Repo +configure_repo() { + local node_version=$1 + + arch=$(dpkg --print-architecture) + if [ "$arch" != "amd64" ] && [ "$arch" != "arm64" ] && [ "$arch" != "armhf" ]; then + handle_error "1" "Unsupported architecture: $arch. Only amd64, arm64, and armhf are supported." + fi + + echo "deb [arch=$arch signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$node_version nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null + + # N|solid Config + echo "Package: nsolid" | tee /etc/apt/preferences.d/nsolid > /dev/null + echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nsolid > /dev/null + echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nsolid > /dev/null + + # Nodejs Config + echo "Package: nodejs" | tee /etc/apt/preferences.d/nodejs > /dev/null + echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nodejs > /dev/null + echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nodejs > /dev/null + + # Run 'apt-get update' + if ! apt-get update -y; then + handle_error "$?" "Failed to run 'apt-get update'" + else + log "Repository configured successfully. To install Node.js, run: apt-get install nodejs -y" "success" + fi +} + +# Define Node.js version +NODE_VERSION="21.x" + +# Check OS +check_os + +# Main execution +install_pre_reqs || handle_error $? "Failed installing pre-requisites" +configure_repo "$NODE_VERSION" || handle_error $? "Failed configuring repository" diff --git a/scripts/deb/setup_current.x b/scripts/deb/setup_current.x new file mode 100644 index 00000000..863797ec --- /dev/null +++ b/scripts/deb/setup_current.x @@ -0,0 +1,102 @@ +#!/bin/bash + +# Logger Function +log() { + local message="$1" + local type="$2" + local timestamp=$(date '+%Y-%m-%d %H:%M:%S') + local color + local endcolor="\033[0m" + + case "$type" in + "info") color="\033[38;5;79m" ;; + "success") color="\033[1;32m" ;; + "error") color="\033[1;31m" ;; + *) color="\033[1;34m" ;; + esac + + echo -e "${color}${timestamp} - ${message}${endcolor}" +} + +# Error handler function +handle_error() { + local exit_code=$1 + local error_message="$2" + log "Error: $error_message (Exit Code: $exit_code)" "error" + exit $exit_code +} + +# Function to check for command availability +command_exists() { + command -v "$1" &> /dev/null +} + +check_os() { + if ! [ -f "/etc/debian_version" ]; then + echo "Error: This script is only supported on Debian-based systems." + exit 1 + fi +} + +# Function to Install the script pre-requisites +install_pre_reqs() { + log "Installing pre-requisites" "info" + + # Run 'apt-get update' + if ! apt-get update -y; then + handle_error "$?" "Failed to run 'apt-get update'" + fi + + # Run 'apt-get install' + if ! apt-get install -y ca-certificates curl gnupg; then + handle_error "$?" "Failed to install packages" + fi + + mkdir -p /usr/share/keyrings + rm -f /usr/share/keyrings/nodesource.gpg + rm -f /etc/apt/sources.list.d/nodesource.list + + # Run 'curl' and 'gpg' + if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg; then + handle_error "$?" "Failed to download and import the NodeSource signing key" + fi +} + +# Function to configure the Repo +configure_repo() { + local node_version=$1 + + arch=$(dpkg --print-architecture) + if [ "$arch" != "amd64" ] && [ "$arch" != "arm64" ] && [ "$arch" != "armhf" ]; then + handle_error "1" "Unsupported architecture: $arch. Only amd64, arm64, and armhf are supported." + fi + + echo "deb [arch=$arch signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$node_version nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null + + # N|solid Config + echo "Package: nsolid" | tee /etc/apt/preferences.d/nsolid > /dev/null + echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nsolid > /dev/null + echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nsolid > /dev/null + + # Nodejs Config + echo "Package: nodejs" | tee /etc/apt/preferences.d/nodejs > /dev/null + echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nodejs > /dev/null + echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nodejs > /dev/null + + # Run 'apt-get update' + if ! apt-get update -y; then + handle_error "$?" "Failed to run 'apt-get update'" + else + log "Repository configured successfully. To install Node.js, run: apt-get install nodejs -y" "success" + fi +} + +# Define Node.js version +NODE_VERSION="21.x" + +# Check OS +check_os + +# Main execution +install_pre_reqs || handle_error $? "Failed installing pre-requisites" +configure_repo "$NODE_VERSION" || handle_error $? "Failed configuring repository" diff --git a/scripts/deb/setup_lts.x b/scripts/deb/setup_lts.x new file mode 100644 index 00000000..1bb5e818 --- /dev/null +++ b/scripts/deb/setup_lts.x @@ -0,0 +1,102 @@ +#!/bin/bash + +# Logger Function +log() { + local message="$1" + local type="$2" + local timestamp=$(date '+%Y-%m-%d %H:%M:%S') + local color + local endcolor="\033[0m" + + case "$type" in + "info") color="\033[38;5;79m" ;; + "success") color="\033[1;32m" ;; + "error") color="\033[1;31m" ;; + *) color="\033[1;34m" ;; + esac + + echo -e "${color}${timestamp} - ${message}${endcolor}" +} + +# Error handler function +handle_error() { + local exit_code=$1 + local error_message="$2" + log "Error: $error_message (Exit Code: $exit_code)" "error" + exit $exit_code +} + +# Function to check for command availability +command_exists() { + command -v "$1" &> /dev/null +} + +check_os() { + if ! [ -f "/etc/debian_version" ]; then + echo "Error: This script is only supported on Debian-based systems." + exit 1 + fi +} + +# Function to Install the script pre-requisites +install_pre_reqs() { + log "Installing pre-requisites" "info" + + # Run 'apt-get update' + if ! apt-get update -y; then + handle_error "$?" "Failed to run 'apt-get update'" + fi + + # Run 'apt-get install' + if ! apt-get install -y ca-certificates curl gnupg; then + handle_error "$?" "Failed to install packages" + fi + + mkdir -p /usr/share/keyrings + rm -f /usr/share/keyrings/nodesource.gpg + rm -f /etc/apt/sources.list.d/nodesource.list + + # Run 'curl' and 'gpg' + if ! curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg; then + handle_error "$?" "Failed to download and import the NodeSource signing key" + fi +} + +# Function to configure the Repo +configure_repo() { + local node_version=$1 + + arch=$(dpkg --print-architecture) + if [ "$arch" != "amd64" ] && [ "$arch" != "arm64" ] && [ "$arch" != "armhf" ]; then + handle_error "1" "Unsupported architecture: $arch. Only amd64, arm64, and armhf are supported." + fi + + echo "deb [arch=$arch signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$node_version nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null + + # N|solid Config + echo "Package: nsolid" | tee /etc/apt/preferences.d/nsolid > /dev/null + echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nsolid > /dev/null + echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nsolid > /dev/null + + # Nodejs Config + echo "Package: nodejs" | tee /etc/apt/preferences.d/nodejs > /dev/null + echo "Pin: origin deb.nodesource.com" | tee -a /etc/apt/preferences.d/nodejs > /dev/null + echo "Pin-Priority: 600" | tee -a /etc/apt/preferences.d/nodejs > /dev/null + + # Run 'apt-get update' + if ! apt-get update -y; then + handle_error "$?" "Failed to run 'apt-get update'" + else + log "Repository configured successfully. To install Node.js, run: apt-get install nodejs -y" "success" + fi +} + +# Define Node.js version +NODE_VERSION="20.x" + +# Check OS +check_os + +# Main execution +install_pre_reqs || handle_error $? "Failed installing pre-requisites" +configure_repo "$NODE_VERSION" || handle_error $? "Failed configuring repository" diff --git a/scripts/rpm/script_generator/README.md b/scripts/rpm/script_generator/README.md index 1656b6ed..14990199 100644 --- a/scripts/rpm/script_generator/README.md +++ b/scripts/rpm/script_generator/README.md @@ -38,3 +38,13 @@ bash generator.sh ``` This script iterates over a list of versions (currently 18.x, 20.x, and 21.x), and creates a new script for each version with the updated base script. It also creates setup_current and setup_latest scripts for the current and latest versions of Node.js, respectively. + +## Deploying the Scripts + +After generating the scripts, you can deploy them to an S3 bucket using the AWS CLI. Here is the command to do so: + +```bash +aws s3 sync scripts/rpm/ s3://rpm.nodesource.com/ --exclude "*/**" +``` + +This command syncs all the files in the scripts/rpm/ directory (but not its subdirectories) with the s3://rpm.nodesource.com/ bucket. Make sure to replace s3://rpm.nodesource.com/ with the path to your own S3 bucket. From 55fa99e7bc3c5f1df38d245cf5c25ba3a304828b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesus=20Hernando=20Paz=20Bola=C3=B1os?= Date: Tue, 26 Dec 2023 19:07:25 -0500 Subject: [PATCH 3/5] update readme --- README.md | 189 +++++++++++++++++++----------------- scripts/nsolid_setup_rpm.sh | 75 -------------- 2 files changed, 100 insertions(+), 164 deletions(-) delete mode 100755 scripts/nsolid_setup_rpm.sh diff --git a/README.md b/README.md index c70b31bd..1694a377 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,8 @@ We'd like to inform you of important changes to our distribution repository [nod **What's New:** - _**Package Changes:** DEB and RPM packages are now available under the `nodistro` codename. We no longer package the installer coupled to specific versions. This means you can install Node.js on almost any distro that meets the minimum requirements._ -- _**Installation Scripts:** The installation scripts `setup_XX.x` are no longer supported and are not needed anymore, as the installation process is straightforward for any RPM and DEB distro._ +- **Installation Scripts:** Back by popular demand, the installation scripts have returned and are better than ever. See the installation instructions below for details on how to use them. +- **RPM Package Signing Key:** The key used to sign RPM packages has changed. We now sign packages using SHA256, providing better support to the community. - **Questions and concerns:** To resolve questions and discuss concerns about this update we've opened this discussion space [New distribution's packages](https://github.com/nodesource/distributions/discussions/#123456) Looking for the previous Documentation [README.md](./OLD_README.md) @@ -25,19 +26,18 @@ Looking for the previous Documentation [README.md](./OLD_README.md) ## Table of Contents - **[Debian and Ubuntu based distributions](#debian-and-ubuntu-based-distributions)** (deb) - - [Available architectures](#available-architectures) - - [Supported Versions](#supported-versions) + - [Available architectures](#deb-available-architectures) + - [Supported Versions](#deb-supported-versions) - [Ubuntu versions](#ubuntu-versions) - [Debian versions](#debian-versions) - [Installation instructions](#installation-instructions) - [Uninstall instructions](#uninstall-nodejs-ubuntu--debian-packages) - **[Enterprise Linux based distributions](#enterprise-linux-based-distributions)** (rpm) - - [Available architectures](#available-architectures-1) - - [Supported Versions](#supported-versions-1) + - [Available architectures](#rpm-available-architectures) + - [Supported Versions](#rpm-supported-versions) - [Fedora versions](#fedora-versions) - [Redhat versions](#redhat-versions) - [Amazon Linux versions](#amazon-linux-versions) - - [Installation instructions](#installation-instructions-1) - [Uninstall instructions](#uninstall-nodejs-enterprise-linux-packages) - **[Nodejs Release Calendar](#nodejs-release-calendar)** - [FAQ](#faq) @@ -46,7 +46,7 @@ Looking for the previous Documentation [README.md](./OLD_README.md) ## Debian and Ubuntu based distributions -### **Available architectures** +### DEB Available architectures NodeSource will continue to maintain the following architectures and may add additional ones in the future. @@ -54,7 +54,7 @@ NodeSource will continue to maintain the following architectures and may add add - **armhf** (ARM 32-bit hard-float, ARMv7 and up: _arm-linux-gnueabihf_) - **arm64** (ARM 64-bit, ARMv8 and up: _aarch64-linux-gnu_) -### **Supported Versions** +### DEB Supported Versions #### **Ubuntu versions** @@ -78,39 +78,47 @@ NodeSource will continue to maintain the following architectures and may add add ### Installation Instructions -#### **Node.js** +#### Node.js > _If you have root access, you can omit the 'sudo' command as you already have full administrative privileges._ -1. Download and import the Nodesource GPG key +#### Node.js v21.x ```sh sudo apt-get update && sudo apt-get install curl -y +curl -fsSL https://deb.nodesource.com/setup_21.x | sudo bash - +sudo apt-get install nodejs -y +``` + +#### Node.js v20.x -sudo mkdir -p /etc/apt/keyrings -curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +```sh +sudo apt-get update && sudo apt-get install curl -y +curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash - +sudo apt-get install nodejs -y ``` -2. Create deb repository +#### Node.js v18.x ```sh -NODE_MAJOR=20 -echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list +sudo apt-get update && sudo apt-get install curl -y +curl -fsSL https://deb.nodesource.com/setup_18.x | sudo bash - +sudo apt-get install nodejs -y ``` -> _**Optional**_: ``NODE_MAJOR`` can be changed depending on the version you need. -> -> ```sh -> NODE_MAJOR=16 -> NODE_MAJOR=18 -> NODE_MAJOR=20 -> NODE_MAJOR=21 -> ``` +#### Node.js Current (v21.x) + +```sh +sudo apt-get update && sudo apt-get install curl -y +curl -fsSL https://deb.nodesource.com/setup_current.x | sudo bash - +sudo apt-get install nodejs -y +``` -3. Run Update and Install +#### Node.js LTS (v20.x) ```sh -sudo apt-get update +sudo apt-get update && sudo apt-get install curl -y +curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo bash - sudo apt-get install nodejs -y ``` @@ -118,7 +126,7 @@ sudo apt-get install nodejs -y To completely remove Node.js installed from the deb.nodesource.com package methods above: -##### use `sudo` on Ubuntu or run this as root on debian +#### use `sudo` on Ubuntu or run this as root on debian ```sh apt-get purge nodejs &&\ @@ -128,14 +136,14 @@ rm -r /etc/apt/keyrings/nodesource.gpg ## Enterprise Linux Based Distributions -### **Available architectures** +### RPM Available architectures NodeSource will continue to maintain the following architectures and may add additional ones in the future. - **x86_64** (64-bit) - **arm64** (ARM 64-bit, ARMv8 and up: _aarch64-linux-gnu_) -### **Supported Versions** +### RPM Supported Versions #### **Fedora versions** @@ -162,30 +170,49 @@ NodeSource will continue to maintain the following architectures and may add add > _NOTE: If you are looking to run Node.js in a non-supported Linux version take a look to [Node.js Unofficial Builds](https://unofficial-builds.nodejs.org/)_ -### Installation Instructions +### RPM Installation Instructions The Nodesource RPM package signing key is available here: > _If you have root access, you can omit the 'sudo' command as you already have full administrative privileges._ -#### **Node.js v21.x** +#### Node.js v21.x ```sh -sudo yum install https://rpm.nodesource.com/pub_21.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm -y +sudo yum update -y && sudo yum install curl -y +curl -fsSL https://rpm.nodesource.com/setup_21.x | sudo bash - sudo yum install nodejs -y ``` -#### **Node.js v20.x** +#### Node.js v20.x ```sh -sudo yum install https://rpm.nodesource.com/pub_20.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm -y +sudo yum update -y && sudo yum install curl -y +curl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash - sudo yum install nodejs -y ``` -#### **Node.js v18.x** +#### Node.js v18.x ```sh -sudo yum install https://rpm.nodesource.com/pub_18.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm -y +sudo yum update -y && sudo yum install curl -y +curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash - +sudo yum install nodejs -y +``` + +#### Node.js Current (v21.x) + +```sh +sudo yum update -y && sudo yum install curl -y +curl -fsSL https://rpm.nodesource.com/setup_current.x | sudo bash - +sudo yum install nodejs -y +``` + +#### Node.js LTS (v20.x) + +```sh +sudo yum update -y && sudo yum install curl -y +curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash - sudo yum install nodejs -y ``` @@ -210,39 +237,12 @@ rm -r /etc/yum.repos.d/nodesource*.repo &&\ yum clean all ``` -## Installation Scripts - -We've created some scripts to make easy the repo configuration. -> This only works from Node16 forwards - -#### DEB - -> change the version as needed `./nsolid_setup_deb.sh 20` - -```SHELL -curl -SLO https://deb.nodesource.com/nsolid_setup_deb.sh -chmod 500 nsolid_setup_deb.sh -./nsolid_setup_deb.sh 21 -apt-get install nodejs -y -``` - -#### RPM - -> change the version as needed `./nsolid_setup_deb.sh 20` - -```SHELL -curl -SLO https://rpm.nodesource.com/nsolid_setup_rpm.sh -chmod 500 nsolid_setup_rpm.sh -./nsolid_setup_rpm.sh 21 -yum install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1 -``` - ## Nodejs Release Calendar [![Node Releases Calendar](https://raw.githubusercontent.com/nodejs/Release/main/schedule.svg?sanitize=true)](https://nodejs.dev/en/about/releases) _source: _ -# FAQ +## FAQ Q: How do I migrate to the new repo? @@ -274,32 +274,43 @@ For more information and possible solutions, please refer to the following resou ## Authors and Contributors - - - - - - - - - - - - - - - - - - - - - - - - - -
Chris LeaGitHub/chrisleaTwitter/@chrislea
Rod VaggGitHub/rvaggTwitter/@rvagg
William BlankenshipGitHub/retrohackerTwitter/@retrohack3r
Harry TruongGitHub/harrytruong
Matteo BrunatiGitHub/mattbrun
Brian WhiteGitHub/mscdex
Matt LewandowskyGitHub/lewellyn
Jan-Hendrik PetersGitHub/hennr
Andris ReinmanGitHub/andris9
CarvilsiGitHub/carvilsi
Krasimir TrenchevGitHub/Ava7
Phil HelmGitHub/phelma
0xmohitGitHub/0xmohit
jdarlingGitHub/jdarling
Prayag VermaGitHub/pra85
Misha BrukmanGitHub/mbrukman
Simon LydellGitHub/lydell
Sebastian BleiGitHub/iamsebastian
Jorge Maldonado VenturaNotABug/jorgesumle
Mayank MethaGitHub/mayankmethaTwitter/@mayankmethad
Adrian EstradaGitHub/edsadrTwitter/@edsadr
Iván IguaránGitHub/igsu
Jesus PazGitHub/JesusPaz
Jefferson RiosGitHub/riosje
+### Current Members + + + + + + + +
Adrian EstradaGitHub/edsadrTwitter/@edsadr
Jesus PazGitHub/JesusPaz
Jefferson RiosGitHub/riosje
+ +### Past Members + + + + + + + + + + + + + + + + + + + + + + + + + +
Chris LeaGitHub/chrisleaTwitter/@chrislea
Rod VaggGitHub/rvaggTwitter/@rvagg
William BlankenshipGitHub/retrohackerTwitter/@retrohack3r
Harry TruongGitHub/harrytruong
Matteo BrunatiGitHub/mattbrun
Brian WhiteGitHub/mscdex
Matt LewandowskyGitHub/lewellyn
Jan-Hendrik PetersGitHub/hennr
Andris ReinmanGitHub/andris9
CarvilsiGitHub/carvilsi
Krasimir TrenchevGitHub/Ava7
Phil HelmGitHub/phelma
0xmohitGitHub/0xmohit
jdarlingGitHub/jdarling
Prayag VermaGitHub/pra85
Misha BrukmanGitHub/mbrukman
Simon LydellGitHub/lydell
Sebastian BleiGitHub/iamsebastian
Jorge Maldonado VenturaNotABug/jorgesumle
Mayank MethaGitHub/mayankmethaTwitter/@mayankmethad
Iván IguaránGitHub/igsu
Contributions are welcomed from anyone wanting to improve this project! diff --git a/scripts/nsolid_setup_rpm.sh b/scripts/nsolid_setup_rpm.sh deleted file mode 100755 index 0d1e2ddb..00000000 --- a/scripts/nsolid_setup_rpm.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/sh -set -e - -NSOLID_VERSION=$1 - -################################ -## Logger Function ## -################################ -logger() { - local message="$1" - local type="$2" - local length=${#message} - local line=$(printf "%-${length}s" | tr ' ' '-') - echo "" - case "$type" in - "info") - echo "\033[38;5;79m$line\033[0m" - echo "\033[38;5;79m$message\033[0m" - echo "\033[38;5;79m$line\033[0m" - ;; - "success") - echo "\033[1;32m$line\033[0m" - echo "\033[1;32m$message\033[0m" - echo "\033[1;32m$line\033[0m" - ;; - "error") - echo "\033[1;31m$line\033[0m" - echo "\033[1;31m$message\033[0m" - echo "\033[1;31m$line\033[0m" - ;; - *) - echo "\033[1;34m$line\033[0m" - echo "\033[1;34m$message\033[0m" - echo "\033[1;34m$line\033[0m" - ;; - esac - echo "" -} - - -################################ -## Error handler function ## -################################ -handleError() { - local exit_code=$1 - local error_message="$2" - logger "Error: $error_message (Exit Code: $exit_code)" "error" - exit $exit_code -} - -################################ -##Function to validate version## -################################ -getVersion() { - local NSOLID_VERSION=$1 - regex='^[0-9][0-9]$' - if ! expr "$NSOLID_VERSION" : "$regex" > /dev/null; then - return 1 - fi - logger "Info: Configuring repository for N|solid $NSOLID_VERSION" "info" -} - -################################## -##Function to configure the Repo## -################################## -configureRepo() { - local NSOLID_VERSION=$1 - # Run 'yum install' - if ! yum install https://rpm.nodesource.com/pub_$NSOLID_VERSION.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm -y; then - handleError "$?" "Failed to run yum install https://rpm.nodesource.com/pub_$NSOLID_VERSION.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm -y" - fi -} - -getVersion $NSOLID_VERSION || handleError $? "Must define a valid N|solid version" -configureRepo $NSOLID_VERSION || handleError $? "Failed configuring repository" From 0b9fd9a8d863f1c436e1ed391092f7f9d6a52638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesus=20Hernando=20Paz=20Bola=C3=B1os?= Date: Tue, 26 Dec 2023 19:28:50 -0500 Subject: [PATCH 4/5] update ci --- .circleci/config.yml | 32 ++------ .github/workflows/ci.yaml | 12 +-- LICENSE.md | 2 +- README.md | 156 ++++++++++++++++++++++++++++---------- 4 files changed, 126 insertions(+), 76 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cf6b2540..1e694e99 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,16 +14,9 @@ jobs: - checkout - run: name: Check Node installation - environment: - NODE_MAJOR: 20 command: | - apt-get update - apt-get install -y ca-certificates curl gnupg - apt install nodejs -y - curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg - echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list - apt-get update - apt-get install nodejs -y + bash ./scripts/deb/setup_lts.x + apt-get install nodejs -y - run: *envinfo debian-test: working_directory: ~/repo @@ -33,16 +26,9 @@ jobs: - checkout - run: name: Check Node installation - environment: - NODE_MAJOR: 20 command: | - apt-get update - apt-get install -y ca-certificates curl gnupg - apt install nodejs -y - curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg - echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list - apt-get update - apt-get install nodejs -y + bash ./scripts/deb/setup_lts.x + apt-get install nodejs -y - run: *envinfo amazonlinux-test: working_directory: ~/repo @@ -55,8 +41,8 @@ jobs: environment: NODE_MAJOR: 20 command: | - yum install https://rpm.nodesource.com/pub_${NODE_MAJOR}.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm -y - yum install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1 + bash ./scripts/rpm/setup_lts.x + yum install nodejs -y - run: *envinfo fedora-test: working_directory: ~/repo @@ -66,11 +52,9 @@ jobs: - checkout - run: name: Check Node installation - environment: - NODE_MAJOR: 20 command: | - yum install https://rpm.nodesource.com/pub_${NODE_MAJOR}.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm -y - yum install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1 + bash ./scripts/rpm/setup_lts.x + yum install nodejs -y - run: *envinfo workflows: diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 41e9b530..63172dca 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,16 +22,11 @@ jobs: run: shell: bash steps: - - name: Update and Install Dependencies - run: | - apt-get update -y - apt-get install curl git -y - - name: Checkout Repo uses: actions/checkout@v4 - name: Run Istallation Script - run: ./scripts/deb/nsolid_setup_deb.sh ${{ matrix.version }} + run: ./scripts/rpm/setup_${{ matrix.version }}.x - name: Install Nodejs run: | @@ -59,11 +54,6 @@ jobs: run: shell: bash steps: - - name: Update and Install Dependencies - run: | - yum update -y - yum install git -y - - name: Checkout Repo uses: actions/checkout@v4 diff --git a/LICENSE.md b/LICENSE.md index 060eed79..a2063f0c 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,7 +1,7 @@ The MIT License (MIT) ===================== -Copyright (c) 2019 NodeSource LLC +Copyright (c) 2024 NodeSource LLC --------------------------------- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/README.md b/README.md index 1694a377..52add0a8 100644 --- a/README.md +++ b/README.md @@ -80,46 +80,84 @@ NodeSource will continue to maintain the following architectures and may add add #### Node.js -> _If you have root access, you can omit the 'sudo' command as you already have full administrative privileges._ +**Node.js v21.x**: -#### Node.js v21.x +##### Using Ubuntu ```sh -sudo apt-get update && sudo apt-get install curl -y -curl -fsSL https://deb.nodesource.com/setup_21.x | sudo bash - -sudo apt-get install nodejs -y +curl -fsSL https://deb.nodesource.com/setup_21.x | sudo -E bash - &&\ +sudo apt-get install -y nodejs ``` -#### Node.js v20.x +##### Using Debian, as root ```sh -sudo apt-get update && sudo apt-get install curl -y -curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash - -sudo apt-get install nodejs -y +curl -fsSL https://deb.nodesource.com/setup_21.x | bash - &&\ +apt-get install -y nodejs ``` -#### Node.js v18.x +**Node.js v20.x**: + +##### Using Ubuntu ```sh -sudo apt-get update && sudo apt-get install curl -y -curl -fsSL https://deb.nodesource.com/setup_18.x | sudo bash - -sudo apt-get install nodejs -y +curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - &&\ +sudo apt-get install -y nodejs ``` -#### Node.js Current (v21.x) +##### Using Debian, as root ```sh -sudo apt-get update && sudo apt-get install curl -y -curl -fsSL https://deb.nodesource.com/setup_current.x | sudo bash - -sudo apt-get install nodejs -y +curl -fsSL https://deb.nodesource.com/setup_20.x | bash - &&\ +apt-get install -y nodejs ``` -#### Node.js LTS (v20.x) +**Node.js v18.x**: + +##### Using Ubuntu ```sh -sudo apt-get update && sudo apt-get install curl -y -curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo bash - -sudo apt-get install nodejs -y +curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - &&\ +sudo apt-get install -y nodejs +``` + +##### Using Debian, as root + +```sh +curl -fsSL https://deb.nodesource.com/setup_18.x | bash - &&\ +apt-get install -y nodejs +``` + +**Node.js LTS (v20.x)**: + +##### Using Ubuntu + +```sh +curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - &&\ +sudo apt-get install -y nodejs +``` + +##### Using Debian, as root + +```sh +curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - &&\ +apt-get install -y nodejs +``` + +**Node.js Current (v21.x)**: + +##### Using Ubuntu + +```sh +curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash - &&\ +sudo apt-get install -y nodejs +``` + +##### Using Debian, as root + +```sh +curl -fsSL https://deb.nodesource.com/setup_current.x | bash - &&\ +apt-get install -y nodejs ``` ### Uninstall `nodejs` Ubuntu & Debian packages @@ -174,46 +212,84 @@ NodeSource will continue to maintain the following architectures and may add add The Nodesource RPM package signing key is available here: -> _If you have root access, you can omit the 'sudo' command as you already have full administrative privileges._ +**Node.js v21.x** + +##### As root -#### Node.js v21.x +```sh +curl -fsSL https://rpm.nodesource.com/setup_21.x | bash - +yum install -y nodejs +``` + +##### No root privileges ```sh -sudo yum update -y && sudo yum install curl -y curl -fsSL https://rpm.nodesource.com/setup_21.x | sudo bash - -sudo yum install nodejs -y +yum install -y nodejs ``` -#### Node.js v20.x +**Node.js v20.x** + +##### As root + +```sh +curl -fsSL https://rpm.nodesource.com/setup_20.x | bash - +yum install -y nodejs +``` + +##### No root privileges ```sh -sudo yum update -y && sudo yum install curl -y curl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash - -sudo yum install nodejs -y +yum install -y nodejs +``` + +**Node.js v18.x** + +##### As root + +```sh +curl -fsSL https://rpm.nodesource.com/setup_18.x | bash - +yum install -y nodejs ``` -#### Node.js v18.x +##### No root privileges ```sh -sudo yum update -y && sudo yum install curl -y curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash - -sudo yum install nodejs -y +yum install -y nodejs ``` -#### Node.js Current (v21.x) +**Node.js LTS (20.x)** + +##### As root ```sh -sudo yum update -y && sudo yum install curl -y -curl -fsSL https://rpm.nodesource.com/setup_current.x | sudo bash - -sudo yum install nodejs -y +curl -fsSL https://rpm.nodesource.com/setup_lts.x | bash - +yum install -y nodejs ``` -#### Node.js LTS (v20.x) +##### No root privileges ```sh -sudo yum update -y && sudo yum install curl -y curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash - -sudo yum install nodejs -y +yum install -y nodejs +``` + +**Node.js Current (21.x)** + +##### As root + +```sh +curl -fsSL https://rpm.nodesource.com/setup_current.x | bash - +yum install -y nodejs +``` + +##### No root privileges + +```sh +curl -fsSL https://rpm.nodesource.com/setup_current.x | sudo bash - +yum install -y nodejs ``` ***Optional***: install build tools @@ -330,6 +406,6 @@ This material is Copyright (c) NodeSource and licensed under the MIT license. Al *Red Hat, CentOS and Fedora are trademarks of Red Hat, Inc.* -*Amazon Linux are trademarks of Amazon Web Services, Inc* +*Amazon Linux is a trademark of Amazon Web Services, Inc.* -*CloudLinux is a trademark of Cloud Linux, Inc* +*CloudLinux is a trademark of CloudLinux, Inc* From 1a56276531eb476292c34ec6c89caa4667f89a7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesus=20Hernando=20Paz=20Bola=C3=B1os?= Date: Tue, 2 Jan 2024 15:59:47 -0500 Subject: [PATCH 5/5] final corrections --- OLD_README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/OLD_README.md b/OLD_README.md index 4977d5e9..51faed18 100644 --- a/OLD_README.md +++ b/OLD_README.md @@ -12,18 +12,17 @@ Please file an issue if you are experiencing a problem or would like to discuss Pull requests are encouraged if you have changes you believe would improve the setup process or increase compatibility across Linux distributions. - Looking for the oldversion of [README.md](./OLD_README.md) ## Table of Contents * **[Debian and Ubuntu based distributions](#deb)** (deb) - - [Installation instructions](#debinstall) - - [Uninstall instructions](#debuninstall) - - [Manual installation](#debmanual) + * [Installation instructions](#debinstall) + * [Uninstall instructions](#debuninstall) + * [Manual installation](#debmanual) * **[Enterprise Linux based distributions](#rpm)** (rpm) - - [Installation instructions](#rpminstall) - - [Uninstall instructions](#rpmuninstall) + * [Installation instructions](#rpminstall) + * [Uninstall instructions](#rpmuninstall) * **[Tests](#tests)** * **[FAQ](#questions)** * **[Requested Distributions](#requests)** @@ -392,7 +391,7 @@ NodeSource will continue to maintain the following architectures and may add add _NOTE: If you are using RHEL 6 or CentOS 6, you might want to read about [running Node.js on older distros](https://github.com/nodesource/distributions/blob/master/OLDER_DISTROS.md)._ -The Nodesource RPM package signing key is available here: https://rpm.nodesource.com/pub/el/NODESOURCE-GPG-SIGNING-KEY-EL +The Nodesource RPM package signing key is available here: Run on RHEL, CentOS, CloudLinux, Amazon Linux or Fedora: @@ -511,6 +510,7 @@ To test an installation is working (and that the setup scripts are working!) use ```sh curl -fsSL https://deb.nodesource.com/test | bash - + ``` `` @@ -541,7 +541,7 @@ A: Due to the limitations of the compiler toolchain on EL 5 and its end of gener --- -Q: I'm seeing "Your distribution, identified as "*.i686" or "*.i386, is not currently supported, why? +Q: I'm seeing "Your distribution, identified as "_.i686" or "_.i386, is not currently supported, why? A: Node.js 4.x and newer require a 64bit os for rpms. See [issue #268](https://github.com/nodesource/distributions/issues/268)