How to Install Gitea on POP! OS Latest

Gitea is a self-hosted Git service similar to GitHub, GitLab, and Bitbucket. It is written in Go and is lightweight, fast, and easy to use. In this tutorial, we will show you how to install Gitea on POP! OS Latest.

Prerequisites

Before we start with the installation, ensure that you have the following:

Step 1: Install Dependencies

To start with the installation, let's introduce the dependencies required by Gitea:

$ sudo apt update
$ sudo apt install -y git sqlite3 certbot

Step 2: Download Gitea

  1. Navigate to the official Gitea website https://gitea.io and download the latest stable release for Linux AMD64 by clicking on the link displayed.

  2. Next, create a new directory for Gitea:

$ sudo mkdir /var/lib/gitea && sudo chown $USER:$USER /var/lib/gitea
  1. Afterward, switch to the downloaded directory:
$ cd ~
  1. Extract the downloaded archive:
$ tar -zxvf gitea-*-linux-amd64.tar.gz
  1. Move the extracted directory to the Gitea directory we created in Step 2 above:
$ sudo mv gitea-* /var/lib/gitea/gitea
  1. Finally, create a symlink to the Gitea binary:
$ sudo ln -s /var/lib/gitea/gitea/gitea /usr/local/bin/gitea

Step 3: Create a Systemd Service

  1. Create a Gitea systemd service configuration file:
$ sudo nano /etc/systemd/system/gitea.service
  1. Paste the following content to the file, replacing the variables with your values:
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
# Requires mariadb/mysql
# Requires=mysqld.service
# Requires=mariadb.service
# Requires=mysql.service

[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/gitea/
ExecStart=/usr/local/bin/gitea web -c /var/lib/gitea/custom/conf/app.ini
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
# If you want to bind Gitea to a port below 1024 uncomment
# the two values below
###
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
#AmbientCapabilities=CAP_NET_BIND_SERVICE

[Install]
WantedBy=multi-user.target
  1. Check and reload systemd to start the Gitea service:
$ sudo systemctl daemon-reload
$ sudo systemctl enable gitea.service
$ sudo systemctl start gitea.service

Step 4: Set up HTTPS With Let's Encrypt (Optional)

To use HTTPS with your Gitea installation, you can use Let's Encrypt to generate free SSL certificates.

  1. Install Certbot:
$ sudo apt-get install certbot
  1. Stop the Gitea service:
$ sudo systemctl stop gitea.service
  1. Generate the SSL certificate with certbot:
$ sudo certbot certonly --standalone -d example.com

Replace example.com with your domain name.

  1. Start the Gitea service again:
$ sudo systemctl start gitea.service

Conclusion

In this tutorial, we showed you how to install and set up Gitea on POP! OS Latest. To get started with using Gitea, navigate to http://localhost:3000 in your favorite web browser.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!