Showing posts with label artifactory. Show all posts
Showing posts with label artifactory. Show all posts

Wednesday, 15 September 2021

How to install Artifactory on a Centos Linux Machine

 Step 1

Launch a Centos 8 instance in AWS

Launch instance...select AWS Market...search for CentOS 8 (x86_64) - with Updates HVM






Launch instance and open Port 8081, 8082

We have clubbed all the commands and created a simple script to install the Jfrog on CentOS 8. The benefit of using script is that we can run all the steps just executing the script at one shot. And also we can keep the script and use at any/multiple time.

Step 2:  Log into the instance. Create a file, The vi editor are our favorite hence using same.

vi install_jfrog_centos8.sh

Paste the given below content and save the file.

#/bin/bash
#
# Install jfrog on CentOS 8
# Blog: https://sharadchhetri.com

# Disable the SELINUX on CentOS 8
# set temporary permissive selinux mode. reboot not require
sudo setenforce 0
# In next reboot,the below line will help to set disable selinux permanently.
sudo sed -i s/^SELINUX=.*$/SELINUX=disabled/ /etc/selinux/config

# jfrog oss 7.x require Java 11, installing wget and openjdk
sudo yum install -y wget java-11-openjdk*

# download jfrog repo and directly keep in /etc/yum.repos.d dir
sudo wget https://bintray.com/jfrog/artifactory-rpms/rpm -O /etc/yum.repos.d/bintray-jfrog-artifactory-oss-rpms.repo

# install jfrog-artifactory-oss (open source)
sudo yum install -y jfrog-artifactory-oss

# yaml files are indent sensitive. So do not remove spaces while copying. Keep as it is.
# creating system.yaml
cat <system.yaml
configVersion: 1
shared:
    extraJavaOpts: "-server -Xms512m -Xmx2g -Xss256k -XX:+UseG1GC"
    security:
    node:
    database:
EOF

# copying above created system.yaml and replacing by original one. It backup the original system.yaml file also.
sudo cp -brvf system.yaml /var/opt/jfrog/artifactory/etc/system.yaml

# enable artifactoyr.service as well as start the service at a same time
sudo systemctl enable --now artifactory


Step 2: Give executable permission to the script.

sudo chmod +x install_jfrog_centos8.sh

Step 3: Now execute the script.

sh install_jfrog_centos8.sh

You may get errors like below. Dont be alarmed. Arti factory is still installed



Step 4: Once the script is finished successfully, now open the web browser and hit the Jfrog IP address at port number 8081 and do the post setup.
Syntax: http://<-jfrog-ip-or-fqdn->:8081

For example, as per our jfrog server ip address in web browser we have typed http://192.168.33.10:8081. This will open the Jfrog Dashboard in web browser from where you can do the rest of the post setup. 

Username:admin

pswd: password

To again login in Jfrog, you can use Syntax: http://<-jfrog-ip-or-fqdn->:8081. Now you can easily manage the artifacts from Jfrog Artifactory. For DevOps, integerate the Jfrog Artifactory with CI/CD pipelines.










Thursday, 27 May 2021

How to Install Nexus on RedHat Linux

Nexus is binary repository manager, used for storing build artifacts. We will eventually integrate Nexus with Jenkins for uploading WAR/EAR/JAR files there.

Here are the steps for installing Sonatype Nexus 3 in RHEL in EC2 on AWS. Please create a new Redhat EC2 instance with small type. Choose Redhat Enterprise 8.



Pre-requisites:
Make sure you open port 8081 in AWS security group

Installation Steps:

sudo yum install wget -y






Download Open JDK
sudo yum install java-1.8.0-openjdk.x86_64 -y

Execute the below command to navigate to /opt directory by changing directory:
cd /opt

Download Nexus
sudo wget http://download.sonatype.com/nexus/3/nexus-3.23.0-03-unix.tar.gz

Extract Nexus
sudo tar -xvf nexus-3.23.0-03-unix.tar.gz
sudo mv nexus-3.23.0-03 nexus

Create a user called Nexus
sudo adduser nexus

Change the ownership of nexus files and nexus data directory to nexus user.
sudo chown -R nexus:nexus /opt/nexus
sudo chown -R nexus:nexus /opt/sonatype-work

Configure to run as Nexus user
change as below screenshot by removing # and adding nexus
 sudo vi /opt/nexus/bin/nexus.rc

Modify memory settings in Nexus configuration file
sudo vi /opt/nexus/bin/nexus.vmoptions

Modify the above file as shown in red highlighted section:










-Xms512m
-Xmx512m
-XX:MaxDirectMemorySize=512m
after making changes, press wq! to come out of the file.

Configure Nexus to run as a service

sudo vi /etc/systemd/system/nexus.service
Copy the below content highlighted in green color.

[Unit]
Description=nexus service
After=network.target
[Service]
Type=forking
LimitNOFILE=65536
User=nexus
Group=nexus
ExecStart=/opt/nexus/bin/nexus start
ExecStop=/opt/nexus/bin/nexus stop
User=nexus
Restart=on-abort
[Install]
WantedBy=multi-user.target

Create a link to Nexus
sudo ln -s /opt/nexus/bin/nexus /etc/init.d/nexus

Execute the following command to add nexus service to boot.

sudo chkconfig --add nexus
sudo chkconfig --levels 345 nexus on

Start Nexus
sudo service nexus start







Check whether Nexus service is running
sudo service nexus status

Check the logs to see if Nexus is running
tail -f /opt/sonatype-work/nexus3/log/nexus.log

You will see Nexus started..
If you Nexus stopped, review the steps above.

Now press Ctrl C to come out of this windows.

Once Nexus is successfully installed, you can access it in the browser by URL - http://public_dns_name:8081

Click on Sign in link
user name is admin and password can be found by executing below command:

sudo cat /opt/sonatype-work/nexus3/admin.password



Copy the password and click sign in.
Now setup admin password as admin123

you should see the home page of Nexus:


Please follow steps for integrating Nexus with Jenkins

Thursday, 17 September 2020

How to integrate Artifactory to Jenkins and publish artifact to Artifactory

 

Integrate Artifactory with Jenkins - Upload Artifacts from Jenkins to Artifactory - How to Integrate Jenkins with Artifactory

You can install plug-in called Artifact plug-in to integrate Artifactory with Jenkins. Let us see how to integrate Jenkins with Artifactory and able to upload War/Ear/Jar/Exe/DLLs using Maven.




Pre-requistes:
Install Artifactory plugin in Jenkins.



Make sure Maven 3 is also configured under Manage Jenkins--> Global Tool configuration
Enter Name as Maven3
/usr/share/maven as MAVEN_HOME



Configure Arifactory in Jenkins:
1. Go to Manage Jenkins, Click on configure system. Look for Artifactory section, click on Add Artifactory server



2. Enter Artifactory url like given below:
some name for server_id
http://public_dns_name:8082
admin/Admin123 as credentials
Click on Test connection to verify everything is right.
You should get the message like below:
Found Artifactory 7.4.1



Apply...Save

3. Once you installed the above plug-in, click on existing Freestyle job configuration.
4. Go under Build environment
Select Maven 3 - Artifactory integration check box
and click on refresh Repositories and choose repos as mentioned below:







 5.Click on Add Build step and choose Invoke Artifactory Maven 3



6. Enter value as below, MyWebApp/pom.xml as root POM
and goal as install




Apply....Save
7. Now click on Build, Jenkins should build using Maven and upload WAR file into Artifactory.

8. Login to Artifactory, Click on Artifactory --> Packages



How to upgrade Maven

  java.lang.IllegalStateException I had installed maven in my ubuntu using command  apt install maven This installed maven in path /usr/shar...