# Update GITEA on debian server: correct process

**URL:** <https://forum.gitea.com/t/update-gitea-on-debian-server-correct-process/8545>\
**Category:** Install/Maintain/Configure\
**Created:** [February 6, 2024, 1:03pm UTC](https://forum.gitea.com/t/update-gitea-on-debian-server-correct-process/8545 "2024-02-06T13:03:12Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![furby\_goulag](https://avatars.discourse-cdn.com/v4/letter/f/e480ec/32.png) [@furby\_goulag](https://forum.gitea.com/u/furby_goulag)\
**Post date:** [February 6, 2024, 1:03pm UTC](https://forum.gitea.com/t/update-gitea-on-debian-server-correct-process/8545/1 "2024-02-06T13:03:12Z")

</div>

Hello fellow GITEA users,

Thanks in advance for your help.  
I am not an expert at all on the subject so forgive me if the information provided is not clear enough or if the subject is not in the right category.

I installed GITEA from the repositories (not from a docker container) on a fresh debian 12 server.  
I manage to make it run correctly and adress it to my domain. It is up and running smoothly for a couple of weeks, and I tested my repositories and process without any issues.

I am now trying to keep my GITEA server up to date.  
I manage to install the debian packages for automatic security updates, and now I am trying to update GITEA (no need for auto update but I want to have a clean and clear process).

As I understand based on my readings of the documentation the main steps of the process could be:

- stop gitea instance
- backup the database (gitea dump)
- update the binary file found in usr/local/bin
- restart gitea instance

A detailed list of acitons for the average user would be:

- log on to the machine
- open a terminal
- change to the user running gitea instances (git in most cases)
- gitea shutdown
- gitea dump
- download the new binary file and replace it in usr/loca/bin
- gitea restart

When I am trying to do this I am never able to stop my gitea process :

 ![image](https://us1.discourse-cdn.com/flex020/uploads/gitea/original/2X/f/f0c0c50af598d451759d7e582a386cd241f9eeb4.png)

I am a little bit confused that then I type “gitea shutdown” the first thing I see is “Starting Gitea…” as of course it is already up and running.

I probably miss some basic understanding but I do not know excatly what.

Thanks for your time if you manage to read up to this point.

Have a great day,

---

<div class="post-metadata">

**Author:** ![linkp](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/linkp/32/4833_2.png) [@linkp](https://forum.gitea.com/u/linkp)\
**Post date:** [February 6, 2024, 5:40pm UTC](https://forum.gitea.com/t/update-gitea-on-debian-server-correct-process/8545/2 "2024-02-06T17:40:14Z")

</div>

> [@furby\_goulag](#):
>
> I installed GITEA from the repositories

> [@furby\_goulag](#):
>
> keep my GITEA server up to date

When you installed from a Debian apt repository, you would keep it up to date with: `sudo apt update && sudo apt upgrade`

The method you referenced is for those who have done their own binary installation outside of host OS package management.

Despite being an `apt` fan, I went with a self-managed binary installation to better keep up with the pace of Gitea development. If you want more frequent updates than what Debian will provide, you may wish to do the same.

---

<div class="post-metadata">

**Author:** ![furby\_goulag](https://avatars.discourse-cdn.com/v4/letter/f/e480ec/32.png) [@furby\_goulag](https://forum.gitea.com/u/furby_goulag)\
**Post date:** [February 6, 2024, 8:21pm UTC](https://forum.gitea.com/t/update-gitea-on-debian-server-correct-process/8545/3 "2024-02-06T20:21:29Z")

</div>

Thanks for your answer. My wording is obviously wrong.

I installed from gitea repository on github: [Releases · go-gitea/gitea · GitHub](https://github.com/go-gitea/gitea/releases)

I installed from apt git maria-db nginx but not gitea.  
So I am probably like yourself in “self-managed binary installation” and I also want to be able to follow correctly the versions to avoid security issues.

---

<div class="post-metadata">

**Author:** ![linkp](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/linkp/32/4833_2.png) [@linkp](https://forum.gitea.com/u/linkp)\
**Post date:** [February 6, 2024, 8:54pm UTC](https://forum.gitea.com/t/update-gitea-on-debian-server-correct-process/8545/4 "2024-02-06T20:54:26Z")

</div>

You don’t appear to have built a systemd unit. You probably want to do that.

> **[Run as service in Linux | Gitea Documentation](https://docs.gitea.com/installation/linux-service)**
>
> Run Gitea as Linux service

You don’t need to grunge the Gitea user. You can simply use `sudo` in front of your commands.

My process is as follows:

1. SSH to server
2. Update download URLs usng `vim`
3. Download binary and checksum files using `wget -i url.txt`
4. Disable Gitea vhost using `a2dissite gitea.example.com.conf`
5. Test Apache config using `apache2ctl -t`
6. Reload Apache using `systemctl reload apache2.service`
7. Confirm reload using `systemctl status apache2.service`
8. Stop Gitea usng `systemctl stop gitea.service`
9. Backup database using `mysqldump`
10. Install new binary using `sudo rsync`
11. Change ownership and permissions using `chown` and `chmod`
12. Start Gitea usng `systemctl start gitea.service`
13. Enable Gitea vhost using `a2ensite gitea.example.com.conf`
14. Test Apache config using `apache2ctl -t`
15. Reload Apache using `systemctl reload apache2.service`
16. Login to Gitea to make sure everything still works

---

<div class="post-metadata">

**Author:** ![furby\_goulag](https://avatars.discourse-cdn.com/v4/letter/f/e480ec/32.png) [@furby\_goulag](https://forum.gitea.com/u/furby_goulag)\
**Post date:** [February 6, 2024, 10:17pm UTC](https://forum.gitea.com/t/update-gitea-on-debian-server-correct-process/8545/5 "2024-02-06T22:17:20Z")

</div>

Thank you.

Thanks to my installation documentation, I found back that I had already created a gitea.service file.

So now when I run your step 8. stop gitea.service it effecively stops my gitea instance.  
Thats a first step for me!

As I am on nginx I am not sure that is the same commands as yours to use.

Instead of step 9. I was trying to use gitea dump but with no success.

In terminal I switched to git user : su git  
Then I entered: ./gitea dump -c /etc/gitea/app.ini but it told me  
“bash: ./gitea: Permission denied”

Sorry for still not being trivial to me.

---

<div class="post-metadata">

**Author:** ![linkp](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/linkp/32/4833_2.png) [@linkp](https://forum.gitea.com/u/linkp)\
**Post date:** [February 7, 2024, 4:13pm UTC](https://forum.gitea.com/t/update-gitea-on-debian-server-correct-process/8545/6 "2024-02-07T16:13:01Z")

</div>

> [@furby\_goulag](#):
>
> In terminal I switched to git user : su git

Try not doing that. Try using `sudo` instead.

e.g. `sudo ./gitea dump`

I don’t know that you need to specify the config file when you are using the default file.

> [@furby\_goulag](#):
>
> I am on nginx

Virtual hosts are managed similarly on nginx as in Apache. Assuming that you have defined your vhosts one per config file, you will only need to remove the corresponding symlink from the `sites-enabled` folder and reload nginx. Replace the symlink and reload to re-enable the site.

---

<div class="post-metadata">

**Author:** ![furby\_goulag](https://avatars.discourse-cdn.com/v4/letter/f/e480ec/32.png) [@furby\_goulag](https://forum.gitea.com/u/furby_goulag)\
**Post date:** [February 8, 2024, 7:34am UTC](https://forum.gitea.com/t/update-gitea-on-debian-server-correct-process/8545/7 "2024-02-08T07:34:27Z")

</div>

Thanks again.

I tried “sudo ./gitea dump”  
I got “./gitea command not found”

Strange

---

<div class="post-metadata">

**Author:** ![linkp](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/linkp/32/4833_2.png) [@linkp](https://forum.gitea.com/u/linkp)\
**Post date:** [February 8, 2024, 8:08am UTC](https://forum.gitea.com/t/update-gitea-on-debian-server-correct-process/8545/8 "2024-02-08T08:08:58Z")

</div>

You specified a relative path to `gitea`. Were you in a directory where that would have been a valid path to your `gitea` binary?

---

<div class="post-metadata">

**Author:** ![eeyrjmr](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/eeyrjmr/32/1095_2.png) [@eeyrjmr](https://forum.gitea.com/u/eeyrjmr)\
**Post date:** [February 25, 2024, 5:56pm UTC](https://forum.gitea.com/t/update-gitea-on-debian-server-correct-process/8545/9 "2024-02-25T17:56:11Z")

</div>

please note that gitea will not execute as root (security protection) and thus you shouldn’t use **sudo /path/to/gitea dump** as this will attempt to execute as root and thus will fail

sudo -u git  
or  
sudo -u gitea

depending on the user the gitea executes as (git for gentoo, gitea for alpine)
