1、准备一台Linux主机 html
IP:192.168.1.165 java
一、开SSH linux
systemctl enable sshd web
二、关闭SELINUX 浏览器
vi /etc/sysconfig/selinux 缓存
修改下边红字部分 服务器
# This file controls the state of SELinux on the system. oracle
# SELINUX= can take one of these three values: app
# enforcing - SELinux security policy is enforced. ssh
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
三、安装rz
yum -y install lrzsz
以后上传文件必定要用-be参数(其中-b是--binary用二进制的方式上传,-e是--escape强制escape全部控制字符),不然上传的文件不完整
rz –be
四、安装wget
yum -y install wget
五、更换yum源,用于提速yum
(1)备份yum源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
(2)下载新的CentOS-Base.repo 到/etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
清理缓存
yum clean all
从新生成缓存
yum makecache
六、用firewalld开80端口
firewall-cmd --permanent --add-service=http
systemctl reload firewalld
2、安装Nexus
一、安装JDK1.8
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
下载rpm包传到服务器上,用rpm命令安装
rpm -ivh jdk-8u191-linux-x64.rpm
增长Java环境变量
vi /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_191-amd64
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
export RUN_AS_USER=root
使环境变量生效
source /etc/profile
查看java版本
java -version
二、下载并安装Nexus
官网下载地址:https://www.sonatype.com/download-oss-sonatype
解压nexus-3.14.0-04-unix.tar.gz
tar -zxvf nexus-3.14.0-04-unix.tar.gz
将nexus-3.14.0-04更名nexus,且将nexus和sonatype-work目录移动到/usr/local/目录下
mv nexus-3.14.0-04 nexus
mv nexus /usr/local/
mv sonatype-work /usr/local/
编辑nexus.rc,修改运行nexus3所使用的用户
cd /usr/local/nexus/bin
vi nexus.rc
修改成
run_as_user="root"
编辑nexus,修改nexus3启动时要使用的jdk版本
vi nexus
修改成
INSTALL4J_JAVA_HOME_OVERRIDE=/usr/java/jdk1.8.0_191-amd64
修改nexus-default.properties
cd /usr/local/nexus/etc
vi nexus-default.properties
修改nexus3默认端口
application-port=80
关闭占用80端口的httpd服务
systemctl stop httpd
systemctl disable httpd
nexus3数据以及相关日志的存储位置能够修改bin目录下的nexus.vmoptions
把nexus3加入到系统服务,使之可以开机自启动:
ln -s /usr/local/nexus/bin/nexus /etc/init.d/nexus
cd /etc/init.d
chkconfig --add nexus
chkconfig --levels 345 nexus on
systemctl start nexus
systemctl status nexus
内置启动和中止方法:
/usr/local/nexus/bin/nexus start
/usr/local/nexus/bin/nexus stop
3、配置Nexus
一、在浏览器输入http://192.168.1.165
PS:nexus服务启动成功后,须要稍等一段时间,端口才起来
默认帐号和密码:admin admin123
能够在右上角查看帐户登陆状态
二、配置LDAP(略)
三、新建普通用户规则
点击左侧Security-Roles按钮
点击"Create role-Nexus role"按钮
Role ID:nx-user
Role name:nx-user
Rrivlieges:nx-repository-view-*-*-*、nx-search-read #容许私服仓库任何操做
建立成功
以后能够在Users中为LDAP帐号赋予对应的权限
四、添加公司内部仓库
点击左侧Repositories按钮
说明:
(1)name列
maven-central:maven中央库,默认从https://repo1.maven.org/maven2/拉取jar
maven-releases:私库发行版jar
maven-snapshots:私库快照(调试版本)jar
maven-public:仓库分组,把上面三个仓库组合在一块儿对外提供服务,在本地maven基础配置settings.xml中使用。
(2)type列(Nexus默认的仓库类型有如下四种):
group(仓库组类型):又叫组仓库,用于方便开发人员本身设定的仓库;
hosted(宿主类型):内部项目的发布仓库(内部开发人员,发布上去存放的仓库);
proxy(代理类型):从远程中央仓库中寻找数据的仓库(能够点击对应的仓库的Configuration页签下Remote Storage Location属性的值即被代理的远程仓库的路径);
virtual(虚拟类型):虚拟仓库(这个基本用不到,重点关注上面三个仓库的使用);
点击"Create Repositories"按钮,再选择maven2(hosted)
Name:xxxx-releases #自定义
Version policy:Release # Releases: 通常是已经发布的Jar包,Snapshot: 未发布的版本,Mixed:混合的
Deployment Pollcy:Allow redeploy
其余默认
xxxx-snapshots建立方法同样
最后记得取消Anonymous里边Allow anonymous users to access the server的勾,这样不登陆看不到任何库文件
问题1:
web页面最上边提示:System Requirement: max file descriptors [4096] likely too low, Increase to at least [65536]
操做系统文件描述符过低,建议改为65536
vi /etc/security/limits.conf
添加
* soft nofile 65536
* hard nofile 65536
注意value不能查过/proc/ysy/fs/nr_open的值,不然不能登陆操做系统