IchHabRecht icon

[BASH] Install CI-Server (CentOS 6.5)

IchHabRecht | PRO | 01/10/15 12:09:48 AM UTC | 0 ⭐ | 472 👁️ | Never ⏰ | []
Bash |

8.85 KB

|

None

|

0 👍

/

0 👎

# Install Ruby
yum install nano libyaml wget gcc libyaml-devel zlib-devel openssl openssl-devel libicu-devel patch gcc-c++ cmake readline-devel
cd /root/
mkdir downloads
cd downloads/
wget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p598.tar.gz
tar -xzvf ruby-2.0.0-p598.tar.gz
cd ruby-2.0.0-p598
./configure
make && make install
 
# Install MySQL
yum install mysql-server mysql-devel
service mysqld start
chkconfig mysqld on
/usr/bin/mysqladmin -u root password 'root'
 
# Install Apache HTTP Server
yum install httpd
service httpd start
chkconfig httpd on
 
# Install Redmine
mkdir /var/www/vhosts
mkdir /var/www/vhosts/redmine
cd /root/downloads/
wget http://www.redmine.org/releases/redmine-2.3.3.tar.gz
tar -xzvf redmine-2.3.3.tar.gz
mysql -u root -p
>>CREATE DATABASE redmine CHARACTER SET utf8;
>>CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'redmine';
>>GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
cp -a redmine-2.3.3/* /var/www/vhosts/redmine/
chown -R root:apache /var/www/vhosts/redmine/
cd /var/www/vhosts/redmine/
cp config/database.yml.example config/database.yml
nano config/database.yml
>>production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: redmine
gem install bundler
bundle install --without development test rmagick
rake generate_secret_token
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data
 
# Test Redmine
ruby script/rails server webrick -e production
 
# Create Redmine service
nano /etc/init.d/redmine
>>[see http://pastebin.com/aDCnD57d]
service redmine start
chkconfig redmine on
 
# Link Apache and Redmine
nano /etc/httpd/conf/httpd.conf
>>#
  # Use name-based virtual hosting.
  #
  NameVirtualHost *:80
  Include /etc/httpd/sites-enabled/
nano /etc/hosts
>>127.0.0.1 redmine.vm
cd /etc/httpd/
mkdir sites-available && mkdir sites-enabled
nano sites-available/redmine.vm
>><VirtualHost *:80>
        ServerName redmine.vm
        DocumentRoot /var/www/vhosts/redmine
 
        ProxyRequests Off
        ProxyPass / http://127.0.0.1:3000/ retry=0
        ProxyPassReverse / http://127.0.0.1:3000/
 
        LogLevel warn
        ErrorLog /var/log/httpd/redmine_error.log
        CustomLog /var/log/httpd/redmine_access.log combined
 
        <Directory /var/www/vhosts/redmine>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>
ln -s /etc/httpd/sites-available/redmine.vm /etc/httpd/sites-enabled/redmine.vm
/usr/sbin/setsebool -P httpd_can_network_connect true
service httpd restart
iptables -I INPUT 5 -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
service iptables save
 
# Install Redis
cd /root/downloads/
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6-8.noarch.rpm
yum install redis
nano /etc/redis.conf
>>unixsocket /var/run/redis/redis.sock
  unixsocketperm 0775
service redis start
chkconfig redis on
 
# Install GitLab
yum install git
adduser --shell /bin/bash --home-dir /home/git/ git
usermod -aG redis git
nano /etc/sudoers
>>Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
mysql -u root -p
>>CREATE USER 'git'@'localhost' IDENTIFIED BY 'git';
>>CREATE DATABASE `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
>>GRANT ALL ON `gitlabhq_production`.* TO 'git'@'localhost';
cd /home/git/
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b v7.2.1 gitlab
cd /home/git/gitlab
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml
sudo -u git -H nano config/gitlab.yml
>>host: gitlab.vm
>>email_from: admin@gitlab.vm
chmod -R u+rwX log/
chmod -R u+rwX tmp && chmod -R u+rwX public/uploads
sudo -u git -H mkdir /home/git/gitlab-satellites && chmod 750 /home/git/gitlab-satellites
sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb
sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
sudo -u git -H cp config/resque.yml.example config/resque.yml
sudo -u git -H cp config/database.yml.mysql config/database.yml
sudo -u git -H nano config/database.yml
>>production:
    adapter: mysql2
    encoding: utf8
    reconnect: false
    database: gitlabhq_production
    pool: 10
    username: git
    password: "git"
sudo -u git -H chmod o-rwx config/database.yml
sudo -u git -H bundle install --deployment --without development test postgres aws
sudo -u git -H bundle exec rake gitlab:shell:install[v2.1.0] REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production
restorecon -Rv /home/git/.ssh
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=5iveL\!fe
cd ../gitlab-shell
sudo -u git -H nano config.yml
>>redis:
  bin: /usr/bin/redis-cli
  host: 127.0.0.1
  port: 6379
 
# Create GitLab service
wget -O /etc/init.d/gitlab https://gitlab.com/gitlab-org/gitlab-recipes/raw/master/init/sysvinit/centos/gitlab-unicorn
chmod +x /etc/init.d/gitlab
chkconfig --add gitlab
service gitlab start
chkconfig gitlab on
 
# Link Apache and GitLab
nano /etc/hosts
>>127.0.0.1 gitlab.vm
cd /etc/httpd/
nano sites-available/gitlab.vm
>><VirtualHost *:80>
        ServerName gitlab.vm
        DocumentRoot /home/git/gitlab/public
 
        ProxyRequests Off
        ProxyPreserveHost On
        ProxyPass / http://127.0.0.1:8080/ retry=0
        ProxyPassReverse / http://127.0.0.1:8080/
 
        LogLevel warn
        ErrorLog /var/log/httpd/gitlab_error.log
        CustomLog /var/log/httpd/gitlab_access.log combined
</VirtualHost>
ln -s /etc/httpd/sites-available/gitlab.vm /etc/httpd/sites-enabled/gitlab.vm
service httpd restart
 
# Update Apache
service httpd stop
yum erase httpd
rm -f /etc/httpd/conf/httpd.conf.rpmsave
yum install pcre-devel
wget http://mirror.netcologne.de/apache.org//httpd/httpd-2.2.29.tar.gz
tar -xzvf httpd-2.2.29.tar.gz
cd httpd-2.2.29
./configure \
        "--prefix=/etc/httpd" \
        "--exec-prefix=/etc/httpd" \
        "--bindir=/usr/bin" \
        "--sbindir=/usr/sbin" \
        "--sysconfdir=/etc/httpd/conf" \
        "--enable-so" \
        "--enable-dav" \
        "--enable-dav-fs" \
        "--enable-dav-lock" \
        "--enable-suexec" \
        "--enable-deflate" \
        "--enable-unique-id" \
        "--enable-mods-static=most" \
        "--enable-reqtimeout" \
        "--with-mpm=prefork" \
        "--with-suexec-caller=apache" \
        "--with-suexec-docroot=/" \
        "--with-suexec-gidmin=100" \
        "--with-suexec-logfile=/var/log/httpd/suexec_log" \
        "--with-suexec-uidmin=100" \
        "--with-suexec-userdir=public_html" \
        "--with-suexec-bin=/usr/sbin/suexec" \
        "--with-included-apr" \
        "--with-pcre=/usr" \
        "--includedir=/usr/include/apache" \
        "--libexecdir=/usr/lib/apache" \
        "--datadir=/var/www" \
        "--localstatedir=/var" \
        "--enable-logio" \
        "--enable-ssl" \
        "--enable-rewrite" \
        "--enable-proxy" \
        "--enable-expires" \
        "--with-ssl=/usr" \
        "--enable-headers"
make && make install
cd /etc/httpd/
find . -type f -exec sed -i 's:/var/logs/:/var/log/httpd/:' {} +
nano conf/httpd.conf
>>PidFile /var/log/httpd/httpd.pid
>>Include conf/extra/httpd-vhosts.conf
nano conf/extra/httpd-vhosts.conf
>><VirtualHost *:80>
        ServerName localhost
        DocumentRoot /var/www/htdocs
 
        LogLevel warn
        ErrorLog /var/logs/httpd/localhost-error_log
        CustomLog /var/logs/httpd/localhost-access_log common
</VirtualHost>
>>Include sites-enabled/*
rm -Rf /var/logs
apachectl start
 
# Install Java
yum install java-1.6.0-openjdk
 
#Install Jenkins
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
yum install jenkins
nano /etc/sysconfig/jenkins
>>JENKINS_PORT="8081"
service jenkins start
chkconfig jenkins on
 
# Link Apache and Jenkins
nano /etc/hosts
>>127.0.0.1 jenkins.vm
cd /etc/httpd/
nano sites-available/jenkins.vm
>><VirtualHost *:80>
        ServerName jenkins.vm
        DocumentRoot /var/www/htdocs
 
        ProxyRequests Off
        ProxyPreserveHost On
        ProxyPass / http://127.0.0.1:8081/ nocanon retry=0
        ProxyPassReverse / http://127.0.0.1:8081/
        AllowEncodedSlashes NoDecode
 
        <Proxy http://localhost:8081/*>
                Order deny,allow
                Allow from all
        </Proxy>
 
        LogLevel warn
        ErrorLog /var/log/httpd/jenkins_error.log
        CustomLog /var/log/httpd/jenkins_access.log combined
</VirtualHost>
ln -s /etc/httpd/sites-available/jenkins.vm /etc/httpd/sites-enabled/jenkins.vm
apachectl restart

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎