Step-by-Step Guide to Installing Gitea from Binary on Ubuntu 24.04 VPS Without Docker
Introduction
At ByteHosting, we understand the importance of having a reliable, lightweight, and self-hosted Git service for your development workflows. Gitea is an excellent choice for this purpose—it's open-source, easy to set up, and highly customizable. In this guide, we will walk you through the step-by-step process of installing Gitea from its binary on an Ubuntu 24.04 VPS without using Docker. This native installation approach gives you better control and performance, making it ideal for those who prefer manual setup and management.
Prerequisites: Ubuntu 24.04 VPS setup and required packages
Before we begin, ensure you have an Ubuntu 24.04 VPS ready. If you haven't already, you can deploy one of our cost-effective KVM VPS plans in Frankfurt am Main, which provides excellent performance and reliability. Once your server is up and running, connect via SSH:
ssh username@your-server-ipNext, update your package list and install the necessary dependencies:
sudo apt update && sudo apt upgrade -y
sudo apt install -y git wget unzip nginx ufwThese packages include Git for version control, wget for downloading files, unzip for extracting archives, Nginx as a reverse proxy, and UFW for firewall management.
Download Gitea binary from the official source
Visit the official Gitea downloads page to find the latest binary release compatible with your system. As of Ubuntu 24.04, you'll want the Linux AMD64 binary. Download it directly to your server:
wget -O gitea https://dl.gitea.io/gitea/latest/gitea--linux-amd64Replace <version> with the latest version number, for example, 1.20.4. Make the binary executable:
chmod +x giteaMove it to a directory in your PATH, such as /usr/local/bin:
sudo mv gitea /usr/local/bin/Configure Gitea user and directories
For security and organization, create a dedicated user for Gitea:
sudo adduser --system --group --shell /bin/bash --gecos 'Gitea' giteaCreate necessary directories for Gitea data and repositories:
sudo mkdir -p /var/lib/gitea/{custom,data,log} /etc/giteaSet ownership to the Gitea user:
sudo chown -R gitea:gitea /var/lib/gitea /etc/giteaSet up systemd service for Gitea
To run Gitea as a service, create a systemd unit file:
sudo nano /etc/systemd/system/gitea.serviceInsert the following configuration:
[Unit]
Description=Gitea
After=network.target
[Service]
User=gitea
Group=gitea
Type=simple
ExecStart=/usr/local/bin/gitea web -c /etc/gitea/app.ini
Restart=always
Environment=USER=gitea HOME=/home/gitea
[Install]
WantedBy=multi-user.targetSave and close the file. Reload systemd and enable Gitea:
sudo systemctl daemon-reload
sudo systemctl enable gitea
sudo systemctl start giteaYou can check the status with:
sudo systemctl status giteaConfigure reverse proxy with Nginx and SSL
Secure your Gitea instance with SSL by configuring Nginx as a reverse proxy. First, create a new server block:
sudo nano /etc/nginx/sites-available/giteaInsert the following configuration, replacing <your-domain> with your actual domain:
server {
listen 80;
server_name <your-domain>
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name <your-domain>
ssl_certificate /path/to/fullchain.pem;
ssl_certificate_key /path/to/privkey.pem;
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Enable the site and restart Nginx:
sudo ln -s /etc/nginx/sites-available/gitea /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginxUse Let's Encrypt or your preferred SSL provider to obtain certificates for your domain.
Start Gitea service and initial setup
Ensure Gitea is running:
sudo systemctl start giteaOpen your browser and navigate to https://your-domain. You should see the Gitea web interface. Follow the on-screen instructions to complete the initial setup, including database configuration and admin account creation.
Verify Gitea installation and troubleshoot common issues
To verify that Gitea is running correctly, check the service status:
sudo systemctl status giteaIf you encounter issues, review the logs located in /var/lib/gitea/log. Common problems include permission issues, incorrect configuration paths, or firewall restrictions. Ensure your firewall allows traffic on ports 80 and 443, and that your domain points correctly to your server's IP.
Conclusion
Installing Gitea from binary on Ubuntu 24.04 VPS without Docker provides a lightweight, flexible, and high-performance Git hosting solution. By following our step-by-step guide, you can set up a secure, self-hosted Gitea instance tailored to your needs. At ByteHosting, we are committed to providing reliable VPS hosting that supports your development and collaboration tools. Whether you're managing small projects or large repositories, our servers in Frankfurt am Main are ready to host your Gitea instance with ease and confidence.