Monthly Archives: January 2019

Running a private GITHUB Style service on a Raspberry Pi 3

 

Using Gitea in Rapberry Pi

 

Setup

This is a general guide… but it likely needs a few tweaks. It is based on the URL below.

https://hobbylad.wordpress.com/2018/02/16/gitea-git-server-setup-on-raspberry-pi/

 

Step 1 Setup the USER Account

Create a new user under which the Gitea process runs

sudo adduser --system --shell /bin/bash --gecos 'Gitea user' --group --disabled-password --home /home/git git

Create the required directory structure. Everything is going to be installed in the /home/git/gitea directory.

 sudo mkdir -p /home/git/gitea/{custom,data,indexers,public,log}
 sudo chown git:git /home/git/gitea/{custom,data,indexers,public,log}
 sudo chmod 750 /home/git/gitea/{custom,data,indexers,public,log}
 sudo chown git:git /home/git/gitea

 

Step 2 Download Gitea

Download the Gitea binary and make it executable.
Check the download page first to figure out the latest version. The second statement is all 1 line.

cd /home/git/gitea

sudo wget -O gitea https://github.com/go-gitea/gitea/releases/download/v1.7.0-rc3/gitea-1.7.0-rc3-linux-arm-7

sudo chmod +x gitea

 

Step 3 Install a Database Server

We will use MariaDB (MySql) as a database server for Gitea.

sudo apt-get install git mariadb-server
...
sudo mysql -u root -p

grant all on *.* to 'root'@'localhost' identified by 'secretpassword';

MariaDB comes without a PASSWORD on Root. We fix this and then proceed to Gitea tasks.

… Now we create the Database

create database gitea

create user 'gitea'@'localhost' identified by 'gitea';

grant all privileges on gitea . * to 'gitea'@'localhost';

flush privileges;

quit;

 

Step 4 Run as a Service

So we need to set it up to run as a service:

sudo nano /etc/systemd/system/gitea.service

These lines below tell the service manager how to handle the service, where to start the application and what user to run it under.

[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target

[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get to HTTP error 500 because of that
#
# LimitMEMLOCK=infinity
# LimitNOFILE=65535

RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/home/git/gitea
ExecStart=/home/git/gitea/gitea web
Restart=always
Environment=USER=git 
HOME=/home/git

[Install]
WantedBy=multi-user.target


 


Initialize up the service:

sudo systemctl enable gitea.service

Then…

sudo systemctl start gitea.service

 

Step 5 Connect to Gitea:

In a browser; http://<Your Host IP or Name>:3000

You will get the option to create a USER and that will kick off the Initial SETUP step , as shown on Hobbylad’s page.

You should probably give the SSH setting the TCP/IP address of the server and the Application URL should have the ‘localhost’ replaced with a fully qualified domain name… this allows you to use the service from other hosts as well.

From here…. it behaves just like github.