Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Gitorious installation on Ubuntu 12.04
# Binary packages
sudo apt-get update
sudo apt-get install build-essential zlib1g-dev libcurl4-openssl-dev apache2 apg geoip-bin libgeoip1 libgeoip-dev libpcre3 libpcre3-dev zlib1g zlib1g-dev libyaml-dev apache2-dev libonig-dev zip unzip memcached git-core git-svn git-doc git-cvs libreadline-dev sqlite3 libsqlite3-dev libmagick++4 libmagick++-dev libapache2-mod-xsendfile libxslt-dev libxml2-dev uuid uuid-dev imagemagick
# Packages built from sources
mkdir ~/src
# Ruby Enterprise
cd ~/src
wget -c
tar zxf ruby-enterprise-1.8.7-2012.02.tar.gz
wget -c
patch -p0 < ruby-ee.patch
sudo ruby-enterprise-1.8.7-2012.02/installer
cd /opt
sudo ln -s ruby-enterprise-1.8.7-2012.02/ ruby-enterprise
sudo ln -s /opt/ruby-enterprise/bin/ruby /opt/ruby-enterprise/bin/rake /opt/ruby-enterprise/bin/gem /usr/local/bin
sudo ln -s /opt/ruby-enterprise/bin/irb /usr/bin/irb
sudo sed -e '$ a\export PATH=\/opt\/ruby-enterprise\/bin:$PATH' -i /etc/profile
sudo sed -e '$ a\export LD_LIBRARY_PATH=\"\/usr\/local\/lib\"' -i /etc/profile
sudo sed -e '$ a\export LDFLAGS=\"-L\/usr\/local\/lib -Wl,-rpath,\/usr\/local\/lib\"' -i /etc/profile
sudo sed -e '1 i\\/usr\/local\/lib' -i /etc/
source /etc/profile
sudo ldconfig
echo "mysql-server-5.5 mysql-server/root_password password $MYSQL_ROOT_PASSWORD" | sudo debconf-set-selections
echo "mysql-server-5.5 mysql-server/root_password_again password $MYSQL_ROOT_PASSWORD" | sudo debconf-set-selections
echo "mysql-server-5.5 mysql-server/root_password seen true" | sudo debconf-set-selections
echo "mysql-server-5.5 mysql-server/root_password_again seen true" | sudo debconf-set-selections
sudo apt-get install -y mysql-client-5.5 mysql-server-5.5 libmysqlclient-dev
mysql -u root --password=$MYSQL_ROOT_PASSWORD -e "CREATE DATABASE gitorious"
mysql -u root --password=$MYSQL_ROOT_PASSWORD -e "CREATE USER 'gitorious'@'localhost' IDENTIFIED BY '$MYSQL_GITORIOUS_PASSWORD'"
mysql -u root --password=$MYSQL_ROOT_PASSWORD -e "GRANT ALL PRIVILEGES ON gitorious.* TO 'gitorious'@'localhost'"
# Sphinx
cd ~/src
wget -c
tar zxf sphinx-0.9.9.tar.gz
cd sphinx-0.9.9
sudo make install
# Memcached
sudo update-rc.d memcached defaults
# Adding gitorious group
sudo groupadd gitorious
sudo usermod -a -G gitorious $SYSADMIN
# Cloning gitorious project
sudo git clone /var/www/gitorious
sudo chown -R $SYSADMIN:gitorious /var/www/gitorious
sudo chmod -R g+sw /var/www/gitorious
sudo ln -s /var/www/gitorious/script/gitorious /usr/local/bin/gitorious
cd /var/www/gitorious/
git submodule init
git submodule update
mv public/.htaccess public/.htaccess-DISABLED
mkdir -p tmp/pids
sudo chmod ug+x script/*
sudo chmod -R g+w config/ log/ public/ tmp/
sudo ln -s /var/www/gitorious/doc/templates/ubuntu/git-ultrasphinx /etc/init.d/git-ultrasphinx
sudo ln -s /var/www/gitorious/doc/templates/ubuntu/git-daemon /etc/init.d/git-daemon
sudo ln -s /var/www/gitorious/doc/templates/ubuntu/git-poller /etc/init.d/git-poller
sudo ln -s /var/www/gitorious/doc/templates/ubuntu/stomp /etc/init.d/stomp
sudo chmod +x /etc/init.d/git-ultrasphinx
sudo chmod +x /etc/init.d/git-daemon
sudo chmod +x /etc/init.d/git-poller
sudo chmod +x /etc/init.d/stomp
sudo update-rc.d -f git-daemon start 99 2 3 4 5 .
sudo update-rc.d -f git-ultrasphinx start 99 2 3 4 5 .
sudo update-rc.d -f git-poller start 99 2 3 4 5 .
sudo update-rc.d -f stomp start 99 2 3 4 5 .
sudo gem install --no-ri --no-rdoc bundler
sudo ln -s /opt/ruby-enterprise/bin/bundle /usr/bin/bundle
cd /var/www/gitorious
sudo bundle install
sudo bundle pack
sudo bundle install --path vendor/cache
#sudo adduser git
sudo adduser --system --home /var/www/gitorious/ --no-create-home --shell /bin/bash git
sudo usermod -a -G gitorious git
sudo mkdir /srv/git
sudo ln -s /srv/git /var/git
sudo mkdir /srv/git/repositories
sudo mkdir /srv/git/tarballs
sudo mkdir /srv/git/tarballs-work
sudo chown -R git:gitorious /srv/git
sudo su git -c "mkdir ~/.ssh"
sudo su git -c "chmod 700 ~/.ssh"
sudo su git -c "touch ~/.ssh/authorized_keys"
sudo su git -c "touch .bashrc"
sudo su git -c "echo 'export RUBY_HOME=/opt/ruby-enterprise' >> .bashrc"
sudo su git -c "echo 'export GEM_HOME=\$RUBY_HOME/lib/ruby/gems/1.8/gems' >> .bashrc"
sudo su git -c "echo 'export PATH=\$RUBY_HOME/bin:\$PATH' >> .bashrc"
cd /var/www/gitorious
sudo cat > config/broker.yml << EOF
adapter: stomp
cat > config/database.yml << EOF
adapter: mysql
database: gitorious
username: gitorious
host: localhost
encoding: utf8
cat > config/gitorious.yml << EOF
cookie_secret: `< /dev/urandom tr -dc A-Za-z0-9 | head -c64`
repository_base_path: "/srv/git/repositories"
gitorious_client_port: 80
gitorious_client_host: $GITORIOUS_HOST
gitorious_host: $GITORIOUS_HOST
gitorious_user: git
exception_notification_emails: $SYSADMIN_EMAIL
mangle_email_addresses: true
public_mode: false
locale: en
archive_cache_dir: "/srv/git/tarballs"
archive_work_dir: "/srv/git/tarballs-work"
only_site_admins_can_create_projects: true
hide_http_clone_urls: true
is_gitorious_dot_org: false
use_ssl: false
RAILS_ENV=production rake _0.8.7_ db:migrate
cat | RAILS_ENV=production script/create_admin << EOF
cat | script/console production << EOF
user = User.first
user.login = "$SYSADMIN"
RAILS_ENV=production rake _0.8.7_ ultrasphinx:bootstrap
cd /var/www/gitorious
sudo chown -R git:gitorious config/environment.rb script/poller log tmp
sudo chmod -R g+w config/environment.rb script/poller log tmp
sudo chmod ug+x script/poller
sudo chmod g-w /var/www/gitorious
sudo gem install stompserver
sudo ln -s /opt/ruby-enterprise/bin/stompserver /usr/bin/stompserver
sudo /etc/init.d/stomp start
sudo env RAILS_ENV=production /etc/init.d/git-daemon start
sudo /etc/init.d/git-poller start
sudo gem install --no-ri --no-rdoc passenger --version 3.0.11
sudo /opt/ruby-enterprise/bin/passenger-install-apache2-module
cat > passenger.load << EOF
LoadModule passenger_module /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-3.0.11/ext/apache2/
PassengerRoot /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-3.0.11
PassengerRuby /opt/ruby-enterprise/bin/ruby
sudo mv passenger.load /etc/apache2/mods-available/
sudo a2enmod passenger
sudo a2enmod rewrite
sudo a2enmod deflate
sudo a2enmod expires
cat > gitorious << EOF
<VirtualHost *:80>
<Directory /var/www/gitorious/public>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from All
DocumentRoot /var/www/gitorious/public
# Gzip/Deflate
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Far future expires date
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
ExpiresActive On
ExpiresDefault "access plus 1 year"
# No Etags
FileETag None
RewriteEngine On
# Check for maintenance file and redirect all requests
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /system/maintenance.html [L]
sudo mv gitorious /etc/apache2/sites-available/
sudo a2ensite gitorious
sudo a2dissite default
sudo a2dissite default-ssl
sudo invoke-rc.d apache2 restart
sudo chmod g-w /var/www/gitorious
sudo chown -R git:gitorious /var/www/gitorious
--- ruby-enterprise-1.8.7-2012.02/source/distro/google-perftools-1.7/src/ 2012-02-19 15:09:11.000000000 +0100
+++ ruby-enterprise-1.8.7-2012.02/source/distro/google-perftools-1.7/src/ 2012-07-05 13:34:17.677491684 +0200
@@ -1669,5 +1669,5 @@
MallocHook::InvokeNewHook(result, size);
return result;
-void *(*__memalign_hook)(size_t, size_t, const void *) = MemalignOverride;
+void *(* volatile __memalign_hook)(size_t, size_t, const void *) = MemalignOverride;

This comment has been minimized.

Copy link

@rabinnh rabinnh commented Jan 3, 2013

Well, it almost worked.

NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /var/www/gitorious/vendor/cache/ruby/1.8/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21.
Type in Administrator's e-mail:
Type in Administrator's password:
Failed creating Admin user.

Loading production environment (Rails 2.3.14)
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /var/www/gitorious/vendor/cache/ruby/1.8/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21.

user = User.first
=> nil
user.login = "sysadmin"
NoMethodError: undefined method login=' for nil:NilClass from (irb):2 user.activate NoMethodError: undefined methodactivate' for nil:NilClass
from (irb):3
NoMethodError: undefined method accept_terms' for nil:NilClass from (irb):4 NoMethodError: undefined methodsave' for nil:NilClass
from (irb):5

(in /var/www/gitorious)
Please install RDoc 2.4.2+ to generate documentation.

rake aborted!
Don't know how to build task 'ultrasphinx:bootstrap'

(See full trace by running task with --trace)


This comment has been minimized.

Copy link

@chrishiggins29 chrishiggins29 commented Feb 4, 2013

@rabinnh -

instead of

  RAILS_ENV=production rake _0.8.7_ ultrasphinx:bootstrap

do this -

  sudo RAILS_ENV=production bundle exec rake thinking_sphinx:configure
  sudo RAILS_ENV=production bundle exec rake thinking_sphinx:index

Let us know if it worked (worked for me)
Good luck,


This comment has been minimized.

Copy link

@3rdLOF 3rdLOF commented May 28, 2014

Lots of people are running this on the account ethere are so few guides out there and this one is pretty goo (not really a guide, but you know what I mean) except for the ultrasphinx portion, which is no used by Gitorious any longer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.