Centos7下部署本地的gitlab(CE版本)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos7下部署本地的gitlab(CE版本)相关的知识,希望对你有一定的参考价值。
1)操作步骤(基本参照官方文档https://about.gitlab.com/downloads/#centos7)
[[email protected] ~]# sudo yum install curl policycoreutils openssh-server openssh-client s -y [[email protected] ~]# sudo systemctl enable sshd [[email protected] ~]# sudo systemctl start sshd [[email protected] ~]# sudo yum install postfix [[email protected] ~]# sudo systemctl enable postfix [[email protected] ~]# sudo systemctl start postfix [[email protected] ~]# sudo firewall-cmd --permanent --add-service=http success [[email protected] ~]# sudo systemctl reload firewalld [[email protected] ~]# curl -sS https://packages.gitlab.com/install/repositories/gitlab/gi tlab-ce/script.rpm.sh | sudo bash [[email protected] ~]# sudo yum install gitlab-ce [[email protected] ~]# gitlab-ctl status run: gitlab-workhorse: (pid 15903) 159s; run: log: (pid 15726) 198s run: logrotate: (pid 15822) 186s; run: log: (pid 15821) 186s run: nginx: (pid 15774) 192s; run: log: (pid 15773) 192s run: postgresql: (pid 15435) 327s; run: log: (pid 15434) 327s run: redis: (pid 15298) 339s; run: log: (pid 15297) 339s run: sidekiq: (pid 15681) 204s; run: log: (pid 15680) 204s run: unicorn: (pid 15625) 210s; run: log: (pid 15624) 210s [[email protected] ~]# gitlab-ctl --help Usage: omnibus-ctl [options] -t, --tmp-dir=DIR Storage location for temporary data [[email protected] ~]# gitlab-ctl restart ok: run: gitlab-workhorse: (pid 16146) 0s ok: run: logrotate: (pid 16156) 0s ok: run: nginx: (pid 16162) 1s ok: run: postgresql: (pid 16173) 0s ok: run: redis: (pid 16175) 1s ok: run: sidekiq: (pid 16187) 0s ok: run: unicorn: (pid 16193) 0s [[email protected] ~]# gitlab-ctl tail nginx ==> /var/log/gitlab/nginx/current <== ==> /var/log/gitlab/nginx/error.log <== ==> /var/log/gitlab/nginx/gitlab_access.log <== ri/537.36" .2743.116 Safari/537.36" ppleWebKit/537.36 (Khtml, like Gecko) Chrome/52.0.2743.116 Safari/537.36" 537.36" 37.36" .0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36" like Gecko) Chrome/52.0.2743.116 Safari/537.36" , like Gecko) Chrome/52.0.2743.116 Safari/537.36" " ==> /var/log/gitlab/nginx/gitlab_error.log <== ==> /var/log/gitlab/nginx/access.log <== 5:in `tail‘: Interrupt s-ctl.rb:575:in `run‘ s-ctl:31:in `<top (required)>‘ from /opt/gitlab/embedded/bin/omnibus-ctl:22:in `load‘ from /opt/gitlab/embedded/bin/omnibus-ctl:22:in `<main>‘ [[email protected] ~]# cd /opt [[email protected] opt]# ls gitlab rh [[email protected] opt]# cd gitlab/ [[email protected] gitlab]# ls bin etc LICENSE service var version-manifest.txt embedded init LICENSES sv version-manifest.json [[email protected] gitlab]# cd etc/ [[email protected] etc]# ll 总用量 52 -rw-r--r--. 1 root root 80 11月 28 13:42 gitlab-psql-rc drwx------. 3 git root 38 11月 28 13:40 gitlab-rails -rw-r--r--. 1 root root 47471 11月 23 02:51 gitlab.rb.template drwx------. 3 git root 16 11月 28 13:44 gitlab-workhorse [[email protected] etc]# cp gitlab.rb.template gitlab.rb.template.20161128 部署完后,查看gitlab的状态: [[email protected] code]# gitlab-ctl status run: gitlab-workhorse: (pid 845) 20880s; run: log: (pid 843) 20880s run: logrotate: (pid 28207) 2879s; run: log: (pid 849) 20880s run: nginx: (pid 847) 20880s; run: log: (pid 846) 20880s run: postgresql: (pid 854) 20880s; run: log: (pid 853) 20880s run: redis: (pid 852) 20880s; run: log: (pid 851) 20880s run: sidekiq: (pid 856) 20880s; run: log: (pid 855) 20880s run: unicorn: (pid 842) 20880s; run: log: (pid 841) 20880s 如上我们可以看到,部署涉及到的软件比较多,建议用一个比较干净的系统来进行部署
2) 查看初始化界面
如上图所示,我们需要配置我们的初始密码
配置完后,我们使用用户名root,以及已经设定的密码进行登录
3)在gitlab中添加公开密钥,这样就可以用私有密钥进行认证了
[[email protected] code]# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): /root/.ssh/id_rsa already exists. Overwrite (y/n)? [[email protected] code]# cd /root/.ssh/ [[email protected] .ssh]# cat id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDgA/RQdMLqmR3TxZdoMJoSr0fZYZaynK0ueaN0fRzEPn87AH7qV6X3dCc18BCxOtsD+o8qfdp8zVYfYbxdL+P1r53Qq278BLXov+ATWCl++Ly62oLYuGTZAAdm/cBYGTTxyqLp83wLutvbmsf3vlD3owbmZyfV/UEjon+j/T6ZVMC2JYcYHDu17HwlsXHZpOpm3g1FimmzMlaf12Hd76bPfC1blE6gcEKMJVJ6qTzK4ksL2DwqaaLpTnw/hLBA0QGM4+s74Q5WoyTSVMqoz+1H3NaXJYquRm5xFf+fZX8sg7SkYJX/7AfkxvuwzYPW+pPzpNtW1KikUgq9aq+rgMt/ [email protected]
将id_ras.pub的内容拷贝到指定的区域,并做好保存:
为git配置好颜色: [[email protected] code]# git config --global color.ui true [[email protected] code]# git config --list user.name=Administrator [email protected] color.ui=true core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true
[[email protected] code]# git clone [email protected]:root/cslc.git Cloning into ‘cslc‘... warning: You appear to have cloned an empty repository. [[email protected] code]# ls cslc freemind-mmx [[email protected] code]# cd cslc [[email protected] cslc]# cp /etc/passwd . [[email protected] cslc]# git add passwd [[email protected] cslc]# git commit -m "add passwd" [master (root-commit) 8c26f36] add passwd 1 file changed, 43 insertions(+) create mode 100644 passwd [[email protected] cslc]# ll -la total 8 drwxr-xr-x. 3 root root 30 Nov 29 16:41 . drwxr-xr-x. 5 root root 47 Nov 29 16:40 .. drwxr-xr-x. 8 root root 4096 Nov 29 16:41 .git -rw-r--r--. 1 root root 2213 Nov 29 16:41 passwd [[email protected] cslc]# git push -u origin master Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 1.04 KiB | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) To [email protected]:root/cslc.git * [new branch] master -> master Branch master set up to track remote branch master from origin.
4)添加一个README
[[email protected] cslc]# echo "欢迎来到中体彩武汉的gitlab站">>README.MD [[email protected] cslc]# ls README.md passwd [[email protected] cslc]# git add README.md [[email protected] cslc]# git commit -m "add README" [master fbe1bfb] add README 1 file changed, 1 insertion(+) create mode 100644 README.md [[email protected] cslc]# git push -u origin master Counting objects: 4, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 320 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) To [email protected]:root/cslc.git 8c26f36..fbe1bfb master -> master Branch master set up to track remote branch master from origin.
到此,gitlab的本地安装基本也就完成了
本文出自 “冰冻vs西瓜” 博客,请务必保留此出处http://molewan.blog.51cto.com/287340/1877804
以上是关于Centos7下部署本地的gitlab(CE版本)的主要内容,如果未能解决你的问题,请参考以下文章