Git, a foundational tool in version control systems, allows developers to precisely track and manage software project modifications. For individuals looking to install Git on CentOS Stream 9 or the earlier enterprise-focused release, CentOS Stream 8, this introduction outlines its key benefits and standout features.
Key Attributes of Git:
- Distributed Control: Git operates on a distributed version control model, enabling multiple developers to work concurrently without hindrance.
- Efficient Branching & Merging: Facilitates creation, management, and seamless merging of multiple branches.
- Staging Precision: Offers a dedicated staging area, ensuring commits are organized and intentional.
- Comprehensive History: Maintains a thorough revision history, granting insights into every change.
- Collaborative Prowess: Its distributed nature and support for various protocols, including HTTP, SSH, and Git, make collaboration effortless.
- Versatility: Beyond CentOS Stream, Git is compatible with various platforms, from Windows and macOS to various Linux distributions.
- File Extensiveness: With Git LFS, even large files are efficiently managed and tracked.
Embracing Git on CentOS Stream streamlines code management and fosters collaboration, ensuring every change is accounted for. Its robust features, from precise branching to comprehensive revision tracking, position it as an indispensable asset for developers. Dive into the subsequent sections to master the installation of Git on CentOS Stream, unlocking a world of streamlined software development.
Table of Contents
Update CentOS Stream Before Git Installation
First, update your system to ensure that all existing packages are up-to-date.
sudo dnf upgrade --refresh
Install GIT on CentOS Stream 9 or 8 via DNF
The first method to install Git on CentOS Stream is by using the package manager. A package manager is a built-in tool with CentOS Stream that allows you to install and manage software packages quickly. To install Git using the package manager, use the following command.
sudo dnf install git
This command will install Git and all of its dependencies on your system.
Install GIT on CentOS Stream 9 or 8 via source
The second method to install Git on CentOS Stream is compiling it from the source code. This method is helpful if you need a specific version of Git unavailable in the package manager or if you want to install Git with custom configurations.
First, visit the release page to find the latest stable version or a particular version you are after. Then download it using the wget command.
At the time of this tutorial, 2.39.0 was the latest, but this will change in time, so please ensure you grab the latest link and regularly check back to keep running the same method to update your GIT version.
Remember, this is just an example command, do not use it, as it will be outdated quickly. Visit the release page to grab the latest link.
Run the following command that will extract the source code.
tar -xzf git-x.x.x.tar.gz
Navigate to the directory.
First, I would advise installing the development tools, which will install nearly all required dependencies:
sudo dnf groupinstall "Development Tools"
Lastly, a few extra ones not covered in the development tools pack are required; run this command to install them.
sudo dnf install libcurl-devel expat-devel
Now run the make command to configure the script.
sudo make prefix=/usr/local all
Next, install Git on CentOS Stream with the following make install command:
sudo make prefix=/usr/local install
Optionally, you can run Git in the terminal, as seen above. You should print out the version of Git you installed. Congratulations, you have installed Git via source.
This article discusses the two ways to install Git on CentOS Stream using the command-line terminal. The first method uses the package manager, the easiest and quickest way to install Git. The second method is compiling from source, which is useful if you need a specific version of Git or want to install Git with custom configurations. Whichever method you choose, Git is a powerful version control system that can benefit your software development projects.