-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Creating a Repository Mirror: A Step‐by‐Step Guide
While our former webserver supported direct browsing and file downloading, transitioning to an object storage system removed our folder listing feature. If you're interested in mirroring our packages, this guide is tailor-made for you! Though we encourage using our repositories over direct file downloads, knowing how to decipher the path format for various Node.js versions is essential for those preferring the latter. Dive into Deciphering the NodeSource Distribution Server Path Format for insights.
-
Install Dependencies and Setup Repo:
- Modify
NODE_MAJOR
to reflect your chosen Node.js version.# Set the desired Node.js version NODE_MAJOR=18 # Install essential tools and set up the repository yum install yum-utils createrepo curl -y yum install https://rpm.nodesource.com/pub_${NODE_MAJOR}.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm -y # Import the signing key for NodeSource packages rpm --import /etc/pki/rpm-gpg/NODESOURCE-NSOLID-GPG-SIGNING-KEY-EL
- Modify
-
Download Artifacts:
# Sync and download all packages from the NodeSource Node.js repository reposync -g --repoid=nodesource-nodejs -p /var/rpm/
-
Prepare the Repository: Move to the directory and initialize the repository.
# Navigate to the downloaded repository's directory cd /var/rpm/nodesource-nodejs # Create metadata for the repository createrepo_c --database .
-
Publish: Make the files available through your HTTP server.
-
Install Dependencies and Key:
# Get essential tools and NodeSource's signing key yum install yum-utils createrepo curl -y curl -LSs -o '/etc/pki/rpm-gpg/NODESOURCE-NODEJS-GPG-SIGNING-KEY-EL' https://rpm.nodesource.com/gpgkey/NODESOURCE-NODEJS-GPG-SIGNING-KEY-EL # Add the key to RPM rpm --import /etc/pki/rpm-gpg/NODESOURCE-NODEJS-GPG-SIGNING-KEY-EL
-
Manual Repo Configuration:
# Create a repository configuration for NodeSource Node.js packages cat << 'EOF' > /etc/yum.repos.d/nodesource-nodejs.repo [nodesource-nodejs] name=Node.js Packages for Linux RPM based distros - $basearch baseurl=https://rpm.nodesource.com/pub_14.x/fc/36/$basearch enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/NODESOURCE-NODEJS-GPG-SIGNING-KEY-EL EOF
-
Download Artifacts:
# Sync and grab all packages from the NodeSource Node.js repository reposync -g --repoid=nodesource-nodejs -p /var/rpm/
-
Prepare the Repository: Head to the directory and initialize the repository.
# Navigate to the repository's directory cd /var/rpm/nodesource-nodejs # Generate metadata for the repository createrepo_c --database .
-
Publish: Host the files on your HTTP server.
Kick off by ensuring aptly
is on your system:
# Get the key for aptly from the keyserver
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A0546A43624A8331
# Refresh the system's package list
apt-get update
# Install aptly tool
apt-get install aptly
📖 Reference: For a comprehensive guide, head to the official aptly download page.
Configure the needed keys and generate a mirror from NodeSource:
# Retrieve and save the NodeSource GPG key
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
# Add the key to the list of trusted keys
gpg --no-default-keyring --keyring /etc/apt/keyrings/nodesource.gpg --export | gpg --no-default-keyring --keyring trustedkeys.gpg --import
# Establish a mirror titled "nodesource-distributions" for Node.js 20.x (or modify for your desired version)
aptly -keyring=/etc/apt/keyrings/nodesource.gpg mirror create nodesource-distributions https://deb.nodesource.com/node_20.x nodistro main
Ensure your mirror aligns with the main repository:
# Refresh the "nodesource-distributions" mirror
aptly mirror update nodesource-distributions
Prior to providing access to your mirrored packages, generate a snapshot and publish it:
-
Snapshot Creation
# Create a snapshot from the "nodesource-distributions" mirror aptly snapshot create monday-updates from mirror nodesource-distributions
🔐 Note: Ensure a GPG key is set up. If missing, either import an existing one or check this guide to establish a new one.
-
Publish the Snapshot
# Make the snapshot publicly available, setting up the directory structure aptly publish snapshot monday-updates
-
Serve the Repository
# Activate the aptly server, granting access to the repository aptly serve
📚 Further Reading: For more details and advanced configurations, consult the official aptly documentation.
- Create a Remote repository and select debian as package type
- Define the repository name
Nodesource
- Specify the remote URL
https://deb.nodesource.com/node_20.x/
- Define Include Patterns
**
- Define repository layout as
simple-default
- Disable
List Remote folder items
3.Configure advanced settings, and disable any related feature to listing directories, because currently our repo does not support folder listing.
# Import Nodesource gpg key
mkdir -p /usr/share/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg
# Configure jFrog repo on `sources.list`
deb [trusted=yes signed-by=/usr/share/keyrings/nodesource.gpg] https://MyjfrogRepo.io/artifactory/Nodesource nodistro main
# Install nsolid or nodejs
apt-get update && apt-get install nodejs
📚 Further Reading: For more details and advanced configurations, consult the official jFrog documentation.
-
Example URL: 🔗 Node.js v16 RPM Package
-
🌐 rpm.nodesource.com: This is the domain for Node.js RPM packages.
-
🔢 pub_16.x: Denotes the Node.js 16 major version. This covers all minor and patch versions.
-
📦 nodistro: A universal package fit for any RPM-based distribution.
-
🔖 nodejs: Refers to the package or category name.
-
💻 x86_64: Specifies the architecture, typically
x86_64
for 64-bit systems. -
📄 nodejs-16.20.2-1nodesource.x86_64.rpm: In this case,
16.20.2
highlights the specific Node.js version.
-
-
Example URL: 🔗 Node.js v14 RPM Package
-
🌐 rpm.nodesource.com: Domain for Node.js RPM packages.
-
🔢 pub_14.x: Marks the Node.js 14 major version.
-
📜 fc/36: Indicates Fedora 36 distribution version. Yet, even if left out, it's still compatible with most RPM-based distributions.
-
💻 x86_64: Represents the architecture.
-
📄 nodejs-14.21.3-1nodesource.x86_64.rpm: Here, 14.21.3 points out the Node.js version.
-
📝 Friendly Reminder: Even though 'fc/36' is present, it doesn't restrict the package only to Fedora 36. It's versatile and aligns with nearly all RPM-based distributions.