一、环境说明
操作系统:centos 7.5 x86_64
JAVA版本:jdk-8u181
Gitlab版本:gitlab-ee-10.0.0
Nexux Maven版本:nexus-2.14.1-01
二、安装前准备
# systemctl disable firewalld.service # systemctl stop firewalld.service # sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config # setenforce 0 # hostnamectl --static set-hostname gitlab-nexus
三、安装Gitlab
1.安装依赖包
yum -y install postfix cronie curl policycoreutils-python openssh-server
2.下载gitlab服务包
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
新建gitlab-ce安装源
# cd /etc/yum.repos.d/ # cp gitlab-ee.repo gitlab-ee.repo-bak # vi gitlab-ee.repo [gitlab-ee] name=gitlab-ee baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ee/yum/el7 repo_gpgcheck=0 gpgcheck=0 enabled=1 gpgkey=https://packages.gitlab.com/gpg.key # yum -y install gitlab-ee
3.修改gitlab对外服务url
# vi /etc/gitlab/gitlab.rb 将external_url 'http://gitlab.example.com'改为 external_url http://{自定义IP或域名} 如要修改gitlab默认端口号 external_url http://{自定义IP或域名}:{port}
4.开启gitlab
# gitlab-ctl reconfigure
5.访问gitlab
http://{自定义IP或域名}:{port}
修改密码,默认用户名root
6.创建project
安装git工具
# yum -y install git
生成密钥文件
# ssh-keygen # cat /root/.ssh/id_rsa.pub 不创建ssh密码gitlab无法推送文件
注:关闭服务器前先使用gitlab-ctl stop命令关闭git
补充说明:
禁止普通用户创建组
# vi /etc/gitlab/gitlab.rb中 gitlab_rails['gitlab_default_can_create_group'] = false 保存,重新gitlab-ctrl reconfigure
查看gitlab的版本信息
# head -1 /opt/gitlab/version-manifest.txt
给用户分配账户
用http方式,新建”Visibility Level”时选择内部
四、安装Nexus Maven
# tar -zxvf jdk-8u181-linux-x64.tar.gz -C /opt
2.配置JAVA环境变量
# cat > /etc/profile.d/jdk.sh <<EOF # Java environment configuratione export JAVA_HOME=/opt/jdk1.8.0_181 export JAVA_BIN=/opt/jdk1.8.0_181/bin export PATH=$PATH:$JAVA_HOME/bin export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export JAVA_HOME JAVA_BIN PATH CLASSPATH EOF # source /etc/profile.d/jdk.sh
# wget http://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-2.14.1-01-bundle.tar.gz # mkdir /opt/nexus2.14 # tar -zxvf nexus-2.14.1-01-bundle.tar.gz -C /opt/nexus2.14
解压后会生成两个目录nexus-2.14.1-01和sonatype-work
4.设置nexus环境变量
# cat > /etc/profile.d/nexus.sh <<EOF NEXUS_HOME=/opt/nexus2.14/nexus-2.14.1-01 export PATH=$NEXUS_HOME/bin/:$PATH EOF # source /etc/profile.d/nexus.sh
修改配置文件
# vi /opt/nexus2.14/nexus-2.14.1-01/bin/nexus 修改NEXUS_HOME=".." 为 NEXUS_HOME="/opt/nexus2.14/nexus-2.14.1-01" 修改#RUN_AS_USER= 为 RUN_AS_USER=nexus 添加JAVA_HOME路径 JAVA_HOME=/opt/jdk1.8.0_181
5.启动nexus并访问,默认管理者admin/admin123,默认发布者账号deployment/deployment123
# nexus start