Nexus: Difference between revisions
Jump to navigation
Jump to search
Line 124: | Line 124: | ||
mkdir -p /var/chorke/www/{hub,reg}.chorke.org/ | mkdir -p /var/chorke/www/{hub,reg}.chorke.org/ | ||
touch /etc/apache2/sites-enabled/01-{hub,reg}.chorke.org.conf | touch /etc/apache2/sites-enabled/01-{hub,reg}.chorke.org.conf | ||
touch /etc/apache2/sites-enabled/01-{hub,reg}.chorke.org-le-ssl.conf | |||
</source> | </source> | ||
===Group=== | ===Group=== | ||
'''HTTP:''' | |||
---- | |||
<source lang="apache"> | <source lang="apache"> | ||
cat <<EOF >> /etc/apache2/sites-enabled/01-hub.chorke.org.conf | cat <<EOF >> /etc/apache2/sites-enabled/01-hub.chorke.org.conf | ||
Line 135: | Line 138: | ||
ServerAlias hub.chorke.org | ServerAlias hub.chorke.org | ||
ServerAdmin [email protected] | |||
ServerName www.hub.chorke.org | 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 | |||
</source> | |||
'''HTTPS:''' | |||
---- | |||
<source lang="apache"> | |||
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] | 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 | ErrorLog /var/chorke/www/hub.chorke.org/error.log | ||
CustomLog /var/chorke/www/hub.chorke.org/requests.log combined | 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 /> | <Location /> | ||
Line 145: | Line 201: | ||
ProxyPass http://localhost:8082/ nocanon | ProxyPass http://localhost:8082/ nocanon | ||
ProxyPassReverse http://localhost:8082/ | ProxyPassReverse http://localhost:8082/ | ||
RequestHeader set X-Forwarded-Proto "https" | |||
</Location> | </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> | </VirtualHost> | ||
</IfModule> | |||
EOF | EOF | ||
</source> | </source> | ||
===Hosted=== | ===Hosted=== | ||
'''HTTP:''' | |||
---- | |||
<source lang="apache"> | <source lang="apache"> | ||
cat <<EOF >> /etc/apache2/sites-enabled/01-reg.chorke.org.conf | cat <<EOF >> /etc/apache2/sites-enabled/01-reg.chorke.org.conf | ||
Line 163: | Line 224: | ||
ServerAlias reg.chorke.org | ServerAlias reg.chorke.org | ||
ServerAdmin [email protected] | |||
ServerName www.reg.chorke.org | 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 | |||
</source> | |||
'''HTTPS:''' | |||
---- | |||
<source lang="apache"> | |||
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] | 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 | ErrorLog /var/chorke/www/reg.chorke.org/error.log | ||
CustomLog /var/chorke/www/reg.chorke.org/requests.log combined | 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 /> | <Location /> | ||
Line 173: | Line 286: | ||
ProxyPass http://localhost:8083/ nocanon | ProxyPass http://localhost:8083/ nocanon | ||
ProxyPassReverse http://localhost:8083/ | ProxyPassReverse http://localhost:8083/ | ||
RequestHeader set X-Forwarded-Proto "https" | |||
</Location> | </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> | </VirtualHost> | ||
</IfModule> | |||
EOF | EOF | ||
</source> | </source> |
Revision as of 18:12, 22 August 2020
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
CentOS
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
[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
chkconfig nexus on
systemctl enable nexus
systemctl enable nexus.service
systemctl start nexus
Docker
Config
Linux: export NEXUS_HOME=/srv/nexus |
MacOS: export NEXUS_HOME=$HOME/nexus |
Volume
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/
Local location | Container location | Usage |
---|---|---|
$NEXUS_HOME/nexus3/nexus-data |
/nexus-data |
For storing nexus data |
Install
docker pull sonatype/nexus3:3.26.0
docker run -d -p 8081:8081 --name nexus sonatype/nexus3:3.26.0
docker run -d -p 8081:8081 --name nexus -e NEXUS_CONTEXT=nexus sonatype/nexus3:3.26.0
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 logs nexus
docker exec -it nexus bash
echo $(cat /nexus-data/admin.password)
exit
docker start nexus
docker stop nexus
Proxy for Https
<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>
Proxy for Docker
mkdir -p /var/chorke/www/{hub,reg}.chorke.org/
touch /etc/apache2/sites-enabled/01-{hub,reg}.chorke.org.conf
touch /etc/apache2/sites-enabled/01-{hub,reg}.chorke.org-le-ssl.conf
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
Hosted
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
Distribution
<settings>
[...]
<profiles>
<profile>
<id>nex</id>
<properties>
<altSnapshotDeploymentRepository>snapshots::default::https://nex.chorke.org/repository/maven/snapshots</altSnapshotDeploymentRepository>
<altReleaseDeploymentRepository>releases::default::https://nex.chorke.org/repository/maven/releases</altReleaseDeploymentRepository>
</properties>
</profile>
</profiles>
</settings>