Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Lelux.fi
Wiki
Commits
667fa245
Verified
Commit
667fa245
authored
Jul 09, 2019
by
Elias Ojala
Browse files
Draft of Gitea installation guide
parent
b449f177
Changes
3
Hide whitespace changes
Inline
Side-by-side
gitea.md
View file @
667fa245
...
...
@@ -10,3 +10,227 @@ By default, Gitea doesn't include a `robots.txt` file.
My Gitea robots.txt is available
[
here
](
https://git.lelux.fi/theel0ja/gitea-robots.txt
)
.
{% include_relative modules/gitea-robots.txt/README.md %}
## Building
### Build-era dependencies
*
[
golang
](
https://packages.debian.org/buster/go-bindata
)
(
on
stretch, use
[
version in stretch-backports
](
https://packages.debian.org/stretch-backports/golang
)
, as gitea requires version 1.11 or higher)
*
[
make
](
https://packages.debian.org/buster/make
)
*
[
go-bindata
](
https://packages.debian.org/buster/go-bindata
)
Also, make sure to configure
[
GOPATH
](
https://github.com/golang/go/wiki/SettingGOPATH#unix-systems
)
for your user.
On Bash, run:
```
bash
echo
"export GOPATH=
$HOME
/go"
>>
~/.bash_profile
# load (source) ~/.bash_profile
source
~/.bash_profile
```
Download Gitea source code by running:
```
bash
go get
-d
-u
code.gitea.io/gitea
```
It should take at maximum few minutes.
Then, move to Gitea source code folder:
```
bash
cd
"
$GOPATH
/src/code.gitea.io/gitea"
```
List releases with
`git tag -l`
.
At the time of writing, the latest stable version is
`v1.8.3`
.
Choose it by running:
```
bash
git checkout v1.8.3
```
With
`git branch -a`
, you can see you switched to the release.
```
console
$
git branch
-a
* (HEAD detached at v1.8.3)
master
```
Start the build by running:
<!-- TODO: bindata is not recommended here: https://docs.gitea.io/en-us/install-from-source/ -->
```
bash
TAGS
=
"bindata"
make generate build
```
After build, you can try the binary by running:
```
bash
./gitea web
```
If it runs without errors, close it by Ctrl+C.
Copy the binary to
`/usr/local/bin/gitea`
by running:
```
bash
sudo cp
$GOPATH
/src/code.gitea.io/gitea/gitea /usr/local/bin/gitea
```
## Installation
### Dependencies
*
[
git
](
https://packages.debian.org/buster/git
)
*
[
nginx
](
https://packages.debian.org/buster/nginx
)
*
[
mariadb-server
](
https://packages.debian.org/buster/mariadb-server
)
(
optional
to be installed on the same server)
First, make sure Git is installed on your server. You can try this by running:
```
bash
git
--version
```
Then, create user for Gitea:
```
bash
sudo
adduser
\
--system
\
--shell
/bin/bash
\
--gecos
'Git Version Control'
\
--group
\
--disabled-password
\
--home
/home/git
\
git
```
After creating user account successfully, create folders:
```
bash
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
```
### `systemd` service
First, download template by running:
```
bash
curl
-L
https://raw.githubusercontent.com/go-gitea/gitea/master/contrib/systemd/gitea.service |
sudo tee
/etc/systemd/system/gitea.service
>
/dev/null
```
If your MySQL server runs on the same server, edit the file by running
`sudo -e /etc/systemd/system/gitea.service`
.
Uncomment the following line:
```
Requires=mysql.service
```
Then, start the service by running:
```
bash
sudo
systemctl daemon-reload
sudo
systemctl
enable
--now
gitea
```
To see if Gitea runs successfully, run:
```
curl -I 127.0.0.1:3000
```
It should return
`HTTP/1.1 200 OK`
.
### Nginx configuration
Filename
`/etc/nginx/sites-available/gitea`
:
```
nginx
upstream
gitea
{
server
127.0.0.1
:
3000
;
}
server
{
# see https://wiki.lelux.fi/certbot and https://wiki.lelux.fi/nginx for listen, SSL configuration, etc.
# ...
# ...
server_name
gitea.example.com
;
location
/
{
proxy_set_header
X-Real-IP
$remote_addr
;
proxy_set_header
X-Forwarded-For
$remote_addr
;
proxy_set_header
Host
$host
;
proxy_pass
http://gitea
;
}
location
=
/robots.txt
{
root
/var/www/gitea-robots.txt
;
}
}
```
To get
`robots.txt`
to work, do steps listed
[
here
](
#robotstxt
)
.
For more Nginx configuration, see
[
certbot
](
certbot.md
)
and
[
nginx
](
nginx.md
)
.
Apply:
```
sudo rm /etc/nginx/sites-enabled/default
sudo ln -s /etc/nginx/sites-available/git.lelux.fi /etc/nginx/sites-enabled/
sudo systemctl restart nginx
```
After that, open
`https://gitea.example.com/install`
in your browser.
Tutorial is going to be continued with MySQL configuration, email server setup, etc.
<!--
### Set permissions after running the Web installer
```
bash
chmod
750 /etc/gitea
chmod
644 /etc/gitea/app.ini
```
-->
## Update script
Tip: Subscribe to Gitea repository update notifications on
[
UpdateWatch
](
https://updatewatch.lelux.fi/
)
.
Make sure your
`$GOPATH`
is
[
correctly set
](
https://github.com/golang/go/wiki/SettingGOPATH#unix-systems
)
.
```
bash
cd
$GOPATH
/src/code.gitea.io/gitea
git pull
echo
"Select version"
echo
"git checkout vX.X.X && exit"
echo
""
echo
""
git tag
-l
bash
# bindata is not recommended here: https://docs.gitea.io/en-us/install-from-source/
TAGS
=
"bindata"
make generate build
sudo
systemctl stop gitea
sudo cp
$GOPATH
/src/code.gitea.io/gitea/gitea /usr/local/bin/gitea
sudo
systemctl daemon-reload
sudo
systemctl start gitea
```
\ No newline at end of file
gitea-robots.txt
@
2c881fa8
Subproject commit
37d3238224c72630a3a20c9600a5e5e1dc78714b
Subproject commit
2c881fa8028cd02a4b975435680399341857010d
nginx.md
View file @
667fa245
...
...
@@ -5,6 +5,8 @@ permalink: /nginx
Most of the configuration can be found from
[
Certbot
](
certbot.md
)
page.
If you use Haproxy, see
[
Nginx backends on Haproxy
](
https://wiki.lelux.fi/haproxy/#nginx-backends
)
.
## Useragent Blocklist
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment