Otu esi etinye Gitea na Ubuntu 20.04 na SQLite 3

Gitea bụ ngwungwu ngwanrọ mepere emepe maka njikwa ụdị mmepe sọftụwia site na iji Git na njirimara mmekorita ndị ọzọ dị ka nsuso ahụhụ, wikis na nyocha koodu. Ọ na-akwado nnabata nke onwe mana ọ na-enyekwa ihe atụ ọha na eze efu na-akwado na China na igwe ojii DiDi. Gitea nwekwara akara ukwu ebe nchekwa pere mpe karịa Gitlab na ọ bụ sọftụwia akwadoro nke ukwuu maka ụlọ ọrụ na ndị mmepe na sistemụ nwere obere ike.

Na ntuziaka na-esonụ, ị ga-amụta ka esi etinye na hazie Gitea na Ubuntu 20.04 site na iji SQLite 3 nchekwa data. Ka e were ya na ị tinyebeghị SQLite 3 mbụ. Enwere onwe gị ịlele ntuziaka anyị Ịwụnye SQLite 3 na SQLite 3 Browser na Ubuntu 20.04.

Prerequisites

  • Awụnyere ọdụ data SQLite 3.
  • Ubuntu 20.04.2.0 LTS (Fosal Fossa) Sava ma ọ bụ Desktọpụ
  • Nweta mgbọrọgwụ ma ọ bụ ikike onye ọrụ Sudo.
  • Git arụnyere na sava gị.
  • wget ma ọ bụ curl arụnyere

Lelee ma melite sistemụ Ubuntu gị.

sudo apt update && sudo apt upgrade -y

Wụnye SQLite 3, na-eso nke anyị eduzi maka nkọwa ka mma.

sudo apt install sqlite3

Wụnye Git. Soro ntuziaka anyị maka otu esi etinye ụdị ọhụrụ nke Git na Ubuntu 20.04.

sudo apt install git

N'ikpeazụ, gbaa mbọ hụ na etinyere curl ma ọ bụ wget.

sudo apt install wget curl

Advertisement


Mepụta onye ọrụ Git ka ọ gbaa Gitea

Tupu ịwụ elu n'ihu, nzọụkwụ mbụ bụ ịmepụta onye ọrụ Git nke ga-eme ngwa Gitea. Iji mepụta akaụntụ onye ọrụ Git ọhụrụ, pịnye iwu a.

sudo adduser \
    --system \
    --shell /bin/bash \
    --gecos 'Git Version Control' \
    --group \
    --disabled-password \
    --home /home/git \
    git

Ị ga - enweta mmepụta ndị a:

~$ sudo adduser \
   --system \
      --shell /bin/bash \
      --gecos 'Git Version Control' \
      --group \
      --disabled-password \
      --home /home/git \
      git
   [sudo] password for bytesboss: 
   Adding system user git' (UID 129) ... Adding new groupgit' (GID 136) …
   Adding new user git' (UID 129) with groupgit' …
   Creating home directory `/home/git' … 

Budata Gitea

Ọzọ, gaa na Gitea nbudata ibe wee chọta ụdị nke dabara na ụkpụrụ ụlọ Ubuntu. Ugbu a, ụdị 1.14.3 bụ ụdị Gitea kacha ọhụrụ. Agbanyeghị, nke a ga-agbanwe ka oge na-aga. Ozugbo ịchọtara njikọ emelitere, budata ngwugwu ahụ site na iji iwu wget dị ka ndị a.

wget https://dl.gitea.io/gitea/${VERSION}/gitea-${VERSION}-linux-amd64

Nbudata a karịrị naanị 100MB. Ozugbo emechara, bugharịa faịlụ ọnụọgụ abụọ n'ime ebe ikpeazụ wee nye ya ikike ka ị nwee ike ịga n'ihu na usoro ntinye.

sudo mv gitea-1.14.3-linux-amd64 /usr/local/bin \
 sudo mv gitea-1.14.3-linux-amd64 gitea \
 sudo chmod +x gitea

Advertisement


Mepụta akwụkwọ ndekọ aha Gitea

Ị ga-achọ ịmepụta akwụkwọ ndekọ aha n'onwe gị maka Gitea. N'okpuru ebe a bụ usoro ndekọ aha akwadoro bụ "atụ aro"site na Gitea. Tinye ihe ndị a ka ịmepụta akwụkwọ ndekọ aha gị.

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 \

Mara, akwụkwọ ndekọ aha “/etc/gitea” dị ugbu a na ikike chmod 777. Emere nke a ka nrụnye wee gaa n'ihu nke ọma na-enweghị mgbakasị ọ bụla. Ozugbo emechara, ị ga-achọ ịgbanwe nke a ka ọ bụrụ ikike chmod echekwara nke ọma.

Mepụta Ọrụ Sistemụ Gitea

Na-esote, iji wụnye ma mee Gitea, ị ga-achọ ịme faịlụ Systemd. Budata nke Gitea nyere anaghị achọ idezi ihe ọ bụla site na itinye iwu a.

wget https://raw.githubusercontent.com/go-gitea/gitea/main/contrib/systemd/gitea.service -P /etc/systemd/system/

Ugbu a, bugharịa daemon gị wee mee ka ọrụ sistemụ Gitea nwee ike.

sudo systemctl daemon-reload && sudo systemctl enable --now gitea

Na-esote, nyochaa na Gitea na-agba ọsọ yana na ọ nweghị mperi emebeghị. Ihe na-emekarị bụ ndị mmadụ na-echefu ịtọ akwụkwọ ndekọ aha. Ọ bụrụ na ị hụ nke a, laghachi azụ usoro ole na ole ma megharịa usoro daemon-reload.

Mmepụta kwesịrị ịdị ka nke dị n'okpuru ma ọ bụrụ na edobere ya nke ọma.

$ sudo systemctl status gitea
 ● gitea.service - Gitea (Git with a cup of tea)
      Loaded: loaded (/etc/systemd/system/gitea.service; enabled; vendor preset: enabled)
      Active: active (running) since Sat 2021-06-26 22:47:23 PDT; 7s ago
    Main PID: 3214 (gitea)
       Tasks: 8 (limit: 4617)
      Memory: 184.9M
      CGroup: /system.slice/gitea.service
              └─3214 /usr/local/bin/gitea web --config /etc/gitea/app.ini

Advertisement


Tọọ Gitea site na Weebụ UI

Ozugbo ọrụ Gitea na-arụ ọrụ nke ọma, usoro a na-ebupụta UI webụ ka ọ kwụsịchaa nrụnye. Site na ndabara, Gitea na-ege ntị ọdụ ụgbọ mmiri 3000 na ntanetị netwọkụ niile.

UFW

Ọ bụrụ na ị nwere UFW, ịkwesịrị ịhapụ ọdụ ụgbọ mmiri dị ka ọ dị n'okpuru.

sudo ufw allow 3000/tcp

UI webụ

Mepee ihe nchọgharị Ịntanetị gị wee pịnye adreesị IP nke ihe nkesa nke ejiri: 3000 dị ka ọdụ ụgbọ mmiri.

Ihe Nlereanya:

http://192.168.53.101:3000

Ọ bụrụ na ịtọlitela ikike ọdụ ụgbọ mmiri nke ọma, ị ga-abịa na ihuenyo na-esonụ n'okpuru.

ubuntu 20.04 gitea web ui ibe ntọala izizi

Ị ga-achọkwa idezi ntọala dịka nke dị n'okpuru. Rịba ama na enwere ike ịgbanwe ihe ndị a ngwa ngwa ma emechaa.

Ntọala nchekwa data:

  •     Ụdị nchekwa data: SQLite 3
  •     Ụzọ: Jiri ụzọ zuru oke, /var/lib/gitea/data/gitea.db

Ntọala mkpokọta ngwa:

  •     Aha saịtị: Tinye aha nzukọ gị.
  •     Rootzọ Mgbakwunye Hapụ ndabara var/lib/gitea/data/gitea-repositories.
  •     Ụzọ mgbọrọgwụ nke Git LFS: Hapụ ndabara /var/lib/gitea/data/lfs. 
  •     Gbaa ọsọ dị ka aha njirimara: git
  •     Ngalaba nkesa SSH: Tinye ngalaba ma ọ bụ adreesị IP nkesa gị.
  •     Ọdụ ụgbọ mmiri SSH: 22, gbanwee ya ma ọ bụrụ na SSH na-ege ntị na Port ọzọ
  •     Gitea HTTP Port Port: 3000
  •     Gitea Base URL: Jiri http na ngalaba gị ma ọ bụ adreesị IP ihe nkesa gị.
  •     Zọ Ebe: Hapụ ndabara /var/lib/gitea/log

Mgbe ịmechara, ị nwere ike pịa "Wụnye Gitea” bọtịnụ dị na ala nke ibe ntọala.

gita wụnye ugbu a ubuntu 20.04

Ozugbo echichi mechara, a ga-edugharị gị gaa na ibe nbanye. Ị ga-achọ ịdebanye aha akaụntụ nke a ga-eme ka ọ bụrụ akaụntụ mbụ onye nchịkwa debanye aha na-akpaghị aka.

ubuntu 20.04 lts gitea admin akaụntụ

Ị mepụtala akaụntụ nchịkwa na ọrụ Gitea, ma ị nwere ahaziri ihe niile. Ọ ga-enyere gị aka ma ọ bụrụ na ị chekwaa folda gị ugbu a. Dị ka akọwara na mmalite nke ntuziaka ahụ, e mere ha 777 maka ntinye dị nro. Na-esote, tinye iwu a ka ịgbanwee ikike echekwara.

sudo chmod 750 /etc/gitea && sudo chmod 640 /etc/gitea/app.ini

Ekele, ị tinyela Gitea nke ọma na sistemụ arụmọrụ Ubuntu 20.04 LTS gị.

Melite ọkwa ozi-e Gitea

Gitea nwere ike izipu ozi site na email. Ị nwere ike ịwụnye Postfix ma ọ bụ ngwungwu ọ bụla ọzọ na-eji iwu ozi ọkọlọtọ. Iji mee ka amamọkwa ndị ahụ mepee faịlụ a site na iji nchịkọta akụkọ nano:

sudo nano /etc/gitea/app.ini

Na-esote, dezie ndebiri n'okpuru site na iji aha njirimara, paswọọdụ na nkọwa nkesa SMTP gị.

[mailer]
 ENABLED = true
 HOST    = SMTP_SERVER:SMTP_PORT
 FROM    = SENDER_EMAIL
 USER    = SMTP_USER
 PASSWD  = YOUR_SMTP_PASSWORD

Ozugbo emechara, malitegharịa ọrụ Gitea.

sudo systemctl restart gitea

A na-atụ aro ka ị gaa na UI webụ, banye na akaụntụ nchịkwa gị, ma zipụ ozi-e ule iji chọpụta na ihe niile na-arụ ọrụ nke ọma. Ụzọ ime nke a bụ nchịkwa> Nhazi> SMTP Mailer Configuration.


Advertisement


Tọọ Nginx dị ka ihe nnọchi anya SSL maka Gitea

A na-atụ aro nzọụkwụ na-esote ma ọ bụrụ na-ejere Gitea ozi n'èzí netwọk dị n'ime. Ihe ọ bụla nwere njikọ dị n'èzí na-abata kwesịrị ka edobere ya na SSL ma chekwaa mgbe gị na azụ azụ gị na-ekwurịta okwu.

Nke mbụ, mepụta faịlụ nhazi ọhụrụ maka saịtị Gitea gị ma ọ bụ gbanwee nke dị:

sudo nano /etc/nginx/sites-enabled/gitea.conf

Wee tinye ihe ndị a. Nke a bụ naanị ntuziaka. Enwere ike iji ọrụ dịka SSL mee ya Igwe ojii or Ka anyị zoo.

server {
   listen 80;
   server_name git.example.com;
   include snippets/letsencrypt.conf;
server {
   listen 80;
   server_name git.example.com;
   include snippets/letsencrypt.conf;
   return 301 https://git.example.com$request_uri;
 }
 server {
   listen 443 ssl http2;
   server_name git.example.com;
   proxy_read_timeout 720s;
   proxy_connect_timeout 720s;
   proxy_send_timeout 720s;
   client_max_body_size 50m;
 # Proxy headers
   proxy_set_header X-Forwarded-Host $host;
   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   proxy_set_header X-Forwarded-Proto $scheme;
   proxy_set_header X-Real-IP $remote_addr;

# SSL parameters
   ssl_certificate /etc/letsencrypt/live/git.example.com/fullchain.pem;
   ssl_certificate_key /etc/letsencrypt/live/git.example.com/privkey.pem;
   ssl_trusted_certificate /etc/letsencrypt/live/git.example.com/chain.pem;
   include snippets/letsencrypt.conf;
   include snippets/ssl.conf;

# log files
   access_log /var/log/nginx/git.example.com.access.log;
   error_log /var/log/nginx/git.example.com.error.log;

# Handle / requests
   location / {
   proxy_redirect off;
   proxy_pass http://127.0.0.1:3000;
  }
 }

Otu esi kwalite Gitea

Ka imelite nwụnye Gitea gị, ihe niile a ga-eme bụ budata faịlụ ọnụọgụ abụọ kachasị ọhụrụ nke Gitea, megharịa nzọụkwụ mbụ na mmalite nke ntuziaka ahụ. Otu esi eme nke a dị ka n'okpuru:

Kwụsị ọrụ Gitea:

sudo systemctl stop gitea

Budata ụdị Gitea kacha ọhụrụ wee bugharịa ya na "/ usr / mpaghara / biini” ndekọ:

VERSION=
 wget -O /tmp/gitea https://dl.gitea.io/gitea/${VERSION}/gitea-${VERSION}-linux-amd64
 sudo mv /tmp/gitea /usr/local/bin

Mee faịlụ ọnụọgụ abụọ Gitea dị ka mmalite nke ntuziaka ntuziaka a.

sudo chmod +x /usr/local/bin/gitea

Malitegharịa ọrụ Gitea:

sudo systemctl restart gitea

Advertisement


Okwu na mmechi

Ntuziaka ahụ egosila gị otu esi etinye Gitea na Ubuntu 20.04 LTS na ihe ndị bụ isi a chọrọ na ịtọlite. N'ozuzu, Gitea bụ ngwa ngwa siri ike nke ejiri obodo na-arụsi ọrụ ike mepụta nke ọma. Ụfọdụ atụmatụ agbakwunyere gụnyere:

  • Ọ dị mfe ijikwa ebe nchekwa.
  • Na-eji HTTP / HTTPS, Git na SSH protocol.
  • Na-emelite kwa oge.
  • njikwa okwu.
  • Usoro oge maka koodu.
  • Anya, dị mfe iji.
  • Na-akwalite mmekorita site na ijikọ arịrịọ ịdọrọ na alaka.

Ọ bụrụ na ị nwere ajụjụ, nweere onwe gị ịhapụ ikwu okwu n'okpuru.

Ahapụ a Comment