In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to install and configure Gitlab client on Linux system". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor to take you to learn "the installation and configuration of Gitlab client on Linux system"!
1. Install dependency packages
Keep in mind that Debian does not install sudo by default, please install it using root:
The code is as follows:
Apt-get update & & apt-get upgrade & & apt-get install sudo
Now you can install the must package:
The code is as follows:
Sudo apt-get update
Sudo apt-get upgrade
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 libicu-dev redis-server openssh-server git-core python-dev python-pip libyaml-dev postfix libpq-dev
Database
SQLite
The code is as follows:
Sudo apt-get install-y sqlite3 libsqlite3-dev
MySQL
The code is as follows:
Sudo apt-get install-y mysql-server mysql-client libmysqlclient-dev
# Login to MySQL
$mysql-u root-p
# Create the GitLab production database
Mysql > CREATE DATABASE IF NOT EXISTS `gitlabhq_ production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ ci`
# Create the MySQL User change $password to a real password
Mysql > CREATE USER 'gitlab'@'localhost' IDENTIFIED BY' $password'
# Grant proper permissions to the MySQL User
Mysql > GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_ production. * TO 'gitlab'@'localhost'
PostgreSQL
The code is as follows:
Sudo apt-get install-y postgresql-9.2 postgresql-server-dev-9.2
# Connect to database server
Sudo-u postgres psql-d template1
# Add a user called gitlab. Change $password to a real password
Template1=# CREATE USER gitlab WITH PASSWORD'$password'
# Create the GitLab production database
Template1=# CREATE DATABASE IF NOT EXISTS gitlabhq_production
# Grant all privileges on database
Template1=# GRANT ALL PRIVILEGES ON DATABASE gitlabhq_production to gitlab
# Quit from PostgreSQL server
Template1=#\ Q
# Try connect to new database
$su-gitlab
$psql-d gitlabhq_production-U gitlab
(translator's note: one of the above three databases can be installed as needed)
two。 Install Ruby
The code is as follows:
Wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
Tar xfvz ruby-1.9.3-p194.tar.gz
Cd ruby-1.9.3-p194
. / configure
Make
Sudo make install
3. Install Gitolite
Create a user for Git:
The code is as follows:
Sudo adduser\
-- system\
-- shell / bin/sh\
-- gecos' git version control'\
-- group\
-- disabled-password\
-- home/ home/git\
Git
Create a user for GitLab:
The code is as follows:
# ubuntu/debian
Sudo adduser-disabled-login-gecos' gitlab system' gitlab
Add gitlab users to the git user group:
The code is as follows:
Sudo usermod-a-G git gitlab
Add git users to the gitlab user group:
The code is as follows:
Sudo usermod-a-G gitlab git
Generate key:
The code is as follows:
Sudo-H-u gitlab ssh-keygen-Q-N'- t rsa-f / home/gitlab/.ssh/id_rsa
Clone the Gitolite branch source code of GitLab:
The code is as follows:
Sudo-H-u git git clone-b gl-v304 https://github.com/gitlabhq/gitolite.git / home/git/gitolite
Installation:
The code is as follows:
Cd / home/git
Sudo-u git-H mkdir bin
Sudo-u git sh-c 'echo-e "PATH=\ $PATH:/home/git/bin\ nexport PATH" > > / home/git/.profile'
Sudo-u git sh-c 'gitolite/install-ln / home/git/bin'
Sudo cp / home/gitlab/.ssh/id_rsa.pub / home/git/gitlab.pub
Sudo chmod 0444 / home/git/gitlab.pub
Sudo-u git-H sh-c "PATH=/home/git/bin:$PATH; gitolite setup-Competition / home/git/gitlab.pub"
Permissions:
The code is as follows:
Sudo chmod-R g+rwX / home/git/repositories/
Sudo chown-R git:git / home/git/repositories/
Check: log out and log back in for the git user group to take effect
The code is as follows:
# Clone the admin repository to add localhost to known_hosts
# and confirm that gitlab users have access to gitolite
Sudo-u gitlab-H git clone git@localhost:gitolite-admin.git / tmp/gitolite-admin
# if the execution is successful, you can delete it
Sudo rm-rf / tmp/gitolite-admin
important! If you cannot clone the gitolite-admin repository, please do not continue with this installation, please follow Trouble Shooting Guide and confirm that you have completed all the steps above carefully.
The author's note: this step tests whether the clone can be successful. I did not pay attention to this prompt. After completing the subsequent installation, I found that the project could not be cloned by git@localhost:gitolite-admin.git because of the failure of ssh authentication, so be sure to confirm this. By the way, the reason why my ssh authentication failed: the value of PubkeyAuthentication in the / etc/ssh/sshd_config configuration file is no, which means that public key authentication is not allowed. Just change it to yes. If you still cannot clone, repeat step 3 and note whether each command was executed successfully. Or delete the git and gitlab users and re-perform step 3.
4. Clone GitLab source code and install prerequisites
The code is as follows:
Sudo gem install charlock_holmes-- version '0.6.8'
Sudo pip install pygments
Sudo gem install bundler
Cd / home/gitlab
# Get gitlab code. Use this for stable setup
Sudo-H-u gitlab git clone-b stable https://github.com/gitlabhq/gitlabhq.git gitlab
(in 2013-1-6, I recently discovered that the latest version is 4.0.0.rc2, which no longer supports sqlite, and I did not succeed when I selected the sql database
Execute after cloning,
The code is as follows:
Sudo-u gitlab git checkout 2.9.1
You can go back to version 2.9.1, which not only supports sqlite, but also has a beautiful gitlab management interface. The version management interface after 3.1.0 is a bit ugly. )
The code is as follows:
# Skip this for stable setup. (the author's note: if you execute the last order, you don't have to execute this order.)
# Master branch (recent changes, less stable)
Sudo-H-u gitlab git clone-b master https://github.com/gitlabhq/gitlabhq.git gitlab
Cd gitlab
# Rename config files
Sudo-u gitlab cp config/gitlab.yml.example config/gitlab.yml
Select the database you want to use
The author's note: SQLite is recommended.
The code is as follows:
# SQLite
Sudo-u gitlab cp config/database.yml.sqlite config/database.yml
# Mysql
Sudo-u gitlab cp config/database.yml.mysql config/database.yml
# PostgreSQL
Sudo-u gitlab cp config/database.yml.postgres config/database.yml
# modify config/database.yml to confirm that the correct user name / password has been entered
Install the database gems
The code is as follows:
# mysql
Sudo-u gitlab-H bundle install-without development test sqlite postgres-deployment
# or postgres
Sudo-u gitlab-H bundle install-without development test sqlite mysql-deployment
# or sqlite
Sudo-u gitlab-H bundle install-without development test mysql postgres-deployment
Initialize the database
The code is as follows:
Sudo-u gitlab bundle exec rake gitlab:app:setup RAILS_ENV=production
Set up GitLab hooks
The code is as follows:
Sudo cp. / lib/hooks/post-receive / home/git/.gitolite/hooks/common/post-receive
Sudo chown git:git / home/git/.gitolite/hooks/common/post-receive
Confirm the application status:
The code is as follows:
Sudo-u gitlab bundle exec rake gitlab:app:status RAILS_ENV=production
# OUTPUT EXAMPLE
Starting diagnostic
Config/database.yml.exists
Config/gitlab.yml.exists
/ home/git/repositories/.exists
/ home/git/repositories/ is writable?.YES
Remote: Counting objects: 603, done.
Remote: Compressing objects: 100% (466 pm), done.
Remote: Total 603 (delta 174), reused 0 (delta 0)
Receiving objects: 100% (603 KiB), 53.29 KiB, done.
Resolving deltas: 100% (174amp 174), done.
Can clone gitolite-admin?.YES
UMASK for .gitolite.rc is 0007? .YES
/ home/git/share/gitolite/hooks/common/post-receive exists? .YES
Author's note: if all the results are YES, congratulations! You can move on to the next step.
5. Set up web server
The application can act with the next command:
The code is as follows:
# for testing purposes
Sudo-u gitlab bundle exec rails s-e production
# for daemons
Sudo-u gitlab bundle exec rails s-e production-d
Default login user name and password:
The author's note: remember this user name and password, which is useful when logging into the gitlab project home page through a browser.
The code is as follows:
Admin@local.host
5iveL!fe
6. Run the Resque process (for processing work queues)
The code is as follows:
# start manually
Sudo-u gitlab bundle exec rake environment resque:work QUEUE=* RAILS_ENV=production BACKGROUND=yes
# GitLab startup script
Sudo-u gitlab. / resque.sh
# if you run this script using root, it will cause the owner of the / home/gitlab/gitlab/tmp/pids/resque_worker.pid file to be root
# will cause resque to fail to start in the next system initialization
Customize the Redis connection used by Resque
If you want Resque to connect to a non-standard port number or Redis on another server, you can modify the connection information in the config/resque.yml file:
The code is as follows:
Production: redis.example.com:6379
Well, we already have a working GitLab, but please keep going, there are some things that have to be done.
7.Nginx and Unicorn
(1)。 Unicorn
The code is as follows:
Cd / home/gitlab/gitlab
Sudo-u gitlab cp config/unicorn.rb.example config/unicorn.rb
Sudo-u gitlab bundle exec unicorn_rails-c config/unicorn.rb-E production-D
(2)。 Nginx
The code is as follows:
# install Nginx for the first time
Sudo apt-get install nginx
# add GitLab to nginx sites
Sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/nginx/gitlab-P / etc/nginx/sites-available/
Sudo ln-s / etc/nginx/sites-available/gitlab / etc/nginx/sites-enabled/gitlab
# modify * * YOUR_SERVER_IP** and * * YOUR_SERVER_FQDN**
# for the original IP address and the domain name for the GitLab service
Sudo vim / etc/nginx/sites-enabled/gitlab
The author's note: at the beginning, I did not know how to configure this configuration file. When I entered the server ip in the browser, the "welcome to nginx" page always appeared.
The later configuration is
The code is as follows:
Listion 80; # listens for all client requests on port 80
Server_name: 192.168.1.120; # this is the ip address of my ubuntu server. Since we have access to the local area network of the group, we just need to match the ip address directly. For remote access, you can use the vpn link.
# restart nginx:
Sudo / etc/init.d/nginx restart
(3)。 Init script
Create an init script in / etc/init.d/gitlab:
The code is as follows:
Sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab-P / etc/init.d/
Sudo chmod + x / etc/init.d/gitlab
Set GitLab to start automatically:
The code is as follows:
Sudo update-rc.d gitlab defaults 21
Now you can start / restart / stop the GitLab service in this way:
The code is as follows:
Sudo / etc/init.d/gitlab restart
At this point, I believe that everyone on the Linux system on the Gitlab client installation and configuration method has a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.