First, the installation and configuration dependent bao
Install the required dependent on CentOS systems: ssh, firewall, postfix (for email notifications), wget, the following command will open the system firewall HTTP and SSH port access
Preparation Before Installation
Command: iptables -F # Clear firewall rules
gitlabserver 192.168.175.100 gitlab server
Before Installation understand gitlab common commands
gitlab-ctl start: Start All Services
gitlab-ctl restart: restart all services
gitlab-ctl stop: Stop All Services
gitlab-ctl reconfigure: take effect so that the configuration file (generally you modify master profile /etc/gitlab/gitlab.rb, need to perform the command)
gitlab-ctl show-config: Authentication Profiles
gitlab-ctl uninstall: Delete gitlab (data retention)
gitlab-ctl cleanse: delete all the data and start again
1. Install package dependencies ssh
Command: yum -y install curl policycoreutils openssh-server openssh-clients postfix # install dependencies
2. SSH service started and set to boot from Kai
Command: systemctl start sshd
命令:systemctl enable sshd
3. Install a firewall and launch
命令:yum -y install firewalld systemd
Command: systemctl start firewalld
4. Add the http service to firewalld, pemmanent represent permanent, if after adding --permanent next boot will fail
命令:firewall-cmd --permanent --add-service=http
命令:systemctl restart firewalld
5. Then install Postfix notification mail is sent to the service provided and postfix boot from Kai
Command: yum -y install postfix (already installed)
Command: systemctl start postfix
命令:systemctl enable postfix
Note: During installation Postfix, configure the screen it may appear. Select "Internet Site" and press enter. Use your external DNS server to "mail name" and press enter. If the additional screen appears, continue to press the enter key to accept the default value (sometimes occur)
Second, add GitLab mirror source server and mounting gitlab
1. Add gitlab mirror
Command: wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.2.3-ce.0.el7.x86_64.rpm
2. Install gitlab
Command: rpm -ivh gitlab-ce-10.2.3-ce.0.el7.x86_64.rpm
Given above, and download a few dependencies, downloaded on the line
Command: yum -y install policycoreutils-python
After the download is performed again
Command: rpm -ivh gitlab-ce-10.2.3-ce.0.el7.x86_64.rpm
The installation process takes some time, if a fox similar picture appears, the installation is successful
3. Modify gitlab server configuration file to specify a custom port and ip:
Command: vim /etc/gitlab/gitlab.rb
Note: The port set here can not be occupied, the default port is 8080, if 8080 is already in use, customize additional ports open in the firewall settings and have corresponding port
4. reset and start GitLab
命令:gitlab-ctl reconfigure
Command: gitlab-ctl restart
Tip "ok: run:" represents a successful start
5. Access GitLab page
If there is no domain name, specify directly enter the server ip and port access
Note: if the latter access the web interface, reported 502 total, should clear the firewall rules, additional memory is greater than 4G, and then out of memory, will report 404
命令:free -m #查看内存
然后在浏览器上访问 http://192.168.175.100/users/sign_in
注意:上面我做的IP是192.168.175.100,因为我的本机的虚拟机内存最高只能到3G,所以我换了服务器上做的,IP是192.168.130.106
yuiyan1208 #设置密码 账号为root 太简单会报错
http://192.168.130.106/ 登陆地址
root
yuyan1208
知识扩展:
命令:gitlab-ctl stop #关闭 gitlab
命令:gitlab-ctl start #启劢 gitlab
命令:gitlab-ctl restart #重启 gitlab
gitlab 主配置文件:/etc/gitlab/gitlab.rb
日志:/var/log/gitlab/
服务地址:/var/opt/gitlab/
仓库地址:/var/opt/gitlab/git-data
重置服务:gitlab-ctl reconfigure
6.支持中文(汉化)
命令:yum -y install git
命令:git clone https://gitlab.com/xhang/gitlab.git #克隆获取汉化版本库
命令:gitlab-ctl stop #先将gitlab关闭
命令:cd /root/gitlab #切换到gitlab汉化包所在的目录
命令:git diff v10.2.3 v10.2.3-zh > ../10.2.3-zh.diff #比较汉化标签和原标签,导出 patch 用的 diff 文件到/root下
命令:yum -y install patch #下载补丁
命令:patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < /root/10.2.3-zh.diff #将10.2.3-zh.diff作为补丁更新到gitlab中
命令:gitlab-ctl restart #启动gitlab
温馨提示:等 1 分钟,再去访问 web 页面。访问太快会显示 502 错误
用户名:root
密码:yuyan1208
创建项目
创建登入用户 修改登入密码
创建gitlab root_ssh 秘钥
命令:ssh-keygen -t rsa
命令:ls /root/.ssh/id_rsa | grep id
命令:cat /root/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDecd/6CCTZKEtIBz/6oRAkeIsJsxz4vka3QnWYrd/QWZOTA5z52/qr3tqajYAVWinD3iTw9reyypha+AJj/+RA4kgfT4NA9IDOJlSvlXnVWRFIzOfXUdZtgtkTKvwdvnbgCnl1ORtxqMgXXpqCvuplYnuVt83c5jN0GMujLjRYG5+7k1qm2IEfzajXmOM2tR4Rzs/gtmM3IRO7h/i0xnUmW+iMhOGYQe9yhFMIbYjEAV3NOUHqtMPYPn/PqFu3jubMs5lWG4DLMaS8ye+AixbXwJp+0M+1lSnMYWcNtdH9q3svvmCiDXTS8RvMdnM1H3lQ3LsIwfFCW32pJN7K3PZ7 root@gitlabserver
都是gitlab的简单操作,就完成了
总结:。。。。。。。。。。。。。此处省略一万字