Gitea

From DaqWiki
Revision as of 22:07, 24 April 2026 by Olchansk (talk | contribs) (→‎Links)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Links

Install 1.26.0

  • install gitea package
as root: create gitea user:

zfs create rpool/gitea
adduser --system --shell /bin/bash --gecos 'Gitea git server' --group --disabled-password --home /gitea gitea

as gitea user:

su - gitea
wget https://dl.gitea.com/gitea/1.26.0/gitea-1.26.0-linux-amd64.xz
wget https://dl.gitea.com/gitea/1.26.0/gitea-1.26.0-linux-amd64.asc
xz -d gitea-1.26.0-linux-amd64.xz
gpg --keyserver hkps://keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
gpg --verify gitea-1.26.0-linux-amd64.asc gitea-1.26.0-linux-amd64
mkdir var-lib-gitea
mkdir etc-gitea
ln -s gitea-1.26.0-linux-amd64 gitea
wget https://raw.githubusercontent.com/go-gitea/gitea/refs/heads/release/v1.26/contrib/systemd/gitea.service

as root:

cd /gitea
ln -s /gitea/var-lib-gitea /var/lib/gitea
ln -s /gitea/etc-gitea /etc/gitea
cp gitea.service /etc/systemd/system/gitea.service
chown root:root /etc/systemd/system/gitea.service
edit /etc/systemd/system/gitea.service to enable mariadb dependancy, change username and home dir
#systemctl enable gitea
#systemctl start gitea

as gitea user:

edit custom/conf/app.ini to read
[server]
HTTP_ADDR = 127.0.0.1
HTTP_PORT = 3000
DOMAIN = localhost
LOCAL_ROOT_URL = http://localhost:3000/
ROOT_URL = https://daq00.triumf.ca/gitea/ 

./gitea web ### should listen to localhost port 3000

as root:

add port 3000 to apache2 at URL https://daq00.triumf.ca/gitea/
in /etc/apache2/sites-available/daq00-ssl.conf
add proxy
        ProxyPass /gitea/             http://localhost:3000/    retry=1  
add password protection
        <Location /gitea> 

systemctl restart apache2

main page at https://daq00.triumf.ca/gitea/ loads
asks us to setup the mysql database
to be continued...
  • setup the mysql databse:
ssh root@daq00
mysql -u root ### no password
use database mysql;
create user 'gitea'@'localhost' identified by 'password';
select * from user;
create database gitea;
use gitea;
grant all privileges on gitea.* to 'gitea'@'localhost';
mysql -p -u gitea gitea ### should work if correct password is entered
  • activate gitea
ssh gitea@daq00
./gitea web ### should listen to localhost port 3000
open https://daq00.triumf.ca/gitea/ ### will ask for daq00 apache password
this will open a page with gitea configuration
enter mysql password
press continue
there will be no errors
takes to the create account page
first user created is administrator
then to test create 2nd user, in Site Administration -> Identity and Access -> make them administrator
gitea is ready to use now
  • start gitea at boot
ssh root@daq00
edit /etc/systemd/system/gitea.service
enable Wants=mariadb
set User=gitea
set Group=gitea
set ExecStart=/gitea/gitea web --config /gitea/custom/conf/app.ini 
systemctl daemon-reload
systemctl restart gitea
systemctl status gitea