Nexus: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
 
(43 intermediate revisions by the same user not shown)
Line 1: Line 1:
<source lang="bash">
scp /Users/chorke/Downloads/nexus-3.22.1-02-unix.tar.gz [email protected]:~
cd /usr/local/
sudo tar -xvzf /home/pi/nexus-3.22.1-02-unix.tar.gz
sudo ln -s nexus-3.22.1-02 nexus
cd nexus/bin/
./nexus status
</source>
==CentOS==
<source lang="bash">
cd /opt; tar -xvzf nexus-3.22.1-02-unix.tar.gz
ln -s /opt/nexus-3.22.1-02 /var/nexus
mkdir /var/sonatype-work
vim /var/nexus/bin/nexus.rc
useradd nexus --shell=/sbin/nologin
chown -R nexus:nexus /var/sonatype-work
chown -R nexus:nexus /var/nexus
vim /var/nexus/bin/nexus.vmoptions
vim /etc/systemd/system/nexus.service
</source>
<source lang="ini">
[Unit]
Description=nexus service
After=network.target
[Service]
Type=forking
LimitNOFILE=65536
User=nexus
Group=nexus
ExecStart=/var/nexus/bin/nexus start
ExecStop=/var/nexus/bin/nexus stop
User=nexus
Restart=on-abort
[Install]
WantedBy=multi-user.target
</source>
<source lang="bash">
chkconfig nexus on
systemctl enable nexus
systemctl enable nexus.service
systemctl start nexus
</source>
==Docker==
===Config===
{|
{|
| valign="top" |
| valign="top" |
Line 59: Line 8:
  export NEXUS_HOME=$HOME/nexus
  export NEXUS_HOME=$HOME/nexus
|}
|}
===Volumes===
{| class="wikitable sortable"
{| class="wikitable sortable"
|-
|-
! Local location !! Container location  !! Usage
! Local location !! Container location  !! Usage
|-
|-
| <code>$NEXUS_HOME/nexus3/data</code> || <code>/nexus-data</code> || For storing nexus data
| <code>$NEXUS_HOME/nexus3/nexus-data</code> || <code>/nexus-data</code> || Nexus data
|}
|}
<syntaxhighlight lang="bash">
docker run -it --rm \
--env NEXUS_CONTEXT=nexus \
--publish 8081:8081 \
sonatype/nexus3:3.22.0 \
bin/bash
id; exit
</syntaxhighlight>


mkdir -p $NEXUS_HOME/nexus3/nexus-data/
chown -R 200:200 $NEXUS_HOME/nexus3/nexus-data/


<source lang="bash">
docker pull sonatype/nexus3:3.22.0
docker run -d -p 8081:8081 --name nexus sonatype/nexus3:3.22.0
docker run -d -p 8081:8081 --name nexus -e NEXUS_CONTEXT=nexus sonatype/nexus3:3.22.0
docker run -d -p 8081:8081 --name nexus -e NEXUS_CONTEXT=nexus sonatype/nexus3:3.22.1


==Docker==
<syntaxhighlight lang="bash" highlight="7,8">
docker run --detach \
--env NEXUS_CONTEXT=nexus \
--publish 8081:8081 \
--publish 8082:8082 \
--publish 8083:8083 \
--name nexus \
--restart always \
--volume $NEXUS_HOME/nexus3/nexus-data:/nexus-data \
sonatype/nexus3:3.26.0
</syntaxhighlight>
<syntaxhighlight lang="bash">
docker exec -it nexus bash
docker exec -it nexus bash
echo $(cat /nexus-data/admin.password)
echo $(cat /nexus-data/admin.password)
Line 81: Line 47:
docker start nexus
docker start nexus
docker stop nexus
docker stop nexus
</source>
docker logs nexus
</syntaxhighlight>


==Proxy for Https==
==Apache==
<source lang="apache" highlight="6">
<syntaxhighlight lang="apache" highlight="6">
<Location /nexus>
<Location /nexus>
     Order Allow,Deny
     Order Allow,Deny
Line 92: Line 59:
     RequestHeader set X-Forwarded-Proto "https"
     RequestHeader set X-Forwarded-Proto "https"
</Location>
</Location>
</source>
</syntaxhighlight>
 
<syntaxhighlight lang="bash">
touch /etc/apache2/sites-enabled/01-{hub,reg}.chorke.org.conf
touch /etc/apache2/sites-enabled/01-{hub,reg}.chorke.org-le-ssl.conf
mkdir -p /var/chorke/www/{hub,reg}.chorke.org/html/.well-known/acme-challenge/
</syntaxhighlight>


==Distribution==
==Group==
<source lang="xml">
===HTTP===
----
<syntaxhighlight lang="apache" highlight="3-5,27-30">
cat <<EOF >> /etc/apache2/sites-enabled/01-hub.chorke.org.conf
<VirtualHost *:80>
    ProxyRequests Off
    ProxyPreserveHost On
    AllowEncodedSlashes Off
 
    ServerAlias hub.chorke.org
    ServerAdmin [email protected]
    ServerName www.hub.chorke.org
    DocumentRoot /var/chorke/www/hub.chorke.org/html
    ErrorLog /var/chorke/www/hub.chorke.org/error.log
    CustomLog /var/chorke/www/hub.chorke.org/requests.log combined
 
    <Directory "/var/chorke/www/hub.chorke.org/">
        AllowOverride None
        Require all granted
    </Directory>
 
    <Directory "/var/chorke/www/hub.chorke.org/html">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
        Order allow,deny
        Allow from all
    </Directory>
 
    #RewriteEngine on
    #RewriteCond %{SERVER_NAME} =www.hub.chorke.org [OR]
    #RewriteCond %{SERVER_NAME} =hub.chorke.org
    #RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
EOF
</syntaxhighlight>
 
===HTTPS===
----
<syntaxhighlight lang="apache" highlight="4-7,12,29-35,37-40">
cat <<EOF >> /etc/apache2/sites-enabled/01-hub.chorke.org-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
    SSLProxyEngine On
    ProxyRequests Off
    ProxyPreserveHost On
    AllowEncodedSlashes Off
 
    ServerAlias hub.chorke.org
    ServerAdmin [email protected]
    ServerName www.hub.chorke.org
    DocumentRoot /var/chorke/www/hub.chorke.org/html
    ErrorLog /var/chorke/www/hub.chorke.org/error.log
    CustomLog /var/chorke/www/hub.chorke.org/requests.log combined
 
    <Directory "/var/chorke/www/hub.chorke.org/">
        AllowOverride None
        Require all granted
    </Directory>
 
    <Directory "/var/chorke/www/hub.chorke.org/html">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
        Order allow,deny
        Allow from all
    </Directory>
 
    <Location />
        Order Allow,Deny
        Allow from all
        ProxyPass http://localhost:8082/ nocanon
        ProxyPassReverse http://localhost:8082/
        RequestHeader set X-Forwarded-Proto "https"
    </Location>
 
    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/hub.chorke.org/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/hub.chorke.org/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/hub.chorke.org/chain.pem
</VirtualHost>
</IfModule>
EOF
</syntaxhighlight>
 
==Private==
===HTTP===
----
<syntaxhighlight lang="apache" highlight="3-5,27-30">
cat <<EOF >> /etc/apache2/sites-enabled/01-reg.chorke.org.conf
<VirtualHost *:80>
    ProxyRequests Off
    ProxyPreserveHost On
    AllowEncodedSlashes Off
 
    ServerAlias reg.chorke.org
    ServerAdmin [email protected]
    ServerName www.reg.chorke.org
    DocumentRoot /var/chorke/www/reg.chorke.org/html
    ErrorLog /var/chorke/www/reg.chorke.org/error.log
    CustomLog /var/chorke/www/reg.chorke.org/requests.log combined
 
    <Directory "/var/chorke/www/reg.chorke.org/">
        AllowOverride None
        Require all granted
    </Directory>
 
    <Directory "/var/chorke/www/reg.chorke.org/html">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
        Order allow,deny
        Allow from all
    </Directory>
 
    #RewriteEngine on
    #RewriteCond %{SERVER_NAME} =www.reg.chorke.org [OR]
    #RewriteCond %{SERVER_NAME} =reg.chorke.org
    #RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
EOF
</syntaxhighlight>
 
===HTTPS===
----
<syntaxhighlight lang="apache" highlight="4-7,12,29-35,37-40">
cat <<EOF >> /etc/apache2/sites-enabled/01-reg.chorke.org-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
    SSLProxyEngine On
    ProxyRequests Off
    ProxyPreserveHost On
    AllowEncodedSlashes Off
 
    ServerAlias reg.chorke.org
    ServerAdmin [email protected]
    ServerName www.reg.chorke.org
    DocumentRoot /var/chorke/www/reg.chorke.org/html
    ErrorLog /var/chorke/www/reg.chorke.org/error.log
    CustomLog /var/chorke/www/reg.chorke.org/requests.log combined
 
    <Directory "/var/chorke/www/reg.chorke.org/">
        AllowOverride None
        Require all granted
    </Directory>
 
    <Directory "/var/chorke/www/reg.chorke.org/html">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
        Order allow,deny
        Allow from all
    </Directory>
 
    <Location />
        Order Allow,Deny
        Allow from all
        ProxyPass http://localhost:8083/ nocanon
        ProxyPassReverse http://localhost:8083/
        RequestHeader set X-Forwarded-Proto "https"
    </Location>
 
    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/reg.chorke.org/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/reg.chorke.org/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/reg.chorke.org/chain.pem
</VirtualHost>
</IfModule>
EOF
</syntaxhighlight>
 
==Deploy==
<syntaxhighlight lang="xml">
<settings>
<settings>
     [...]
     [...]
Line 102: Line 247:
         <id>nex</id>
         <id>nex</id>
         <properties>
         <properties>
             <altSnapshotDeploymentRepository>snapshots::default::https://nex.chorke.org/repository/maven/snapshots</altSnapshotDeploymentRepository>
             <altSnapshotDeploymentRepository>academia.snapshots::default::https://nex.chorke.org/repository/maven/snapshots</altSnapshotDeploymentRepository>
             <altReleaseDeploymentRepository>releases::default::https://nex.chorke.org/repository/maven/releases</altReleaseDeploymentRepository>
             <altReleaseDeploymentRepository>academia.releases::default::https://nex.chorke.org/repository/maven/releases</altReleaseDeploymentRepository>
         </properties>
         </properties>
         </profile>
         </profile>
     </profiles>
     </profiles>
</settings>
</settings>
</source>
</syntaxhighlight>
 
==Debian==
<syntaxhighlight lang="bash" highlight="26,27">
cat <<EOF >> /etc/apt/sources.list.d/sonatype-community.list
deb [arch=all] https://repo.sonatype.com/repository/community-apt-hosted/ bionic main
#deb https://repo.sonatype.com/repository/community-apt-hosted/ bionic main
EOF
 
wget -qO - https://repo.sonatype.com/repository/community-hosted\
/pki/deb-gpg/DEB-GPG-KEY-Sonatype.asc|apt-key add -
 
apt update;\
apt list --upgradable;\
apt install nexus-repository-manager
 
NVM_OPS_FILE="/opt/sonatype/nexus3/bin/nexus.vmoptions";\
sed -i "s|-Djava.endorsed.dirs=lib/endorsed|-Djava.endorsed.dirs=lib/endorsed:/opt/sonatype/jna|" "$NVM_OPS_FILE";\
sed -i "s|-XX:MaxDirectMemorySize=2703m|-XX:MaxDirectMemorySize=2G|" "$NVM_OPS_FILE";\
sed -i "s|-Xms2703m|-Xms1200M|" "$NVM_OPS_FILE";\
sed -i "s|-Xmx2703m|-Xmx1200M|" "$NVM_OPS_FILE"
 
mkdir -p /opt/sonatype/jna;cd /opt/sonatype/jna;\
wget https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.6.0/jna-5.6.0.jar;\
wget https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform/5.6.0/jna-platform-5.6.0.jar;\
chmod +x /opt/sonatype/jna/*;\
cd /opt/sonatype/
 
service nexus-repository-manager restart
tail -n 50  -f /opt/sonatype/sonatype-work/nexus3/log/nexus.log
echo $(cat /opt/sonatype/sonatype-work/nexus3/admin.password)
netstat -plnt|grep 8081
</syntaxhighlight>
 
<syntaxhighlight lang="bash" highlight="3,4">
# pios swap memory
printf '\nbefore:\n';free -th;\
sed -i "s|CONF_SWAPSIZE=100|CONF_SWAPSIZE=2048|" /etc/dphys-swapfile;\
service dphys-swapfile restart;\
printf '\nupdate:\n';free -th
</syntaxhighlight>
 
==Context Path==
<code>nano /opt/sonatype/nexus3/etc/nexus-default.properties</code>
 
<syntaxhighlight lang="bash" start="3" highlight="5" line>
# Jetty section
application-port=8081
application-host=0.0.0.0
nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml
nexus-context-path=/nexus
</syntaxhighlight>


==References==
==References==
Line 127: Line 323:
* [https://support.sonatype.com/hc/en-us/articles/115013153887-Docker-Repository-Configuration-and-Client-Connection Docker Repository Configuration and Client Connection]
* [https://support.sonatype.com/hc/en-us/articles/115013153887-Docker-Repository-Configuration-and-Client-Connection Docker Repository Configuration and Client Connection]
* [https://blog.sonatype.com/how-to-get-started-with-nexus-repository-manager-oss Getting Start With Nexus Repository Manager OSS]
* [https://blog.sonatype.com/how-to-get-started-with-nexus-repository-manager-oss Getting Start With Nexus Repository Manager OSS]
* [https://blog.sonatype.com/using-nexus-3-as-your-repository-part-2-npm-packages Configure Nexus 3 as Private NPM Repository]
* [https://devopscube.com/how-to-install-latest-sonatype-nexus-3-on-linux/ Install Latest Sonatype Nexus 3 on Linux]
* [https://devopscube.com/how-to-install-latest-sonatype-nexus-3-on-linux/ Install Latest Sonatype Nexus 3 on Linux]
* [https://www.sonatype.com/download-oss-sonatype Download Nexus Repository OSS]
* [https://www.sonatype.com/download-oss-sonatype Download Nexus Repository OSS]
* [https://help.sonatype.com/repomanager2/managing-maven-settings/nexus-m2settings-maven-plugin Nexus M2Settings Maven Plugin]
* [https://help.sonatype.com/repomanager2/managing-maven-settings/nexus-m2settings-maven-plugin Nexus M2Settings Maven Plugin]
* [https://docs.docker.com/storage/volumes/ Managing Data in Containers]
* [https://hub.docker.com/r/sonatype/nexus3 Sonatype Nexus3 Docker]
* [https://hub.docker.com/r/sonatype/nexus3 Sonatype Nexus3 Docker]
* [https://help.sonatype.com/repomanager3/system-requirements System Requirements]
* [https://help.sonatype.com/repomanager3/system-requirements System Requirements]
Line 137: Line 333:


| valign="top" |
| valign="top" |
* [https://hub.docker.com/r/sonatype/nexus3/ Docker HUB for Sonatype Nexus3]
* [https://medium.com/@arnobroekhof/using-sonatype-nexus-3-as-backend-provider-for-terraform-41e16d275fd7 Configure Nexus TF State Private Repository]
* [https://blog.sonatype.com/using-nexus-3-as-your-repository-part-3-docker-images Configure Nexus Docker Private Repository]
* [https://blog.sonatype.com/using-nexus-3-as-your-repository-part-1-maven-artifacts Configure Nexus Maven Private Repository]
* [https://blog.sonatype.com/using-nexus-3-as-your-repository-part-2-npm-packages Configure Nexus NPM Private Repository]
* [[Raspberry Pi Apache2 Lets Encrypt SSL]]
* [[Virtual Host And Certbot in Raspbian 10]]
* [[Virtual_Host_And_Certbot_in_RHEL7]]
* [[Nexus:Maven|Nexus Maven Repository]] 🟢
* [[Nexus:Docker|Nexus Docker Registry]] 🟢
* [[Nexus:NPM|Nexus NPM Registry]] 🟢
 
|}
----
{|
| valign="top" |
* [https://stackoverflow.com/questions/41611671/ <code>altDeploymentRepository</code> vs. <code>altReleaseDeploymentRepository</code>]
* [https://help.sonatype.com/repomanager3/installation/configuring-the-runtime-environment#ConfiguringtheRuntimeEnvironment-ChangingtheContextPath Configuring Nexus 3 Repository Manager Context Path]
* [https://help.sonatype.com/repomanager2/installing-and-running/configuring-nexus-repository-manager-as-a-service Configuring Nexus 2 Repository Manager as a Service]
* [https://help.sonatype.com/repomanager3/installation/system-requirements Nexus 3 System Requirements]
* [http://bhamail.github.io/pinexus/nexussetup.html PiOS Nexus 3 Setup]
* [https://help.sonatype.com/repomanager3/download Nexus 3 Download]
* [https://help.sonatype.com/repomanager3/nexus-repository-administration/formats/helm-repositories Helm Repositories]
* [[Maven]]


|}
|}

Latest revision as of 04:19, 17 July 2024

Linux:
export NEXUS_HOME=/srv/nexus
MacOS:
export NEXUS_HOME=$HOME/nexus
Local location Container location Usage
$NEXUS_HOME/nexus3/nexus-data /nexus-data Nexus data
docker run -it --rm \
--env NEXUS_CONTEXT=nexus \
--publish 8081:8081 \
sonatype/nexus3:3.22.0 \
bin/bash
id; exit
mkdir -p $NEXUS_HOME/nexus3/nexus-data/
chown -R 200:200 $NEXUS_HOME/nexus3/nexus-data/


Docker

docker run --detach \
--env NEXUS_CONTEXT=nexus \
--publish 8081:8081 \
--publish 8082:8082 \
--publish 8083:8083 \
--name nexus \
--restart always \
--volume $NEXUS_HOME/nexus3/nexus-data:/nexus-data \
sonatype/nexus3:3.26.0
docker exec -it nexus bash
echo $(cat /nexus-data/admin.password)
exit

docker start nexus
docker stop nexus
docker logs nexus

Apache

<Location /nexus>
    Order Allow,Deny
    Allow from all
    ProxyPass http://localhost:8081/nexus nocanon
    ProxyPassReverse http://localhost:8081/nexus
    RequestHeader set X-Forwarded-Proto "https"
</Location>
touch /etc/apache2/sites-enabled/01-{hub,reg}.chorke.org.conf
touch /etc/apache2/sites-enabled/01-{hub,reg}.chorke.org-le-ssl.conf
mkdir -p /var/chorke/www/{hub,reg}.chorke.org/html/.well-known/acme-challenge/

Group

HTTP


cat <<EOF >> /etc/apache2/sites-enabled/01-hub.chorke.org.conf
<VirtualHost *:80>
    ProxyRequests Off
    ProxyPreserveHost On
    AllowEncodedSlashes Off

    ServerAlias hub.chorke.org
    ServerAdmin [email protected]
    ServerName www.hub.chorke.org
    DocumentRoot /var/chorke/www/hub.chorke.org/html
    ErrorLog /var/chorke/www/hub.chorke.org/error.log
    CustomLog /var/chorke/www/hub.chorke.org/requests.log combined

    <Directory "/var/chorke/www/hub.chorke.org/">
        AllowOverride None
        Require all granted
    </Directory>

    <Directory "/var/chorke/www/hub.chorke.org/html">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
        Order allow,deny
        Allow from all
    </Directory>

    #RewriteEngine on
    #RewriteCond %{SERVER_NAME} =www.hub.chorke.org [OR]
    #RewriteCond %{SERVER_NAME} =hub.chorke.org
    #RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
EOF

HTTPS


cat <<EOF >> /etc/apache2/sites-enabled/01-hub.chorke.org-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
    SSLProxyEngine On
    ProxyRequests Off
    ProxyPreserveHost On
    AllowEncodedSlashes Off

    ServerAlias hub.chorke.org
    ServerAdmin [email protected]
    ServerName www.hub.chorke.org
    DocumentRoot /var/chorke/www/hub.chorke.org/html
    ErrorLog /var/chorke/www/hub.chorke.org/error.log
    CustomLog /var/chorke/www/hub.chorke.org/requests.log combined

    <Directory "/var/chorke/www/hub.chorke.org/">
        AllowOverride None
        Require all granted
    </Directory>

    <Directory "/var/chorke/www/hub.chorke.org/html">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
        Order allow,deny
        Allow from all
    </Directory>

    <Location />
        Order Allow,Deny
        Allow from all
        ProxyPass http://localhost:8082/ nocanon
        ProxyPassReverse http://localhost:8082/
        RequestHeader set X-Forwarded-Proto "https"
    </Location>

    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/hub.chorke.org/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/hub.chorke.org/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/hub.chorke.org/chain.pem
</VirtualHost>
</IfModule>
EOF

Private

HTTP


cat <<EOF >> /etc/apache2/sites-enabled/01-reg.chorke.org.conf
<VirtualHost *:80>
    ProxyRequests Off
    ProxyPreserveHost On
    AllowEncodedSlashes Off

    ServerAlias reg.chorke.org
    ServerAdmin [email protected]
    ServerName www.reg.chorke.org
    DocumentRoot /var/chorke/www/reg.chorke.org/html
    ErrorLog /var/chorke/www/reg.chorke.org/error.log
    CustomLog /var/chorke/www/reg.chorke.org/requests.log combined

    <Directory "/var/chorke/www/reg.chorke.org/">
        AllowOverride None
        Require all granted
    </Directory>

    <Directory "/var/chorke/www/reg.chorke.org/html">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
        Order allow,deny
        Allow from all
    </Directory>

    #RewriteEngine on
    #RewriteCond %{SERVER_NAME} =www.reg.chorke.org [OR]
    #RewriteCond %{SERVER_NAME} =reg.chorke.org
    #RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
EOF

HTTPS


cat <<EOF >> /etc/apache2/sites-enabled/01-reg.chorke.org-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
    SSLProxyEngine On
    ProxyRequests Off
    ProxyPreserveHost On
    AllowEncodedSlashes Off

    ServerAlias reg.chorke.org
    ServerAdmin [email protected]
    ServerName www.reg.chorke.org
    DocumentRoot /var/chorke/www/reg.chorke.org/html
    ErrorLog /var/chorke/www/reg.chorke.org/error.log
    CustomLog /var/chorke/www/reg.chorke.org/requests.log combined

    <Directory "/var/chorke/www/reg.chorke.org/">
        AllowOverride None
        Require all granted
    </Directory>

    <Directory "/var/chorke/www/reg.chorke.org/html">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
        Order allow,deny
        Allow from all
    </Directory>

    <Location />
        Order Allow,Deny
        Allow from all
        ProxyPass http://localhost:8083/ nocanon
        ProxyPassReverse http://localhost:8083/
        RequestHeader set X-Forwarded-Proto "https"
    </Location>

    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/reg.chorke.org/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/reg.chorke.org/privkey.pem
    SSLCertificateChainFile /etc/letsencrypt/live/reg.chorke.org/chain.pem
</VirtualHost>
</IfModule>
EOF

Deploy

<settings>
    [...]
    <profiles>
        <profile>
        <id>nex</id>
        <properties>
            <altSnapshotDeploymentRepository>academia.snapshots::default::https://nex.chorke.org/repository/maven/snapshots</altSnapshotDeploymentRepository>
            <altReleaseDeploymentRepository>academia.releases::default::https://nex.chorke.org/repository/maven/releases</altReleaseDeploymentRepository>
        </properties>
        </profile>
    </profiles>
</settings>

Debian

cat <<EOF >> /etc/apt/sources.list.d/sonatype-community.list
deb [arch=all] https://repo.sonatype.com/repository/community-apt-hosted/ bionic main
#deb https://repo.sonatype.com/repository/community-apt-hosted/ bionic main
EOF

wget -qO - https://repo.sonatype.com/repository/community-hosted\
/pki/deb-gpg/DEB-GPG-KEY-Sonatype.asc|apt-key add -

apt update;\
apt list --upgradable;\
apt install nexus-repository-manager

NVM_OPS_FILE="/opt/sonatype/nexus3/bin/nexus.vmoptions";\
sed -i "s|-Djava.endorsed.dirs=lib/endorsed|-Djava.endorsed.dirs=lib/endorsed:/opt/sonatype/jna|" "$NVM_OPS_FILE";\
sed -i "s|-XX:MaxDirectMemorySize=2703m|-XX:MaxDirectMemorySize=2G|" "$NVM_OPS_FILE";\
sed -i "s|-Xms2703m|-Xms1200M|" "$NVM_OPS_FILE";\
sed -i "s|-Xmx2703m|-Xmx1200M|" "$NVM_OPS_FILE"

mkdir -p /opt/sonatype/jna;cd /opt/sonatype/jna;\
wget https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.6.0/jna-5.6.0.jar;\
wget https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform/5.6.0/jna-platform-5.6.0.jar;\
chmod +x /opt/sonatype/jna/*;\
cd /opt/sonatype/

service nexus-repository-manager restart
tail -n 50  -f /opt/sonatype/sonatype-work/nexus3/log/nexus.log
echo $(cat /opt/sonatype/sonatype-work/nexus3/admin.password)
netstat -plnt|grep 8081
# pios swap memory
printf '\nbefore:\n';free -th;\
sed -i "s|CONF_SWAPSIZE=100|CONF_SWAPSIZE=2048|" /etc/dphys-swapfile;\
service dphys-swapfile restart;\
printf '\nupdate:\n';free -th

Context Path

nano /opt/sonatype/nexus3/etc/nexus-default.properties

# Jetty section
application-port=8081
application-host=0.0.0.0
nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml
nexus-context-path=/nexus

References

  1. RubyGems
  2. Composer
  3. Conan
  4. Docker
  5. Maven
  6. NuGet
  7. PyPI
  8. apt
  9. npm
  10. yum