#centos7.6安装部署gitlab服务器
yum -y install policycoreutils openssh-server openssh-clients postfix
systemctl enable postfix && systemctl start postfix
如果启动失败:
编辑/etc/postfix/main.cf文件 inet_interfaces = localhost 修改为 inet_interfaces = all
vim /etc/postfix/main.cf
inet_interfaces = all
再次启动即可:
systemctl start postfix
我安装的版本是14.8.2-ce.0.el7
使用国内的源:
vim /etc/yum.repos.d/gitlab_gitlab-ce.repo
修改内容如下:
[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key
yum install gitlab-ce
vim /etc/gitlab/gitlab.rb
external_url 'http://osgitlab.q1oa.com'
nginx['listen_port'] = 8080 #默认是80端口
puma['port'] = 8081 #默认是8080,一定不能和nginx端口冲突
puma['worker_processes'] = 10 #根据机器配置进行设置,我的是docker,我写的是2
postgresql['max_worker_processes'] = 4 #根据机器配置进行设置,我的是docker,配置很低,配置为4
postgresql['shared_buffers'] = "128MB" #根据机器配置进行设置,配置文件中推荐是总内存的1/4
域名根据实际情况填写,外网需要找运维增加对https支持;
gitlab-ctl reconfigure
gitlab-ctl restart
提示“ok: run:”表示启动成功
gitlab-rails console -e production
一定不要少了参数-e,进入控制台后,按提示输入以下命令:
irb(main):001:0> u=User.where(id:1).first
=> #
irb(main):003:0> u.password='12345678'
=> 12345678
irb(main):004:0> u.password_confirmation='12345678'
=> 12345678
irb(main):005:0> u.save!
Enqueued ActionMailer::DeliveryJob (Job ID: 15c3c8de-e839-4874-8104-d72dbe224756) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", #>
=> true
irb(main):006:0> quit
其中的u.password='12345678’即为设置管理员密码
http://osgitlab.q1oa.com:8080/users/sign_in
进入系统:
设置中文界面:
setting->Perferences-> language :选择简体中文,重新登录即可
内置nginx配置文件地址:/var/opt/gitlab/nginx/conf/gitlab-http.conf
yum -y groupinstall "Development tools"
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
yum install libffi-devel -y
cd #回到用户目录
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
tar -xvJf Python-3.7.0.tar.xz
mkdir /usr/local/python3 #创建编译安装目录
cd Python-3.7.0
./configure --prefix=/usr/local/python3
make && make install
ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3
yum remove git
rpm -ivh http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-1.noarch.rpm
yum install git -y
curl https://storage.googleapis.com/git-repo-downloads/repo > /bin/repo
sudo chmod a+x /bin/repo
repo init
把项目拉到本地:
git clone https://skygitlab.q1oa.com/huanghq/manifest
4. 初始化:
repo init -u https://skygitlab.q1oa.com/huanghq/manifest.git -b dev -m gitlab.xml
repo sync
repo forall -p -c git branch -vv
repo start dev --all
repo start dev battle