Introduction to Git - Git for sysadmins
OS: Centos7
User with admin rights
Version control for system administration
Git version control
- Open source
- Free
- Very popular
- Very powerful
- Distributed
1982 - RCS (widely used, cross-platform, tracked single file, no binary support)
1980 - CVS ( allowed conucrrent version, fire stored in CVS repo on network, only text file supported)
2000 - subversion (SVN) - (directory as a project, help, welcome, main.c)
subverson tracks everything in a directory
2005 - git released
cvs and subversion are centralized version control systems while
Git features
- git is distributed version control system.
- each use maintain their own local repository rather than depending on central repo.
- Git track the changes on document not on versions
- You can push your changes to remote git repository.
Why git for system administrator?
- System config files
- Generic text files such as shell scripts
- some document files, or any other files.
Problem storing binary files
- Changes to text files are stored
- Whole binary files are stored. if there is change in binary file, whole file will be stored.
- can not merge two binary files.
- Git server may come with limited storage and storing large files may not be allowed.
To come up with this problem, you can use
- git-annex
- git-lfs (git large file storage)
this allows us to store large files.
- you can use amazon s3 to store files.
Advantage of git
- Distributed version control system
- No need to have centrl server
- Very fast local versioning
- Network is not necessary
- No single point of failure
- Encourages version folks - what this mean is create a fork of a file, make changes, test and merge to main body of file.
Why git?
- open source
- fast and stable
- Very polular
gitHub Nov 2008
100 million in Nov 2018
Software repo
- Best way to get packages are using software repositories.
- Packages are cryptographically singed and gurantee to be safe.
- Easy to install software take little time.
1. Create repo for your os.
2. Install git on Centos
$ yum install -y git
$ dnf install git
$ git --version
for other os
ubuntu or Debian - apt-get install git
Gentoo linux - emerge --ask --versbose dev-vcs/git
Arch Linux - pacman -S git
SUSE - zypper install git
Mageia - urpmi git
FreeBSD - pkg install git
OpenBsd - pkg_add git
Solaris - pkgutil -i git
Solaris 11 - pkg install developer/versioning/git
Installing git using source (Compile)
1. Remove old git package
$ sudo yum remove -y git
2. Install required tools on your system to complie git
$ sudo yum group install -y "development Tools"
Install other required software tools.
$ sudo yum install -y automake curl-devel gettext-devel openssl-devel perl-devel zlib-devel
3. Download git source code
$ wget https://github.com/git/git.git -O git.tar.gz
# git clone https://github.com/git/git.git
# yum remove git
# cd git
Create configure script. This checks for tools and library to complete build process
[root@worker1 git]# make configure
GIT_VERSION = 2.31.GIT
GEN configure
[root@worker1 git]#
set /usr/local directory as install dir path for binary
[root@worker1 git]# ./configure --prefix=/usr/local
Now, compile for binary
As of now,
- We are done with configuration step.
- We have a Make file.
Make file is a configuration file of instructions for make command to process.
- Make file includes instructions on how to compile the binary.
- At this time, we need sudo or root level access to to install.
Now let's check the version by typing in git space dash dash version and hit Enter. This should reflect the version we just compiled. We'll be using this version for the rest of this course, as it's the most current.
it may take upto 5 minutes depending speed of your system.
[root@worker1 git]# make install
Check the version
[root@worker1 git]# git --version
-bash: /usr/bin/git: No such file or directory
[root@worker1 git]# pwd
/root/git
[root@worker1 git]# ls -l /usr/local/
bin/ etc/ games/ include/ lib/ lib64/ libexec/ sbin/ share/ src/
[root@worker1 git]# ls -l /usr/local/bin/git
git gitk git-shell git-upload-pack
git-cvsserver git-receive-pack git-upload-archive
[root@worker1 git]# ls -l /usr/local/bin/git
-rwxr-xr-x. 137 root root 21184880 Mar 22 15:23 /usr/local/bin/git
[root@worker1 git]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@worker1 git]# which git
/usr/local/bin/git
[root@worker1 git]# git --version
-bash: /usr/bin/git: No such file or directory
[root@worker1 git]# /usr/local/bin/git --version
git version 2.31.GIT
[root@worker1 git]#
[root@worker1 git]# ln -s /usr/local/bin/git /usr/bin/git
[root@worker1 git]# git --version
git version 2.31.GIT
[root@worker1 git]#
Subscribe to:
Post Comments (Atom)
Git branch show detached HEAD
Git branch show detached HEAD 1. List your branch $ git branch * (HEAD detached at f219e03) 00 2. Run re-set hard $ git reset --hard 3. ...
-
snmpconfig command allow you to managge snmpv1/v3 agent configuration on SAN switch. Event trap level is mapped with event severity level....
-
Firmware upgrade on HPE SuperDom Flex 280 - prerequisites tasks a. Set up repo b. Upload firmware to your webserver 1. For foundation so...
-
Disabling the Telnet protocol on Brocade SAN switches By default, telnet is enabled on Brocade SAN switches. As part of security hardening o...
No comments:
Post a Comment