{"id":2536,"date":"2025-06-08T18:52:39","date_gmt":"2025-06-08T17:52:39","guid":{"rendered":"https:\/\/www.balajibandi.com\/?p=2536"},"modified":"2025-06-14T14:38:24","modified_gmt":"2025-06-14T13:38:24","slug":"how-to-install-gitea-on-ubuntu-24-0-1-lts","status":"publish","type":"post","link":"https:\/\/www.balajibandi.com\/?p=2536","title":{"rendered":"How to Install Gitea Locally on Ubuntu 24.0.1 LTS"},"content":{"rendered":"\n<p>Gitea is designed to be resource-efficient and fast, making it suitable for both small and large projects.<\/p>\n\n\n\n<p>Since i want to have Local Version control so i find Gitea is good tool for me to install Locally and maintain own version for my automation application i am working on to build.<\/p>\n\n\n\n<p>This Blog show how to setup Gitea on Ubunut from Scratch to end, its each and less resource consumption on your Local VM.<\/p>\n\n\n\n<p>For now i am using Esxi (but i am going to Migrate to Proxmox free VM deployment &#8211; that i will cover another blog)<\/p>\n\n\n\n<p>I have installed Ubuntu 24 LTS with 8 CPU and 32GB RAM and 1TB HDD (which is used for all my DevOp).<\/p>\n\n\n\n<p>Gitea Installation :<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Prerequisites<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A user with Sudo privileges is required or Full SSH root access.<\/li>\n\n\n\n<li>Gitea supports the following databases. \n<ul class=\"wp-block-list\">\n<li>SQLite<\/li>\n\n\n\n<li>PostgreSQL<\/li>\n\n\n\n<li>MySQL<\/li>\n\n\n\n<li>MariaDB<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>In my installation guide below, i will be using <strong>PostgresSQL<\/strong>&nbsp;as the database for&nbsp;<strong>Gitea<\/strong>. You can pick any of the supported databases in your installation as needed. Since i use PGSQL for other purpose for Large application deployment.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"postgresql\">PostgreSQL<a href=\"https:\/\/docs.gitea.com\/installation\/database-prep#postgresql\">\u200b<\/a><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>For remote database setup, configure PostgreSQL on database instance to listen to your IP address by editing&nbsp;<code>listen_addresses<\/code>&nbsp;on&nbsp;<code>postgresql.conf<\/code>\n<ul class=\"wp-block-list\">\n<li><code>listen_addresses = 'localhost, 203.0.113.3'<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>PostgreSQL uses&nbsp;<code>md5<\/code>&nbsp;challenge-response encryption scheme for password authentication by default. Nowadays this scheme is not considered secure anymore. Use SCRAM-SHA-256 scheme instead by editing the&nbsp;<code>postgresql.conf<\/code>&nbsp;configuration file on the database server \n<ul class=\"wp-block-list\">\n<li><code>password_encryption = scram-sha-256<br><\/code>Restart PostgreSQL to apply the setting.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>On the database server, login to the database console as superuser:\n<ul class=\"wp-block-list\">\n<li><code>su -c \"psql\" - postgres<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Create database user (role in PostgreSQL terms) with login privilege and password. Please use a secure, strong password instead of&nbsp;<code>'gitea'<\/code>&nbsp;below:\n<ul class=\"wp-block-list\">\n<li><code>CREATE ROLE gitea WITH LOGIN PASSWORD 'xxxxx';<br><\/code>Replace username and password as appropriate.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Allow the database user to access the database created above by adding the following authentication rule to\u00a0<code>pg_hba.conf<\/code>.For local database:<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>local giteadb gitea scram-sha-256<br><\/code>For remote database:<\/li>\n\n\n\n<li><code>host giteadb gitea 192.168.1.74\/32 scram-sha-256<\/code><\/li>\n\n\n\n<li>Replace database name, user, and IP address of Gitea instance with your own.<\/li>\n\n\n\n<li><\/li>\n\n\n\n<li><\/li>\n<\/ul>\n\n\n\n<p>Testing PGSQL working as expected :<\/p>\n\n\n\n<p>psql<\/p>\n\n\n\n<p>giteadb=&gt;<\/p>\n\n\n\n<p>display tables<\/p>\n\n\n\n<p>giteadb-&gt; \\dt<\/p>\n\n\n\n<p>Note : you can find good cheat sheet how to use PGSQL on many searches.<\/p>\n\n\n\n<p>Install Git<\/p>\n\n\n\n<p>Prepare environment<\/p>\n\n\n\n<p>Check that Git is installed on the server. If it is not, install it first. Gitea requires Git version &gt;= 2.0.<\/p>\n\n\n\n<p>git &#8211;version<\/p>\n\n\n\n<p>git version 2.43.0<\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># On Ubuntu\/Debian:\nadduser \\\n   --system \\\n   --shell \/bin\/bash \\\n   --gecos 'Gitea Version Control' \\\n   --group \\\n   --disabled-password \\\n   --home \/home\/git \\\n   git<\/code><\/pre>\n\n\n\n<p><strong>Create the directory structure and set the required permissions and ownership.<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir -p \/var\/lib\/gitea\/{custom,data,indexers,public,log}\nchown git: \/var\/lib\/gitea\/{data,indexers,log}\nchmod 750 \/var\/lib\/gitea\/{data,indexers,log}\nmkdir \/etc\/gitea\nchown root:git \/etc\/gitea\nchmod 770 \/etc\/gitea<\/code><\/pre>\n\n\n\n<p>wget -O gitea https:\/\/dl.gitea.com\/gitea\/1.23.8\/gitea-1.23.8-linux-amd64<\/p>\n\n\n\n<p>mv gitea \/usr\/local\/bin<br>chmod +x \/usr\/local\/bin\/gitea<\/p>\n\n\n\n<p>Create a Systemd Unit File, which we can use to run the gitea in background and control with&nbsp;<code>systemctl<\/code>.<\/p>\n\n\n\n<p>Download the file to the &#8220;\/etc\/systemd\/system\/&#8221; directory using the following command.<\/p>\n\n\n\n<p>wget https:\/\/raw.githubusercontent.com\/go-gitea\/gitea\/main\/contrib\/systemd\/gitea.service -P \/etc\/systemd\/system\/<\/p>\n\n\n\n<p><br>ls \/etc\/systemd\/system\/ -al<br>systemctl daemon-reload<br>systemctl enable gitea<br>systemctl start gitea.service<br><\/p>\n\n\n\n<p>systemctl status gitea<\/p>\n\n\n\n<p>netstat -lntpd<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"811\" height=\"160\" src=\"https:\/\/www.balajibandi.com\/wp-content\/uploads\/2025\/06\/image.png\" alt=\"\" class=\"wp-image-2539\" srcset=\"https:\/\/www.balajibandi.com\/wp-content\/uploads\/2025\/06\/image.png 811w, https:\/\/www.balajibandi.com\/wp-content\/uploads\/2025\/06\/image-300x59.png 300w, https:\/\/www.balajibandi.com\/wp-content\/uploads\/2025\/06\/image-768x152.png 768w, https:\/\/www.balajibandi.com\/wp-content\/uploads\/2025\/06\/image-705x139.png 705w\" sizes=\"auto, (max-width: 811px) 100vw, 811px\" \/><\/figure>\n\n\n\n<p>Now Gitea running, we use Web GUI to configure<\/p>\n\n\n\n<p>Navigate to your browser.&nbsp;<strong>http:\/\/192.168.1.74:3000<\/strong>&nbsp;to access the Gitea dashboard.<\/p>\n\n\n\n<p>Now that we&#8217;ve started Gitea we can access it on port 3000 of our server. Upon opening Gitea in your browser for the first time, you should be greated with an initial configuration page. This configuration page should be fairly straight forward.<\/p>\n\n\n\n<p>If you have been following this guide so far, the database settings section should be configured like this (with the password filled in):<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"598\" src=\"https:\/\/www.balajibandi.com\/wp-content\/uploads\/2025\/06\/image-1-1024x598.png\" alt=\"\" class=\"wp-image-2541\" srcset=\"https:\/\/www.balajibandi.com\/wp-content\/uploads\/2025\/06\/image-1-1024x598.png 1024w, https:\/\/www.balajibandi.com\/wp-content\/uploads\/2025\/06\/image-1-300x175.png 300w, https:\/\/www.balajibandi.com\/wp-content\/uploads\/2025\/06\/image-1-768x449.png 768w, https:\/\/www.balajibandi.com\/wp-content\/uploads\/2025\/06\/image-1-705x412.png 705w, https:\/\/www.balajibandi.com\/wp-content\/uploads\/2025\/06\/image-1.png 1220w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The &#8220;General Application Settings&#8221; should be configured , Follow the on-screen instructions to complete the Gitea setup. Click on Register to start the database initialization.<\/p>\n\n\n\n<p>Once all good you get Home Page screen<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"186\" src=\"https:\/\/www.balajibandi.com\/wp-content\/uploads\/2025\/06\/image-2-1024x186.png\" alt=\"\" class=\"wp-image-2542\" srcset=\"https:\/\/www.balajibandi.com\/wp-content\/uploads\/2025\/06\/image-2-1024x186.png 1024w, https:\/\/www.balajibandi.com\/wp-content\/uploads\/2025\/06\/image-2-300x54.png 300w, https:\/\/www.balajibandi.com\/wp-content\/uploads\/2025\/06\/image-2-768x139.png 768w, https:\/\/www.balajibandi.com\/wp-content\/uploads\/2025\/06\/image-2-705x128.png 705w, https:\/\/www.balajibandi.com\/wp-content\/uploads\/2025\/06\/image-2.png 1492w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Good Luck &#8211; i will cover another blog when my application ready and using version control to show how we can manage on demand  CI\/CD part of the process.<\/p>\n\n\n\n<p>HappyLabbinggggggggggggggggg!!!!<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Gitea is designed to be resource-efficient and fast, making it suitable for both small and large projects. Since i want to have Local Version control so i find Gitea is good tool for me to install Locally and maintain own version for my automation application i am working on to build. This Blog show how [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-2536","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/posts\/2536","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2536"}],"version-history":[{"count":35,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/posts\/2536\/revisions"}],"predecessor-version":[{"id":2574,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=\/wp\/v2\/posts\/2536\/revisions\/2574"}],"wp:attachment":[{"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.balajibandi.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}