Both sides previous revision Previous revision Next revision | Previous revision |
windows:chocolatey:setup-self-hosted-choco-repo [2023/12/19 08:12] – ↷ Page name changed from windows:chocolatey:setup-self-hostet-choco-repo to windows:chocolatey:setup-self-hosted-choco-repo Zyzonix | windows:chocolatey:setup-self-hosted-choco-repo [2025/02/11 08:10] (current) – old revision restored (2025/02/11 08:09) Zyzonix |
---|
===== Setup self hosted Chocolatey Repository on Linux ===== | ===== Setup self hosted Chocolatey Repository/Proxy on Linux ===== |
| |
<WRAP center todo> | 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. |
**Under construction** | |
</WRAP> | |
| ==== Installation ==== |
| |
| - Download Debian 12 Server from here: [[https://www.debian.org/distrib/|debian.org/distrib]] and install your machine. |
| - Install Java 17: <code bash>sudo apt install openjdk-17-jdk</code> |
| - Add user ''nexus'' to run Nexus3: <code bash>adduser nexus</code> |
| - Download the latest Nexus3 from ''https://help.sonatype.com/en/download.html'' |
| - Unpack it to ''/opt/'': <code bash>tar xzvf <downloaded-tar-package>.tar.gz -C /opt</code> |
| - Change owner of unpacked files: <code bash>chown nexus -R /opt/nexus-<version></code> |
| - Make binary executeable: <code bash>chmod +x /opt/nexus-<version>/bin/nexus</code> |
| - 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"> |
| <code bash> |
| [Unit] |
| Description=nexus service |
| After=network.target |
| |
| [Service] |
| Type=forking |
| Environment="NEXUS_SECRETS_KEY_FILE=/opt/sonatype-work/nexus3/keystores/nexus.secrets.json" |
| LimitNPROC=65536 |
| LimitNOFILE=65536 |
| ExecStart=/opt/nexus-<version>/bin/nexus start |
| ExecStop=/opt/nexus-<version>/bin/nexus stop |
| User=nexus |
| Restart=on-abort |
| TimeoutSec=600 |
| |
| [Install] |
| WantedBy=multi-user.target |
| </code> |
| </panel><code bash>cp nexus.service /etc/systemd/system</code><code bash>systemctl start nexus.service</code><code bash>systemctl enable nexus.service</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 installation 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:// |
| * //[[https://github.com/sonatype-nexus-community/nexus-repository-installer|github.com/sonatype-nexus-community]]// |
| * //[[https://www.howtoforge.com/how-to-install-nexus-repository-manager-on-ubuntu-22-04/|howtoforge.com - install Nexus3 on Ubuntu22]]// |
| * //[[https://stackoverflow.com/questions/45867716/nexus-to-serve-up-chocolately-packages|stackoverflow.com - Nexus serve up chocolatey]]// |
| |