Install Gitlab Fedora 16

Posted on by

I was using the very good guide found here: http://wasil.org/gitlab-installation-on-fedora-16-with-gitolite however there were quite a few things that didn’t work with my Rackspace Install of Fedora 16 so I have updated below:

yum update
yum install make openssh-clients gcc libxml2 libxml2-devel libxslt libxslt-devel python-devel httpd mysql mysql-server mysql-devel gcc-c++ curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel libicu-devel sendmail redis
systemctl start mysqld.service
/usr/bin/mysql_secure_installation

Remember the password you set here!

systemctl enable mysqld.service
adduser -r -m --shell /bin/bash --comment 'git version control' git
mkdir /home/git/.ssh
chown git:git -R /home/git/.ssh
ssh-keygen -q -o -N '' -t rsa -f /home/git/.ssh/id_rsa
usermod -s /bin/bash -d /var/www/ -G git apache
mkdir /var/www/.ssh
cp -f /home/git/.ssh/id_rsa* /var/www/.ssh/ && chown apache:apache /var/www/.ssh/id_rsa* && chmod 600 /var/www/.ssh/id_rsa*
sudo -u apache ssh-keyscan localhost >> /var/www/.ssh/known_hosts
chown -R apache:apache /var/www

Install Ruby

sudo bash -s stable < <(curl -sk https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
source /etc/profile.d/rvm.sh
rvm pkg install openssl
rvm install ruby-1.9.3-p194 --with-openssl
rvm all do gem update --system
rvm all do gem install rails
rvm all do gem install passenger
passenger-install-apache2-module

Add to httpd.conf – vi /etc/httpd/conf/httpd.conf

LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p194/ruby

Add to gitlab.conf – vi /etc/httpd/conf.d/gitlab.conf

<VirtualHost *:80>
ServerName yourserver.yourdomain.com
DocumentRoot /var/www/gitlabhq/public
<Directory /var/www/gitlabhq/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>

Install Gitolite

yum install -y gitolite
curl http://python-distribute.org/distribute_setup.py | python
easy_install pip
cd /var/www
git clone git://github.com/gitlabhq/gitlabhq.git
cd /var/www/gitlabhq/
pip install pygments
rvm all do gem install bundler
bundle install --deployment --without development test
service redis start
chkconfig redis on
cp config/gitlab.yml.example config/gitlab.yml
cp config/database.yml.example config/database.yml

Set database and host config

vi config/database.yml

Change “Secure password” to one set earlier

vi config/gitlab.yml

Change host and others to what required

RAILS_ENV=production rake db:setup
RAILS_ENV=production rake db:seed_fu
sed -i 's/0077/0007/g' /usr/share/gitolite/conf/example.gitolite.rc
su - git -c "gl-setup -q /home/git/.ssh/id_rsa.pub"

Clean up permissions or you won’t be able to browse code in Gitlab

chown -R git:git /home/git/
chmod 770 /home/git/repositories/
chmod 770 /home/git/
chmod 600 -R /home/git/.ssh/
chmod 700 /home/git/.ssh/
chmod 600 /home/git/.ssh/authorized_keys
chown -R apache:apache /var/www/gitlabhq
chown apache:root -R /usr/local/rvm/gems/
chmod 770 /home/git/
chmod go-w /home/git/

Start Apache

systemctl start httpd.service
systemctl enable httpd.service
iptables -I INPUT 1 -p tcp --dport http -j ACCEPT
iptables-save > /etc/sysconfig/iptables
systemctl restart iptables.service

Sign in as
admin@local.host
5iveL!fe

Apache, Fedora | 2 Comments
  • Daniel Craig Jallits

    Out of the countless tutorials out there yours is the only one that works almost flawlessly. For some reason my customizations in gitlab.yml aren’t being read in.

    Just thought it was worth mentioning that your instructions apply to (mt) DV4 instances. I would just add that in line 10 because you are in a virtual host enviroment it is generally a bad idea to chown the whole www directory and its contents. So I recommend skipping that line and replace it with the following after you clone GitlabHQ

    chown -R apache:apache /var/www/gitlabhq

  • http://profile.yahoo.com/HJG7CCAHJIN56P3CQ4SSJE5K5Q raka

    I followed the step but when I do bundle exe production. I am able to login to the web interface but when I want to add a project its asking for password at the console. git@localhost:disqus
    Coutless search on google is not helping either.  And when I somehow manged to copy ssh keys to all users across.. I am still not able to create project it says problem is connecting to gitolite system. I am using centos 6.. but same problem I faced on F16 as well.