linux安装gitlab 配置文件,GitLab 7.13.x安装和配置--Linux篇

阅读目录:

1. 关闭防火墙和Selinux

2. 安装依赖库

3. 下载并安装GitLab 7.13.x版本

4. 配置并启动GitLab

5. 登录GitLab

6. 重置root账户密码

7.配置要求以及说明

1. 关闭防火墙和Selinux

Linux的防火墙是咱们新手的噩梦,很多情况会出现能ping通,但是访问不了Web页面。所以开始就干掉它!

1.1 关闭防火墙

[root@localhost ~]# /etc/init.d/iptables stop

iptables: Setting chains to policy ACCEPT: filter [ OK ]

iptables: Flushing firewall rules: [ OK ]

iptables: Unloading modules: [ OK ]

1.2 开机自动关闭防火墙

[root@localhost ~]# chkconfig iptables off

1.3 查看Selinux状态

[root@localhost ~]# sestatus

SELinux status: enabled

SELinuxfs mount: /sys/fs/selinux

SELinux root directory: /etc/selinux

Loaded policy name: targeted

Current mode: enforcing

Mode from config file: enforcing

Policy MLS status: enabled

Policy deny_unknown status: allowed

Max kernel policy version: 28

1.4 关闭selinux

[root@localhost ~]# vim /etc/selinux/config

修改SELINUX=disabled ,重启机器。

注:永久开启->改成:SELINUX=enforcing

2. 安装依赖库

2.1 安装依赖库

[root@localhost ~]# yum -y install curl policycoreutils openssh-server openssh-clients postfix cronie

2.2 启动postfix发送邮件

[root@localhost ~]# service postfix start

2.2.1 设置postfix自启动

[root@localhost ~]# chkconfig postfix on

2.3 启动sshd

[root@localhost ~]# service sshd start

2.3.1 设置sshd自启动

[root@localhost ~]# chkconfig sshd on

可选:不推荐-> 设置避免用户通过ssh方式和http来访问

[root@localhost ~]# lokkit -s http -s ssh

3. 下载并安装GitLab 7.13.x版本

3.1 下载GitLab(两种方式)

[root@localhost ~]# cd /

3.1.1 curl下载

[root@localhost/]# curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

3.1.2 wget下载

[root@localhost /]# wget -c https://packages.gitlab.com/gitlab/gitlab-ce/el/6/x86_64/gitlab-ce-7.13.3-ce.1.el6.x86_64.rpm

3.2 安装GitLab(两种方式)

3.2.1 yum安装

[root@localhost /]# yum -y install gitlab-ce

整个包有300多MB,如果使用yum无法下载,可以直接下载RPM包。

3.2.2 rpm安装

[root@localhost /]# rpm -ivh gitlab-ce-7.13.3-ce.1.el6.x86_64.rpm

4. 配置并启动GitLab

4.1 查看ip

[root@localhost /]# ifconfig

eth0      Link encap:Ethernet  HWaddr 00:0C:29:DD:0E:62

inet addr:192.168.28.131  Bcast:192.168.163.255  Mask:255.255.255.0

inet6 addr: fe80::20c:29ff:fedd:e62/64 Scope:Link

4.2 编辑配置文件

[root@localhost /]# vim /etc/gitlab/gitlab.rb

# 指定host地址(此处改成自己的ip)

external_url 'http://192.168.28.131'

注:如果8080端口也被其他程序占用了, 比如说我们有启动着的tomcat。那么,我们还需要修改unicorn的端口

# 同样找到并修改

unicorn['port'] = 18080

可选:修改Gitlab数据存储路径

#找到git_data_dir "/var/opt/gitlab/git-data"修改为

git_data_dir "/gitlab"

#有可能配置文件的数据存储路径是这样的,

#git_data_dirs({ "default" => { "path" => "/var/opt/gitlab/git-data" } }) 修改为

git_data_dirs({ "default" => { "path" => "/gitlab } })

4.3修改完配置文件,需要重新加载

[root@localhost /]# gitlab-ctl reconfigure

4.4 启动GitLab

[root@localhost /]# gitlab-ctl start

5.登录GitLab

5.1 打开浏览器,输入ip:18080

http://192.168.28.131:18080

a9ca7e6a046dca0e6708f6fce28ab360.png

5.2 root管理员登录

账号: root

初始密码:5iveL!fe

054e4fca879f15a602e675d0b0a1d83a.png

6. 重置root账户密码

6.1 获得用户数据,修改用户密码。

[root@localhost /]# gitlab-rails console production

Loading production environment (Rails 4.2.5.2) irb(main):001:0> user = User.where(id: 1).first

=> #

4eUIx2o8CWWPYGfk...", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: n

il, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_si

gn_in_ip: nil, created_at: "2018-01-26 09:12:32", updated_at: "2018-01-26 09:12:32", name: "Administr

ator", admin: true, projects_limit: 10000, skype: "", linkedin: "", twitter: "", authentication_token

: "Zz4KYrJXqGh7-PHtMzv1", theme_id: 2, bio: nil, failed_attempts: 0, locked_at: nil, username: "root",

can_create_group: true, can_create_team: false, state: "active", color_scheme_id: 1, notification_leve

l: 1, password_expires_at: "2018-01-26 09:12:31", created_by_id: nil, last_credential_check_at: nil, a

vatar: nil, confirmation_token: nil, confirmed_at: "2018-01-26 09:12:32", confirmation_sent_at: "2018-

01-26 09:12:32", unconfirmed_email: nil, hide_no_ssh_key: false, website_url: "", github_access_token:

nil, gitlab_access_token: nil, notification_email: "admin@example.com", hide_no_password: false, passw

ord_automatically_set: false, bitbucket_access_token: nil, bitbucket_access_token_secret: nil, locatio

n: nil, encrypted_otp_secret: nil, encrypted_otp_secret_iv: nil, encrypted_otp_secret_salt: nil, otp_r

equired_for_login: false, otp_backup_codes: nil, public_email: "", dashboard: 0, project_view: 0>

irb(main):002:0> user.password=12345678

=> 12345678

irb(main):003:0> user.password_confirmation=12345678

=> 12345678

irb(main):004:0> user.save!

=> true

irb(main):005:0> quit

7.配置要求、注意事项以及说明

配置要求:

cpu : 2核心 支持500用户,这也是官方推荐的最低标准。

内存 : 4GB 物理内存 支持100用户,也是 官方推荐 的配置。

注意事项:

8080端口被Tomcat占用,会出现502的页面。

说明:本次使用

操作系统:CentOS 6.8 64位

GitLab 版本:7.13.3

下一篇:GitLab 7.13.x安装和配置--Linux篇

https://my.oschina.net/u/3209432/blog/1613898

安装Elasticsearch 7.13.3版本,你可以按照以下步骤操作,假设你是在Linux系统上: **步骤1:下载二进制文件** 首先,访问Elasticsearch官方网站 (<https://www.elastic.co/downloads/elasticsearch>),找到对应版本(7.13.3)的下载页面,选择“Linux”并选择合适的平台(如x86_64)。下载`elasticsearch-7.13.3.tar.gz`或其他提供的tarball。 **步骤2:解压并移动到指定目录** 在服务器的任意位置解压下载的文件: ``` tar -zxvf elasticsearch-7.13.3.tar.gz ``` 然后将解压后的文件夹移动到你想放置Elasticsearch的服务目录(通常是 `/usr/share` 或 `/opt` 下的一个子目录): ``` sudo mv elasticsearch-7.13.3 /your/install/path/ ``` **步骤3:创建配置文件** 复制默认配置模板并自定义配置,一般在安装目录下的 `config` 文件夹下: ``` sudo cp /your/install/path/config/elasticsearch.yml.example /your/install/path/config/elasticsearch.yml ``` 编辑 `elasticsearch.yml` 来满足你的需求。 **步骤4:初始化索引和数据路径** 运行Elasticsearch的命令行工具 `bin/elasticsearch-plugin` 来安装必要的插件,并创建数据路径(如果有需要的话): ``` cd /your/install/path/bin ./elasticsearch-plugin list --repositories https://artifacts.elastic.co/downloads/elasticsearch-plugins --verbose # 查看已有的插件 ./elasticsearch-plugin install x-pack # 如果需要X-Pack插件,替换为你的插件名 ./elasticsearch init --path.data /your/data/path # 初始化数据路径 # 创建一个新的索引模板(可选) curl -XPUT 'http://localhost:9200/_template/default' -H 'Content-Type: application/json' -d' { "template": "default*", "settings": { "number_of_shards": 5, "number_of_replicas": 1 } } ' ``` **步骤5:启动服务** 最后,通过 `bin/elasticsearch` 启动Elasticsearch服务: ``` sudo ./elasticsearch ``` 确认服务启动成功,可以在浏览器访问 `http://localhost:9200` 来查看Elasticsearch的状态。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值