-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Creating a Repository Mirror: A Step‐by‐Step Guide
In the past, we had a webserver that allowed us to easily navigate through folders and directly click on files for downloading. However, we have since transitioned to use an object storage system, which doesn't provide the ability to list files within a folder. Therefore, we've created this guide to help those who need to set up mirrors of our packages.
We strongly recommend using our repositories instead of downloading the artifacts directly. Nevertheless, if you still wish to download files directly, you only need to understand the path format for each Node.js version.
For those who still want to download files directly, it's essential to know the path format for each Node.js version. Here's how you can do it -> go to -> Understanding the NodeSource Distribution Server Path Format
By following this guide, you can effectively create a mirror of our packages. However, we highly encourage using our repositories for a smoother and more reliable experience.
- Install dependencies and repo
replace the variable
NODE_MAJOR
value with the desired node version
NODE_MAJOR=18
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
rpm --import /etc/pki/rpm-gpg/NODESOURCE-NSOLID-GPG-SIGNING-KEY-EL
- execute reposync to download all the available artifacts
reposync -g --repoid=nodesource-nodejs -p /var/rpm/
- You can find now all the RPM packages on
/var/rpm/nodesource-nodejs
and create the repo
cd /var/rpm/nodesource-nodejs
createrepo_c --database .
- Publish it on your own HTTP server
- Install dependencies and import 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
rpm --import /etc/pki/rpm-gpg/NODESOURCE-NODEJS-GPG-SIGNING-KEY-EL
- Configure the Repo Manually
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
- execute reposync to download the artifacts
reposync -g --repoid=nodesource-nodejs -p /var/rpm/
- You can find now all the RPM packages on
/var/rpm/nodesource-nodejs
and create the repo
cd /var/rpm/nodesource-nodejs
createrepo_c --database .
- Publish it on your own HTTP server
Example URL: https://rpm.nodesource.com/pub_16.x/nodistro/nodejs/x86_64/nodejs-16.20.2-1nodesource.x86_64.rpm
Explanation:
- rpm.nodesource.com: The base domain where Node.js RPM packages are hosted.
- pub_16.x: This part of the path indicates that it encompasses all minor and patch versions of Node.js 16. This means you can find packages for Node.js 16.0.0, 16.1.0, 16.2.0, and so on within this repository.
- nodistro: This indicates that the package was designed in a generic manner, making it compatible for installation on any RPM-based distribution.
- nodejs: The name of the package or category.
-
x86_64: This indicates the architecture for which the package is built. It's typically
x86_64
for64-bit
systems.nodejs-16.20.2-1nodesource.x86_64.rpm
: In this example,16.20.2
represents the specific Node.js version included in the package name.
Example URL: https://rpm.nodesource.com/pub_14.x/fc/36/x86_64/nodejs-14.21.3-1nodesource.x86_64.rpm
Explanation:
- rpm.nodesource.com: Same as in Example 1.
- pub_14.x: This part indicates Node.js version 14. In Node.js 14 and earlier, the path format does not include the nodistro part.
- fc/36: In this example, it specifies the Fedora distribution version (Fedora 36). Users can omit this part if the package should install on most RPM-based distributions.
- x86_64: Same as in Example 1.
- nodejs-14.21.3-1nodesource.x86_64.rpm: Here, 14.21.3 represents the specific Node.js version included in the package name.
Important Note: Having 'fc/36' in the path does not mean that the package is exclusively for Fedora 36. It can be installed on almost any other RPM-based distribution