📜 ⬆️ ⬇️

Installing Gitorious on Centos 6

image
Gitorious - an open source alternative to GitHUB, written in RoR, uses ActiveMQ (in this case Stomp)
The installation was performed on a freshly installed CentOS-6.2-x86_64-minimal distribution kit. All commands are executed from root, where a different user is needed will be an appropriate indication.

Installation time ~ 3 hours

Preparing to install Gitorious

For convenience, I installed the nano console text editor (I don’t like vi), wget’s shaker, midnight commander file manager
')
yum install nano wget mc 


Now you need to add the RPMForge repository

 wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm rpm -ivh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm 


Then update the system and install some required packages.

 yum update yum groupinstall -y "Development tools" "Development Libraries" yum install -y git-core git-svn java-1.6.0-openjdk vim-* apg pcre pcre-devel zlib zlib-devel libyaml-devel GeoIP-devel sphinx mysql-devel mysql-server mysql readline-devel libxml2-devel libxslt libxslt-devel aspell* 


Mysql

Now we set up MySQL

 service mysqld start /usr/bin/mysql_secure_installation 


Set a password for the root user and answer yes to all requests.

Ruby Enterprise Edition

Download the latest ruby ​​enterprise distribution from www.rubyenterpriseedition.com/download.html and install

 wget http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2012.02.tar.gz tar xzf tar xzf ruby-enterprise-1.8.7-2012.02.tar.gz cd cd ruby-enterprise-1.8.7-2012.02 ./installer 


Click Enter 2 times and wait for the installation to finish.
We configure ruby ​​and we change variable environments
 cd /opt ln -s ruby-enterprise-1.8.7-2012.02/ ruby nano /etc/profile      if [ "$EUID" = "0" ]; then pathmunge /opt/ruby/bin export RAILS_ENV=production export PATH=/usr/local/sphinx/bin:/usr/local/bin:$PATH export _JAVA_OPTIONS=-Xmx64m export MAGICK_HOME=/usr/local export DYLD_LIBRARY_PATH=/usr/local/lib 


Add the following settings to the very end of the file.
 nano /etc/bashrc pathmungea () { if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then if [ "$2" = "after" ] ; then PATH=$PATH:$1 else PATH=$1:$PATH fi fi } pathmungea /opt/ruby/bin export RAILS_ENV=production export PATH=/usr/local/sphinx/bin:/usr/local/bin:$PATH export _JAVA_OPTIONS=-Xmx64m export MAGICK_HOME=/usr/local export DYLD_LIBRARY_PATH=/usr/local/lib unset pathmungea 


Now relogin and proceed with the installation of ImageMagick

Imagemagick

 cd ~ yum install -y tcl-devel libpng-devel libjpeg-devel ghostscript-devel bzip2-devel freetype-devel libtiff-devel 


yum is an outdated version of ImageMagick, so we install from source to prevent errors
 wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.7.6-1.tar.gz tar xzf ImageMagick-6.7.6-1.tar.gz cd ImageMagick-6.7.6-1 ./configure --prefix=/usr/local --with-bzlib=yes --with-fontconfig=yes --with-freetype=yes --with-gslib=yes --with-gvc=yes --with-jpeg=yes --with-jp2=yes --with-png=yes --with-tiff=yes make make install 


Now you need to install some ruby ​​gems and bundle exec

 gem install bundle gem install sphinx rmagick ultrasphinx mime-types chronic ruby-hmac daemons mime-types BlueCloth ruby-yadis ruby-openid rspec rspec-rails RedCloth stompserver --no-ri --no-rdoc 


Add EPEL repository (download.fedora.redhat.com changed to dl.fedoraproject.org)

 wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm 


Gitorious

Actually finished with the preparation, now you can safely proceed to the installation of the subject.

useradd -d / home / git git

 su git cd ~ mkdir log mkdir conf git clone git://gitorious.org/gitorious/mainline.git gitorious cd gitorious/ mkdir -p tmp/pids exit #logout  root ln -s /home/git/gitorious/script/gitorious /usr/local/bin/gitorious cd /home/git/gitorious/ chmod ug+x script/* chmod -R g+w config/ log/ public/ tmp/ 


Configuring gitorious

 su git nano /home/git/gitorious/doc/templates/centos/git-daemon RUBY_HOME="/opt/ruby" GITORIOUS_HOME="/home/git/gitorious" nano /home/git/gitorious/doc/templates/centos/git-ultrasphinx GITORIOUS_HOME="/home/git/gitorious" nano /home/git/gitorious/doc/templates/centos/git-poller RUBY_HOME="/opt/ruby" GITORIOUS_HOME="/home/git/gitorious" export _JAVA_OPTIONS=-Xmx64m nano /home/git/gitorious/doc/templates/centos/stomp RUBY_HOME="/opt/ruby" GEMS_HOME="/opt/ruby" GITORIOUS_HOME="/home/git/gitorious" exit gem install --no-ri --no-rdoc -v 1.5.0 json gem install --no-ri --no-rdoc -v 1.3.1.1 rdiscount gem install --no-ri --no-rdoc -v 0.8.7 rake gem install --no-ri --no-rdoc -v 1.1.0 daemons gem install --no-ri --no-rdoc -v 0.8.9 geoip gem install --no-ri --no-rdoc -v 1.0 raspell gem uninstall rake -v 0.9.2.2 cd /home/git/gitorious bundle install cp config/database.sample.yml config/database.yml cp config/gitorious.sample.yml config/gitorious.yml cp config/broker.yml.example config/broker.yml su git mkdir /home/git/data mkdir /home/git/data/repositories mkdir /home/git/data/tarballs mkdir /home/git/data/tarball-work chown -R git:git /home/git/data #    mkdir /home/git/.ssh chmod -R 700 /home/git/.ssh touch /home/git/.ssh/authorized_keys chmod 600 /home/git/.ssh/authorized_keys chmod -R 700 /home/git/data exit chown -R git:git /home/git chmod 711 /home/git 

Create a secret cookie for the configuration file

 apg -m 64 


and copy the data to a file
 nano /home/git/gitorious/config/gitorious.yml 

in the cookie_secret string:

Example:

 development: cookie_secret: SwouncievNivJucivrevnisfookEcnasiarHamgogdipmopyicbyctyikBagArimgronugAmIsUkDifpoyftEggobviuzIpArgecHewElsOcubnuejEtDecerlyooHibsmivyecivfalakMarfAvikokip^ojyorwahonkIrEdeibZepbivsaftIdmapmic)frivetcetEceivepJuxNeipnidzaroyffAgVevfuIvDesemAfyacAppAtdeavayswenEjUcoofnafryefGewboshkyersufcawJontIavZenFeifWoitGejEajnoiWrysawidHewofOkheTwiOjFigWigbobinCushBurnErnodedLuenAtTeyznoynoryop repository_base_path: "/home/git/data/repositories" extra_html_head_data: system_message: gitorious_client_port: 80 gitorious_client_host: git.example.com gitorious_host: git.example.com gitorious_user: git exception_notification_emails: admin@example.com mangle_email_addresses: true public_mode: true locale: en archive_cache_dir: "/home/git/data/tarballs" archive_work_dir: "/home/git/data/tarball-work" only_site_admins_can_create_projects: true hide_http_clone_urls: false is_gitorious_dot_org: false use_ssl: false test: cookie_secret: SwouncievNivJucivrevnisfookEcnasiarHamgogdipmopyicbyctyikBagArimgronugAmIsUkDifpoyftEggobviuzIpArgecHewElsOcubnuejEtDecerlyooHibsmivyecivfalakMarfAvikokip^ojyorwahonkIrEdeibZepbivsaftIdmapmic)frivetcetEceivepJuxNeipnidzaroyffAgVevfuIvDesemAfyacAppAtdeavayswenEjUcoofnafryefGewboshkyersufcawJontIavZenFeifWoitGejEajnoiWrysawidHewofOkheTwiOjFigWigbobinCushBurnErnodedLuenAtTeyznoynoryop repository_base_path: "/home/git/data/repositories" extra_html_head_data: system_message: gitorious_client_port: 80 gitorious_client_host: git.example.com gitorious_host: git.example.com gitorious_user: git exception_notification_emails: admin@example.com mangle_email_addresses: true public_mode: true locale: en archive_cache_dir: "/home/git/data/tarballs" archive_work_dir: "/home/git/data/tarball-work" only_site_admins_can_create_projects: true hide_http_clone_urls: false is_gitorious_dot_org: false use_ssl: false production: cookie_secret: SwouncievNivJucivrevnisfookEcnasiarHamgogdipmopyicbyctyikBagArimgronugAmIsUkDifpoyftEggobviuzIpArgecHewElsOcubnuejEtDecerlyooHibsmivyecivfalakMarfAvikokip^ojyorwahonkIrEdeibZepbivsaftIdmapmic)frivetcetEceivepJuxNeipnidzaroyffAgVevfuIvDesemAfyacAppAtdeavayswenEjUcoofnafryefGewboshkyersufcawJontIavZenFeifWoitGejEajnoiWrysawidHewofOkheTwiOjFigWigbobinCushBurnErnodedLuenAtTeyznoynoryop repository_base_path: "/home/git/data/repositories" extra_html_head_data: system_message: gitorious_client_port: 80 gitorious_client_host: git.example.com gitorious_host: git.matthouse.us gitorious_user: git exception_notification_emails: admin@example.com mangle_email_addresses: true public_mode: true locale: en archive_cache_dir: "/home/git/data/tarballs" archive_work_dir: "/home/git/data/tarball-work" only_site_admins_can_create_projects: true hide_http_clone_urls: false is_gitorious_dot_org: false use_ssl: false 


Continue setting:

 nano /home/git/gitorious/config/broker.yml production: adapter: stomp development: adapter: stomp test: adapter: stomp 


configure Mysql and initialize the database

 mysql -uroot –p'<ROOT'S MYSQL PASSWORD>' create database gitorious; create database gitorious_test; create database gitorious_dev; CREATE user 'git'@'localhost' IDENTIFIED BY '<PASWORD>'; GRANT ALL ON gitorious.* TO 'git'@'localhost'; GRANT ALL ON gitorious_test.* TO 'git'@'localhost'; GRANT ALL ON gitorious_dev.* TO 'git'@'localhost'; FLUSH privileges; exit; nano /home/git/gitorious/config/database.yml cd /home chown -R git:git /home/git cd /home/git chmod -R 755 data chmod 755 gitorious cd /home/git/gitorious 


 nano Rakefile #  require 'thread' # require 'tasks/rails' 


 cd /home chown -R git:git /home/git cd /home/git chmod -R 755 data chmod 755 gitorious gem update --system 1.6.2 bundle exec rake gems:install bundle exec rake db:create:all bundle exec rake db:setup bundle exec rake db:migrate 


Ultrsphinx setup:
 cd /home/git/gitorious export RAILS_ENV=production export PATH=/usr/local/sphinx/bin:$PATH bundle exec rake ultrasphinx:configure RAILS_ENV=production bundle exec rake ultrasphinx:index bundle exec rake ultrasphinx:daemon:start RAILS_ENV=production 


create links to init files and start the services necessary for Gitorious to work

 ln -s /home/git/gitorious/doc/templates/centos/git-daemon /etc/init.d/git-daemon chmod +x /etc/init.d/git-daemon chkconfig --add git-daemon service git-daemon start ln -s /home/git/gitorious/doc/templates/centos/stomp /etc/init.d/stomp chmod +x /etc/init.d/stomp chkconfig --add stomp service stomp start ln -s /home/git/gitorious/doc/templates/centos/git-poller /etc/init.d/git-poller cd /home chown -R git:git /home/git cd /home/git chmod -R 755 data chmod 755 gitorious chmod +x /etc/init.d/git-poller chkconfig --add git-poller nano /home/git/gitorious/script/poller #  require 'thread'   $KCODE = 'u' service git-poller start ln -s /usr/local/bin/gitorious /usr/bin cd /home chown -R git:git /home/git cd /home/git chmod -R 755 data chmod 755 gitorious 


configuring ultrasphinx

 #  cd /home/git/gitorious aspell config dict-dir /usr/lib64/aspell-0.60 cp vendor/plugins/ultrasphinx/examples/ap.multi /usr/lib64/aspell-0.60/ bundle exec rake ultrasphinx:spelling:build nano /home/git/gitorious/config/ultrasphinx/production.conf # "address" "listen" listen = 0.0.0.0 #    64 indexer { mem_limit = 64M # git-ultrasphinx . ln -s /home/git/gitorious/doc/templates/centos/git-ultrasphinx /etc/init.d/git-ultrasphinx chmod +x /etc/init.d/git-ultrasphinx 


memcached
Install memcached
 yum install -y --enablerepo=remi memcached service memcached start chkconfig memcached on 

Apache
 yum install -y httpd httpd-devel mod_xsendfile curl-devel # xsendfile nano /etc/httpd/conf.d/xsendfile.conf #   LoadModule XSendFile on XSendFilePath /home/git/data/tarballs XSendFilePath /home/git/data/repositories 

Install Ruby passenger
 /opt/ruby/bin/passenger-install-apache2-module 


Httpd.conf example
Host.conf example

Final teams:

 chcon -R -h -t httpd_sys_script_exec_t /opt/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.11/ext/apache2/mod_passenger.so service httpd configtest service httpd start 


disable the firewall (we have a clean system, it is not yet configured)
 service iptables stop 


Open git.example.com in the browser and admire the gitorious home page.

image

Source: https://habr.com/ru/post/154573/


All Articles