1. 程式人生 > >centos7搭建gitlab版本控制系統

centos7搭建gitlab版本控制系統

resolv permanent all network 物理地址 original data epo nbsp

一. 配置centos7網絡

查看本地ip地址的方法: ip addr

a) 修改對應網卡的DNS的配置文件

sudo vi /etc/resolv.conf
修改以下內容

nameserver 8.8.8.8 #google域名服務器
nameserver 8.8.4.4 #google域名服務器

b) 修改對應網卡的網關的配置文件
sudo vi /etc/sysconfig/network

修改以下內容
NETWORKING=yes(表示系統是否使用網絡,一般設置為yes。如果設為no,則不能使用網絡,而且很多系統服務程序將無法啟動)
HOSTNAME=centos (設置本機的主機名,這裏設置的主機名要和/etc/hosts中設置的主機名對應, 不需要想網址(centos.google.com)一樣寫全

)
GATEWAY=192.168.1.1(設置本機連接的網關的IP地址。例如,網關為10.0.0.2)

c) 修改對應網卡的IP地址的配置文件

sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0

修改以下內容

DEVICE=eth0 #描述網卡對應的設備別名,例如ifcfg-eth0的文件中它為eth0
BOOTPROTO=static #設置網卡獲得ip地址的方式,可能的選項為static,dhcp或bootp,分別對應靜態指定的 ip地址,通過dhcp協議獲得的ip地址,通過bootp協議獲得的ip地址
BROADCAST=192.168.0.255 #對應的子網廣播地址
HWADDR=00:07:E9:05:E8:B4 #對應的網卡物理地址
IPADDR=12.168.1.2 #如果設置網卡獲得 ip地址的方式為靜態指定,此字段就指定了網卡對應的ip地址
IPV6INIT=no
IPV6_AUTOCONF=no
NETMASK=255.255.255.0 #網卡對應的網絡掩碼
NETWORK=192.168.1.0 #網卡對應的網絡地址
ONBOOT=yes #系統啟動時是否設置此網絡接口,設置為yes時,系統啟動時激活此設備

二. 安裝 gitlab

1. Install and configure the necessary dependencies

sudo yum install curl policycoreutils openssh-server openssh-clients
sudo systemctl enable sshd
sudo systemctl start sshd
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld

2. Add the GitLab package server and install the package

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install gitlab-ce

3. Configure and start GitLab

sudo gitlab-ctl reconfigure

4. Browse to the hostname and login

On your first visit, you‘ll be redirected to a password reset screen to provide the password for the initial administrator account. Enter your desired password and you‘ll be redirected back to the login screen.

The default account‘s username is root. Provide the password you created earlier and login. After login you can change the username if you wish.


centos7搭建gitlab版本控制系統