# l安装卸载 ## 使用源码 - 下载 [下载地址](https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/) - 安装依赖 ```shell yum install curl policycoreutils openssh-server openssh-clients policycoreutils-python systemctl enable sshd systemctl start sshd ``` ```shell yum install postfix systemctl enable postfix systemctl start postfix ``` - 汉化 打补丁方式 ```shell wget https://gitlab.com/xhang/gitlab git diff v12.0.3 v12.0.3-zh > ../12.0.3-zh.diff patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < ../12.0.3-zh.diff ``` 直接覆盖方式 ```shell wget https://gitlab.com/xhang/gitlab/repository/12-0-stable-zh/archive.tar.bz2 -O gitlab-12-0-stable-zh.tar.bz2 \cp -rf gitlab-v12.0.0/* /opt/gitlab/embedded/service/gitlab-rails/ ``` - 卸载 * 清理命令 ```shell wget https://gitlab.com/xhang/gitlab/repository/12-0-stable-zh/archive.tar.bz2 -O gitlab-12-0-stable-zh.tar.bz2 \cp -rf gitlab-v12.0.0/* /opt/gitlab/embedded/service/gitlab-rails/ ``` * 停止gitlab ```shell gitlab-ctl stop ``` * 卸载gitlab ```shell rpm -e gitlab-ce ``` - 查看进程 ```shell ps aux | grep gitlab ``` - 杀掉守护进程 ```shell kill -9 xxx ``` - 清理残余文件 ```shell find / -name gitlab | xargs rm -rf ``` ## 使用docker - 安装**docker** - 查找镜像 ```shell docker search gitlab ``` - 下载汉化版镜像 ```shell docker pull twang2218/gitlab-ce-zh ``` - 创建并启动容器 ```shell docker run -d -p 443:443 -p 280:80 -p 222:22 --name gitlab --privileged --restart=always -v /home/gitlab/config:/etc/gitlab -v /home/gitlab/logs:/var/log/gitlab -v /home/gitlab/data:/var/opt/gitlab twang2218/gitlab-ce-zh ``` 容器80、443、22端口分别为`http`、`https`、`ssh`访问端口 - 启动与停止容器 - 卸载 删除容器、镜像和数据 # 配置 ## 配置文件 * 配置文件位置 `/etc/gitlab/gitlab.rb` 使用docker安装时需挂载在宿主机上 * 内容 ​`external_url` 访问地址 `git_data_dir` 数据保存位置 * 注意 用`docker`方式安装时,如使用`nginx`做反向代理,则需要配置`nginx['proxy_set_headers']`中的`host`配置,例: ```tex external_url "http://gitlab.xumy.vip:28080" nginx['proxy_set_headers'] = { "Host" => "gitlab.xumy.vip:28080" } ```