gitlab安装和使用

gitlab安装和使用

1.下载必要的依赖

bash 复制代码
    sudo yum install curl openssh-server openssh-clients postfix cronie  #需要执行
    sudo service postfix start #配置邮箱的
    sudo chkconfig postfix on #配置邮箱的
    #这句是用来做防火墙的,避免用户通过ssh方式和http来访问。
    sudo lokkit -s http -s ssh

2.下载gitlab安装包

清华大学镜像源:https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce

下载完放到指定位置

进入目录安装命令

bash 复制代码
rpm -ivh ./gitlab-ce-14.10.5-ce.0.el7.x86_64.rpm

3.修改必要的配置文件

bash 复制代码
vim /etc/gitlab/gitlab.rb 
bash 复制代码
    #外部访问url(经过编译后,自动将这个配置编译到nginx配置,nginx就无需配置了)
    external_url 'http://192.168.0.1:8888'
    #默认值就是8080。如果端口被占用,可将8080修改为其它(例如:9090)
    unicorn['port'] = 8080  #gitlab版本不同,这个配置项可能不存在

4.是配置文件生效

bash 复制代码
    #使配置生效
    gitlab-ctl reconfigure
    #重新启动GitLab 
    gitlab-ctl restart

5.登录网页-默认密码

密码放在了一个临时文件中

密码位置:/etc/gitlab/initial_root_password

密码需要及时修改,24小时会自动删除

6.修改密码

http://110.42.188.114:8888/users/sign_in

root !QAZ2wsx

7.增加用户

8.测试分享代码

9.上传clone创建分支,提交代码

  • gitlab-ce-14初装以后,把密码放在了一个临时文件中了

常用的gitlab命令

bash 复制代码
    gitlab-ctl start    # 启动所有 gitlab 组件;
    gitlab-ctl stop        # 停止所有 gitlab 组件;
    gitlab-ctl restart        # 重启所有 gitlab 组件;
    gitlab-ctl status        # 查看服务状态;
    vim /etc/gitlab/gitlab.rb        # 修改gitlab配置文件;
    gitlab-ctl reconfigure        # 重新编译gitlab的配置;
    gitlab-rake gitlab:check SANITIZE=true --trace    # 检查gitlab;
    gitlab-ctl tail        # 查看日志;
    gitlab-ctl tail nginx/gitlab_access.log

git的使用

  1. 安装git yum install git

  2. 查看git 版本 git --version

  3. 配置git

    git config --global user.email "you@example.com" git config --global user.name "Your Name"

参考资料:CentOs7 安装Gitlab

相关推荐
裁二尺秋风18 小时前
CI/CD — Pipeline的使用以及Blue Ocean多分支流水线的使用方法
ci/cd·gitlab·jenkins
北海之灵1 天前
docker desktop部署本地gitlab服务
docker·容器·gitlab
兔老大RabbitMQ1 天前
GitHub vs GitLab 全面对比报告(2025版)
gitlab·github
CC码码2 天前
管理你的多个 Git 密钥(多平台多账号)
git·gitlab·github
CC码码2 天前
管理你的多个 Git 密钥(单平台多账号)
git·gitlab·github
兔老大RabbitMQ2 天前
GitLab详细分析
gitlab
小道仙9715 天前
gitlab对接,gitlabRestApi,gitlab4j-api
java·git·gitlab
tswddd16 天前
项目:Gitlab HSD CI/CD总结
ci/cd·kubernetes·gitlab
许_安16 天前
docker中部署gitlab
docker·eureka·gitlab
Haoea!16 天前
持续集成 CI/CD-Jenkins持续集成GitLab项目打包docker镜像推送k8s集群并部署至rancher
ci/cd·gitlab·jenkins·rancher