docker

[ubuntu]gitea 설치

수학소년 2023. 11. 21. 00:10

1. git 설치

# apt-get install git
# git --version

 

2. gitea를 사용할 사용자 추가

# adduser --system --shell /bin/bash --gecos 'Git Version Control' \
          --group --disabled-password --home /home/git git
Adding system user `git' (UID 101) ...
Adding new group `git' (GID 102) ...
Adding new user `git' (UID 101) with group `git' ...
Creating home directory `/home/git' ...

 

3. gitea 설치

apt-get install wget
wget -O /tmp/gitea https://dl.gitea.io/gitea/1.12.2/gitea-1.12.2-linux-amd64
mv /tmp/gitea /usr/local/bin
chmod +x /usr/local/bin/gitea

 

 

5. gitea사용 기본 세팅

sudo mkdir -p /var/lib/gitea/{custom,data,log}
sudo chown -R git:git /var/lib/gitea/
sudo chmod -R 750 /var/lib/gitea/
sudo mkdir /etc/gitea
sudo chown root:git /etc/gitea
sudo chmod 770 /etc/gitea

 

6. systemctl로 Gitea를 관리

apt-get install nano
apt-get install systemctl
nano /etc/systemd/system/gitea.service
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
#After=mysqld.service
#After=postgresql.service
#After=memcached.service
#After=redis.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 /etc/gitea/app.ini -p 4000
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

port번호 4000. 기본값 3000은 react port번호로 쓰고 있어서 바꿔야 했음.

sudo systemctl daemon-reload
sudo systemctl enable gitea
sudo systemctl start gitea
sudo systemctl status gitea

 

http://localhost:4000 접속 후,

base Url도 4000, port도 4000으로 설정.