本人博客已经迁移至 www.shangyang.me 欢迎大家访问
安装 BItnami Gitlab 的时候,遇到不少坑,总结下
- 获取一键安装包
https://bitnami.com/stack/gitlab
下载路径为 /home/mine/bitnami-gitlab-7.13.5-0-linux-x64-installer.run - 设置权限
# 如果不设置权限,安装到最后的时候,会出现某文件写入错误的问题,如何解决者扰人的错误,如下
问题是在 centos 7 系统中出现,
第一次安装的时候,提示创建 .git 目录失败,没有权限,接着提示 不能锁定 .git/git_config ...
让第一次安装执行完成,gitlab 会创建两个目录 /home/git 和 /home/gitlab_ci
然后卸载 gitlab,
chown git:git /home/git
chmod -R 775 /home/git
重装 gitlab,既无错误安装成功。
$ sudo chmod -R 775 /home/mine - 安装
# 启动
$ sudo /home/mine/bitnami-gitlab-7.13.5-0-linux-x64-installer.run
直接 next -> next -> next -> Done
不过,有一步需要注意,当提示配置邮箱服务器的时候,选择 Y
注:在选择安装路径的时候,选择 /opt/bitnami - 卸载
$ sudo /opt/bitnami/uninstall - 配置邮箱服务器
两步:第一步,修改 production.rb;第二步,修改 gitlab.yml
4.1 修改 proudction.rb
$ sudo vim /opt/bitnami/apps/gitlab/htdocs/config/environments/production.rb
修改该对应的内容如下config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = true config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :address => "smtp.163.com", :port => "25", :domain => "163.com", :authentication => :login, :user_name => "yourname", :password => "yourpwd", :enable_starttls_auto => true }
4.2 修改 gitlab.yml$ sudo vim /opt/bitnami/apps/gitlab/htdocs/config/gitlab.yml
注意:gitlab.yml 中的 email_from 的 username 和 production.rb 中的 邮箱 username 必须一致。## Email settings # Uncomment and set to false if you need to disable email sending from GitLab (default: true) # email_enabled: true # Email address used in the "From" field in mails sent by GitLab email_from: yourname@163.com email_display_name: GitLab email_reply_to: noreply@example.com
这里注意,有个坑,搞了我很久;如果你是新申请的一个 163 的邮箱,这个时候,SMTP 服务默认是没有打开的..... 唯一要做的,就是进入 163 邮箱,打开你的 SMTP 服务。 - 重启,使设置生效
$ sudo /opt/bitnami/ctlscript.sh restart gitlab_sidekiq $ sudo /opt/bitnami/ctlscript.sh restart apache
- 安装完毕后,如何修改 domain 信息
修改该如下配置文件$ sudo vim /opt/bitnami/apps/gitlab/htdocs/config/gitlab.yml
## Web server settings (note: host is the FQDN, do not include http://) host: 10.162.102.179 port: 8080 # Set to 443 if using HTTPS, see installation.md#using-https for additional HTTPS configuration details https: false # Set to true if using HTTPS, see installation.md#using-https for additional HTTPS configuration details
- 日志查看
bitnami gitlab 存放运行时刻的日志路径
sidekiq.log 会记录运行时刻遇到的异常信息/opt/bitnami/apps/gitlab/htdocs/log
- Repositories
Git 代码库是保存在 /opt/bitnami/apps/gitlab/repositories/ 路径下
- 错误相关
错误一:
提交的时候,提示 warnings: unsecure path ... blar blar ... /opt
该提示表示,/opt 目录的权限过于开放,将 /opt 的权限改为 775 即可修复该问题.
错误二:Transport Error: Cannot get remote repository refs.
http://218.244.137.212:8080/dev_demo/fenghua_demo.git: not authorized
检查在Gitlab中注册的用户名和密码有没有输入正确
错误三:
sudo: ./bitnami-gitlab-7.13.5-0-linux-x64-installer.run: command not found
文件权限的问题,改成 775 就可以。
错误四:
FATAL: data directory "/opt/bitnami/postgresql/data" has group or world access
DETAIL: Permissions should be u=rwx (0700).
错误的原因是,错误的修改了 postgresql 的目录权限,正确的权限必须是0700
改正:chmod -R 700 postgresql - bitnami 官方文档
https://wiki.bitnami.com/Applications/BitNami_GitLab#How_to_configure_the_email_settings_of_GitLab.3f