How to Install Gitea on Linux – Full Guide & Explanation
-==== How to Install Gitea on Linux – Full Guide & Explanation ====-
---
## What is Gitea?
Gitea is a lightweight, self-hosted Git service — similar to GitHub, but it runs on your own computer or server.
It allows you to:
* Create and manage Git repositories
* Collaborate with others using pull requests, issues, and wikis
* Host your code privately and securely
* Practice Git workflows in labs like TryHackMe or Hack The Box
Gitea is written in Go, fast, and very easy to set up.
---
## Why Not Just Use GitHub?
GitHub is a great cloud-based Git service, but it requires an account and internet access. Gitea is useful when you want:
* A local Git service
* Full control over your repositories
* An offline environment
* A private setup for personal, internal, or lab projects
---
## What File Do I Need to Download?
Visit the official Gitea release page:
[https://github.com/go-gitea/gitea/releases](https://github.com/go-gitea/gitea/releases)
There are many files available. You should choose the one that matches your system’s CPU architecture.
* `linux-amd64`: This is the most common version for 64-bit desktop or laptop systems (Intel/AMD).
* `linux-arm` or `linux-arm64`: Used for ARM-based systems like Raspberry Pi.
My system is AMD (64-bit), so I picked the `gitea-1.24.0-linux-amd64` file.
Avoid files like `.asc` or `.sha256` unless you’re checking the file’s integrity (explained below).
---
## What is the SHA256 Hash?
When you download a file, the SHA256 hash helps you verify that the file hasn’t been corrupted or tampered with.
To check the downloaded file, use this command:
`sha256sum gitea-1.24.0-linux-amd64`
Compare the result to the SHA256 hash listed on the Gitea GitHub release page.
If they match, the file is safe and valid.
---
## Step-by-Step Gitea Installation
### Step 1 – Download Gitea
Open the Gitea releases page in your browser and download the correct file for your system.
[https://github.com/go-gitea/gitea/releases](https://github.com/go-gitea/gitea/releases)
Example:
Download `gitea-1.24.0-linux-amd64` if you are using a 64-bit system like most desktops/laptops.
### Step 2 – Make the File Executable
Navigate to the folder where you downloaded the file, for example:
`cd ~/Downloads`
Then make the file executable:
`chmod +x gitea-1.24.0-linux-amd64`
### Step 3 – Verify the SHA256 Hash (Optional but Recommended)
Use this command to print the file’s hash:
`sha256sum gitea-1.24.0-linux-amd64`
Make sure it matches the hash shown on the GitHub release page.
If the hash is correct, continue. If not, download the file again.
### Step 4 – Move the File to a System-Wide Location
To make Gitea available globally on your system, move it to a folder like `/usr/local/bin`:
`sudo mv gitea-1.24.0-linux-amd64 /usr/local/bin/gitea`
Now you can run Gitea from anywhere using the `gitea` command.
### Step 5 – Run Gitea
Start the Gitea server using:
`gitea web`
Gitea will launch and listen by default on port 3000.
Open your browser and go to:
`http://localhost:3000`
This will load the Gitea setup page. You can now configure your database and create your admin account.
---
## What If Gitea Doesn’t Work?
If the `gitea` command is not found, run this:
`which gitea`
If there’s no result, make sure:
* You moved the file to `/usr/local/bin/`
* You used `chmod +x` to make it executable
* You spelled the command correctly
You can also try running it directly using:
`./gitea-1.24.0-linux-amd64 web` (from the Downloads folder)
---
## Optional: Understanding Git Clone and Branching
You don’t need to use `git clone` to install Gitea. Downloading the binary is enough.
But if you want to contribute to the Gitea source code, then you would run:
`git clone https://github.com/go-gitea/gitea.git`
Then you can create a new branch for your changes:
`git checkout -b new-feature`
This is only useful for developers, not regular users.
---
## Troubleshooting Tips
If Gitea is already running and you want to restart it:
`pkill gitea && gitea web`
This stops the process and runs it again cleanly.
---
## Summary Table
| Step | Description |
| ---------------------- | -------------------------------------- |
| Download Gitea | From GitHub release page |
| Make executable | `chmod +x gitea...` |
| Check hash | `sha256sum` to verify file safety |
| Move to /usr/local/bin | So it works globally on your system |
| Start Gitea | `gitea web` to launch the local server |
| Setup in browser | Visit `localhost:3000` to configure it |
---
## Final Note
If you don’t care about verifying the file, you can skip the SHA256 check.
But it’s a good habit for security and best practice.
You also don’t need to use `git clone` unless you are working on the source code.
SOURCE: CHAT GPT
Comments
Post a Comment