Use Gitlab+redmine+jenkins under Centos7

Source: Internet
Author: User
Tags install php imagemagick openssl ssh email account git client mail account redmine

Gitlab is better than SVN, ready to use Gitlab+redmine and move the code to Gitlab.
Machine IP 192.168.1.146
System CentOS 7.1 one. Gitlab installation

This time using the Yum installation method, the compilation and installation has not been attempted.
installation Steps https://about.gitlab.com/downloads/
Official document http://doc.gitlab.com/omnibus/

close Selinux,postfix can be used without
Yum install-y vim Unzip Curl curl-devel wget gcc gcc-c++ OpenSSL openssl-devel openssh openssh-clients dovecot Tree Telnet lrzsz net-tools

yum Install curl openssh-server

Curl https://packages.gitlab.com/install/repositories /gitlab/gitlab-ce/script.rpm.sh | sudo bash
yum install gitlab-ce-y
#这里看网络情况, may be a time to install, after the installation, Gitlab can be used.

Start Gitlab
Gitlab-ctl Reconfigure
Open Browser, enter HTTP://IP, username root, password 5ivel!fe two. Gitlab Configuration

1. Mail Delivery configuration
After user registration, the default configuration is to require mailbox authentication, SendMail Basic send is not successful, instead of Gitlab SMTP send to Tencent Enterprise mailbox as a column

VI/ETC/GITLAB/GITLAB.RB
#更改为如下
external_url ' http//local IP address '
gitlab_rails[' smtp_enable '] = True  
gitlab_rails[' smtp_address ' = "smtp.exmail.qq.com"  
gitlab_rails[' smtp_port '] =  
gitlab_rails[' Smtp_user _name '] = "email account"  
gitlab_rails[' smtp_password ' = "password to send mail account"  
gitlab_rails[' smtp_domain '] = "smtp.qq.com"  
gitlab_rails[' smtp_authentication ' =:p lain  
gitlab_rails[' smtp_enable_starttls_auto '] = True  

Gitlab _rails[' gitlab_email_from ' = "Same as the account that sent the message"  

After the modification is complete, reload the configuration
Gitlab-ctl Reconfigure

2. Integrate issue to Redmine
In Project settings, select Service, and then select Redmine, configured as follows:

3. Change the warehouse storage path
Gitlab The default warehouse path is/var/opt/gitlab/git-data/repositories, the general server/var space is not very sufficient, so to configure the warehouse to other paths, such as I want to change to/mnt/nas/git-data, Here's how to modify it:
If you have just installed Gitlab and have not started to use it, modify the configuration:

VI/ETC/GITLAB/GITLAB.RB
Find the Git_data_dir option, remove the comment, modify the following path to/mnt/nas/git-data, save the exit, and reload the configuration
gitlab-ctl Reconfigure

If you are already in use, to modify the configuration, follow these steps

Stop Gitlab
gitlab-ctl stop to
synchronize data on the old path to the new path
rsync-av/var/opt/gitlab/git-data/repositories/mnt/nas/ git-data/
Modify the configuration in the/etc/gitlab/gitlab.rb, as above
vi/etc/gitlab/gitlab.rb
gitlab-ctl reconfigure
And finally start Gitlab
gitlab-ctl start

4.ssh Keys
In Gitlab, there are two SSH keys: User and deploy keys, a key cannot be used in these two locations at the same time.
Deploy keys read-only permissions
Specific information to view
Http://doc.gitlab.com/ce/ssh/README.html

5. Backup and Restore
http://segmentfault.com/a/1190000002439923
Backup

Gitlab-rake gitlab:backup:create

This command creates a compressed package with a name similar to 1393513186_gitlab_backup.tar in the/var/opt/gitlab/backups directory by default
Modify the directory where the backup files are stored by modifying/ETC/GITLAB/GITLAB.RB:

gitlab_rails[' backup_path '] = '/mnt/backups '

You can also add commands to the crontab to automatically back up

0 2 * * */opt/gitlab/bin/gitlab-rake gitlab:backup:create

Restore

# Stop related data connection service
Gitlab-ctl stop unicorn
gitlab-ctl stop Sidekiq

**# recover from 1393513186 numbered backups, note here that The restore package should be placed in the path of the Gitlab configuration, or it will be reported: The specified backup doesn ' t exist!
#gitlab的默认配置如下
gitlab_rails[' backup_path ') = "/var/opt/gitlab/backups"
#所以要把备份文件放到/var/opt/gitlab/ Backups, execute the following command. The following number is the number of the backup file name, also note that the Gitlab version number is consistent * *
gitlab-rake Gitlab:backup:restore backup= 1393513186

# start Gitlab
sudo gitlab-ctl start
three. Redmine Installation and Configuration

Native Redmine installation is relatively troublesome, you can use the Next button to install the program, Https://bitnami.com/stack/redmine
Native installation method is used here
Chinese documents
Http://www.redmine.org.cn/index.php/news/v_16_33.html
English documents
Http://www.redmine.org/projects/redmine/wiki/Install_Redmine_25x_on_Centos_65_complete

1. Install Ruby and other components

Yum-y install gcc mysql-devel ruby-devel rubygems mysql-server
gem install bundler
gem install-y MySQL----with -mysql-config=/usr/bin/mysql_config
yum-y Install php php-mysql php-gd php-imap php-ldap php-mbstring php-odbc Php-pear php-xml php-xmlrpc PHP-PECL-APC php-soap
yum-y install nano zip unzip libyaml-devel zlib-devel curl-devel op Enssl-devel httpd-devel apr-devel apr-util-devel mysql-devel gcc ruby-devel gcc-c++ make Postgresql-devel Imagemagick-devel sqlite-devel perl-ldap mod_perl Perl-digest-sha

2. Download Redmine, modify the configuration

wget http://www.redmine.org/releases/redmine-3.1.0.tar.gz
  tar zxvf redmine-3.1.0.tar.gz
  mv redmine-3.1.0/ Usr/local/redmine
  cd/usr/local/redmine/config
  CP database.yml.example DATABASE.YML

Note here that the version of CENTOS6,CENTOS7 is inconsistent with the Ruby version, and the Redmine version also corresponds to the
Http://www.redmine.org/projects/redmine/wiki/RedmineInstall

General CENTOS6 with 2.6
Http://www.redmine.org/releases/redmine-2.6.10.tar.gz

modifying database parameters

VI database.yml
production:
adapter:mysql2
database:redmine      
host:localhost
Username: Redmineuser
password:redminepw
Encoding:utf8
Save exit: Wq
here notice, adapter do not change, production operation mode, If you want to run with development, then the database configuration corresponding to development is also modified, and test similarly

3. Change to Toabao Ruby image
Ruby default image is difficult to access in China, can hang VPN, but Taobao also provides mirroring, fast
Reference Connection http://ruby.taobao.org/

Bundle Config mirror.https://rubygems.org https://ruby.taobao.org

4. Installing ImageMagick
When the bundle installs, it will depend on the imagemagick.pc, which needs to be installed first.

wget http://www.imagemagick.org/download/ImageMagick.tar.gz
tar zxvf ImageMagick.tar.gz
CD Imagemagick-6.7.8-3
./configure make do
install

5.bundle Install
Only rake and rails were installed in the document, but in the initial redmine, there were some problems and all were installed.

Export Pkg_config_path=/usr/local/lib/pkgconfig
cd/usr/local/redmine/
Bundle Install
in the course of execution, If installing a component encounters an error, first execute
bundle config that component name--use-system-libraries, and
then execute bundle install
such as Build.nokogiri installation error
Bundle config Build.nokogiri--use-system-libraries
bundle Install

Installing Apache2-module

Gem install passenger passenger-install-apache2-module here all the way to the 
return

6. Initialize the environment and start Redmine

Cd/usr/local/redmine/config
rails_env=production rake db:migrate
rails_env=production rake Redmine:load_ Default_data
start
cd/usr/local/redmine/script
rails s-b 192.168.1.146 webrick-e with  production Production
as normal startup, press CTRL + C to exit, reboot for daemon
rails s-b 192.168.1.146  webrick-e production-d
Open Browser, Enter 192.168.1.146:3000
user name password default admin

If Access appears with a 500 error, look at the Redmine log, if prompted:
Incorrect location of Secret_token in the error message, you can attempt to execute the following command:
Bundle EXEC Rake Generate_secret_token
And then restart Redmine.

7. Configuring the Redmine Mail feature

Create a new file email.yml under/usr/local/redmine/config, with the following content:

Production:
  Delivery_method:: SMTP
  smtp_settings:
    Address: "Smtp.exmail.qq.com"
    port:25
    Authentication::p Lain
    domain: ' smtp.qq.com '
    user_name: ' redmine@xxx '
    password: ' xxx '
four. Jenkins Configuration

1. Get Gitlab

Relatively simple, in the Jenkins configuration can be:
To find a git entry, click System settings, System Management, and enter the path to the git command in path to git executable, such as/usr/local/bin/git
Install several plugins in Jenkins: Git client plugin, git Plugin,gitlab plugin
After completing the above two steps, go to the corresponding Jenkins project, choose the configuration, find the source control, choose Git, fill in the HTTP path of Gitlab, the corresponding user name and password

2. Configure Jenkin Mail

First install a plugin email-ext, download the address
http://updates.jenkins-ci.org/download/plugins/email-ext/
If the high version is not installed, the version installation is reduced.
Choose System Management, System settings, find the Jenkins URL, and fill in the email address in system Admin e-mail
Find the e-mail notification option, set as follows

Tick the test settings by sending test messages, fill in the recipient's mailbox, click on test Configuration, if you receive the message, the configuration is successful.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.