Skip to content

Instantly share code, notes, and snippets.

@simonvc
Forked from ikawka/gist:4174481
Last active December 20, 2015 02:09
Show Gist options
  • Save simonvc/6053881 to your computer and use it in GitHub Desktop.
Save simonvc/6053881 to your computer and use it in GitHub Desktop.
# see also http://www.pickysysadmin.ca/2013/03/25/how-to-install-gitlab-5-0-on-centos-6/
su -
#dependcies
#centos 6.2 | http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-7.noarch.rpm
rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm
yum -y groupinstall 'Development Tools' 'Additional Development'
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 gcc-c++ libyaml libyaml-devel libffi libffi-devel libxml2 libxml2-devel libxslt libxslt-devel libicu libicu-devel system-config-firewall-tui python-devel redis
#$ wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
#$ tar xzvf yaml-0.1.4.tar.gz
#$ cd yaml-0.1.4
#$ ./configure --prefix=/usr/local
#$ make
#$ make install
#ruby
curl -O http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
tar xzvf ruby-1.9.3-p0.tar.gz
cd ruby-1.9.3-p0
./configure --enable-shared --disable-pthread --prefix=/usr/local/pearson
make
make install
#$ wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
#$ tar xzvf ruby-1.9.3-p0.tar.gz
#$ cd ruby-1.9.3-p0
#$ ./configure --prefix=/usr/local --enable-shared --disable-install-doc --with-opt-dir=/usr/local/lib
#$ make
#$ make install
#install qt4
yum install -y qt4 qt4-devel qtwebkit-devel
export PATH=$PATH:/usr/lib64/qt4/bin
gem install rubygems-update
gem update --system
gem update
gem install rails
adduser --shell /bin/bash --create-home --home-dir /home/gitlab gitlab
#generate ssh key
su gitlab
ssh-keygen -t rsa # as gitlab user
exit
adduser -r --shell /bin/sh --comment 'gitolite' --create-home --home-dir /home/git git
#permission
usermod -a -G git gitlab
sudo usermod -a -G gitlab git
#gitolite
# make sure you do this as root
cp /home/gitlab/.ssh/id_rsa.pub /home/git/gitlab.pub
su git
#getolite
sudo -H -u git git clone -b gl-v304 https://github.com/gitlabhq/gitolite.git /home/git/gitolite
cd /home/git
sudo -u git -H mkdir bin
sudo -u git sh -c 'echo -e "PATH=\$PATH:/home/git/bin\nexport PATH" >> /home/git/.profile'
sudo -u git sh -c 'gitolite/install -ln /home/git/bin'
sudo cp /home/gitlab/.ssh/id_rsa.pub /home/git/gitlab.pub
sudo chmod 0444 /home/git/gitlab.pub
sudo -u git -H sh -c "PATH=/home/git/bin:$PATH; gitolite setup -pk /home/git/gitlab.pub"
#permission
chmod -R g+rwX /home/git/repositories/
chmod 770 /home/git
# clone admin repo to add localhost to known_hosts
# & be sure your user has access to gitolite
sudo -u gitlab -H git clone git@localhost:gitolite-admin.git /tmp/gitolite-admin
# if succeed you can remove it
sudo rm -rf /tmp/gitolite-admin
passwd gitlab # please choose a good password :)
#make gitlab sudoer
visudo
# find: root ALL=(ALL) ALL
# and add
gitlab ALL=(ALL) ALL
#python
curl http://python-distribute.org/distribute_setup.py | python
#install pip
wget http://pypi.python.org/packages/source/p/pip/pip-0.7.2.tar.gz
tar xzf pip-0.7.2.tar.gz
cd pip-0.7.2
python setup.py install
pip install pygments
gem install bundler
#more gems!!!
gem install ruby-debug19
gem install charlock_holmes
#pg headers and gem
wget http://yum.postgresql.org/9.1/redhat/rhel-5-x86_64/pgdg-centos91-9.1-4.noarch.rpm
rpm -i pgdg-centos91-9.1-4.noarch.rpm
yum install postgresql91-devel
PATH=/usr/pgsql-9.1/bin:$PATH
gem install pg
#mysql
yum -y install mysql-server mysql-devel
/etc/init.d/mysqld start
mysql_secure_installation
mysql -u root -p # when prompted enter the root password you've chosen in mysql_secure_installation
mysql> CREATE DATABASE gitlab CHARACTER SET UTF8;
mysql> GRANT ALL PRIVILEGES ON gitlab.* TO 'gitlabusr'@'localhost' IDENTIFIED BY 'supersecret' WITH GRANT OPTION;
mysql> quit
gem install mysql2 -v '0.3.11'
#install gitlab
cd /home/gitlab
#stable
sudo -H -u gitlab git clone -b stable https://github.com/gitlabhq/gitlabhq.git gitlab
cd gitlab
# Rename config files
sudo -u gitlab cp config/gitlab.yml.example config/gitlab.yml
# Copy mysql db config
# make sure to update username/password in config/database.yml change all users to root & password
sudo -u gitlab cp config/database.yml.mysql config/database.yml
# Copy unicorn config
sudo -u gitlab cp config/unicorn.rb.example config/unicorn.rb
#as gitlab
cd ~/gitlabhq
before you rake it edit Gem lock file and look for rake(10.0.1) and change to 10.0.2
RAILS_ENV=production rake db:setup
RAILS_ENV=production rake db:seed_fu
exit
#disable firewall or you can configure it if you want, as root
service iptables save
service iptables stop
chkconfig iptables off
exit
#as gitlab
bundle exec rails s -e production
celebrate!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment