Skip to content

Commit 692b6bb

Browse files
committed
Merge branch 'refine_centos_guide' into 'master'
WIP - Refine Centos Guide Various fixes to the Centos guide.
2 parents 86e56ee + ab3dd4b commit 692b6bb

File tree

2 files changed

+89
-64
lines changed

2 files changed

+89
-64
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[PUIAS_6_computational]
2+
name=PUIAS computational Base $releasever - $basearch
3+
mirrorlist=http://puias.math.ias.edu/data/puias/computational/$releasever/$basearch/mirrorlist
4+
#baseurl=http://puias.math.ias.edu/data/puias/computational/$releasever/$basearch
5+
enabled=1
6+
gpgcheck=1
7+
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puias

install/centos/README.md

Lines changed: 82 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
```
22
Distribution : CentOS 6.5 Minimal
3-
GitLab version : 6.0 - 6.7
3+
GitLab version : 6.0 - 6.8
44
Web Server : Apache, Nginx
55
Init system : sysvinit
66
Database : MySQL, PostgreSQL
@@ -98,18 +98,13 @@ Computational repository to obtain a git v1.8.x package since the base CentOS
9898
repositories only provide v1.7.1 which is not compatible with GitLab.
9999
Although the PUIAS offers an RPM to install the repo, it requires the
100100
other PUIAS repos as a dependency, so you'll have to add it manually.
101+
Otherwise you can install git from source (instructions below).
101102

102-
Create `/etc/yum.repos.d/PUIAS_6_computational.repo` and add the following lines:
103+
Download PUIAS repo:
103104

104-
[PUIAS_6_computational]
105-
name=PUIAS computational Base $releasever - $basearch
106-
mirrorlist=http://puias.math.ias.edu/data/puias/computational/$releasever/$basearch/mirrorlist
107-
#baseurl=http://puias.math.ias.edu/data/puias/computational/$releasever/$basearch
108-
enabled=1
109-
gpgcheck=1
110-
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puias
105+
wget -O /etc/yum.repos.d/PUIAS_6_computational.repo https://gitlab.com/gitlab-org/gitlab-recipes/raw/master/install/centos/PUIAS_6_computational.repo
111106

112-
Next download and install the gpg key.
107+
Next download and install the gpg key:
113108

114109
wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-puias http://springdale.math.ias.edu/data/puias/6/x86_64/os/RPM-GPG-KEY-puias
115110
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-puias
@@ -139,7 +134,7 @@ If you can't see them listed, use the folowing command (from `yum-utils` package
139134

140135
yum -y update
141136
yum -y groupinstall 'Development Tools'
142-
yum -y install vim-enhanced readline readline-devel ncurses-devel gdbm-devel glibc-devel tcl-devel openssl-devel curl-devel expat-devel db4-devel byacc sqlite-devel gcc-c++ libyaml libyaml-devel libffi libffi-devel libxml2 libxml2-devel libxslt libxslt-devel libicu libicu-devel system-config-firewall-tui redis sudo wget crontabs logwatch logrotate perl-Time-HiRes git patch
137+
yum -y install readline readline-devel ncurses-devel gdbm-devel glibc-devel tcl-devel openssl-devel curl-devel expat-devel db4-devel byacc sqlite-devel libyaml libyaml-devel libffi libffi-devel libxml2 libxml2-devel libxslt libxslt-devel libicu libicu-devel system-config-firewall-tui redis sudo wget crontabs logwatch logrotate perl-Time-HiRes
143138

144139
**RHEL Notes**
145140

@@ -183,45 +178,49 @@ You can choose between editors such as nano, vi, vim, etc.
183178
In this case we will use vim as the default editor for consistency.
184179

185180
ln -s /usr/bin/vim /usr/bin/editor
186-
181+
187182
To remove this alias in the future:
188-
183+
189184
rm -i /usr/bin/editor
190185

191186

192187
### Install Git from Source (optional)
193188

194-
Remove the system Git
189+
Make sure Git is version 1.7.10 or higher, for example 1.7.12 or 1.8.4
190+
191+
git --version
192+
193+
If not install it from source. Remove the system Git:
195194

196195
yum -y remove git
197196

198-
Install the pre-requisite files for Git compilation
197+
Install the pre-requisite files for Git compilation:
199198

200199
yum install zlib-devel perl-CPAN gettext curl-devel expat-devel gettext-devel openssl-devel
201-
202-
Download and extract Git 1.9.0
200+
201+
Download and extract it:
203202

204203
mkdir /tmp/git && cd /tmp/git
205204
curl --progress https://git-core.googlecode.com/files/git-1.9.0.tar.gz | tar xz
206205
cd git-1.9.0/
207206
./configure
208207
make
209208
make prefix=/usr/local install
210-
209+
211210
Make sure Git is in your `$PATH`:
212211

213212
which git
214-
215-
You might have to run `source ~/.bash_profile` for the `$PATH` to take effect.
216213

214+
You might have to logout and login again for the `$PATH` to take effect.
215+
**Note:** When editing `config/gitlab.yml` (step 6), change the git `bin_path` to `/usr/local/bin/git`.
217216

218217
----------
219218

220219
## 2. Ruby
221220

222221
The use of ruby version managers such as [RVM](http://rvm.io/), [rbenv](https://github.com/sstephenson/rbenv) or [chruby](https://github.com/postmodern/chruby) with GitLab in production frequently leads to hard to diagnose problems. Version managers are not supported and we strongly advise everyone to follow the instructions below to use a system ruby.
223222

224-
Remove the old Ruby 1.8 package if present. Gitlab 6.7 only supports the Ruby 2.0.x release series:
223+
Remove the old Ruby 1.8 package if present. GitLab only supports the Ruby 2.0+ release series:
225224

226225
yum remove ruby
227226

@@ -257,9 +256,7 @@ installed with:
257256

258257
Create a `git` user for Gitlab:
259258

260-
adduser --system --shell /sbin/nologin --comment 'GitLab' --create-home --home-dir /home/git/ git
261-
262-
For extra security, the shell we use for this user does not allow logins via a terminal.
259+
adduser --system --shell /bin/bash --comment 'GitLab' --create-home --home-dir /home/git/ git
263260

264261
**Important:** In order to include `/usr/local/bin` to git user's PATH, one way is to edit the sudoers file. As root run:
265262

@@ -286,20 +283,24 @@ GitLab Shell is a ssh access and repository management application developed spe
286283
cd /home/git
287284

288285
# Clone gitlab shell
289-
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-shell.git -b v1.9.1
286+
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-shell.git -b v1.9.3
290287

291288
cd gitlab-shell
292289

293290
sudo -u git -H cp config.yml.example config.yml
294291

295292
# Edit config and replace gitlab_url
296293
# with something like 'https://domain.com/'
297-
# also edit self_signed_cert to true if you are going to use selfsigned cert
294+
# also edit self_signed_cert to true if you are going to use a self signed cert
298295
sudo -u git -H editor config.yml
299296

300297
# Do setup
301298
sudo -u git -H /usr/local/bin/ruby ./bin/install
302299

300+
# Ensure the correct SELinux contexts are set
301+
# Read http://wiki.centos.org/HowTos/Network/SecuringSSH
302+
restorecon -Rv /home/git/.ssh
303+
303304
----------
304305

305306
## 5. Database
@@ -312,37 +313,52 @@ Install `mysql` and enable the `mysqld` service to start on boot:
312313
chkconfig mysqld on
313314
service mysqld start
314315

315-
Secure MySQL by entering a root password and say "Yes" to all questions:
316+
Ensure you have MySQL version 5.5.14 or later:
317+
318+
mysql --version
316319

317-
/usr/bin/mysql_secure_installation
320+
Secure your installation:
318321

319-
Create a new user and database for GitLab:
322+
mysql_secure_installation
323+
324+
Login to MySQL (type the database root password):
320325

321-
# Login to MySQL
322326
mysql -u root -p
323-
# Type the database root password
324-
# Create a user for GitLab. (change supersecret to a real password)
325-
CREATE USER 'git'@'localhost' IDENTIFIED BY 'supersecret';
326327

327-
# Create the GitLab production database
328+
329+
Create a user for GitLab (change $password in the command below to a real password you pick):
330+
331+
CREATE USER 'git'@'localhost' IDENTIFIED BY '$password';
332+
333+
Ensure you can use the InnoDB engine which is necessary to support long indexes.
334+
If this fails, check your MySQL config files (e.g. `/etc/mysql/*.cnf`, `/etc/mysql/conf.d/*`) for the setting "innodb = off".
335+
336+
SET storage_engine=INNODB;
337+
338+
Create the GitLab production database:
339+
328340
CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
329341

330-
# Grant the GitLab user necessary permissions on the table.
342+
Grant the GitLab user necessary permissions on the table:
343+
331344
GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'git'@'localhost';
332345

333-
# Quit the database session
346+
Quit the database session:
347+
334348
\q
335349

336350
Try connecting to the new database with the new user:
337351

338-
mysql -u git -p -D gitlabhq_production
339-
# Type the password you replaced supersecret with earlier
340-
# Quit the database session
352+
sudo -u git -H mysql -u git -p -D gitlabhq_production
353+
354+
Type the password you replaced $password with earlier.
355+
Quit the database session:
356+
341357
\q
342358

343359
### 5.2 PostgreSQL
344360

345-
NOTE: because we need to make use of extensions we need at least pgsql 9.1 and the default 8.x on centos will not work. We need to get the PGDG repositories enabled
361+
NOTE: because we need to make use of extensions we need at least pgsql 9.1 and the default 8.x on centos will not work. We need to get the PGDG repositories enabled
346362

347363
Install the pgdg repositories
348364

@@ -370,9 +386,10 @@ Configure the database user and password:
370386

371387
su - postgres
372388
psql -d template1
373-
psql (8.4.13)
374389

375-
template1=# CREATE USER git WITH PASSWORD 'your-password-here';
390+
psql (8.4.20)
391+
Type "help" for help.
392+
template1=# CREATE USER git CREATEDB;
376393
CREATE ROLE
377394
template1=# CREATE DATABASE gitlabhq_production OWNER git;
378395
CREATE DATABASE
@@ -382,22 +399,24 @@ Configure the database user and password:
382399
Test the connection as the gitlab (uid=git) user. You should be root to begin this test:
383400

384401
whoami
385-
402+
386403
Attempt to log in to Postgres as the git user:
387404

388-
sudo -u git psql -d gitlabhq_production -U git -W
389-
405+
sudo -u git psql -d gitlabhq_production
406+
390407
If you see the following:
391408

392409
gitlabhq_production=>
393410

394-
Your password has been accepted successfully and you can type \q to quit.
411+
your password has been accepted successfully and you can type \q to quit.
395412

396-
You should ensure you are using the right settings in your pg_hba.conf to not get ident issues
397-
NOTE: set to something like "host all all 127.0.0.1/32 trust" use trust over ident
413+
Ensure you are using the right settings in your `/var/lib/pgsql/9.3/data/pg_hba.conf`
414+
to not get ident issues (you can use trust over ident):
398415

399-
vi /var/lib/pgsql/9.3/data/pg_hba.conf
416+
host all all 127.0.0.1/32 trust
400417

418+
Check the official [documentation][psql-doc-auth] for more information on
419+
authentication methods.
401420

402421
----------
403422
## 6. GitLab
@@ -408,9 +427,9 @@ NOTE: set to something like "host all all 127.0.0.1/3
408427
### Clone the Source
409428

410429
# Clone GitLab repository
411-
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 6-7-stable gitlab
430+
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 6-8-stable gitlab
412431

413-
**Note:** You can change `6-7-stable` to `master` if you want the *bleeding edge* version, but do so with caution!
432+
**Note:** You can change `6-8-stable` to `master` if you want the *bleeding edge* version, but do so with caution!
414433

415434
### Configure it
416435

@@ -426,23 +445,21 @@ NOTE: set to something like "host all all 127.0.0.1/3
426445
sudo -u git -H editor config/gitlab.yml
427446

428447
# Make sure GitLab can write to the log/ and tmp/ directories
429-
sudo chown -R git log/
430-
sudo chown -R git tmp/
431-
sudo chmod -R u+rwX log/
432-
sudo chmod -R u+rwX tmp/
448+
chown -R git log/
449+
chown -R git tmp/
450+
chmod -R u+rwX log/
451+
chmod -R u+rwX tmp/
433452

434453
# Create directory for satellites
435454
sudo -u git -H mkdir /home/git/gitlab-satellites
455+
chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites
436456

437-
# Create directories for sockets/pids and make sure GitLab can write to them
438-
sudo -u git -H mkdir tmp/pids/
439-
sudo -u git -H mkdir tmp/sockets/
440-
sudo chmod -R u+rwX tmp/pids/
441-
sudo chmod -R u+rwX tmp/sockets/
457+
# Make sure GitLab can write to the tmp/pids/ and tmp/sockets/ directories
458+
chmod -R u+rwX tmp/pids/
459+
chmod -R u+rwX tmp/sockets/
442460

443-
# Create public/uploads directory otherwise backup will fail
444-
sudo -u git -H mkdir public/uploads
445-
sudo chmod -R u+rwX public/uploads
461+
# Make sure GitLab can write to the public/uploads/ directory
462+
chmod -R u+rwX public/uploads
446463

447464
# Copy the example Unicorn config
448465
sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb
@@ -488,7 +505,7 @@ Make sure to edit both `gitlab.yml` and `unicorn.rb` to match your setup.
488505
cd /home/git/gitlab
489506

490507
# For MySQL (note, the option says "without ... postgres")
491-
sudo -u git -H /usr/local/bin/bundle install --deployment --without development test postgres aws
508+
sudo -u git -H bundle install --deployment --without development test postgres aws
492509

493510
# Or for PostgreSQL (note, the option says "without ... mysql")
494511
sudo -u git -H bundle config build.pg --with-pg-config=/usr/pgsql-9.3/bin/pg_config
@@ -657,3 +674,4 @@ nobody can access your GitLab by using this login information later on.
657674
[keys]: https://fedoraproject.org/keys
658675
[issue-nginx]: https://github.com/gitlabhq/gitlabhq/issues/5774
659676
[nginx-centos]: http://wiki.nginx.org/Install#Official_Red_Hat.2FCentOS_packages
677+
[psql-doc-auth]: http://www.postgresql.org/docs/9.3/static/auth-methods.html

0 commit comments

Comments
 (0)