modify the nexus installation directory layout to match the recommend layout
This commit is contained in:
parent
7a468bd4b9
commit
ccbaa63b36
63
README.md
63
README.md
|
|
@ -112,26 +112,81 @@ You can also see them with `journalctl -u nexus`.
|
||||||
Nexus uses [OrientDB](https://en.wikipedia.org/wiki/OrientDB) as its database. To directly use it from the console run:
|
Nexus uses [OrientDB](https://en.wikipedia.org/wiki/OrientDB) as its database. To directly use it from the console run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
systemctl stop nexus
|
systemctl stop nexus # make sure nexus is not running while you use the database.
|
||||||
su nexus -s /bin/bash -c 'cd /opt/nexus && java -jar ./lib/support/nexus-orient-console.jar'
|
su -s /bin/bash nexus # switch to the nexus user.
|
||||||
|
nexus_home=/opt/nexus/nexus-3.13.0-01 # make sure you have the correct version here.
|
||||||
|
nexus_data=$nexus_home/../sonatype-work/nexus3
|
||||||
|
function orientdb-console {
|
||||||
|
java -jar $nexus_home/lib/support/nexus-orient-console.jar $*
|
||||||
|
}
|
||||||
|
cd $nexus_data
|
||||||
|
ls -laF db | grep ^d # list the databases
|
||||||
|
orientdb-console # start the console.
|
||||||
```
|
```
|
||||||
|
|
||||||
Then connect to one of the databases, e.g. to the `security` database:
|
Then connect to one of the databases, e.g. to the `security` database:
|
||||||
|
|
||||||
```plain
|
```plain
|
||||||
connect plocal:nexus3/db/security admin admin
|
connect plocal:db/security admin admin
|
||||||
```
|
```
|
||||||
|
|
||||||
Then execute some commands, e.g.:
|
Then execute some commands and exit the orientdb console, e.g.:
|
||||||
|
|
||||||
```plain
|
```plain
|
||||||
help
|
help
|
||||||
|
config
|
||||||
list classes
|
list classes
|
||||||
|
exit
|
||||||
|
```
|
||||||
|
|
||||||
|
Exit the nexus user shell:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
exit
|
||||||
|
```
|
||||||
|
|
||||||
|
And start nexus again:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
systemctl start nexus
|
||||||
```
|
```
|
||||||
|
|
||||||
For more information about the console see [Running the OrientDB Console](http://orientdb.com/docs/master/Tutorial-Run-the-console.html).
|
For more information about the console see [Running the OrientDB Console](http://orientdb.com/docs/master/Tutorial-Run-the-console.html).
|
||||||
|
|
||||||
|
## OrientDB Check Databases
|
||||||
|
|
||||||
|
Execute the commands from the OrientDB section to stop nexus, to enter the
|
||||||
|
nexus account and create the orientdb-console function, then:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# check the databases.
|
||||||
|
# NB use CHECK DATABASE -v to see the verbose log.
|
||||||
|
orientdb-console 'CONNECT PLOCAL:db/accesslog admin admin; CHECK DATABASE;'
|
||||||
|
orientdb-console 'CONNECT PLOCAL:db/analytics admin admin; CHECK DATABASE;'
|
||||||
|
orientdb-console 'CONNECT PLOCAL:db/audit admin admin; CHECK DATABASE;'
|
||||||
|
orientdb-console 'CONNECT PLOCAL:db/component admin admin; CHECK DATABASE;'
|
||||||
|
#orientdb-console 'CONNECT PLOCAL:db/component admin admin; REPAIR DATABASE;'
|
||||||
|
orientdb-console 'CONNECT PLOCAL:db/config admin admin; CHECK DATABASE;'
|
||||||
|
orientdb-console 'CONNECT PLOCAL:db/security admin admin; CHECK DATABASE;'
|
||||||
|
#orientdb-console 'CONNECT PLOCAL:db/OSystem admin admin; CONFIG; LIST CLASSES;' # XXX fails to connect. see https://groups.google.com/a/glists.sonatype.com/forum/#!topic/nexus-users/7dVofIwC5HM
|
||||||
|
```
|
||||||
|
|
||||||
|
Then start nexus.
|
||||||
|
|
||||||
|
## OrientDB Export Databases
|
||||||
|
|
||||||
|
Execute the commands from the OrientDB section to stop nexus, to enter the
|
||||||
|
nexus account and create the orientdb-console function, then:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# export the databases.
|
||||||
|
orientdb-console 'CONNECT PLOCAL:db/config admin admin; EXPORT DATABASE /tmp/nexus-export-config.json.gz;'
|
||||||
|
#orientdb-console 'CONNECT PLOCAL:db/security admin admin; EXPORT DATABASE /tmp/nexus-export-security.json.gz;'
|
||||||
|
orientdb-console 'CONNECT PLOCAL:db/component admin admin; EXPORT DATABASE /tmp/nexus-export-component.json.gz;'
|
||||||
|
|
||||||
|
|
||||||
## Reference
|
## Reference
|
||||||
|
|
||||||
* [How to reset a forgotten admin password in Nexus 3.x](https://support.sonatype.com/hc/en-us/articles/213467158-How-to-reset-a-forgotten-admin-password-in-Nexus-3-x)
|
* [How to reset a forgotten admin password in Nexus 3.x](https://support.sonatype.com/hc/en-us/articles/213467158-How-to-reset-a-forgotten-admin-password-in-Nexus-3-x)
|
||||||
|
* [Backup and Restore](https://help.sonatype.com/repomanager3/backup-and-restore)
|
||||||
|
* [Upgrading](https://help.sonatype.com/repomanager3/upgrading)
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,9 @@ install -d -o root -g nexus -m 750 /opt/nexus
|
||||||
pushd /opt/nexus
|
pushd /opt/nexus
|
||||||
# see http://www.sonatype.com/download-oss-sonatype
|
# see http://www.sonatype.com/download-oss-sonatype
|
||||||
# see https://help.sonatype.com/display/NXRM3
|
# see https://help.sonatype.com/display/NXRM3
|
||||||
nexus_tarball=nexus-3.13.0-01-unix.tar.gz
|
nexus_version=3.13.0-01
|
||||||
|
nexus_home=/opt/nexus/nexus-$nexus_version
|
||||||
|
nexus_tarball=nexus-$nexus_version-unix.tar.gz
|
||||||
nexus_download_url=https://sonatype-download.global.ssl.fastly.net/nexus/3/$nexus_tarball
|
nexus_download_url=https://sonatype-download.global.ssl.fastly.net/nexus/3/$nexus_tarball
|
||||||
nexus_download_sha1=baf74b6d61254fd409ca8a058f113c8e18e55b0f
|
nexus_download_sha1=baf74b6d61254fd409ca8a058f113c8e18e55b0f
|
||||||
wget -q $nexus_download_url
|
wget -q $nexus_download_url
|
||||||
|
|
@ -40,17 +42,15 @@ if [ "$(sha1sum $nexus_tarball | awk '{print $1}')" != "$nexus_download_sha1" ];
|
||||||
echo "downloaded $nexus_download_url failed the checksum verification"
|
echo "downloaded $nexus_download_url failed the checksum verification"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
tar xf $nexus_tarball --strip-components 1
|
tar xf $nexus_tarball # NB this creates the $nexus_home (e.g. nexus-3.13.0-01) and sonatype-work directories.
|
||||||
rm $nexus_tarball
|
rm $nexus_tarball
|
||||||
chmod 700 nexus3
|
|
||||||
chown -R nexus:nexus nexus3
|
|
||||||
install -d -o nexus -g nexus -m 700 .java # java preferences are saved here (the default java.util.prefs.userRoot preference).
|
install -d -o nexus -g nexus -m 700 .java # java preferences are saved here (the default java.util.prefs.userRoot preference).
|
||||||
install -d -o nexus -g nexus -m 700 nexus3/etc
|
install -d -o nexus -g nexus -m 700 sonatype-work/nexus3/etc
|
||||||
grep -v -E '\s*##.*' etc/nexus-default.properties >nexus3/etc/nexus.properties
|
chown -R nexus:nexus sonatype-work
|
||||||
sed -i -E 's,(application-host=).+,\1127.0.0.1,g' nexus3/etc/nexus.properties
|
grep -v -E '\s*##.*' $nexus_home/etc/nexus-default.properties >sonatype-work/nexus3/etc/nexus.properties
|
||||||
sed -i -E 's,nexus-pro-,nexus-oss-,g' nexus3/etc/nexus.properties
|
sed -i -E 's,(application-host=).+,\1127.0.0.1,g' sonatype-work/nexus3/etc/nexus.properties
|
||||||
diff -u etc/nexus-default.properties nexus3/etc/nexus.properties || true
|
sed -i -E 's,nexus-pro-,nexus-oss-,g' sonatype-work/nexus3/etc/nexus.properties
|
||||||
sed -i -E 's,\.\./sonatype-work/,,g' bin/nexus.vmoptions
|
diff -u $nexus_home/etc/nexus-default.properties sonatype-work/nexus3/etc/nexus.properties || true
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -64,7 +64,7 @@ fi
|
||||||
|
|
||||||
|
|
||||||
# start nexus.
|
# start nexus.
|
||||||
cat >/etc/systemd/system/nexus.service <<'EOF'
|
cat >/etc/systemd/system/nexus.service <<EOF
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Nexus
|
Description=Nexus
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
@ -73,8 +73,8 @@ After=network.target
|
||||||
Type=simple
|
Type=simple
|
||||||
User=nexus
|
User=nexus
|
||||||
Group=nexus
|
Group=nexus
|
||||||
ExecStart=/opt/nexus/bin/nexus run
|
ExecStart=$nexus_home/bin/nexus run
|
||||||
WorkingDirectory=/opt/nexus
|
WorkingDirectory=$nexus_home
|
||||||
Restart=on-abort
|
Restart=on-abort
|
||||||
LimitNOFILE=65536
|
LimitNOFILE=65536
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue