sudo is not installed on Debian by default. Make sure your system is up-to-date and install it.sudo apt-get updatesudo apt-get upgradeNote: Vim is an editor that is used here whenever there are files that need to be edited by hand. But, you can use any editor you like instead.# Install vimsudo apt-get install -y vimInstall the required packages:sudo apt-get install -y wget curl gcc checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libreadline6-dev libc6-dev libssl-dev libmysql++-dev make build-essential zlib1g-dev openssh-server git-core libyaml-dev postfix libpq-dev libicu-devsudo apt-get install redis-server
2. Ruby
Download Ruby and compile it:mkdir /tmp/ruby && cd /tmp/rubycurl --progress http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz | tar xzcd ruby-1.9.3-p392./configuremakesudo make installInstall the Bundler Gem:sudo gem install bundler --no-ri --no-rdoc
3. Prepare the database
You can use either MySQL or PostgreSQL.
MySQL
# Install the database packagessudo apt-get install -y mysql-server mysql-client libmysqlclient-dev# Login to MySQL$ mysql -u root -p# Create the GitLab CI databasemysql> CREATE DATABASE IF NOT EXISTS `gitlab_ci_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;# Create the MySQL User change $password to a real password 这里的 $password密码需要替换为你希望的密码mysql> CREATE USER "gitlab_ci"@"localhost" IDENTIFIED BY "$password";# Grant proper permissions to the MySQL Usermysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlab_ci_production`.* TO "gitlab_ci"@"localhost";
PostgreSQL
# Install the database packagessudo apt-get install -y postgresql-9.1 libpq-dev# Login to PostgreSQLsudo -u postgres psql -d template1# Create a user for GitLab. (change $password to a real password) 这里的 $password密码需要替换为你希望的密码 template1=# CREATE USER gitlab_ci WITH PASSWORD "$password";# Create the GitLab production database & grant all privileges on databasetemplate1=# CREATE DATABASE gitlab_ci_production OWNER gitlab_ci;# Quit the database sessiontemplate1=# q# Try connecting to the new database with the new usersudo -u git -H psql -d gitlab_ci_production
sudo -u gitlab_ci -H bundle --without development test postgres --deploymentsudo -u gitlab_ci -H bundle --without development test postgres --deployment
Setup db
# mysqlsudo -u gitlab_ci -H cp config/database.yml.mysql config/database.yml# postgressudo -u gitlab_ci -H cp config/database.yml.postgres config/database.yml# Edit user/passwordsudo -u gitlab_ci -H vim config/database.yml以下是database.yml例子 ## PRODUCTION#production:adapter: mysql2encoding: utf8reconnect: falsedatabase: gitlab_ci_productionpool: 5username: gitlab_cipassword: "travelchallenge" #这里设置你的先前设置的gilab_ci的密码# host: localhost# socket: /tmp/mysql.sock## Development specific#development:adapter: mysql2encoding: utf8reconnect: falsedatabase: gitlab_ci_developmentpool: 5username: debian-sys-maintpassword: "r0VpzdDxG33ruj0m"# socket: /tmp/mysql.sock# Warning: The database defined as "test" will be erased and# re-generated from your development database when you run "rake".# Do not set this db to the same as development or production.test: &testadapter: mysql2encoding: utf8reconnect: falsedatabase: gitlab_ci_testpool: 5username: debian-sys-maintpassword: "r0VpzdDxG33ruj0m"# socket: /tmp/mysql.sock # Setup tablessudo -u gitlab_ci -H bundle exec rake db:setup RAILS_ENV=production# Setup scedules #sudo -u gitlab_ci -H bundle exec whenever -w RAILS_ENV=production
7. Install Init Script
Download the init script (will be /etc/init.d/gitlab_ci):sudo wget https://raw.github.com/gitlabhq/gitlab-ci/master/lib/support/init.d/gitlab_ci -P /etc/init.d/sudo chmod +x /etc/init.d/gitlab_ciMake GitLab start on boot:sudo update-rc.d gitlab_ci defaults 21Start your GitLab instance:sudo service gitlab_ci start# orsudo /etc/init.d/gitlab_ci restart
8. Nginx
Installation
sudo apt-get install nginx
Site Configuration
Download an example site config:sudo wget https://raw.github.com/gitlabhq/gitlab-ci/master/lib/support/nginx/gitlab_ci -P /etc/nginx/sites-available/sudo ln -s /etc/nginx/sites-available/gitlab_ci /etc/nginx/sites-enabled/gitlab_ciMake sure to edit the config file to match your setup:# Change **YOUR_SERVER_IP** and **YOUR_SERVER_FQDN**# to the IP address and fully-qualified domain name# of your host serving GitLab CIsudo vim /etc/nginx/sites-enabled/gitlab_ci#下面是gitlab_ci的例子upstream gitlab_ci { server unix:/home/gitlab_ci/gitlab-ci/tmp/sockets/gitlab-ci.socket; }
server {#设置访问gitlab_ci的地址 listen 192.168.47.46:9292; server_name 192.168.47.46;
The project is designed for the Linux operating system.We officially support (recent versions of) these Linux distributions:
Ubuntu Linux
Debian/GNU Linux
Installation
# Get codegit clone https://github.com/gitlabhq/gitlab-ci-runner.git# Enter code dircd gitlab-ci-runner# Install dependencies# a) Linuxsudo apt-get install libicu-dev# b) MacOSx (make sure you have brew installed)sudo brew install icu4cgem install bundlerbundle install# Install runner in interactive modebundle exec ./bin/install# SSH into your GitLab server and confirm to add host key to known_hostsssh git@<your gitlab url>
Run
bundle exec ./bin/runner
Autostart Runners
On linux machines you can have your runners operate like daemons with the following steps# make sure you install any system dependancies firstadministrator@server:~$ sudo adduser --disabled-login --gecos "GitLab CI Runner" gitlab_ci_runneradministrator@server:~$ sudo su gitlab_ci_runnergitlab_ci_runner@server:/home/administrator$ cd ~/# perform the setup abovegitlab_ci_runner@server:~$ exit;gitlab_ci_runner@server:/home/gitlab_ci_runner$ sudo cp ./gitlab-ci-runner/lib/support/init.d/gitlab_ci_runner /etc/init.d/gitlab-ci-runnergitlab_ci_runner@server:/home/gitlab_ci_runner$ cd ~administrator@server:~$ sudo chmod +x /etc/init.d/gitlab-ci-runneradministrator@server:~$ sudo update-rc.d gitlab-ci-runner defaults 21 administrator@server:~$ sudo service gitlab-ci-runner start
Done!
#这个得注意,这条告诉你用gitlab的密码来登录gitlab_ci 而不是 什么admin@local.hostVisit YOUR_SERVER for your first GitLab CI login. You should use your GitLab credentials in orider to loginEnjoy! #说是enjoy,我一开始还是没有明白。我搞了半天都没发现如何启动一次构建。后来发现你需要到gitlab中找到你要构建的项目,在其settings中的service中激活你构建。这需要你填写你的gitlab_ci的对应的项目中的integration的相关项。 好吧现在你可以Enjoy 了如果你还是没有Enjoy,请以Enjoy为主题评论GitLab 的详细介绍:请点这里 GitLab 的下载地址:请点这里相关阅读:GitLab 5.3 升级注意事项 http://www.linuxidc.com/Linux/2013-06/86473.htm在 CentOS 上部署 GitLab (自托管的Git项目仓库) http://www.linuxidc.com/Linux/2013-06/85754.htmGitlab在Ubuntu 12.04.2上面的安装配置教程 http://www.linuxidc.com/Linux/2013-11/92686.htmGitlab 6.3 社区版发布 http://www.linuxidc.com/Linux/2013-11/93092.htm如何使用Reaver破解Wi-Fi网络的WPA密码Docker的搭建Gitlab CI 全过程详解相关资讯 Gitlab 持续集成CI Gitlab CI