概述
1安装java、maven环境
2下载nexus
官方下载太慢,这是一个免积分下载地址https://download.csdn.net/download/u010792039/12097188
3 将下载的文件提交到服务器,并解压
命令行cd到存放压缩文件的文件夹下, 输入: tar -zvxf nexus-2.14.8-01-bundle.tar.gz
4配置环境变量
/etc/profile中添加以下配置信息
export RUN_AS_USER=root
#如果这里不配置,nexus启动时会出现
#If you insist running as root ,than set the environment variable RUN_AS_USER=root before running this script 报错
然后 命令行输入:source /etc/profile 以激活配置
5 开启nexus
[root@izwz91h49n3mj8r232gqwez weblogic]# /weblogic/nexus-2.14.8-01/bin/nexus start
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
Starting Nexus OSS...
Started Nexus OSS.
6配置nexus 和maven
访问网址:http://yourhostname:8081/nexus 如果无法访问,
执行关闭防火墙命令:sudo systemctl stop firewalld.service && sudo systemctl disable firewalld.service
maven/conf/setting.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">
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://你的服务器地址:8081/private/npm/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!--Enable snapshots for the built in central repo to direct -->
<!--all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<repository>
<id>spring-release</id>
<name>Spring Maven Release Repository</name>
<url>http://repo.springsource.org/libs-release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
<!-- deploy artifacts to repository. -->
<servers>
<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
</settings>
最后
以上就是淡定母鸡为你收集整理的如何在linux服务器上搭建npm私服 (nexus)的全部内容,希望文章能够帮你解决如何在linux服务器上搭建npm私服 (nexus)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复