π GiteaΒΆ
βοΈ Cloudflare SetupΒΆ
-
β Verify Cloudflare DNS
Ensure your domain is pointed to Cloudflare's DNS.
-
π Access Cloudflare Zero Trust
Go to Cloudflare Zero Trust. -
π Navigate to Network > Tunnels.
-
π οΈ Create a Tunnel
Select the Debian 64-bit architecture. -
π» Install Cloudflared on Ubuntu 24.04
Copy the Cloudflared connector and install it on your server. -
π·οΈ Configure the Public Hostname
π₯οΈ Step 1: Update Your SystemΒΆ
Start by updating your system packages:
ποΈ Step 2: Install and Configure MariaDBΒΆ
π¦ Install MariaDBΒΆ
Run the following commands to install MariaDB:
Follow the prompts:
- Current root password: Press
Enter
- Switch to unix_socket authentication:
n
- Change root password: Press
Enter
or typeY
and set a new password. - Remove anonymous users: Press
Enter
or typeY
- Disallow root login remotely: Press
Enter
or typeY
- Remove test database: Press
Enter
or typeY
- Reload privilege tables: Press
Enter
or typeY
ποΈ Create the Gitea DatabaseΒΆ
Open the MariaDB prompt:
Create the Gitea database and user:
CREATE DATABASE gitea;
GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'localhost' IDENTIFIED BY 'Strong-Password';
FLUSH PRIVILEGES;
EXIT;
π Step 3: Install GiteaΒΆ
π€ Create a User for GiteaΒΆ
Create a system user named git
:
π₯ Download and Move GiteaΒΆ
Download Gitea and move it to the /usr/bin
directory:
wget https://dl.gitea.com/gitea/1.22.3/gitea-1.22.3-linux-amd64
sudo mv gitea-1.22.3-linux-amd64 /usr/bin/gitea
π Set PermissionsΒΆ
Adjust the permissions for the Gitea binary:
π Create Required DirectoriesΒΆ
Set up the necessary directories for Gitea:
sudo mkdir -p /etc/gitea /var/lib/gitea/{custom,data,indexers,public,log}
sudo chown git:git /etc/gitea /var/lib/gitea/{custom,data,indexers,public,log}
sudo chmod 750 /var/lib/gitea/{data,indexers,log}
sudo chmod 770 /etc/gitea
βοΈ Create the Gitea Service FileΒΆ
Create a new service file for Gitea:
Add the following content:
[Unit]
Description=Gitea
After=syslog.target
After=network.target
[Service]
RestartSec=3s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/gitea/
ExecStart=/usr/bin/gitea web --config /etc/gitea/app.ini
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
[Install]
WantedBy=multi-user.target
Save and exit the file (Ctrl + O, Enter, Ctrl + X).
π Start the Gitea ServiceΒΆ
Reload the systemd daemon and start the Gitea service:
Enable Gitea to start on boot:
π Step 4: Access Gitea Web InterfaceΒΆ
Open your web browser and go to http://<IP-address-of-your-server>:3000
. You will see Gitea's initial configuration screen.
To use Gitea with a domain, set up a reverse proxy using your preferred web server (Nginx, Apache, etc.). This will allow access to Gitea without specifying a port.
During the initial setup, use the database credentials created earlier and configure the general settings. Click βInstall Giteaβ to complete the setup, and you will be redirected to the Gitea homepage where you can log in.
π Step 5: Modify the INI FileΒΆ
If you use Cloudflare to create a (sub)domain for your Gitea instance, itβs essential to modify the INI file to restrict user sign-ups.
Locate the file at /etc/gitea/app.ini
and make the necessary adjustments.
Restart the Gitea service: