Maven installation and nexus private server construction in maven_linux

Source: Internet
Author: User
Tags stop script sonatype

I. Preparations before installation

Download JDK http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u26-download-400750.html.

Jdk-6u26-linux-x64.bin

Download Maven http://mirrors.geoexpat.com/apache//maven/binaries/

Apache-maven-3.0.3-bin.tar.gz

Download nexus http://nexus.sonatype.org/downloads/

Nexus-oss-webapp-1.9.1.1-bundle.tar.gz

Http://www.sonatype.org/downloads/all/

Ii. Install JDK

Use Root User

Add execution permission chmod A + x jdk-6u26-linux-x64.bin

Install./jdk-6u26-linux-x64.bin press enter to complete installation

3. install and configure Maven

1. Create a user group and users who need to operate on maven (if installed as root users, do not create one)

1. # groupadd mavenuser // create a user group

2. # useradd-G mavenuser // create a user and specify a user group

3. # passwd mavenuser // assign a password to the user

2. Unzip and install

1. # cd/Data

2. # mkdir Maven

3. # chown-r mavenuser: mavenuser/data/Maven

4. # chmod 755/data/Maven

5. # Su-l Xinhua

6. # tar-zvxf apache-maven-3.0.3-bin.tar.gz

3. Configuration

Check whether the. m2 directory exists in the user's home directory.

If mkdir. m2 is not created

In the. m2 directory, set settings. XML

<? XML version = "1.0" encoding = "UTF-8"?>
<Settings
Xmlns = "http://maven.apache.org/SETTINGS/1.0.0"
Xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
Xsi: schemalocation = "http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

<! -- Specify the jar package storage path -->
& Lt; localrepository & gt;/data/Maven/apache-maven-3.0.3/repo/& lt;/localrepository & gt;

<Plugingroups> </plugingroups>

<! -- Set Proxy Server -->
<Proxies>
<Proxy>
<ID> my-proxy </ID>
<Active> true </active>
<Protocol> HTTP </protocol>
<Host> IPaddress <Port> port </port>
</Proxy>
</Proxies>

<! -- Set private server -->
<Servers>
<Server>
<ID> nexus </ID>
<Username> admin </username>
<Password> admin </password>
</Server>
</Servers>

<! -- Configure the private server as an image and only allow Maven to use the private server -->
<Mirrors>
<Mirror>
<ID> nexus </ID>
<Mirrorof> * </mirrorof>
<URL> http: // localhost: 8081/nexus/content/groups/Public </URL>
</Mirror>
</Mirrors>
<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>
</Profiles>

<Activeprofiles>
<Activeprofile> nexus </activeprofile>
</Activeprofiles>

</Settings>

4. Install nexus

Unzip tar-zxvf nexus-oss-webapp-1.9.1.1-bundle.tar.gz

5. Compile the Startup Script

You can create a STARTUP script in any folder.

STARTUP script:

VI mavenstart. Sh

Add the following script

#! /Bin/bash

Export lang = 'zh. gb18030'

M2_home =/data/Maven/apache-maven-3.0.3

Export m2_home

Java_home =/data/jdk1.6.0 _ 26/bin

Path = $ java_home: $ path: $ home/bin: $ m2_home/bin

Export path

/Data/Maven/nexus-oss-webapp-1.9.1.1/bin/JSW/linux-x86-64/nexus start

The command for running the script is:

~ /Maven $ Sudo-S
~ /Maven #./mavenstart. Sh
Bash:./mavenstart. sh: Permission denied
Root @ AAA ~ /Maven # chmod + x mavenstart. Sh
Root @ AAA :~ /Maven #./mavenstart. Sh
Starting nexus OSS...
Started nexus OSS.

In this way, the nexus is started, and the live input http: // 127.0.0.1: 8081/nexus is not displayed on the logon page.

Stop script:

VI mavenstop. Sh

Add the following script

#! /Bin/bash

/Data/Maven/nexus-oss-webapp-1.9.1.1/bin/JSW/linux-x86-64/nexus stop6

6. Use and configure nexus

1. Run

The server starts the mavenstart. Sh script.

Enter http: // IPaddress: 8081/nexus in the browser

The home page of nexus is displayed. Click Log in the upper right corner.

The default username and password are admin/admin123.

2. Configuration

Click Repositories on the left

Change the configuration of download remote index in the configuration option of "all types are proxies" to "true ".

If you want the proxy to hook up the bottom of the configuration override HTTP Proxy setting, fill in the proxy server address and port, and finally save the settings

Right-click reindex in the list

3. add your own jar to nexus

Select the 3rd party and artifact upload labels.

Gav definition select Gav Parameters

Enter group artifact version Packaging

Then select the jar package to upload and submit.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.