Install GitLAB OpenSUSE 12.3 Link => http://www.linuxpro.com.br/blog/2013/04/install-gitlab-opensuse-12-3/
#!/bin/bash | |
## Install Gitlab 5.2 on OpenSUSE 12.3 32Bits | |
## Project http://gitlab.org/ | |
## Base https://github.com/gitlabhq/gitlabhq/blob/5-0-stable/doc/install/installation.md | |
## Autor: Nilton OS -- Version 0.9 14-06-2013 -- http://wwww.linuxpro.com.br/blog | |
## Change Vars !!! | |
SERVER_IP="10.0.2.15" | |
SERVER_FQDN="gitlab.linuxpro.com.br" | |
DOMIAN="linuxpro.com.br" | |
MYSQL_PASS="123456" | |
## No change var | |
sudo_cmd="sudo -u git -H" | |
# run as root | |
zypper clean && zypper refresh | |
zypper install -y sudo vim vim-data ctags postfix python | |
zypper install -y mysql-community-server ntp python-Pygments | |
zypper install -y ruby redis curl git-core wget nginx findutils-locate | |
zypper install -y rubygem-bundler rubygem-mysql2 libxml2-devel libxslt-devel | |
zypper install -y ruby-devel make gcc libicu-devel libmysqlclient-devel gcc-c++ | |
gem install charlock_holmes --version '0.6.9' | |
groupadd git | |
useradd -m -G git --system -s /bin/sh -c 'GitLab' -d /home/git git | |
# Login as git | |
cd /home/git | |
## Error SSL | |
$sudo_cmd git config --global http.sslVerify false | |
# Clone gitlab shell | |
$sudo_cmd git clone https://github.com/gitlabhq/gitlab-shell.git | |
cd /home/git/gitlab-shell | |
# switch to right version for v5.0 | |
$sudo_cmd git checkout v1.4.0 | |
$sudo_cmd cp /home/git/gitlab-shell/config.yml.example /home/git/gitlab-shell/config.yml | |
#vim config.yml | |
sed -i "s/localhost/$SERVER_FQDN/" /home/git/gitlab-shell/config.yml | |
# Do setup | |
cd /home/git/gitlab-shell | |
$sudo_cmd ./bin/install | |
## Configure Mysql | |
rcmysql start | |
mysqladmin -u root password "$MYSQL_PASS" | |
rcmysql restart | |
# Create a user for GitLab. (change gitlab to a real password) | |
echo 'CREATE USER gitlab@localhost IDENTIFIED BY "gitlab"; | |
CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; | |
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO gitlab@localhost;' > create_bd_git.sql | |
mysql -u root -p$MYSQL_PASS < create_bd_git.sql | |
rm -f create_bd_git.sql | |
## Configure redis | |
sudo -u redis -H cp /etc/redis/default.conf.example /etc/redis/default.conf | |
rcredis restart | |
# Clone GitLab repository | |
cd /home/git/ | |
$sudo_cmd git clone https://github.com/gitlabhq/gitlabhq.git gitlab | |
# Go to gitlab dir | |
cd /home/git/gitlab | |
# Checkout to stable release | |
$sudo_cmd git checkout 5-2-stable | |
cd /home/git/gitlab | |
# Copy the example GitLab config | |
$sudo_cmd cp /home/git/gitlab/config/gitlab.yml.example /home/git/gitlab/config/gitlab.yml | |
#vim config/gitlab.yml | |
sed -i "s/localhost/$SERVER_FQDN/" /home/git/gitlab/config/gitlab.yml | |
# Make sure GitLab can write to the log/ and tmp/ directories | |
chown -R git log/ | |
chown -R git tmp/ | |
chmod -R u+rwX log/ | |
chmod -R u+rwX tmp/ | |
# Create directory for satellites | |
mkdir /home/git/gitlab-satellites | |
# Create directory for pids and make sure GitLab can write to it | |
mkdir tmp/pids/ | |
chmod -R u+rwX tmp/pids/ | |
# Copy the example Unicorn config | |
cp /home/git/gitlab/config/puma.rb.example /home/git/gitlab/config/puma.rb | |
# Mysql | |
cp /home/git/gitlab/config/database.yml.mysql /home/git/gitlab/config/database.yml | |
# Change Config DB | |
## vim config/database.yml | |
sed -i 's/root/gitlab/' /home/git/gitlab/config/database.yml | |
sed -i 's/"secure password"/gitlab/' /home/git/gitlab/config/database.yml | |
cd /home/git/gitlab | |
# For MySQL (note, the option says "without") | |
$sudo_cmd bundle install --deployment --without development test postgres | |
$sudo_cmd bundle exec rake gitlab:setup RAILS_ENV=production | |
cp lib/support/init.d/gitlab /etc/init.d/gitlab | |
chmod +x /etc/init.d/gitlab | |
sed -i 's/redis-server/redis/' /etc/init.d/gitlab | |
chown -R git:git /home/git | |
cd /home/git/gitlab | |
$sudo_cmd git config --global user.name "GitLab" | |
$sudo_cmd git config --global user.email "gitlab@$DOMIAN" | |
$sudo_cmd bundle exec rake gitlab:env:info RAILS_ENV=production | |
$sudo_cmd bundle exec rake gitlab:check RAILS_ENV=production | |
/etc/init.d/gitlab restart | |
mkdir -p /etc/nginx/vhosts.d/ | |
wget --no-check-certificate https://raw.github.com/gitlabhq/gitlab-recipes/5-0-stable/nginx/gitlab -O /etc/nginx/vhosts.d/gitlab.conf | |
## vim /etc/nginx/vhosts.d/gitlab.conf | |
sed -i "s/YOUR_SERVER_IP/$SERVER_IP/" /etc/nginx/vhosts.d/gitlab.conf | |
sed -i "s/YOUR_SERVER_FQDN/$SERVER_FQDN/" /etc/nginx/vhosts.d/gitlab.conf | |
systemctl enable nginx.service | |
systemctl start nginx.service | |
chkconfig --add mysql | |
chkconfig --add redis | |
chkconfig --add gitlab |
This comment has been minimized.
This comment has been minimized.
On Open SuSE 13.1 64 bit it's needed to call |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Hi, is this still working for 5.4? I want to include this script in gitlab-recipes if you don't mind :)