add first draft of Gitea server setup
commit
9fa6de0f44
@ -0,0 +1,196 @@
|
|||||||
|
# Create Gitea Server
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo apt-get install git sqlite -y
|
||||||
|
|
||||||
|
--create git user without login
|
||||||
|
|
||||||
|
sudo adduser --disabled-login --gecos 'Gitea' git
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
$ wget -O gitea https://dl.gitea.io/gitea/1.10.2/gitea-1.10.2-linux-amd64
|
||||||
|
|
||||||
|
|
||||||
|
$ wget -O gitea https://dl.gitea.io/gitea/1.10.2/gitea-1.10.2-linux-arm-7
|
||||||
|
|
||||||
|
$ wget -O gitea https://dl.gitea.io/gitea/1.10.2/gitea-1.10.2-linux-arm-6
|
||||||
|
$ chmod +x gitea
|
||||||
|
```
|
||||||
|
|
||||||
|
Add git user
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo useradd -m git
|
||||||
|
```
|
||||||
|
|
||||||
|
copy gitea to new user folder
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo cp gitea /home/git
|
||||||
|
```
|
||||||
|
|
||||||
|
Run gitea command as git user. default port is 3000
|
||||||
|
|
||||||
|
!!!! switch/login to git user
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo su - git
|
||||||
|
$./gitea web
|
||||||
|
```
|
||||||
|
!!!!
|
||||||
|
|
||||||
|
********** cleanup
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo userdel git
|
||||||
|
$ sudo rm -rf /home/git
|
||||||
|
```
|
||||||
|
************
|
||||||
|
|
||||||
|
open browser to `http://192.168.0.113:3000/install`
|
||||||
|
|
||||||
|
install gitea configuration
|
||||||
|
|
||||||
|
|
||||||
|
## Run Caddy service
|
||||||
|
|
||||||
|
for x86
|
||||||
|
|
||||||
|
```
|
||||||
|
$ wget https://github.com/caddyserver/caddy/releases/download/v1.0.4/caddy_v1.0.4_linux_amd64.tar.gz -O caddy.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
for arm cpu
|
||||||
|
|
||||||
|
```
|
||||||
|
& wget https://github.com/caddyserver/caddy/releases/download/v1.0.4/caddy_v1.0.4_linux_arm7.tar.gz -O caddy.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
$ mkdir caddy && tar -zxvf caddy.tar.gz -C caddy
|
||||||
|
|
||||||
|
$ cd caddy
|
||||||
|
$ mv caddy_linux_arm7 caddy
|
||||||
|
```
|
||||||
|
|
||||||
|
Create caddy config file named as Caddyfile and add the following content
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo nano Caddyfile
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
homenetyth.dlinkddns.com {
|
||||||
|
proxy / 127.0.0.1:3000
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo setcap CAP_NET_BIND_SERVICE=+eip ./caddy
|
||||||
|
```
|
||||||
|
|
||||||
|
install/update acme client
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo apt-get install certbot
|
||||||
|
```
|
||||||
|
|
||||||
|
to check acme version
|
||||||
|
|
||||||
|
install the script
|
||||||
|
|
||||||
|
```
|
||||||
|
$ curl https://get.acme.sh | sh
|
||||||
|
```
|
||||||
|
|
||||||
|
get version
|
||||||
|
|
||||||
|
```
|
||||||
|
$ acme.sh -v
|
||||||
|
```
|
||||||
|
|
||||||
|
!!!! run service
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo ./caddy -conf Caddyfile
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
caddy login https://caddyserver.com/
|
||||||
|
smarttvminix@gmail.com
|
||||||
|
pass : yikth@7572137
|
||||||
|
```
|
||||||
|
|
||||||
|
Update Gitea config file `custom/conf/app.ini`
|
||||||
|
|
||||||
|
```text
|
||||||
|
[server]
|
||||||
|
SSH_DOMAIN = example.com
|
||||||
|
HTTP_PORT = 3000
|
||||||
|
ROOT_URL = https://example.com
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
$ restart gitea service
|
||||||
|
|
||||||
|
$ ./gitea web
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
tmux
|
||||||
|
```
|
||||||
|
|
||||||
|
install go compiler
|
||||||
|
|
||||||
|
```
|
||||||
|
$ wget https://dl.google.com/go/go1.13.7.linux-armv6l.tar.gz -O golang.tar.gz
|
||||||
|
|
||||||
|
$ sudo tar -C /usr/local -xzf golang.tar.gz
|
||||||
|
|
||||||
|
$ sudo nano $HOME/.profile
|
||||||
|
```
|
||||||
|
|
||||||
|
add text
|
||||||
|
|
||||||
|
```text
|
||||||
|
export PATH=$PATH:/usr/local/go/bin
|
||||||
|
```
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
reboot
|
||||||
|
|
||||||
|
run go build
|
||||||
|
|
||||||
|
```
|
||||||
|
$ go get github.com/caddyserver/caddy/caddy
|
||||||
|
```
|
||||||
|
|
||||||
|
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
Disable root login and password based login (Optional)
|
||||||
|
|
||||||
|
For improved security, you may want to disable shell pasword based login if the server is accessible externally
|
||||||
|
|
||||||
|
Edit the `/etc/ssh/sshd_config` file, enter:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo nano /etc/ssh/sshd_config
|
||||||
|
```
|
||||||
|
|
||||||
|
Set all this settings to no:
|
||||||
|
|
||||||
|
```text
|
||||||
|
ChallengeResponseAuthentication no
|
||||||
|
PasswordAuthentication no
|
||||||
|
UsePAM no
|
||||||
|
PermitRootLogin no
|
||||||
|
```
|
||||||
|
|
||||||
|
Save and close the file. Reload the ssh server:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo systemctl reload ssh
|
||||||
|
```
|
||||||
|
|
||||||
|
Create user in Gitea to access Gitea
|
||||||
Loading…
Reference in New Issue