How to Upgrade Gitea
By WretchedGhost
- One minute read - 167 wordsUpdating gitea is a simple as replacing the binary in /usr/local/bin/gitea.
- Stop the gitea service
$ sudo systemctl stop gitea
- Move the current binary from gitea to gitea.old just in case things break.
$ sudo mv /usr/local/bin/gitea /usr/local/bin/gitea.old
- Use wget to get the the current version: example -> https://github.com/go-gitea/gitea/releases/download/v1.20.2/gitea-1.20.2-linux-amd64. This is not the latest version, this is just an example.
cd ~/Downloads && wget https://github.com/go-gitea/gitea/releases/download/v1.20.2/gitea-1.20.2-linux-amd64
- Change the name of the file from gitean-x.x.x-linux-amd to gitea
$ mv gitea-x.x.x-linux-amd gitea
- Make a backup of /var/lib/gitea/ as well as the gitea database. Change to your username.
$ mkdir ~/temp && cd ~/temp && tar czvf gitea-old.tgz /var/lib/gitea
$ mysqldump –user=wretchedghost –password –lock-tables –databases gitea > gitea-20231208.sql
- Copy the new gitea binary to /usr/local/bin/
$ sudo cp ~/Downloads/gitea /usr/local/bin/
- Change owner and mode of the gitea binary
$ sudo chown root:root /usr/local/bin/gitea
$ sudo chmod 755 /usr/local/bin/gitea
- Start gitea
$ sudo systemctl start gitea
- Make sure things work then you may safely delete the /usr/local/bin/gitea.old
$ sudo rm -rf /usr/local/bin/gitea.old