Installation of GitLab Centos 6.5
===================================
IMP: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
https://about.gitlab.com/downloads/
http://doc.gitlab.com/ce/install/installation.html
http://tecadmin.net/install-ruby-2-1-on-centos-rhel/
https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-on-centos-6
================================================
Instalation:
Requirement:
HTTP
MySQL
PHP
Ruby
Git
# yum install http*
# yum install mysql mysql-server
# yum install php* <<---------- its optional part
# yum install git
Ruby Install:
Step 1: Install Required Packages
# yum install gcc-c++ patch readline readline-devel zlib zlib-devel
# yum install libyaml-devel libffi-devel openssl-devel make
# yum install bzip2 autoconf automake libtool bison iconv-devel
# yum install gcc g++ make automake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel
# yum install ruby-rdoc ruby-devel
# yum install ruby
OR
Step 1: Install Required Packages
# yum install gcc-c++ patch readline readline-devel zlib zlib-devel
# yum install libyaml-devel libffi-devel openssl-devel make
# yum install bzip2 autoconf automake libtool bison iconv-devel
Step 2: Install RVM
Install latest stable version of RVM on your system using following command. This command will automatically download all required files and install on your system.
# curl -L get.rvm.io | bash -s stable
Step 3: Setup RVM Environment
RVM provides a shell script to setup system environment before installing Ruby. Use below command to setup rvm environment.
# source /etc/profile.d/rvm.sh
Step 4: Install Ruby
After completing setup of RVM environment, lets install Ruby language using following command.
# rvm install 2.1.2
[Sample Output]
ruby-2.1.2 - #removing src/ruby-2.1.2..
Searching for binary rubies, this might take some time.
No binary rubies available for: centos/6/i386/ruby-2.1.2.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for centos.
Requirements installation successful.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.1.2, this may take a while depending on your cpu(s)...
ruby-2.1.2 - #downloading ruby-2.1.2, this may take a while depending on your connection...
ruby-2.1.2 - #extracting ruby-2.1.2 to /usr/local/rvm/src/ruby-2.1.2...
ruby-2.1.2 - #configuring.....................................................
ruby-2.1.2 - #post-configuration.
Step 5: Setup Default Ruby Version
Use rvm command to setup default ruby version to be used by applications.
# rvm use 2.1.2 --default
Using /usr/local/rvm/gems/ruby-2.1.2
============================================
Step 6: Check Current Ruby Version.
Using following command you can check the current ruby version is used.
# ruby --version
ruby 2.1.2p95 (2014-05-08 revision 45877) [i686-linux]
# Download gitlab package:
curl -O https://downloads-packages.s3.amazonaws.com/centos-6.6/gitlab-7.9.0_omnibus.2-1.el6.x86_64.rpm
sudo rpm -i gitlab-7.9.0_omnibus.2-1.el6.x86_64.rpm
After every changes in configuration file of gitlab then fire below commands:
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
Start GitLab:
sudo gitlab-ctl start
# Check GitLab Status:
sudo gitlab-ctl status
If any of the processes is not behaving like expected, try tailing their logs to see what is wrong.
# sudo gitlab-ctl tail postgresql
For Email Alert:
vim /etc/gitlab/gitlab.rb
gitlab_rails['gitlab_email_from'] = 'gitlab@gitlab.firstcry.com'
gitlab_rails['gitlab_support_email'] = "namdev.rathod@firstcry.com"
Login GitLab Web Panel:
http://192.168.100.113
Default Login:
Username: root
Password: 5iveL!fe
We have to reset new password while login web panel
We can change login url from /etc/gitlab/gitlab.rb file
# Change the external_url to the address your users will type in their browser
external_url 'http://192.168.102.29:8888'
unicorn['port'] = 8888
:wq
sudo gitlab-ctl restart
sudo gitlab-ctl status
======================================================================================
Manage with MySQL:
mysql -u root -p'mysql@123'
CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'mysql@123';
CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
commit;
\q
# Ensure you can use the InnoDB engine which is necessary to support long indexes
# If this fails, check your MySQL config files (e.g. `/etc/mysql/*.cnf`, `/etc/mysql/conf.d/*`) for the setting "innodb = off"
mysql> SET storage_engine=INNODB;
================================================================
Service Starting and stopping
# status
sudo gitlab-ctl status
# Start all GitLab components
sudo gitlab-ctl start
# Stop all GitLab components
sudo gitlab-ctl stop
# Restart all GitLab components
sudo gitlab-ctl restart
GitLab Server Logs:
gitlab-ctl tail
=========================================================
GitLab By default storing location of repo data:
omnibus-gitlab stores Git repository data under /var/opt/gitlab/git-data:
repositories are stored in /var/opt/gitlab/git-data/repositories
satellites in /var/opt/gitlab/git-data/gitlab-satellites.
We can change the location of the git-data parent directory by adding the following line to /etc/gitlab/gitlab.rb.
=======================================================================================================================
Backups of Application:
To create a backup of your repositories and GitLab metadata, run the following command.
Note that GitLab CI currently does not have a backup script.
sudo gitlab-rake gitlab:backup:create
This will store a tar file in /var/opt/gitlab/backups. The filename will look like 1393513186_gitlab_backup.tar, where 1393513186 is a timestamp.
If you want to store your GitLab backups in a different directory, add the following setting to /etc/gitlab/gitlab.rb and run sudo gitlab-ctl reconfigure:
gitlab_rails['backup_path'] = '/mnt/backups'
Scheduling a backup:
To schedule a cron job that backs up your repositories and GitLab metadata, use the root user:
crontab -e
There, add the following line to schedule the backup for everyday at 2 AM:
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create
=======================================================================================
Restoring backup of Application:
We will assume that you have installed GitLab from an omnibus package and run sudo gitlab-ctl reconfigure at least once.
First make sure your backup tar file is in /var/opt/gitlab/backups.
sudo cp 1393513186_gitlab_backup.tar /var/opt/gitlab/backups/
Next, restore the backup by running the restore command. You need to specify the timestamp of the backup you are restoring.
# Stop processes that are connected to the database
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq
# This command will overwrite the contents of your GitLab database!
sudo gitlab-rake gitlab:backup:restore BACKUP=1393513186
# Start GitLab
sudo gitlab-ctl start
# Create satellites
sudo gitlab-rake gitlab:satellites:create
# Check GitLab
sudo gitlab-rake gitlab:check SANITIZE=true
=========================================================================================================================
Directory structure
Omnibus-gitlab uses four different directories.
/opt/gitlab holds application code for GitLab and its dependencies.
/var/opt/gitlab holds application data and configuration files that gitlab-ctl reconfigure writes to.
/etc/gitlab holds configuration files for omnibus-gitlab. These are the only files that you should ever have to edit manually.
/var/log/gitlab contains all log data generated by components of omnibus-gitlab.
======================================================================================================================
Uninstalling omnibus-gitlab
To uninstall omnibus-gitlab, preserving your data (repositories, database, configuration), run the following commands.
# Stop gitlab and remove its supervision process
sudo gitlab-ctl uninstall
# Debian/Ubuntu
sudo dpkg -r gitlab
# Redhat/Centos
sudo rpm -e gitlab
===============================================================
For redis setup:
https://gist.github.com/nghuuphuoc/7801123
http://blog.andolasoft.com/2013/07/how-to-install-and-configure-redis-server-on-centosfedora-server.html
===================================================================
To Manage GitLab From Browser:
https://www.digitalocean.com/community/tutorials/how-to-use-the-gitlab-user-interface-to-manage-projects
https://scotch.io/tutorials/how-to-setup-gitlab-a-self-hosted-github
Refer:
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
http://www.digitalsanctuary.com/tech-blog/general/installing-gitlab-on-redhat-enterprise-5-rhel-5.html
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md
https://about.gitlab.com/downloads/#centos6
https://www.linode.com/docs/applications/development/gitlab-on-ubuntu-14-04
============================================================================================
Reset root password:
http://roland.kierkels.net/git/reset-your-gitlab-root-password-from-a-terminal/
Start the console with this command:
# gitlab-rails console production
Now there are multiple ways to find your user. In my case I know there was only one user and it had so it has ID 1. But you can also search for email or username
irb(main):001:0> u = User.where(id: 1).first
Now lets change your password:
> u.password = 'secret_pass'
> u.password_confirmation = 'secret_pass'
Its important that you change both password and password_confirmation to make it work.
Now lets save the changes.
> u.save!
The ( ! ) symbol is very important. Otherwise your changes are not pushed to the database. Now exit the console and try to login with your new password. It should work now
=========================================================================================================
Install Sendmail to send automatically password for newly created user:
Install sendmail and m4 packages,
]# yum install sendmail* m4* -y
3. Edit configuration file, so the given line looks like below,
add dnl # before below line
]# vi /etc/mail/sendmail.mc
dnl # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
:wq
4. Compile the configuration,
]# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
5. Start the sendmail service,
]# service sendmail start
]# chkconfig sendmail on
6. Allow access to IPs to access this SMTP server, Here you generally specify your local internet ip.
]# vi /etc/mail/access
Connect:202.52.134.200 RELAY
:wq
]# service sendmail restart
[root@server~]# tail -f /var/log/maillog
=================================================================================================
GitLab Detail:
Main Configuration File: /var/opt/gitlab/gitlab-rails/etc/gitlab.yml
GitLab Document Root: /opt/gitlab
Default Repository Location: /var/opt/gitlab/git-data/repositories
Default Nginx Configuration File: /opt/gitlab/embedded/conf/nginx.conf
GitLab Nginx Configuration file Location: /var/opt/gitlab/nginx/conf
Postgresql data Directory: /var/opt/gitlab/postgresql/data
No comments:
Post a Comment