gitlab从安装到维护

xiaoxiao2021-02-28  124

类似文章

备份:

sudo gitlab-rake gitlab:backup:create

最近重新开了项目,有很多闲置的机器,我抓了一台,重装了ubuntu,再装了Gitlab,操作挺简单的:

Install

Refer to https://about.gitlab.com/installation/#ubuntu

https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/

ubuntu

STEP 1

sudo apt-get install curl openssh-server ca-certificates postfix

STEP 2

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash sudo apt-get install gitlab-ce

STEP 3

sudo gitlab-ctl reconfigure

STEP4

sudo gitlab-ctl status

STEP 5

http:// IP :80

完。


Note.1

如果STEP 3 一直装不上

curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add - &>/dev/null vim /etc/apt/sources.list.d/gitlab-ce.list

deb http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/debian jessie main

sudo apt-get update sudo apt-get install gitlab-ce


Note.2

如果第三步还是报错,如果出现这样的报错

There was an error running gitlab-ctl reconfigure: execute[/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8] (gitlab::postgresql line 80) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1' ---- Begin output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ---- STDOUT: The files belonging to this database system will be owned by user "gitlab-psql". This user must also own the server process. STDERR: initdb: invalid locale settings; check LANG and LC_* environment variables ---- End output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ---- Ran /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 returned 1

可以这样修改

LANG="en_US.utf8" LC_COLLATE="C" LC_CTYPE="C" LC_MESSAGES="C" LC_MONETARY="C" LC_NUMERIC="C" LC_TIME="C" LC_ALL="C" sudo gitlab-ctl reconfigure

Note.3

如果reconfigure还是报错

… migrate gitlab-rails database bash /tmp/chef-script20180324-12853-1dxf4mh …

可以这样做

sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install gcc-4.9 g++-4.9

备份与还原

备份这样做

sudo gitlab-rake gitlab:backup:create ls -al /var/opt/gitlab/backups

备份出来的包是这样的,前面是时间,后面是版本号,重新安装的时候要用相同的版本号

1520398011_2018_03_07_10.3.2_gitlab_backup.tar

eg:

sudo apt-get install gitlab-ce=10.3.2-ce.0

恢复备份

sudo gitlab-ctl stop unicorn sudo gitlab-ctl stop sidekiq sudo gitlab-rake gitlab:backup:restore BACKUP=1520398011_2018_03_07_10.3.2 sudo gitlab-ctl start

Note.4

如果安装之后gitlab没有东西出来,就要检查下nginx的80、8080两个端口有没有被占用,是这样检查的

sudo vim /etc/nginx/sites-available/default

把里面包含的80、8080端口的server都换个端口

Ubuntu安装

U盘安装/ubuntu

Refer to how-to-create-a-bootable-ubuntu-usb-flash-drive-from-terminal

cd ~/download/ wget http://releases.ubuntu.com/14.04/ubuntu-14.04.5-desktop-amd64.iso mv ubuntu-14.04.5-desktop-amd64.iso ubuntu14.iso # insert u-pan sudo umount /dev/sd<?><?> sudo dd bs=4M if=ubuntu14.iso of=/dev/sd<?> && sync

开机 不停按F8 进入U盘系统

refer to http://www.upanok.com/jiaocheng/60.html

硬盘安装/ubuntu

(Install ubuntu from ubuntu)

sudo chmod +w /boot/grub/grub.cfg sudo vim /boot/grub/grub.cfg

找到启动项

/export linux_gfx_mode

在里面增加一项

menuentry "install ubuntu 14.04" { search --set -f /ubuntu.iso loopback loop /ubuntu.iso set root=(loop) linux /casper/vmlinuz.efi boot=casper iso-scan/filename=/ubuntu.iso initrd /casper/initrd.lz boot } sudo reboot

开机长按shif键

选中install ubuntu 14.04 开始安装

转载请注明原文地址: https://www.6miu.com/read-31286.html

最新回复(0)