As for gitlab's articles and instructions, the previous articles have been written, so we will not elaborate on them here. For details, see this article: set up gitlab on Debian wheel
Note: the details of gitlab installation, debug and other information are also recorded in the above article, so we will not write more here
Set up gitlab in Ubuntu 12.04 (precise)
Gitlab installation mainly refers to this file: gitlabhq / Doc / install / installation.md
System and kit version requirements
- Ubuntu/Debian
- python 2.5+ (3.x is not supported at the moment)
- Ruby 1.9.3+
- Git 1.7.10+
- Redis 2.0+
- MySQL or PostgreSQL
System basic environment installation
- sudo apt-get update
- sudo apt-get dist-upgrade
- sudo apt-get install -y vim
- sudo update-alternatives --set editor /usr/bin/vim.basic
- sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate
- sudo apt-get install -y python
- #If Python and python2 are version 2.7, the next step (install python2.7) can be skipped
- python --version # Python 2.7.3
- Python2 -- version is used for command execution, so you need to confirm the version of python2
- #For Python 3. X, you need to install Python 2. X, which is not used in 12.04 at present. Please comment it out first
- # sudo apt-get install -y python2.7
- # python --version # Python 2.7.3
- #Python2 -- version is used for command execution, so you need to confirm the version of python2
- #If python2 does not exist, you need to pass the LN of Python version 2.7
- # sudo ln -s /usr/bin/python /usr/bin/python2
- sudo apt-get install -y python-docutils
Check and install git version 1.7.10 and above
- Apt cache showpkg git core is currently 1.7.9, so it can't be used. You need to manually install package: git core versions: 1:1.7.9.5-1 (/ var / lib / apt / lists / FTP. TKU. Edu. TW? Ubuntu? Dis? Precise? Main? Binary-amd64? Packages)
Package: git-coreVersions:1:1.7.9.5-1 (/var/lib/apt/lists/ftp.tku.edu.tw_ubuntu_dists_precise_main_binary-amd64_Packages)
- #If the version is greater than 1.7.10, you can install directly with apt, but not at present. Skip this step and manually
- # sudo apt-get install -y git-core
- #If Git is already installed, it needs to be removed
- # sudo apt-get remove git-core
Install git manually
- #Install git dependency Suite
- sudo apt-get install -y libcurl4-openssl-dev libexpat1-dev gettext libz-dev libssl-dev build-essential
- #Manual git installation steps
- CD /tmp
- curl --progress https://git-core.googlecode.com/files/git-1.8.4.1.tar.gz | tar xz
- cd git-1.8.4.1/
- make prefix=/usr/local all
- Sudo make prefix = / usr / local install specifies to install to / usr / local / bin, otherwise the default will be installed to ~ / bin/
To provide mail alerts, you need to install the SMTP software
- Sudo apt get install - y postfix select Internet site and enter domain name
Select Internet site and enter domain name
Install Ruby
- Sudo apt get remove ruby1.8
- #Start installing Ruby 2.0+
- mkdir /tmp/ruby && cd /tmp/ruby
- curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz | tar xz
- cd ruby-2.0.0-p247
- ./configure --disable-install-rdoc
- Make
- sudo make install
- Sudo gem install bundler -- no RI -- no RDOC -- install bundler gem
Open gitlab system account - Git
- sudo adduser --disabled-login --gecos 'GitLab' git
Install gitlab shell
- CD /home/git
- sudo -u git -H git clone https://github.com/gitlabhq/gitlab-shell.git
- cd gitlab-shell
- Sudo - U git - H git checkout v1.7.6 switch to right version, GIT tag to find the latest version
- sudo -u git -H cp config.yml.example config.yml
- Sudo - U git - H editor config.yml? Modify gitlab URL to your own domain, http: / / your domain name / '
- sudo -u git -H ./bin/install # Do setup
Install database
- For DB installation, please refer to this file: gitlabhq / Doc / install / databases.md
- sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
- mysql -u root -pmysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'GITLAB_PASSWORD';mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;mysql> GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
- mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'GITLAB_PASSWORD';
- mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
- mysql> GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
- #Use gitlab account to test MySQL connection status
- Sudo - U git - H MySQL - u gitlab - P - D gitlabhq? Production? Enter the password to see if you enter MySQL >
Install gitlab
- CD /home/git
- sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab # Clone GitLab repository
- cd /home/git/gitlab
- Sudo - U git - H git checkout 6-2-stable. Find the stable version of GIT branch - A or git branch - R. the list is available at https://github.com/gitlabhq/gitlabhq/branches
Set gitlab
- cd /home/git/gitlab
- sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml
- #Note: there are two parts to be changed in the following file modification: 1. All localhost = > your domain. 2. / usr / bin / git = > / usr / local / bin / Git
- Sudo - U git - H editor config / gitlab.yml? Change localhost to your domain (including mail sender address, which should be changed by the way). In addition, find bin path: / usr / bin / git, and change it to / usr / loca / bin / GIT
- sudo chown -R git log/
- sudo chown -R git tmp/
- sudo chmod -R u+rwX log/
- sudo chmod -R u+rwX tmp/
- sudo -u git -H mkdir /home/git/gitlab-satellites
- sudo -u git -H mkdir tmp/pids/
- sudo -u git -H mkdir tmp/sockets/
- sudo chmod -R u+rwX tmp/pids/
- sudo chmod -R u+rwX tmp/sockets/
- sudo -u git -H mkdir public/uploads
- sudo chmod -R u+rwX public/uploads
- sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb
- Sudo - U git - H editor config / unicorn.rb if there is more than 2G ram, worker processes can be changed to 3
- sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
- sudo -u git -H git config --global user.name "GitLab"
- sudo -u git -H git config --global user.email "[email protected]"
- sudo -u git -H git config --global core.autocrlf input
- #After this setting, you can check whether gitlab.yml and unicorn.rb exist and check whether gitlab.yml is set correctly
Gitlab DB settings
- Sudo - U git CP config / database.yml.mysql config / database.yml ා this is mysql, PostgreSQL please copy other files
- Sudo - U git - H editor config / database.yml ා change the password of "production" to "secure password", and change it to the password of MySQL gitlab account. You can ignore others
- sudo -u git -H chmod o-rwx config/database.yml
Install Gems
- cd /home/git/gitlab
- Sudo - U git - H bundle install -- deployment -- without development test Postgres AWS -- using MySQL is -- without PostgreSQL, PostgreSQL is the reverse
Initialize database
- Sudo - U git - H bundle exec rake gitlab: setup rails? Env = production? Enter 'yes' to create a database
- #Get the default account and password of gitlab system administrator account created: login......... Admin @ local. Hostpassword...... 5ivel! Fe
Administrator account created:[email protected]!fe
Set automatic startup
- sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
- sudo chmod +x /etc/init.d/gitlab
- sudo update-rc.d gitlab defaults 21
Set logrotate
- sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
Check gitlab application settings
- sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
Start gitlab
- Sudo service gitlab start or sudo / etc / init.d/gitlab restart
Setting up the Apache 2 Environment
- #I use apache2. If I want to use nginx, I can go to the official settings again
- sudo apt-get install apache2
- #Visible: gitlab recipes / Web server / Apache at master · gitlabhq / gitlab recipes
- #Get github.conf: https://github.com/gitlabhq/gitlab-recipes/blob/master/web-server/apache/gitlab.conf
- CD /tmp
- wget https://raw.github.com/gitlabhq/gitlab-recipes/master/web-server/apache/gitlab.conf
- Sudo VIM gitlab.conf modify servername, proxypassreverse, log path (/ var / log / httpd / logs / = > / var / log / apache2 /), etc., modify the following two items: ා change all gitlab.example.com = > your domain name ා errorlog, / var / log / httpd / logs = > / var / log / apache2 of CustomLog
- #All gitlab. Example. Com = > your domain name
- #/ var / log / httpd / logs of errorlog and CustomLog = > / var / log / apache2
- sudo mv gitlab.conf /etc/apache2/sites-enabled/
- Sudo VIM / etc / apache2 / sites enabled / 000 default ා annotates the entire file (precede each line with 'ා')
- sudo a2enmod rewrite proxy proxy_http
- Sudo service apache2 restart or sudo / etc / init.d/apache2 restart
The gitlab will be set up here. Connect to http://your-domain-name/, and log in with the following account password
login: [email protected]: 5iveL!fe
Note: the first time you open a web page, you need to run a long time and be patient~
Gitlab restart
- sudo /etc/init.d/gitlab restart
For other debugging methods, see this article: set gitlab on Debian wheel, which will not be detailed here~
About "Tsung"
I am interested in new things, like simple things and live a simple life