#17:00 2016.04.01
#http://www.cyberciti.biz/tips/fdisk-unable-to-create-partition-greater-2tb.html
#Linux Creating a Partition Size Larger Than 2TB
#__________________________________STATUS:
root@srv152bk:~# lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
NAME FSTYPE SIZE MOUNTPOINT LABEL
sda 5.5T
sdb 1.8T
├─sdb1 ext4 46.6G / #Dinh dang EXT4
├─sdb2 1K
├─sdb5 swap 7.5G [SWAP]
└─sdb6 LVM2_member 1.8T
└─vg_srv152-lv01 (dm-0) ext4 7.2T /disk1
sdc 5.5T
└─sdc1 LVM2_member 5.5T
└─vg_srv152-lv01 (dm-0) ext4 7.2T /disk1
sdd 1.8T
└─sdd1 ntfs 1.8T 2tb_2016.03.29
#__________________________________
root@srv152bk:~# fdisk -l | grep dev
WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.
WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/mapper/vg_srv152-lv01 doesn't contain a valid partition table
Disk /dev/sda: 6001.2 GB, 6001175126016 bytes
Disk /dev/sdc: 6001.2 GB, 6001175126016 bytes
/dev/sdc1 1 4294967295 2147483647+ ee GPT
Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
/dev/sdb1 * 2048 97656831 48827392 83 Linux
/dev/sdb2 97658878 3907028991 1904685057 5 Extended
/dev/sdb5 97658880 113281023 7811072 82 Linux swap / Solaris
/dev/sdb6 113283072 3907028991 1896872960 83 Linux
Disk /dev/mapper/vg_srv152-lv01: 7938.5 GB, 7938475294720 bytes
Disk /dev/sdd: 2000.4 GB, 2000365289472 bytes
/dev/sdd1 2048 3906963455 1953480704 7 HPFS/NTFS/exFAT
'
#__________________________________To create a partition start GNU parted as follows:
#root@srv152bk:~# parted /dev/sda
GNU Parted 2.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
#Creates a new GPT disklabel i.e. partition table:
#(parted) mklabel gptWarning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No?Yes
#Next, set the default unit to TB, enter:
#(parted) unit TB
#To create a 3TB partition size, enter:
#(parted) mkpart primary 0 0
OR
#(parted) mkpart primary 0.00TB 6.00TB (CHOOSE THIS COMMAND)
#To print the current partitions, enter:
#(parted) print
Model: ATA WDC WD6001FSYZ-0 (scsi)
Disk /dev/sda: 6.00TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Number Start End Size File system Name Flags
1 0.00TB 6.00TB 6.00TB primary
#Quit and save the changes, enter:
#(parted) quit
Information: You may need to update /etc/fstab
#root@srv152bk:~# fdisk -l | grep dev
WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/mapper/vg_srv152-lv01 doesn't contain a valid partition table
Disk /dev/sda: 6001.2 GB, 6001175126016 bytes
/dev/sda1 1 4294967295 2147483647+ ee GPT #<<GPT
#Use the mkfs.ext4 command to format the file system, enter:
#root@srv152bk:~# mkfs.ext4 /dev/sda1
mke2fs 1.42.9 (4-Feb-2014)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
183144448 inodes, 1465130240 blocks
73256512 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
44713 block groups
32768 blocks per group, 32768 fragments per group
4096 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
#Type the following commands to mount /dev/sda1, enter:
# mkdir /data
# mount /dev/sda1 /data
# df -H
root@srv152bk:~# fdisk -l | grep dev
WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/mapper/vg_srv152-lv01 doesn't contain a valid partition table
Disk /dev/sda: 6001.2 GB, 6001175126016 bytes
/dev/sda1 1 4294967295 2147483647+ ee GPT
2016-04-01
2016-03-27
INSTALLATION VIRTUALBOX 5.0.16.r105871 ON CENTOS 7.2.15.11 x64
#OS:
root@dc1 /opt/VirtualBox-Storage# uname -a
Linux dc1 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
root@dc1 /opt/VirtualBox-Storage# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
root@dc1 /opt/VirtualBox-Storage#
<br>
########################
echo "######################################"
echo "INSTALLATION VIRTUALBOX 5.0.16.r105871 for CENTOS 7.2.1511 x64"
#mkdir -p /opt/VirtualBox-Storage/
#useradd vbox
#passwd vbox
#Enter new UNIX password: vbox
#Retype new UNIX password: vbox
#passwd: password updated successfully
#usermod -aG vboxusers vbox
#chown -R vbox.vboxusers /opt/VirtualBox-Storage/
mkdir -p /opt/VirtualBox-Storage
cd /opt/VirtualBox-Storage
#/etc/yum.repos.d/virtualbox.repo
[virtualbox]
name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/el/$releasever/$basearch
enabled=1
gpgcheck=1
gpgkey=http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc
wget http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
rpm -Uvh epel-release-7-5.noarch.rpm
yum -y install gcc make patch dkms qt libgomp
yum -y install kernel-headers kernel-devel fontforge binutils glibc-headers glibc-devel
yum -y install VirtualBox-5.0
#/etc/profile
echo "" >> /etc/profile
echo "KERN_DIR=/usr/src/kernels/3.10.0-327.10.1.el7.x86_64" >> /etc/profile
echo "export KERN_DIR" >> /etc/profile
source /etc/profile
cd VirtualBox-5.0-5.0.16_105871_el7-1.x86_64
wget http://download.virtualbox.org/virtualbox/5.0.16/Oracle_VM_VirtualBox_Extension_Pack-5.0.16-105871.vbox-extpack
VBoxManage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-5.0.16-105871.vbox-extpack
root@dc1 /opt/VirtualBox-Storage# uname -a
Linux dc1 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
root@dc1 /opt/VirtualBox-Storage# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
root@dc1 /opt/VirtualBox-Storage#
<br>
########################
echo "######################################"
echo "INSTALLATION VIRTUALBOX 5.0.16.r105871 for CENTOS 7.2.1511 x64"
#mkdir -p /opt/VirtualBox-Storage/
#useradd vbox
#passwd vbox
#Enter new UNIX password: vbox
#Retype new UNIX password: vbox
#passwd: password updated successfully
#usermod -aG vboxusers vbox
#chown -R vbox.vboxusers /opt/VirtualBox-Storage/
mkdir -p /opt/VirtualBox-Storage
cd /opt/VirtualBox-Storage
#/etc/yum.repos.d/virtualbox.repo
[virtualbox]
name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/el/$releasever/$basearch
enabled=1
gpgcheck=1
gpgkey=http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc
wget http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
rpm -Uvh epel-release-7-5.noarch.rpm
yum -y install gcc make patch dkms qt libgomp
yum -y install kernel-headers kernel-devel fontforge binutils glibc-headers glibc-devel
yum -y install VirtualBox-5.0
#/etc/profile
echo "" >> /etc/profile
echo "KERN_DIR=/usr/src/kernels/3.10.0-327.10.1.el7.x86_64" >> /etc/profile
echo "export KERN_DIR" >> /etc/profile
source /etc/profile
cd VirtualBox-5.0-5.0.16_105871_el7-1.x86_64
wget http://download.virtualbox.org/virtualbox/5.0.16/Oracle_VM_VirtualBox_Extension_Pack-5.0.16-105871.vbox-extpack
VBoxManage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-5.0.16-105871.vbox-extpack
2016-03-26
POSTFIX MTA as a SMART HOST + SSH LOGIN WARNING OVER EMAIL
#http://tecadmin.net/bash-mail-command-not-found/
#CENTOS: yum -y install mailx
#UBUNTU: apt-get install mailutils
#Sending Test Email
echo "Message Body" | mail -s "Message Subject" xxx@gmail.com
mkdir -p /opt/script/
cd /opt/script/
echo "">/opt/script/ssh-alert-via-email.sh
nano /opt/script/ssh-alert-via-email.sh
#UBUNTU:
echo "##################################" >>/root/.bashrc
echo "/opt/script/ssh-alert-via-email.sh" >>/root/.bashrc
#CENTOS:
echo "##################################" >>/root/.bash_profile
echo "/opt/script/ssh-alert-via-email.sh" >>/root/.bash_profile
#END
###################################
#/opt/script/ssh-alert-via-email.sh
#13:55 08/09/2015###################################
NOW="$(date +'%Y.%m.%d-%H.%M.%S.%6N')"
IP="$(echo $SSH_CONNECTION | cut -d " " -f 1)"
HOSTNAME=$(hostname)
USER_NAME=$(whoami)
#NOTE: CURRENT SERVER SSH PORT
SSH_PORT=65113
echo -e "################################" > /var/log/mail.log
echo -e "THOI GIAN BAT DAU GUI EMAIL | "$NOW >>/var/log/mail.log
echo -e "################################" >> /var/log/mail.log
echo -e "SSH REMOTE LOGIN NOTIFICATION: " > /tmp/ps-ssh-$NOW.log
echo -e "DATE......:"$NOW >>/tmp/ps-ssh-$NOW.log
echo -e "IP........:"$IP >>/tmp/ps-ssh-$NOW.log
echo -e "HOSTNAME..:"$HOSTNAME >>/tmp/ps-ssh-$NOW.log
echo -e "USERNAME..:"$USER_NAME >>/tmp/ps-ssh-$NOW.log
echo -e "#####################" >>/tmp/ps-ssh-$NOW.log
w >>/tmp/ps-ssh-$NOW.log
echo -e "#####################" >>/tmp/ps-ssh-$NOW.log
ps aux | egrep "USER|sshd" >>/tmp/ps-ssh-$NOW.log
echo -e "#####################" >>/tmp/ps-ssh-$NOW.log
netstat -n | egrep "Send-Q|$SSH_PORT" >>/tmp/ps-ssh-$NOW.log
echo -e "#####################" >>/tmp/ps-ssh-$NOW.log
echo -e "ps aux | egrep \"USER|sshd\" | awk '{print \$2}' | xargs kill -9" >>/tmp/ps-ssh-$NOW.log
mail -s "SSH WARNING [$HOSTNAME|$IP|$NOW]" a@mail.com b@mail.com </tmp/ps-ssh-$NOW.log
cat /tmp/ps-ssh-$NOW.log
echo "__________________________________________________________________________"
sleep 5
cat /var/log/mail.log
#CENTOS: yum -y install mailx
#UBUNTU: apt-get install mailutils
#Sending Test Email
echo "Message Body" | mail -s "Message Subject" xxx@gmail.com
mkdir -p /opt/script/
cd /opt/script/
echo "">/opt/script/ssh-alert-via-email.sh
nano /opt/script/ssh-alert-via-email.sh
#UBUNTU:
echo "##################################" >>/root/.bashrc
echo "/opt/script/ssh-alert-via-email.sh" >>/root/.bashrc
#CENTOS:
echo "##################################" >>/root/.bash_profile
echo "/opt/script/ssh-alert-via-email.sh" >>/root/.bash_profile
#END
###################################
#/opt/script/ssh-alert-via-email.sh
#13:55 08/09/2015###################################
NOW="$(date +'%Y.%m.%d-%H.%M.%S.%6N')"
IP="$(echo $SSH_CONNECTION | cut -d " " -f 1)"
HOSTNAME=$(hostname)
USER_NAME=$(whoami)
#NOTE: CURRENT SERVER SSH PORT
SSH_PORT=65113
echo -e "################################" > /var/log/mail.log
echo -e "THOI GIAN BAT DAU GUI EMAIL | "$NOW >>/var/log/mail.log
echo -e "################################" >> /var/log/mail.log
echo -e "SSH REMOTE LOGIN NOTIFICATION: " > /tmp/ps-ssh-$NOW.log
echo -e "DATE......:"$NOW >>/tmp/ps-ssh-$NOW.log
echo -e "IP........:"$IP >>/tmp/ps-ssh-$NOW.log
echo -e "HOSTNAME..:"$HOSTNAME >>/tmp/ps-ssh-$NOW.log
echo -e "USERNAME..:"$USER_NAME >>/tmp/ps-ssh-$NOW.log
echo -e "#####################" >>/tmp/ps-ssh-$NOW.log
w >>/tmp/ps-ssh-$NOW.log
echo -e "#####################" >>/tmp/ps-ssh-$NOW.log
ps aux | egrep "USER|sshd" >>/tmp/ps-ssh-$NOW.log
echo -e "#####################" >>/tmp/ps-ssh-$NOW.log
netstat -n | egrep "Send-Q|$SSH_PORT" >>/tmp/ps-ssh-$NOW.log
echo -e "#####################" >>/tmp/ps-ssh-$NOW.log
echo -e "ps aux | egrep \"USER|sshd\" | awk '{print \$2}' | xargs kill -9" >>/tmp/ps-ssh-$NOW.log
mail -s "SSH WARNING [$HOSTNAME|$IP|$NOW]" a@mail.com b@mail.com </tmp/ps-ssh-$NOW.log
cat /tmp/ps-ssh-$NOW.log
echo "__________________________________________________________________________"
sleep 5
cat /var/log/mail.log
2016-03-25
Freenas vs NAS4Free vs Openfiler vs OMV (Open Media Vault)
I was Looking For a Simple Free Home NAS, Start small and Grow by adding disks later.
Looked at OpenFiler (OF) , NAS4Free, FreeNAS, Open Media Vault (OMV) to find a suitable NAS for my Home NAS.
Here are my findings, (As of January 2013)
There are many options out there, where you can setup a small low-power, low-cost server and run your home NAS at home to store files and don't loose them in case of a disk failure. But what NAS software to choose from? My blog is on what I found out during my research. (I have no bias to anyone of them)
Openfiler.
OF is Old - Look like development is stopped. Version 2.99.1 has a bug where GUI do leave 5% of storage behind when using GUI / GPT disks. (Can fix using command line parted but not straight forward - no one in development community care to fix any more). Prior version 2.3 is good but iSCSI support is old (If you don't use iSCSI, OF 2.3 version is good enough). Volume Snapshots are available, when enabled, performance drop is significant, but that is part of the linux lvm implementation and you have to live with it if you want snapshots.
One of the great features for a home user that I see with OF is that we can go to disk partition level from the GUI to create storage groups. Where as none other programs did provide this capability. For example ; If I had 3 x 3TB disks I can partition each disk to 3 partitions, and create 3 raid - stripes (each stripe will hold 2TB data with 2+1 raid) and later I can add a 1TB disk to the mix and expand one of the stripes to make that stripe a 3TB (re-stripe to 3+1 from 2+1) without loosing data. (Need to go to command line to issue few simple commands to re-stripe but simple enough to do).
FreeNAS / NAS4Free (Version 9.x)
FreeNAS has been out there for a long time, and NAS4Free is a fork from FreeNAS. FreeNAS interface is modern, but both interfaces does the similar functionality at the end. Both are very good and stable. Both offer encryption and de-duplication (5GB of Memory per 1TB of de-dup recommended sort of high requirement for a home NAS if you need dedup, but that is what you need for for that kind of technology.), Both based on FreeBSD. For home use, issue that I have is zfs-raidz (their raid 5 implementation) cannot add a disk later and expand without destroying data on it. (Example If I start with 3 disk raid config and want to add a disk to make make a 4 disk raid later, I have to destroy data before I can make it a new 4 disk raid, This was a big no for me for my home NAS.). FreeNAS/NAS4Free work well installed from a USB stick. (Notes : Embedded install option is great and make sure not to enable de-dupe unless you know what you are getting into. Read Here before enabling de-dupe.)
OMV (Open Media Vault)
From performance perspective, Openfiler and OMV is similar. Both don't have zfs, no pre-fetching. Openfiler may still be better and stable than OMV in my opinion. OMV is new and it can take some time to see if it is for real and people will support development going into future. OMV also have LVM and iSCSI as plug-ins. Confusing to find how to enable them for the first time user, but they are there. OMV is similar in many ways to OF as both are based on Linux. Now that OF project is dead you can consider OMV as a upgrade to OF as well.
My Thoughts :
So which NAS to choose ?
Short answer...
Simple, Flexible & Work with low end hardware -> Openfiler or OMV (Both Similar)
Performance, Complex & More Memory -> FreeNAS or NAS4Free (Both similar)
Long Answer .....
If looking for performance and have good cpu & memory to go with it, FreeNAS/NAS4Free is good. Specially in multi-user environments features like pre-fetch has value. For a simple home NAS, you need to be able to grow easily by adding additional storage disks, and with FreeNAS it is not easy to add disk. Some of the zfs features may not even necessary for a home NAS environment (over-kill). Openfiler (or OMV) is still probably best if looking for flexibility of growth & ok performance.
2015-10-18
Eclipse Mars: version 4.5.0 Release on June 24th 2015 – Hands on
Hurray –
Eclipse Mars release on 24th June – the big major Eclipse release. There are quite a few under the hood changes happened on Eclipse Mars project.Major changes into Eclipse Mars Project:
- Brand new hierarchical view of nested projects
- Improved Maven archetypes integration and enhanced auto-completion in the pom editor
- Ability to customize perspectives and speed improvements for text search
- Best new tools for building and maintaining Docker containers
- New ability to record and share user preference settings across individual workspaces
- Improved Maven support, including support for Maven 3.3.3
- Nice and Automated way for error reporting
How to update Workspace from Eclipse Luna (Previous release) to Mars?
Step-1
Eclipse Mars IDE for Java EE Developers: http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/marsr
Step-2
Extract above
.tar.gz file and you will see just Eclipse.app file.Step-3
During startup just provide your previous Eclipse’s work space and click ok and you should be all good.
So far all my ~20 projects imported successfully to Eclipse Mars without any issue. Compilation worked just fine. Only thing which I had to do is to just install Apache Tomcat again on Eclipse Mars. If you face any issue while installing Tomcat then follow the tutorial.
SHARE ON
Some more articles you might also be interested in …
- How to fix Cannot change version of project facet Dynamic Web Module to 3.0 Error in Eclipse
- How to Configure BitBucket Git Repository in your Eclipse Environment? Git version control with Eclipse (EGit)
- How to Create Dynamic Web Project using Maven in Eclipse?
- How to Create a .war file from Eclipse using Maven Plugin? Apache ‘maven-war-plugin’ usage
- How to Upgrade WordPress to latest Beta, Release Candidate (RC) or Nightly Release?
- Cannot be Read or is Not a Valid ZIP file – How to fix Maven Build Path Error with corrupted .jar file
- Convert Java Project to Dynamic Web Project in Eclipse Environment
- Best Code Coverage Plugin you Should Use in Eclipse IDE & Complete Working Testcase Example
- How to convert existing Java Project to Maven in Eclipse?
- How to fix “org.eclipse.jst.ws.util.JspUtils cannot be resolved to a type” Error in Eclipse?
How to Configure BitBucket Git Repository in your Eclipse Environment? Git version control with Eclipse (EGit)
Bitbucket is a distributed version control system (DVCS) code hosting site that supports Mercurial and Git. With
Mercurial and Git, your data is distributed by definition but you still
need a place to share it and keep track of your development. That is
where Bitbucket comes in.
You may need to check why I choose bitbucket over github.
Bitbucket provides a fully-featured environment for managing your
development project, including a code repository, a wiki (naturally
backed by Mercurial and Git – you can clone it), a powerful issue
tracker and easy collaboration with others.
Simply put, Bitbucket takes the pain out of sharing code and lets you
focus on what you do best: Code. Bitbucket offers both commercial plans
and free accounts. It offers free accounts with an unlimited number of
private repositories (which can have up to five users in the case of
free accounts).
Here are quick steps to setup BitBucket Repository to you Eclipse Environment.
Step-1
Register for Bitbucket.
Step-2
Create Private/Public repository
Step-3
On Overview page
https://bitbucket.org/dashboard/overview, look for your repository information.
Mouse hover will give you
Repository URL which we will use later to import project into Eclipse.Step-4
Now let’s make Eclipse ready for Git.
- Open Eclipse
- Click on
Helpmenu - Click
Install New Software
Step-5
Install eGit into Eclipse. Git version control with Eclipse (EGit) – Tutorial. How to use bitBucket with EGit in Eclipse.
URL:
http://download.eclipse.org/egit/updatesStep-6
Select
Eclipse Git Team Provider and JGit form option and click next and finish install.Step-7
Now Open
Perspective and choose Git from list.Step-8
Click Clone Repository Button
Step-9
Enter your Bitbucket URL and User Information as mentioned in below diagram. Click
Next and Finish. No need to change other configuration in next window.Step-10
You should see your Bitbucket repository now in eclipse.
Step-11
Now you may want to import the project so you can work on the source code.
- Click
- ‘Windows’ >
- ‘Open Perspective’ >
- ‘Resource’
- Click
- ‘File’ >
- ‘Import’ >
- ‘Git’ >
- ‘Projects from Git’ >
- ‘Existing local repository’ >
- ‘Select a Git Repository’ >
- ‘Import as General Project’ >
- ‘Next’ >
- ‘Finish’
- The code should then appear in your ‘Project Explorer’ window as a normal project
- Now make changes to your file as you want
- Look at ‘Git Staging’ view to see your changed files and Click ‘
Commit and Push‘
Do let me know if you encounter any issue while setting this up. Now what? Now setup SmartGit with your BitBucket repository to do all kind of commit, put, etc GIT operations.
Thanks,
App Shah
Source: http://crunchify.com/how-to-configure-bitbucket-git-repository-in-you-eclipse/
App Shah
Source: http://crunchify.com/how-to-configure-bitbucket-git-repository-in-you-eclipse/
Getting Started With Git and Eclipse EGit Integration Tutorial using GitHub
This page will walk through the getting started with Git and Eclipse
EGit integration tutorial using GitHub. Now days most of the software
developer/student writes code on the Eclipse IDE and make their coding
experience easy. We have a lots of valuable project and code that we
programed and experiments on the system. But sometime we face the
problem with our system (like system damaged, virus attack, HHD failure,
etc.). In this situation we lost the project as well as code. But we
have an alternate method to back up our project/code manually. Manual
back up process is too lengthy and time consuming process.
Using Git Hub we may save our time and it's very easy process to store our projects/code online and access from anywhere. Now the problem is How to Install and Integrate Git Hub in Eclipse.
If you don't know the Git installation and integration don't worries, this page will help you with the concrete process.
If you are using the latest Eclipse (Mars) then need not to install the EGit otherwise you need to install EGit Plugin in your Eclipse IDE.
Using Git Hub we may save our time and it's very easy process to store our projects/code online and access from anywhere. Now the problem is How to Install and Integrate Git Hub in Eclipse.
If you don't know the Git installation and integration don't worries, this page will help you with the concrete process.
If you are using the latest Eclipse (Mars) then need not to install the EGit otherwise you need to install EGit Plugin in your Eclipse IDE.
Contents
- What is Git?
- Mechanism of Git
- Basic Requirements
- Eclipse Git Integration
- Working with Git in Eclipse using Github
- Create Github Account
- Clone Git Repository
- Use Gradle to Set Classpath and .project in Eclipse
- Check-In and Check-Out Code from and To Remote Git Repository(Github)
- Show History and Compare Code using Git in Eclipse
- Expected Error
What is Git?
1- Git is version control system.
2- Git maintain the history.
3- Check In and Check Out control.
4- It provides an intermediate Git repository i.e. local git repository.
5- Git supports rapid branching and merging, and includes specific tools for visualizing and navigating a non-linear development history.
6- Repositories can be published via HTTP, FTP, rsync.
7- Efficient handling of large projects.
2- Git maintain the history.
3- Check In and Check Out control.
4- It provides an intermediate Git repository i.e. local git repository.
5- Git supports rapid branching and merging, and includes specific tools for visualizing and navigating a non-linear development history.
6- Repositories can be published via HTTP, FTP, rsync.
7- Efficient handling of large projects.
Mechanism of Git
While working with Git we will have 2 repositories
1- Git Remote Repository
2- Git Local Repository
Git is strong version control system that is secure as well. When we clone the Remote repository Git will create a local repository in the system. Creating a local repository in system will save damage of remote code. Suppose you are working with Project 1 and change the code of Project 1 and you want to review it but suddenly you have assigned for Project 2 then what you will do with those changes that you make in Project 1. Here we use the Git local repository. We commit the changes of Project 1 to Git local repository and start working with Project 2. Whenever Project 2 has completed then we rebase the Project 1 changes to our workspace.
1- Git Remote Repository
2- Git Local Repository
Git is strong version control system that is secure as well. When we clone the Remote repository Git will create a local repository in the system. Creating a local repository in system will save damage of remote code. Suppose you are working with Project 1 and change the code of Project 1 and you want to review it but suddenly you have assigned for Project 2 then what you will do with those changes that you make in Project 1. Here we use the Git local repository. We commit the changes of Project 1 to Git local repository and start working with Project 2. Whenever Project 2 has completed then we rebase the Project 1 changes to our workspace.
Basic Requirements
1- Eclipse IDE
2- EGit Plugin
3- Gradle Build Tool
4- JDK 6
5- Git Hub account.
2- EGit Plugin
3- Gradle Build Tool
4- JDK 6
5- Git Hub account.
Eclipse Git Integration
To integrate the Git in Eclipse follow the below steps to better understating.
1- Go to Help >> Install New Software
2- Paste the below URL in Work with
http://download.eclipse.org/egit/updates
3- Check all and proceed the Next
4- Wait until the installation has been finished. When the installation process has been finished restart the Eclipse.
5- To ensure that Git is successfully installed or not, go to Windows >> Show View >> Other >> Git. And you get five list in Git

1- Go to Help >> Install New Software
2- Paste the below URL in Work with
http://download.eclipse.org/egit/updates
3- Check all and proceed the Next
4- Wait until the installation has been finished. When the installation process has been finished restart the Eclipse.
5- To ensure that Git is successfully installed or not, go to Windows >> Show View >> Other >> Git. And you get five list in Git
Working with Git in Eclipse using Github
Working with Git in Eclipse is very easy and reliable process. All the steps will described clearly below.
Create Github Account
To work with Github you need to create a Github
account(https://github.com/). When you have successfully create the
account now create a Repository inside the account. After successfully
creation of repository click on it and in the bottom of right side you
will find the URL of the repository. Copy that URL for cloning in
Eclipse.
Note : Do not forget to create a README.md file inside the repository.
Clone Git Repository
1- Open the Eclipse >> Windows >> Show View
2- If you find the Git in list click on it otherwise click on Other
3- Find the Git >> Git Repositories
4- Click on the Clone a Git repository

5- Fill required detail and proceed Next

6- Followed Next check the master and again click the Next.
7- Set the location of your local workspace and check the Projects >> Import all existing Eclipse project after clone finishes >> Finish
8- When the process has been finished it will import all project if exist in the repository other you need to create the project.
9- To create and import the project go to the Git Repository >> Working Directory >> Right click on it >> Import Project >> Next >> Finish
10- Now your Repository/Project will show in eclipse navigator/project explorer.
11- Create a folder src/main/java
12- Start making the java class and check-in the code on Git Hub.
2- If you find the Git in list click on it otherwise click on Other
3- Find the Git >> Git Repositories
4- Click on the Clone a Git repository
5- Fill required detail and proceed Next
6- Followed Next check the master and again click the Next.
7- Set the location of your local workspace and check the Projects >> Import all existing Eclipse project after clone finishes >> Finish
8- When the process has been finished it will import all project if exist in the repository other you need to create the project.
9- To create and import the project go to the Git Repository >> Working Directory >> Right click on it >> Import Project >> Next >> Finish
10- Now your Repository/Project will show in eclipse navigator/project explorer.
11- Create a folder src/main/java
12- Start making the java class and check-in the code on Git Hub.
Use Gradle to Set Classpath and .project in Eclipse
Gradle build tool is the most popular build tool that is used in
software industry. To download Gradle build tool got to the below link
https://gradle.org/
Steps for Gradle-
1- Set the path of Gradle in Environment Variable.
2- Now create the file in your root directory named build.gradle in Eclipse.
3- Paste the below code in build.gradle file and save it.
1- Set the path of Gradle in Environment Variable.
2- Now create the file in your root directory named build.gradle in Eclipse.
3- Paste the below code in build.gradle file and save it.
apply plugin: 'java' apply plugin: 'eclipse' archivesBaseName = 'Concretepage.com' version = '1.0' repositories { mavenCentral() }
4- Now open Command Prompt >> go to your project >> type gradle eclipse >> Enter

5- Gradle will set all the setting that is required.
6- Now your project is a Java project and you are able to create the package as well as class.
5- Gradle will set all the setting that is required.
6- Now your project is a Java project and you are able to create the package as well as class.
Check-In and Check-Out Code from and To Remote Git Repository(Github)
This figure is clearly show that the work flow process of Git.

Check-In
Check In is a process to send the code in Git repository. How to check in your code look at below steps
1- To check in the code you will need Git Staging Tab in your Eclipse.
2- To get Git Staging Tab. Go to Window >> Show View >> Other >> Git >> Git Staging
3- Refresh your project. All the file will come in Unstaged Changes >> select all and drop in Staged Changes, >> write the Commit Message >> Commit and Push

Check-Out
Check-out is a process that brings the code from Remote Git to local workspace and it has two processes.
Fetch from Upstream: As in above figure we can see that Git has a local workspace. When we fetch the date it will come to the Git local workspace/repository.
Rebase: Rebase is a process that fetch the data from Git local repository to Eclipse workspace.
Check-In
Check In is a process to send the code in Git repository. How to check in your code look at below steps
1- To check in the code you will need Git Staging Tab in your Eclipse.
2- To get Git Staging Tab. Go to Window >> Show View >> Other >> Git >> Git Staging
3- Refresh your project. All the file will come in Unstaged Changes >> select all and drop in Staged Changes, >> write the Commit Message >> Commit and Push
Check-Out
Check-out is a process that brings the code from Remote Git to local workspace and it has two processes.
Fetch from Upstream: As in above figure we can see that Git has a local workspace. When we fetch the date it will come to the Git local workspace/repository.
Rebase: Rebase is a process that fetch the data from Git local repository to Eclipse workspace.
Show History and Compare Code using Git in Eclipse
Show in History : This feature will show all the commit history that you had committed. While clicking on the commit you will see the changes.
Compare with HEAD Revision: This will compare from the current code from workspace and existing code from remote section.
Compare with PREVIOUS Revision: It is just opposite of Compare with Head Revision, it will compare the previous code of remote and local workspace.
Compare with HEAD Revision: This will compare from the current code from workspace and existing code from remote section.
Compare with PREVIOUS Revision: It is just opposite of Compare with Head Revision, it will compare the previous code of remote and local workspace.
Expected Error
If the project extension is not a Java Project then it will show you such type of message Source folder is not a Java project.
To make the source folder as a Java project and set all setting of Eclipse properly you need to run Gradle Build Tool.
Subscribe to:
Posts (Atom)