Developer git gitea Open source ubuntu

How to install the Gitea git repository on Ubuntu Server 22.04

Jack Wallen reveals you ways to install the user-friendly native Git repository Gitea on Ubuntu Server 22.04.

git commit command programming technology code repository online cloud
Image: ribkhan/Adobe Stock

Gitea is certainly one of the greatest self-hosted Git servers on the market. This Go-based bundle could be very user-friendly, light-weight and pretty simple to install. Once you may have it up and working, your growth groups can take pleasure in a Git repository from inside your LAN, which implies delicate code shall be much less seemingly to discover its means into the palms of a 3rd occasion. Gitea options notifications, a built-in editor, person administration and extra.

SEE: Hiring package: Back-end Developer (TechRepublic Premium)

I would like to stroll you thru the strategy of deploying the newest model of Gitea (1.17.1) on the newest model of Ubuntu Server (22.04). The course of ought to solely take you about 5-10 minutes to full.

What you’ll want to install Gitea

The solely stuff you’ll want for this are a working occasion of Ubuntu Server (Jammy Jellyfish) and a person with sudo privileges. That’s it.

How to install the crucial dependencies

The very first thing we’ll do is install the crucial dependencies. Log in to your Ubuntu Server occasion and subject the command:

sudo apt-get install wget get mariadb-server -y

When the set up completes, safe the database server with the command:

sudo mysql_secure_installation

Make certain to create a brand new admin person password and reply y for the remaining questions.

How to create a database and person

The subsequent step is to create your database. Log into the database console with:

sudo mysql -u root -p

Create the database with:

CREATE DATABASE gitea;

Next, create a database person with:

GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'localhost' IDENTIFIED BY "PASSWORD";

Where PASSWORD is a robust and distinctive password.

Flush the privileges and exit from the database console with:

FLUSH PRIVILEGES;
exit

How to install Gitea

Let’s obtain the newest launch of Gitea and duplicate it to /usr/native/bin with:

sudo wget -O /usr/native/bin/gitea https://dl.gitea.io/gitea/1.17.1/gitea-1.17.1-linux-amd64

Change the permissions of the downloaded file with:

sudo chmod +x /usr/native/bin/gitea

Next, we should create a brand new person with the command:

sudo adduser --system --shell /bin/bash --gecos 'Git Version Control' --group --disabled-password --home /dwelling/git git

Create the required directories with:

sudo mkdir -pv /var/lib/gitea/{customized,information,log}

Change the possession of the new directories:

sudo chown -Rv git:git /var/lib/gitea

Change the permissions of the major gitea listing with the command:

sudo chmod -Rv 750 /var/lib/gitea

Create a brand new config listing for Gitea with:

sudo mkdir -v /and so forth/gitea

Change the possession of the new listing:

sudo chown -Rv root:git /and so forth/gitea

Change the permissions of the new listing with:

sudo chmod -Rv 770 /and so forth/gitea

How to create a systemd service file

Next, you should create a systemd service file for Gitea. Create the file with the command:

sudo nano /and so forth/systemd/system/gitea.service

In that file, paste the following contents:

[Unit]
Description=Gitea
After=syslog.goal
After=community.goal

[Service]
RestartSec=3s
Type=easy
User=git
Group=git
WorkingDirectory=/var/lib/gitea/

ExecStart=/usr/native/bin/gitea internet --config /and so forth/gitea/app.ini
Restart=at all times
Environment=USER=git HOME=/dwelling/git GITEA_WORK_DIR=/var/lib/gitea

[Install]
WantedBy=multi-user.goal

Save and shut the file.

Start and allow the gitea service:

sudo systemctl allow --now gitea

How to entry the Gitea web-based installer

Finally, you may end the set up with the web-based installer. Open a browser and level it to http://SERVER:3000, the place SERVER is the IP tackle of the internet hosting server.

You will see the Gitea configuration web page, the place you should configure the database settings (Figure A) and different choices you may want to change. Make certain to change each the Server Domain and the Gitea Base URL from localhost to the IP tackle or area of the internet hosting server.

Figure A

The Gitea configuration web page.

When completed, click on Install Gitea at the backside of the web page and permit the set up to full. You will then end up on the Gitea login web page, the place you may register an account and begin utilizing your LAN-based Gitea server.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the newest tech recommendation for enterprise professionals from Jack Wallen.

admin

Leave a Reply

Your email address will not be published.Required fields are marked *

*