Forked from premist/stage0-change-mirror-to-korean.sh
Last active
December 11, 2015 16:29
-
-
Save agborkowski/4628356 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# skipp it if you wont change mirror of repository | |
curl https://raw.github.com/gist/1588091/8b7b7a203074231f3dc75bdee48b3017078fb621/CentOS-Base.repo -o /etc/yum.repos.d/CentOS-Base.repo | |
curl https://raw.github.com/gist/1588091/2e5ab750cd0603dd7210ea7a999d15f9aadae711/epel.repo -o /etc/yum.repos.d/epel.repo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yum -y update | |
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 gitolite 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 | |
### 'Additional Development' | |
yum -y install vim-enhanced httpd 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 sudo mysql-server wget \ | |
mysql-devel crontabs logwatch logrotate sendmail-cf qtwebkit qtwebkit-devel \ | |
perl-Time-HiRes | |
chkconfig redis on | |
#mysql | |
chkconfig mysqld on | |
service mysqld start | |
/usr/bin/mysql_secure_installation | |
#apache | |
chkconfig httpd on | |
touch /etc/httpd/conf.d/gitlab.conf | |
nano /etc/httpd/conf.d/gitlab.conf | |
#<VirtualHost *:80> | |
# ServerName git.example.org | |
# ProxyRequests Off | |
# <Proxy *> | |
# Order deny,allow | |
# Allow from all | |
# </Proxy> | |
# ProxyPreserveHost On | |
# ProxyPass / http://localhost:3000/ | |
# ProxyPassReverse / http://localhost:3000/ | |
#</VirtualHost> | |
#in httpd.conf set NameVirtualHost to *:80 | |
setsebool -P httpd_can_network_connect on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -L https://get.rvm.io | bash -s stable --ruby | |
# [xxx@slave]# ruby --version | |
# ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-linux] | |
# [xxx@slave]# gem --version | |
# 1.8.24 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem update --system | |
gem update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem install rails | |
gem install bundler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#create user git | |
adduser \ | |
--system \ | |
--shell /bin/bash \ | |
--comment 'Git Version Control' \ | |
--create-home \ | |
--home-dir /home/git \ | |
git | |
#create user gitlab | |
adduser \ | |
--shell /bin/bash \ | |
--comment 'GitLab user' \ | |
--create-home \ | |
--home-dir /home/gitlab \ | |
gitlab | |
usermod -a -G git gitlab | |
passwd gitlab # please choose a good password :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generate the SSH key | |
sudo -u gitlab -H ssh-keygen -q -N '' -t rsa -f /home/gitlab/.ssh/id_rsa | |
#forwarding emails | |
echo [email protected] > /root/.forward | |
chown root /root/.forward | |
chmod 600 /root/.forward | |
restorecon /root/.forward | |
echo [email protected] > /home/gitlab/.forward | |
chown gitlab /home/gitlab/.forward | |
chmod 600 /home/gitlab/.forward | |
restorecon /home/gitlab/.forward | |
cd /home/git | |
sudo -u git -H git clone -b gl-v320 https://github.com/gitlabhq/gitolite.git /home/git/gitolite | |
# issue | |
# link: https://github.com/atomic-penguin/cookbook-gitlab/issues/15 | |
yum install perl-Time-HiRes | |
# Add Gitolite scripts to $PATH | |
sudo -u git -H mkdir /home/git/bin | |
sudo -u git -H sh -c 'printf "%b\n%b\n" "PATH=\$PATH:/home/git/bin" "export PATH" >> /home/git/.profile' | |
sudo -u git -H sh -c 'gitolite/install -ln /home/git/bin' | |
# Copy the gitlab user's (public) SSH key ... | |
cp /home/gitlab/.ssh/id_rsa.pub /home/git/gitlab.pub | |
chmod 0444 /home/git/gitlab.pub | |
# ... and use it as the admin key for the Gitolite setup | |
sudo -u git -H sh -c "PATH=/home/git/bin:$PATH; gitolite setup -pk /home/git/gitlab.pub" | |
# Make sure the Gitolite config dir is owned by git | |
chmod 750 /home/git/.gitolite/ | |
chown -R git:git /home/git/.gitolite/ | |
# Make sure the repositories dir is owned by git and it stays that way | |
chmod -R ug+rwXs,o-rwx /home/git/repositories/ | |
chown -R git:git /home/git/repositories/ | |
# Make sure the gitlab user can access the required directories | |
chmod g+x /home/git | |
su - gitlab | |
ssh git@localhost # type 'yes' and press <Enter>. | |
# You schould see: | |
# PTY allocation request failed on channel 0 | |
# hello gitlab, this is git@gitlab running gitolite3 v3.2-gitlab-patched-0-g2d29cf7 on git 1.7.1 | |
# More test | |
# Clone the admin repo so SSH adds localhost to known_hosts ... | |
# ... and to be sure your users have access to Gitolite | |
git clone git@localhost:gitolite-admin.git /tmp/gitolite-admin | |
# If it succeeded without errors you can remove the cloned repo | |
rm -rf /tmp/gitolite-admin | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We'll install GitLab into home directory of the user "gitlab" | |
cd /home/gitlab | |
# Clone GitLab repository | |
git clone https://github.com/gitlabhq/gitlabhq.git gitlab | |
# Go to gitlab dir | |
cd /home/gitlab/gitlab | |
# Checkout to stable release | |
# warning 4-1-stable dont work !!! | |
git checkout 4-0-stable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cp /home/gitlab/gitlab/config/gitlab.yml{.example,} | |
nano /home/gitlab/gitlab/config/gitlab.yml #change hostanme to fully domain for eg gitlab.company.com | |
cp /home/gitlab/gitlab/config/unicorn.rb{.example,} | |
nano cp /home/gitlab/gitlab/config/unicorn.rb | |
# and configure like this | |
# #listen 8080 # listen to port 8080 on all TCP interfaces | |
# listen "127.0.0.1:3000" # listen to port 8080 on the loopback interface | |
# #listen "#{app_dir}/tmp/sockets/gitlab.socket" | |
# MySQL | |
cp /home/gitlab/gitlab/config/database.yml{.mysql,} | |
# logout from gitlab to root | |
logout | |
# logged as root | |
yum install libicu-devel | |
cd /home/gitlab/gitlab | |
gem install charlock_holmes --version '0.6.9' | |
su - gitlab | |
cd /home/gitlab/gitlab | |
# For mysql db | |
bundle install --deployment --without development test postgres | |
#logged as gitlab | |
git config --global user.name "GitLab" | |
git config --global user.email "gitlab@localhost" | |
logout | |
#back to root | |
cd /home/gitlab/gitlab | |
cp ./lib/hooks/post-receive /home/git/.gitolite/hooks/common/post-receive | |
chown git:git /home/git/.gitolite/hooks/common/post-receive | |
su - gitlab | |
cd /home/gitlab/gitlab | |
bundle exec rake gitlab:app:setup RAILS_ENV=production |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment