$ tar -xf ~/Downloads/nexus-3.18.0-01-unix.tar.gz -C /opt/
$ sudo chmod -R 755 /opt/nexus-3.18.0-01/ $ sudo chown -R mtitek:mtitek /opt/nexus-3.18.0-01/ $ sudo chmod -R 755 /opt/sonatype-work/ $ sudo chown -R mtitek:mtitek /opt/sonatype-work/
$ sudo ln -s /opt/nexus-3.18.0-01/ /opt/nexus $ sudo chown -R mtitek:mtitek /opt/nexus
$ vi /opt/nexus/bin/nexus run_as_user='mtitek'
$ vi .profile export NEXUS_HOME=/opt/nexus export PATH=$PATH:$NEXUS_HOME/bin
$ source ~/.profile
$ /opt/nexus/bin/nexus start
Usage: /opt/nexus/bin/nexus {start|stop|run|run-redirect|status|restart|force-reload}
$ ls -al /opt/sonatype-work/nexus3/log
Server administration and configuration
" page you must "Sign In
".admin
" password can be found in this file: "/opt/sonatype-work/nexus3/admin.password
"mirror
" element (inside element <mirrors>
):<mirror> <id>nexus</id> <mirrorOf>*</mirrorOf> <url>http://localhost:8081/repository/maven-public/</url> </mirror>
server
" elements for Snapshots/Releases (inside element <servers>
)
You can define only one if you want to use one configuration for both snapshots and releases.
The default "admin
" password can be found in this file: "/opt/sonatype-work/nexus3/admin.password
"<server> <id>httpNexusSnapshots</id> <username>admin</username> <password>admin</password> </server> <server> <id>httpNexusReleases</id> <username>admin</username> <password>admin</password> </server>
profile
" element for nexus repositories (inside element <profiles>
):<profile> <id>nexus</id> <repositories> <repository> <id>central</id> <url>http://central</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>central</id> <url>http://central</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile>
activeProfile
" element:<activeProfiles> <activeProfile>nexus</activeProfile> </activeProfiles>
$ sudo mkdir /data/workspace $ sudo chmod -R 755 /data/workspace/ $ sudo chown -R mtitek:mtitek /data/workspace/
mvn archetype:generate
" to create the maven project:$ cd /data/workspace/ $ mvn archetype:generate \ -DarchetypeGroupId=org.apache.maven.archetypes \ -DarchetypeArtifactId=maven-archetype-quickstart \ -DarchetypeVersion=1.4 \ -DgroupId=mtitek.nexus.test \ -DartifactId=mtitek-nexus-test-a \ -Dpackage=mtitek.nexus.test \ -Dversion=1.0.0-SNAPSHOT \ -DinteractiveMode=false
pom.xml
" file of the project "mtitek-nexus-test-a
".distributionManagement
" element to configure the nexus repositories Snapshots and Releases:$ cd /data/workspace/mtitek-nexus-test-a/ $ vi pom.xml
<distributionManagement> <snapshotRepository> <id>httpNexusSnapshots</id> <name>Snapshots repository</name> <url>http://localhost:8081/repository/maven-snapshots</url> </snapshotRepository> <repository> <id>httpNexusReleases</id> <name>Releases repository</name> <url>http://localhost:8081/repository/maven-releases</url> </repository> </distributionManagement>
$ mvn deploy
[INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) @ mtitek-nexus-test-a --- Uploading to httpNexusSnapshots: http://localhost:8081/repository/maven-snapshots/mtitek/nexus/test/mtitek-nexus-test-a/1.0.0-SNAPSHOT/mtitek-nexus-test-a-1.0.0-20161119.020742-1.jar Uploading to httpNexusSnapshots: http://localhost:8081/repository/maven-snapshots/mtitek/nexus/test/mtitek-nexus-test-a/1.0.0-SNAPSHOT/mtitek-nexus-test-a-1.0.0-20161119.020742-1.pom Uploading to httpNexusSnapshots: http://localhost:8081/repository/maven-snapshots/mtitek/nexus/test/mtitek-nexus-test-a/1.0.0-SNAPSHOT/maven-metadata.xml Uploading to httpNexusSnapshots: http://localhost:8081/repository/maven-snapshots/mtitek/nexus/test/mtitek-nexus-test-a/maven-metadata.xml
$ sudo mkdir /data/nexus-repositories /data/nexus-repositories/snapshots /data/nexus-repositories/releases $ sudo chmod -R 775 /data/nexus-repositories $ sudo chown -R mtitek:mtitek /data/nexus-repositories
admin
").Server administration and configuration
" link.Repository
" link.Blob Stores
" link.Create blob store
" button.Type
" and enter a "Name
" and a "Path
" for the blob store.Create blob store
" button to save your configuration.Type: File Name: nexus-repositories-snapshots Path: /data/nexus-repositories/snapshots
Type: File Name: nexus-repositories-releases Path: /data/nexus-repositories/releases
Server administration and configuration
" link.Repository
" link.Repositories
" link.Create repository
" button.maven2 (hosted)
" link.Name
" and Select the "Version policy
" and a "Blob store
" for the repository.Create repository
" button to save your configuration.Name: nexus-repositories-snapshots Version policy: Snapshot Blob store: nexus-repositories-snapshots
Name: nexus-repositories-releases Version policy: Release Blob store: nexus-repositories-releases
yes
|no
Disable redeploy
|Allow redeploy
|Read-only
$ cd /data/workspace/mtitek-nexus-test-a/ $ vi pom.xml
<distributionManagement> <snapshotRepository> <id>httpNexusSnapshots</id> <name>Snapshots repository</name> <url>http://localhost:8081/repository/nexus-repositories-snapshots/</url> </snapshotRepository> <repository> <id>httpNexusReleases</id> <name>Releases repository</name> <url>http://localhost:8081/repository/nexus-repositories-releases/</url> </repository> </distributionManagement>
mvn deploy