天天看点

安装GitLab,设置GitLabadmin密码,设置GitLab端口

安装了这么多次GitLab,每次因为很长时间没有安装踩了坑,今天特意记录一下
#什么是GitLab
GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务。安装方法是参考GitLab在GitHub上的Wiki页面。
#GitLab 与 GitHub的不同
1.Github 分布式在线代码托管仓库,个人版可直接在线免费使用,企业版本收费且需要服务器安装
2.Gitlab 分布式在线代码仓库托管软件,分社区免费版本与企业收费版本
#搭建GitLab
搭建GitLab 实在没啥好说的跟着官网来就好了
简单记录一下
1.关闭防火钱
systemctl stop firewalld
systemctl disable firewalld
2.按照opss
 yum -y install policycoreutils openssh-server openssh-clients postfix
3.安装
    curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
   12  sudo yum install postfix
   13  sudo systemctl enable postfix
   14  sudo systemctl start postfix
   15  yum install -y gitlab-ce
   16  sudo yum install -y curl policycoreutils-python openssh-server
   17  sudo systemctl enable sshd
   18  sudo systemctl start sshd
   
#自定义端口和域名
默认访问的话是是80端口
修改 /etc/gitlab/gitlab.rb 文件如下,然后执行重新配置,重启命令后完成。
external_url '你的域名'
nginx['listen_post]=9091
unicorn['port']=9092
gitlab-ctl reconfigure  //让配置生效,重新执行此命令时间也比较长
gitlab-ctl restart
端口要用9090以后的最好,否则不生效
默认情况下:unicorn会占用8080端口,nginx会占用80端口。改完之后,就可以通过nginx[‘listen_port’] 在浏览器进行访问了。
内部8080端口也不再被占用了。
版权声明:本文为博主原创文章,转载请附上博文链接!




#设置admin 账号

1.cd /opt/gitlab/bin
2. sudo gitlab-rails console production
3. u=User.where(id:1).first
4. u.password='0101540303'
5 u.password_confirmation='540303'
6 u.save!      
安装GitLab,设置GitLabadmin密码,设置GitLab端口