In this tutorial, we'll walk you through the steps to install Gitea on NetBSD.
Gitea is a self-hosted Git service that provides a web interface for managing Git repositories. It is written in Go and is lightweight and easy to use.
Before we begin, make sure you have the following requirements:
First, update the package manager and install the required dependencies:
sudo pkgin update
sudo pkgin install git go sqlite curl
Download the latest version of Gitea from the official website using the following command:
cd ~
curl -LO https://dl.gitea.io/gitea/master/gitea-master-netbsd-386.gz
Once the download is complete, extract the file:
gunzip gitea-master-netbsd-386.gz
Make the extracted file executable:
chmod +x gitea-master-netbsd-386
Move the binary to the /usr/local/bin
directory:
sudo mv gitea-master-netbsd-386 /usr/local/bin/gitea
Create a Gitea user:
sudo useradd -r -s /sbin/nologin gitea
Create the directory for Gitea configuration files:
sudo mkdir /etc/gitea
Create a SQLite database directory:
sudo mkdir -p /var/lib/gitea/data/
sudo chown -R gitea:gitea /var/lib/gitea/
sudo chmod -R 750 /var/lib/gitea/
Create a file /etc/gitea/app.ini
for Gitea configuration:
sudo vi /etc/gitea/app.ini
Copy and paste the following configuration in the file:
APP_NAME = Gitea: Git with a cup of tea
RUN_USER = gitea
RUN_MODE = prod
[database]
DB_TYPE = sqlite3
HOST = 127.0.0.1:3306
NAME = gitea
USER =
PASSWD =
PATH = /var/lib/gitea/data/gitea.db
SSL_MODE = disabled
CHARSET = utf8
[repository]
ROOT = /var/lib/gitea/repositories
SCRIPT_TYPE = bash
DEFAULT_BRANCH = master
DEFAULT_PRIVATE = false
DEFAULT_ENABLE_TIMELINE_ATOM = true
DEFAULT_ENABLE_TIMELINE_RSS = true
DEFAULT_REPOSITORY_VISIBILITY= "public"
ENABLE_PUSH_CREATE_USER = true
ENABLE_PUSH_CREATE_ORG = true
[server]
PROTOCOL = http
HTTP_PORT = 3000
ROOT_URL = http://<your-domain>:3000/
DISABLE_SSH = true
[mailer]
ENABLED = false
[picture]
DISABLE_GRAVATAR = false
ENABLE_FEDERATED_AVATAR = false
Replace <your-domain>
with your domain name.
Save and close the file.
Create a file /etc/systemd/system/gitea.service
for Gitea systemd service:
sudo vi /etc/systemd/system/gitea.service
Copy and paste the following configuration in the file:
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
Requires=dbus.service
[Service]
Type=simple
User=gitea
Group=gitea
WorkingDirectory=/home/gitea/
ExecStart=/usr/local/bin/gitea web -c /etc/gitea/app.ini
Restart=always
Environment=USER=gitea HOME=/home/gitea
[Install]
WantedBy=multi-user.target
Save and close the file.
Reload systemd configuration:
sudo systemctl daemon-reload
Start and enable Gitea service:
sudo systemctl start gitea
sudo systemctl enable gitea
If you have a firewall enabled on your system, you need to allow traffic on the HTTP port 3000
:
sudo firewall-cmd --add-port=3000/tcp --permanent
sudo firewall-cmd --reload
Open a web browser and visit http://<your-domain>:3000
. You should see the Gitea login page.
Use the username root
and any password to login. You will be prompted to change the root password.
After changing the password, you will be redirected to the Gitea dashboard.
That's it! You have successfully installed Gitea on NetBSD. You can now create repositories and manage your Git projects.
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!