NEXUS SETUP AND INTEGRATED TO JENKINS
STEP-1: LAUNCH INSTANCE WITH T2.MEDIUM AND 8081 PORT
STEP-2: INSTALL JAVA1.8.0 AS THE NEXUS DEPENDENCY
STEP-3: CREATE A FOLDER (mkdir /app)
SETP-4: GO TO FOLDER (cd /app)
STEP-5: DOWNLOAD THE NEUXS (sudo wget -O nexus.tar.gz
https://download.sonatype.com/nexus/3/latest-unix.tar.gz)
STEP-6: UNTAR THE FILE (tar -zxvf filename)
STEP-7: RENAME THE NEXUS FILE (from nexus-3* to nexus)
STEP-8: ADD NEXUS USER (useradd nexus)
STEP-9: CHANGE THE OWNERS OF THE FILES (chmod -R nexus:nexus file_names)
STEP-10: CHANGE nexus.rc file (vim nexux/bin/nexus.rc)
run_as_user="nexus"
STEP-11: WRITE A SCRIPT TO RUN NEXUS (vi /etc/systemd/system/nexus.service)
[Unit]
Description=nexus service
After=network.target
[Service]
Type=forking
LimitNOFILE=65536
User=nexus
Group=nexus
ExecStart=/app/nexus/bin/nexus start
ExecStop=/app/nexus/bin/nexus stop
User=nexus
Restart=on-abort
[Install]
WantedBy=multi-user.target
STEP-12: CHECK THE CONFIGURATION (chkconfig nexus on)
STEP-13: START THE NEXUS (systemctl start nexus)
STEP-14: CHECK THE STATUS (systemctl status nexus)
STEP-15: CONNECT TO NEXUS (public:8081)
AFTER LOGIN INTO NEXUS SIGN OUT FROM THE DASHBOARD, BECAUSE THAT IS THE
DEFAULT PAGE, WE NEED TO CREATE OUR BY OWN
CLICK ON SIGN-IN
IT WILL ASKS THE USER NAME & PASSWORD
USERNAME: admin
PASSWORD: cat /app/sonatype-work/nexus3/admin.password
use this command in our server to get the password and paste it into our nexus dashboard
NOW GO TO SERVER ADMINISTRATION AND CONFIGURATION
SELECT REPOSITORIES
SELECT CREATE-REPOSITORY
SELECT MAVEN2(HOSTED)
GIVE REPOSITORY NAME AS myapp-releases and click on create repositories
now you can see our repository created in dashboard
NOW GO TO JENKINS AND INSTALL PLUGIN "nexus artifactory uploader"
GO TO MANAGE JENKINS AND CONFIGURE JENKINS
GO TO SONATYPE NEXUS
ADD CREDENTIALS :
and add description as nexus credentials
CLICK ON TEST CONNECTION, THEN YOU WILL SEE THE MESSAGE
NOW GO AND CREATE A JOB
GIT: URL OF OUR PROJECT
ADD BUILD STEP: invoke top-level maven targets
ADD BUILD STEP: Nexus artifact uploader
NOW GO TO POST BUILD ACTIONS: deploy war/ear to container
NOW SAVE AND BUILD THE JOB
IF THE BUILD GETS SUCCESS:
then we can see that war files are stored in nexus repository
==============================================================================================
Or or or or or or or or or or or or or or or
==============================================================================================
Install nexus platform plugin in jenkins
Go to jenkins —> configuration system —> nexus
Display name: nexus
Server-id: nexus-repo
Server url: public ip of nexus:8081
Credentials: ****
Test connection
Go to job:
Configure —>
Add a build step: Nexus Repository Manager Publisher
Nexus instance: auto update
Nexus-repo: sample-releases
packages:
Group: search in pom.xlm
Artifact id: search in pom.xlm
Version: search in pom.xlm
Package: war
Artifact:
File path: target/myweb-8.2.5.war
Extension: .war