Compare commits
4 Commits
76252f5107
..
wip
| Author | SHA1 | Date | |
|---|---|---|---|
|
78c2b51e4e
|
|||
|
2f34b14262
|
|||
|
49281ad4ba
|
|||
|
b934551853
|
@@ -0,0 +1,160 @@
|
||||
---
|
||||
title: Setup Gitea on Debian
|
||||
template: blog
|
||||
page_dir: /blog/2025/07/setup-gitea-on-debian
|
||||
---
|
||||
|
||||
# Setup Gitea on Debian
|
||||
|
||||
I just recently setup a new Gitea server for myself, and I would like to share with y'all on how to do the same
|
||||
|
||||
This was done on a fresh Debian 12 cheapo VPS on Linode, so this guide will pretty much apply to any Debian (and likely Ubuntu) system that is more-or-less a stock installation
|
||||
|
||||
I did this using <a href="https://gitlab.com/packaging/gitea/" target="_blank">a third-party repository for Gitea</a> that was <a href="https://www.gitea.com/gitea/awesome-gitea/src/branch/main/README.md#user-content-packages/" target="blank">linked from the official site</a>, as I don't care for Docker personally, and with a PostgreSQL database as opposed to something like SQLite, as that's the database I prefer to use when I have to use one (I'm not a big database person either)
|
||||
|
||||
Caddy will be used for the webserver as well, as it handles automatic TLS certificate acquisition, and is easy to setup
|
||||
|
||||
For clarity's sake, any command that starts with a `#` has to be run either as root or with `sudo`, and any command that starts with `$` can be run as a normal user (neither `#` nor `$` are part of the actual command itself)
|
||||
|
||||
We'll also assume `nano` will be used for editing files, but you can use whatever text editor you prefer
|
||||
|
||||
We're also going to assume you already have a domain name pointed at the server you are doing this on (we'll use `git.example.net` as a placeholder)
|
||||
|
||||
|
||||
## Overview
|
||||
|
||||
1. [Adding a repo for installing Gitea](#adding-a-repo-for-installing-gitea)
|
||||
2. [Install Gitea, PostgreSQL, and Caddy](#install-gitea-postgresql-and-caddy)
|
||||
3. [Configure PostgreSQL](#configure-postgresql)
|
||||
4. [Configure Caddy](#configure-caddy)
|
||||
5. [Setup Gitea](#setup-gitea)
|
||||
|
||||
|
||||
## Adding a Repo for Installing Gitea
|
||||
|
||||
First thing we're gonna need to do, since we're not using something like Docker, or just using the standalone binary, is add the third-party repo for Gitea
|
||||
|
||||
First up, we'll download the GPG key for the repo
|
||||
|
||||
```
|
||||
# curl -sL -o /etc/apt/trusted.gpg.d/morph027-gitea.asc https://packaging.gitlab.io/gitea/gpg.key
|
||||
```
|
||||
|
||||
Then, we'll add the repo by creating/editing the `.source` file that will contain the repo's information in `deb822` format
|
||||
|
||||
```
|
||||
# nano /etc/apt/sources.list.d/morph027-gitea.sources
|
||||
```
|
||||
|
||||
```
|
||||
Types: deb
|
||||
URIs: https://packaging.gitlab.io/gitea
|
||||
Suites: gitea
|
||||
Components: main
|
||||
Signed-By: /etc/apt/trusted.gpg.d/morph027-gitea.asc
|
||||
Enabled: yes
|
||||
```
|
||||
|
||||
Now we'll update apt so it can refresh it's list of known packages
|
||||
|
||||
```
|
||||
# apt update
|
||||
```
|
||||
|
||||
|
||||
## Install Gitea, PostgreSQL, and Caddy
|
||||
|
||||
Now for the easiest part, we'll install Gitea, our PostgreSQL database, and our Caddy webserver
|
||||
|
||||
```
|
||||
# apt install gitea postgresql caddy
|
||||
```
|
||||
|
||||
|
||||
## Configure PostgreSQL
|
||||
|
||||
Now for configuring PostgreSQL
|
||||
|
||||
First we're gonna edit PostgreSQL's config file
|
||||
|
||||
```
|
||||
# nano /etc/postgresql/15/main/postgresql.conf
|
||||
```
|
||||
|
||||
and go to line 96, and uncomment
|
||||
|
||||
```
|
||||
#password_encryption = scram-sha-256 # scram-sha-256 or md5
|
||||
```
|
||||
|
||||
Next, we're gonna edit
|
||||
|
||||
```
|
||||
# nano /etc/postgresql/15/main/pg_hba.conf
|
||||
```
|
||||
|
||||
and add at the bottom of the file
|
||||
|
||||
```
|
||||
local gitea gitea scram-sha-256
|
||||
```
|
||||
|
||||
Now, we'll restart PostgreSQL
|
||||
|
||||
```
|
||||
# sytemctl restart postgresql
|
||||
```
|
||||
|
||||
Now, to actually setup and configure the database
|
||||
|
||||
|
||||
First, we'll need to run `psql` as the `postgres` user
|
||||
|
||||
```
|
||||
$ sudo -u postgres psql
|
||||
```
|
||||
|
||||
Now, we need to create the "role" (user) that PostgreSQL will use for interfacing with the database, replacing `password` with the password you want to assign it
|
||||
|
||||
```
|
||||
CREATE ROLE gitea WITH LOGIN PASSWORD 'password'
|
||||
```
|
||||
|
||||
Next, the database
|
||||
|
||||
```
|
||||
CREATE DATABASE gitea WITH OWNER gitea TEMPLATE template0 ENCODING UTF8 LC_COLLATE 'en_US.UTF-8' LC_CTYPE 'en_US.UTF-8';
|
||||
```
|
||||
|
||||
Now exit `psql`
|
||||
|
||||
```
|
||||
exit
|
||||
```
|
||||
|
||||
|
||||
## Configure Caddy
|
||||
|
||||
We're gonna edit the main Caddyfile and configure it to simply reverse proxy traffic to our new Gitea server
|
||||
|
||||
```
|
||||
# nano /etc/caddy/Caddyfile
|
||||
```
|
||||
|
||||
Comment out/delete the contents of the file and put in
|
||||
|
||||
```
|
||||
git.example.net {
|
||||
reverse_proxy localhost:3000
|
||||
}
|
||||
```
|
||||
|
||||
And now we'll restart Caddy
|
||||
|
||||
```
|
||||
# systemctl restart caddy
|
||||
```
|
||||
|
||||
|
||||
## Setup Gitea
|
||||
|
||||
@@ -14,7 +14,7 @@ page_dir: /buttons
|
||||
<h2 style="text-align: center;">
|
||||
My Badges
|
||||
</h2>
|
||||
<div style="overflow: auto; height: 201px; margin-top: -8px;">
|
||||
<div style="overflow: auto; calc(100%-20px); margin-top: -8px;">
|
||||
<div class="web_buttons">
|
||||
<!-- Badges -->
|
||||
<a href="/res/img/badges/large/web-badge-large.gif" target="_blank"><img src="/res/img/badges/web-badge.gif" alt="" width="88px" height="31px"></a>
|
||||
@@ -26,7 +26,7 @@ My Badges
|
||||
<h2 style="text-align: center;">
|
||||
Other's Badges
|
||||
</h2>
|
||||
<div style="overflow: auto; height: 201px; margin-top: -8px;">
|
||||
<div style="overflow: auto; calc(100%-20px); margin-top: -8px;">
|
||||
<div class="web_buttons">
|
||||
<a href="https://yesterweb.org/no-to-web3/" target="_blank"><img src="/res/img/badges/roly-saynotoweb3.gif" alt="Say no to Web3" width="88px" height="31px"></a>
|
||||
<a href="https://yesterweb.org/" target="_blank"><img src="/res/img/badges/yesterweb.png" alt="The Yesterweb" width="88px" height="31px"></a>
|
||||
@@ -40,6 +40,7 @@ Other's Badges
|
||||
<img src="/res/img/badges/cookie.png" alt="No cookies" width="88px" height="31px">
|
||||
<img src="/res/img/badges/i_dream_in_html.gif" alt="I dream in HTML" width="88px" height="31px">
|
||||
<img src="/res/img/badges/bestcomp.gif" alt="Best viewed with a computer" width="88px" height="31px">
|
||||
<img src="/res/img/badges/debian-powered.gif" alt="Debian powered" width="88px" height="31px">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -47,7 +48,7 @@ Other's Badges
|
||||
<h2 style="text-align: center;">
|
||||
My Buttons
|
||||
</h2>
|
||||
<div style="overflow: auto; height: 201px; margin-top: -8px;">
|
||||
<div style="overflow: auto; calc(100%-20px); margin-top: -8px;">
|
||||
<div class="web_buttons">
|
||||
<!-- Buttons -->
|
||||
<a href="/res/img/buttons/large/web-button-2-large.gif" target="_blank"><img src="/res/img/buttons/web-button-2.gif" width="32px" height="32px"></a>
|
||||
@@ -59,7 +60,7 @@ My Buttons
|
||||
<h2 style="text-align: center;">
|
||||
Other's Buttons
|
||||
</h2>
|
||||
<div style="overflow: auto; height: 201px; margin-top: -8px;">
|
||||
<div style="overflow: auto; calc(100%-20px); margin-top: -8px;">
|
||||
<div class="web_buttons">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+1
-2
@@ -9,15 +9,14 @@ page_dir: /links
|
||||
- <a href="https://32bit.cafe/" target="_blank">32-Bit Cafe</a>
|
||||
- <a href="https://www.debian.org/" target="_blank">Debian</a>
|
||||
- <a href="https://www.endof10.org/" target="_blank">End of 10</a>
|
||||
- <a href="https://www.fedoraproject.org/" target="_blank">Fedora Project</a>
|
||||
- <a href="https://www.fsfe.org/" target="_blank">Free Software Foundation Europe</a>
|
||||
- <a href="https://www.gimp.org/" target="_blank">The GNU Image Manipulation Program</a>
|
||||
- <a href="https://www.inkscape.org/" target="_blank">Inkscape</a>
|
||||
- <a href="https://www.kate-editor.org/" target="_blank">Kate</a>
|
||||
- <a href="https://www.kde.org/" target="_blank">KDE</a>
|
||||
- <a href="https://www.nekoweb.org/" target="_blank">Nekoweb</a>
|
||||
- <a href="https://www.neocities.org/" target="_blank">Neocities</a>
|
||||
- <a href="https://www.thenewoil.org/" target="_blank">The New Oil</a>
|
||||
- <a href="https://www.nixos.org/" target="_blank">NixOS</a>
|
||||
- <a href="https://www.techlore.tech/" target="_blank">Techlore</a>
|
||||
- <a href="https://www.vscodium.com/" target="_blank">VSCodium</a>
|
||||
- <a href="https://yesterweb.org/" target="_blank">Yesterweb</a>
|
||||
|
||||
+21
-11
@@ -5,9 +5,9 @@
|
||||
<title>
|
||||
[ $title$ | easthighNerd ]
|
||||
</title>
|
||||
<link href="/res/css/default.css" rel="stylesheet">
|
||||
<link href="/res/img/favicon.gif" rel="icon" type="image/gif">
|
||||
<link rel="me" href="https://raru.re/@easthighNerd">
|
||||
<link href="/res/css/default.css" rel="stylesheet">
|
||||
<link href="/res/img/favicon.gif" rel="icon" type="image/gif">
|
||||
<link rel="me" href="https://raru.re/@easthighNerd">
|
||||
</head>
|
||||
<body class="window">
|
||||
<div class="window_bar">
|
||||
@@ -17,14 +17,25 @@
|
||||
<a href="/home/" class="close_button">
|
||||
<img src="/res/img/close.png" width="48px" height="48px" alt="Close button">
|
||||
</a>
|
||||
<a href="/blog/" class="back_button">
|
||||
<img src="/res/img/back.png" width="23px" height="23px" alt="Back button">
|
||||
</a>
|
||||
<div class="explorer_bar_top">
|
||||
<img src="/res/img/explorer-bar.jpg" width="100%" height="88px">
|
||||
<p>
|
||||
https://www.easthighnerd.net/
|
||||
</p>
|
||||
<div class="menu_bar">
|
||||
<p>
|
||||
File Edit View Favorites Tools Help
|
||||
</p>
|
||||
</div>
|
||||
<div class="navigation_bar">
|
||||
<p>
|
||||
<a href="/blog/" class="back_button">
|
||||
<img src="/res/img/back.png" width="23px" height="23px" alt="Back button">
|
||||
Back
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="address_bar">
|
||||
<p>
|
||||
https://www.easthighnerd.net/
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="window_content">
|
||||
@@ -40,7 +51,6 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="explorer_bar_bottom">
|
||||
<img src="/res/img/explorer-bar-bottom.jpg" width="100%" height="23px">
|
||||
<p>
|
||||
https://www.easthighnerd.net/
|
||||
</p>
|
||||
|
||||
+45
-34
@@ -1,37 +1,48 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>
|
||||
[ $title$ | easthighNerd ]
|
||||
</title>
|
||||
<link href="/res/css/default.css" rel="stylesheet">
|
||||
<link href="/res/img/favicon.gif" rel="icon" type="image/gif">
|
||||
<link rel="me" href="https://raru.re/@easthighNerd">
|
||||
</head>
|
||||
<body class="window">
|
||||
<div class="window_bar">
|
||||
<p>
|
||||
$title$
|
||||
</p>
|
||||
<a href="/home/" class="close_button">
|
||||
<img src="/res/img/close.png" width="48px" height="48px" alt="Close button">
|
||||
</a>
|
||||
<div class="explorer_bar_top">
|
||||
<img src="/res/img/explorer-bar.jpg" width="100%" height="88px">
|
||||
<p>
|
||||
https://www.easthighnerd.net/
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="window_content">
|
||||
$body$
|
||||
</div>
|
||||
<div class="explorer_bar_bottom">
|
||||
<img src="/res/img/explorer-bar-bottom.jpg" width="100%" height="23px">
|
||||
<p>
|
||||
https://www.easthighnerd.net/
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>
|
||||
[ $title$ | easthighNerd ]
|
||||
</title>
|
||||
<link href="/res/css/default.css" rel="stylesheet">
|
||||
<link href="/res/img/favicon.gif" rel="icon" type="image/gif">
|
||||
<link rel="me" href="https://raru.re/@easthighNerd">
|
||||
</head>
|
||||
<body class="window">
|
||||
<div class="window_bar">
|
||||
<p>
|
||||
$title$
|
||||
</p>
|
||||
<a href="/home/" class="close_button">
|
||||
<img src="/res/img/close.png" width="48px" height="48px" alt="Close button">
|
||||
</a>
|
||||
<div class="explorer_bar_top">
|
||||
<div class="menu_bar">
|
||||
<p>
|
||||
File Edit View Favorites Tools Help
|
||||
</p>
|
||||
</div>
|
||||
<div class="navigation_bar">
|
||||
<p>
|
||||
<img src="/res/img/back.png" width="23px" height="23px" alt="Back button" style="filter: grayscale(1)">
|
||||
Back
|
||||
</p>
|
||||
</div>
|
||||
<div class="address_bar">
|
||||
<p>
|
||||
https://www.easthighnerd.net/
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="window_content">
|
||||
$body$
|
||||
</div>
|
||||
<div class="explorer_bar_bottom">
|
||||
<p>
|
||||
https://www.easthighnerd.net/
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user