Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
windows:chocolatey:setup-self-hosted-choco-repo [2024/05/12 13:36] Zyzonixwindows:chocolatey:setup-self-hosted-choco-repo [2025/02/11 08:10] (current) – old revision restored (2025/02/11 08:09) Zyzonix
Line 1: Line 1:
 ===== Setup self hosted Chocolatey Repository/Proxy on Linux ===== ===== Setup self hosted Chocolatey Repository/Proxy on Linux =====
  
-To host a local repository for [[https://chocolatey.org|Chocolatey]] either as server for self-hosted packages or as proxy server for any NuGet server/the official chocolatey repository server we use Solartype Nexus3: [[https://www.sonatype.com/products/sonatype-nexus-repository|sonatype.com - Nexus3]]+To host a local repository for [[https://chocolatey.org|Chocolatey]] either as server for self-hosted packages or as proxy server for any NuGet server/the official chocolatey repository server we use Solartype Nexus3: [[https://www.sonatype.com/products/sonatype-nexus-repository|sonatype.com - Nexus3]].  Nexus3 is also useable for hosting a simple, easy-to-manage repository for the APT-package manager.
  
-<callout icon="true" type="warning">Therefore that ''Nexus3'' required ''Java **8**'' it's recommended to use a Ubuntu Server (in this case ''24'') because Ubuntu still serves Java 8 from the official repository which Debian doesn't.</callout> 
  
-  - Download Ubuntu Server from here: [[https://ubuntu.com/download/server|ubuntu.com/download/server]] and install your machine. +==== Installation ====
-  - Install Java8: <code bash>sudo apt install openjdk-8-jdk</code> +
-  - Add Sonatype's APT repository to sources lists: <code bash>wget -P /etc/apt/sources.list.d/ https://repo.sonatype.com/repository/community-hosted/deb/sonatype-community.list</code> +
-  - Add the repositories key: <code bash>nano sonatype-apt-repo.key</code> And paste the following content: <code bash>-----BEGIN PGP PUBLIC KEY BLOCK-----+
  
-mQGNBF1Uv8ABDAD0Te7EGf8n4jUKzeD9YfqqiPUs/Q54QBOQeFHe+pdMQeC7O8Kl +  - Download Debian 12 Server from here: [[https://www.debian.org/distrib/|debian.org/distrib]] and install your machine. 
-W3AX0Qy1C0SUZWlDkOt3F+5ct18S/xT/42bVQYHzaT05zIjlwxqiSB8ApVnR9Gpm +  - Install Java 17: <code bash>sudo apt install openjdk-17-jdk</code> 
-+N2u6eNyHCXItsdNwV8djd9B5nsRd0Gqgzmklt8bxZUX9NI0OQmbcquEg46Kt65J +  - Add user ''nexus'' to run Nexus3: <code bash>adduser nexus</code> 
-IueVqy/qM4vdZSIH3+f/klHblBty8JHNorbNXdtz8e7PuzshVghULKlvgnJmQWdG +  - Download the latest Nexus3 from ''https://help.sonatype.com/en/download.html'' 
-XJsMuWpKYUhDtsN4UHOzsS7uFBn/cWlLYs9bQy9BmK/8tBfcMtoXZGq3/c+fN9fj +  - Unpack it to ''/opt/'': <code bash>tar xzvf <downloaded-tar-package>.tar.gz -C /opt</code> 
-9wdxNeTrbMEsZiaLOLHCZwKEbn03+OjJKtTAxu6Q+benc9/++0BMhQK4gqj7zQW+ +  - Change owner of unpacked files: <code bash>chown nexus -R /opt/nexus-<version></code> 
-CPlN+gg+PX4WVreU8rhT3kgTGCMm2aGiCjBg/aF4BmewLl/+CPgpw9VrFAKPN7w/ +  - Make binary executeable: <code bash>chmod +/opt/nexus-<version>/bin/nexus</code> 
-fE5Smcrmta4i4DFSQoMYclOObzjr3qydx8INcRyXWEXPHz7NW+3PQY4JvUec8/KR +  - Create systemservice with the name ''nexus.service'' and copy it to ''/etc/systemd/system'' (keep in mind to add the nexus version): <panel type="info" icon="glyphicon glyphicon-file" title="nexus.service"> 
-BE6DJWInZPuo5j0AEQEAAbQxU29uYXR5cGUgQ29tbXVuaXR5IDxjb21tdW5pdHkt +<code bash> 
-Z3JvdXBAc29uYXR5cGUuY29tPokB1AQTAQoAPgIbAwULCQgHAgYVCgkICwIEFgID +[Unit] 
-AQIeAQIXgBYhBOd4iMdnFOvXGUAl6pZLXnIKpPMaBQJhGs7JBQkJaamJAAoJEJZL +Description=nexus service 
-XnIKpPMaLtQMAMthe85oV6QyyWyTqTMnI6Huotd6IXn97YsbL6AUNiE23x4UcF8B +After=network.target 
-nVkyaFmtIrSkV+W0Y9yuCmgUDDtXDbpOwaJeCPK8avTtUpKojRPManh4+K9MK94i +   
-NkzxbWWGjb2wgbGdSDPuFeAW3dnd+eeC9+5iYtnhUYzcnKFvtnE1g9comzpvmZhD +[Service] 
-cyAS5+Kp/bP8sT3Sk51tlnBnYCZuXs30lCiOGUie8UM5JJeCMK/ppugPFa5DOwVb +Type=forking 
-HGRqCDjWcKdnEYG1c2KUYPVsWZ/5Feqg4PXXDwZbrRWoCWj34omX597RYFKQR7sT +Environment="NEXUS_SECRETS_KEY_FILE=/opt/sonatype-work/nexus3/keystores/nexus.secrets.json" 
-4pUjwmyl65iIf9jdDerPqSAIkrCaXGdZz1rqC3Fvn7xZm3CRyaQwUgf9pwO4kjFo +LimitNPROC=65536 
-neaYSW5P0f37fbAuH4n7c8s/8khFe8ljnKs4ivxQErZMACyddW0ZjJvReD9uBczI +LimitNOFILE=65536 
-mgYLA3rarP9fxwwGVCa0IIPchGAeUG53QSby18m3M4I2oKGJHpENGQZRsu7ArKQl +ExecStart=/opt/nexus-<version>/bin/nexus start 
-e1dx2e2gUr5OgbkBjQRdVL/AAQwAr11CHfZ6KBi1IRH/Ca0jG7LonStBX2XUNvyA +ExecStop=/opt/nexus-<version>/bin/nexus stop  
-iz+IsFM8CAD8rGSzhgJO2Br/+u9KgyVczolmUlK1TvIzJUmNyUyc2p/WGYdzFs8K +User=nexus 
-UteSSa2zxNVMbjuePDKu+aThklVnBU//Q2HkqTNPXYklo4f+IzkCQg7A+jcT9BHB +Restart=on-abort 
-1JhNWhzan3IytpuypXJxX5Le0kXAhULeIiBM+UoGFGdblldVN7ieH5FOrDcbHcYu +TimeoutSec=600 
-RUNZRkwLSARawkc9g8f2omAvwFDzcqmvA3xjC3cQMEwBS0BdvsGwM18/0G8khR3E +   
-c03plCeWMaWEfYh0infkP9twoH6XoI4dAyTOnf7w11smIYCBjc07VOUtraRfGkjQ +[Install] 
-5TXfmPC5LVBo8OXLhkcmpYQwFHnncqFzzK20iGM1plc758Enwzx2elGVhXdw5upF +WantedBy=multi-user.target 
-LQUHYU29vHePRwlv/AGAjl+UzZWrE7IKNrphc1bKFsAHJZ0MisJu4BtHTGKcY6EZ +</code> 
-rmnGEW32iCvrZTWcwICRDWx77IZFABEBAAGJAbwEGAEKACYCGwwWIQTneIjHZxTr +</panel><code bash>cp nexus.service /etc/systemd/system</code><code bash>systemctl start nexus.service</code><code bash>systemctl enable nexus.service</code> 
-1xlAJeqWS15yCqTzGgUCYRrPpAUJCWmqZAAKCRCWS15yCqTzGiNODACh5Ho5RlBJ +  - When everything was successful, enter the webservice with ''<nowiki>http://<ip>:8081/</nowiki>'' 
-PQcsyaBpLkpzJvmY59Q7g50pAWd9GoLF0rnJi5jd7+senRwHYWig4H/9+01lx7fi +  - The password for ''admin'' is located under ''/opt/sonatype/sonatype-work/nexus3/admin.password'' after entering the password, it's forced to be changed.<code bash>cat /opt/sonatype/sonatype-work/nexus3/admin.password</code> The installation of Nexus is now finished!
-7sI2Cd96xXV01pp6OpopR346IvbiNOPzk6ngpFfFc90ujA5CrXjj+lMl5VzV3QOO +
-nVHOvFXkT0wMloHq8MdYzkLFuSETEcEdvKM9E5yXhUo0BCC60G+YZTvMuITvAw4i +
-5xBnLIdKHmOXZhCq3ChtwFf/hXhGH7Xf5F9pHPmHx6tC7+uJ0Tovpk7Jd42YLtHT +
-RMH/Q39OxFfGHOIvrzuHa6cpKaBlE0/Zqs9DGJE7pKetyWA5aRNWElGFWFgOsE0j +
-0duTbAh/xyvAb9LF2F2XP21EoCmA3mHd2/SVMQfenvk9i8VcB5KBZYKt5kvsoFvy +
-5YA5ENG8dtMQDyfV3dhUWpzghOOgOof05fp/JUNdHTEHbjh57yj+W04KNsPAl84E +
-dq6/peJdFjJp7dHV94yQjv1O4OcNtriD2kTBtucc+XswPSFgyeoR8tQ= +
-=1ghU +
------END PGP PUBLIC KEY BLOCK-----</code> +
-  - Then update the repositories: <code bash>sudo apt update</code> +
-  - And install Nexus3: <code bash>sudo apt install nexus-repository-manager</code> +
-  - When everything was successful, enter the webservice with <nowiki>http://<ip>:8081/</nowiki> +
-  - The password for ''admin'' is located under ''/opt/sonatype/sonatype-work/nexus3/admin.password'' after entering the password, it's forced to be changed.<code bash>cat /opt/sonatype/sonatype-work/nexus3/admin.password</code> The setup of Nexus is now finished!+
  
 +==== Setup Repository ====
  
 +=== NuGet Proxy ===
 +To add a new NuGet (Chocolatey) repository proxy add a new ''nuget (proxy)''. To proxy the official Chocolatey repository add the following URL as URL: 
 +<code bash>https://community.chocolatey.org/api/v2/</code>
 +Finally save the proxy repository.
 +
 +=== NuGet Hosted ===
 +If the repository should also host packages locally add a new ''nuget (hosted)''
 +<panel><WRAP center todo>This section will be extended later.</WRAP></panel>
 +
 +=== NuGet Group ===
 +To make the proxy-repository and all local hosted packages available through one URL, add a ''nuget-group'' on the repository tab. Then add both ''nuget-proxy'' and ''nuget-hosted'' to the group.
 +
 +=== APT Repository (hosted) ===
 +  - Firstly create a GPG-Key for signing the release file: 
 +  - Therefore install ''gpg'' and generate a key with <code bash>gpg --gen-key</code>. Then export the key with to paste it under ''APT Settings'': <code bash>gpg --export-secret-key --armor <KEY-ID> > Key.gpg</code>   
 +  - If your key is password-secured enter the passphrase in the field below.
 +  - Then add the name above e.g. ''apt'', and set the distribution e.g. to ''stable''
 +  - It's then recommended to upload the public-release-key to a RAW storage to make it easy to download. Therefore export the public key with: <code bash>gpg --armor --export <KEY-ID> > Key.gpg</code>
 +  - Finally add the repo to APT: <code bash>echo "deb [signed-by=/usr/share/keyrings/your-repo.gpg] https://<your-repo>/repository/apt/ stable main" | sudo tee /etc/apt/sources.list.d/<your-repo>.list</code>
 +  - And add the key: <code bash>curl -sS https://<your-repo>/repository/storage/ReleaseKey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/<your-repo>.gpg > /dev/null</code>
 +  - Finished!
 +
 +-----
 //Sourced from:// //Sourced from://
   * //[[https://github.com/sonatype-nexus-community/nexus-repository-installer|github.com/sonatype-nexus-community]]//   * //[[https://github.com/sonatype-nexus-community/nexus-repository-installer|github.com/sonatype-nexus-community]]//
  • windows/chocolatey/setup-self-hosted-choco-repo.1715513807.txt.gz
  • Last modified: 2024/05/12 13:36
  • by Zyzonix