Go Gitea is written from the open-source git hosting server. This is Gogs bifurcation. Gitea including repository file editor, project issue tracking, user management, notification, built-in Wiki and so on.
Gitea is a lightweight application that can be installed on low-power systems. If you are looking for a much less memory footprint Gitlab alternative products, and do not need all the features Gitlab offer, then you should definitely try Gitea.
Requirements
Gitea support for SQLite, PostgreSQL and MySQL / MariaDB as the database backend.
We will use SQLite as Gitea database. If SQLite is not installed on your Ubuntu system, you can install it by entering the following command sudo user:
Installation Gitea
Providing Gitea Docker image, from the source code, binary files, or as package software installation.
We will have installed binaries Gitea. Complete the following steps Gitea mounted on Ubuntu.
Install Git
The first step is to install Git on your server:
To verify the installation by displaying the Git version:
git version 2.17.1
Create a Git user
Create a new system user, you will run Gitea application by typing the following:
This command creates a new user and group named git, and set the working directory / home / git. Output is as follows:
Download Gitea binary files
Access Gitea download page and download the latest binary file for your architecture. At this writing, the latest version 1.10.2. If a new version is available, change the VERSION variable in the following command.
Use the following wget command to download Gitea binary file in the / tmp directory:
gitea binaries can be run at any position. We will follow the convention and the binary file to / usr / local / bin directory:
Given binary executable permissions:
Run the following command to create the directory and set the permissions and ownership required:
/ Etc permissions / gitea directory is set to 770, so that the Setup Wizard can create a profile. After installation is complete, we will set more restrictive permissions.
Bit files created Systemd Unit
Gitea provided has been configured to match the settings of our Systemd Unit files.
Download the file by typing the following command to the / etc / systemd / system / directory:
When finished, enable and start Gitea services:
Configuration Gitea
Now download and run the Gitea, it is time to complete the installation through the Web interface.
By default, Gitea listens for connections on port 3000 on all network interfaces.
If the UFW firewall running on your server, you need to open ports Gitea:
To allow traffic on port 3000, enter the following command:
Database settings:
- Database Type: SQLite3
- Path: use absolute paths /var/lib/gitea/data/gitea.db
Application general settings:
- Site Name: You can enter the name of your company here.
- Repository root: retention default / home / git / gitea-repositories.
- Git LFS root path: keep the default / var / lib / gitea / data / lfs.
- User name to run: git
- SSH server field: Enter your domain or server IP address.
- SSH Port: 22, if SSH is listening on a different port, change it
- Gitea HTTP listener port: 3000
- Gitea basic URL: http and use your domain or server IP address.
- Log path: keep the default / var / lib / gitea / log
You can change the settings at any time by editing the configuration file Gitea.
When finished, click "Install Gitea" button. Installation is immediate. When finished, you will be redirected to the login page.
Click on "Register Now" link. The first registered user will be automatically added to the Admin group.
Change the permissions Gitea configuration file is read-only, use the following command:
that's it. Gitea already installed on your Ubuntu computer.
The Nginx configure SSL / TLS Agent (termination proxy)
First, install Nginx and generate free "encryption SSL" certificate with the following guidelines:
After completion, and open a text editor to edit the domain block file server:
sudo nano /etc/nginx/sites-enabled/git.example.com
server {
listen 80;
server_name git.linuxidc.com;
include snippets/letsencrypt.conf;
return 301 https://git.linuxidc.com$request_uri;
}
server {
listen 443 ssl http2;
server_name git.linuxidc.com;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
client_max_body_size 50m;
# Proxy headers
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
# SSL parameters
ssl_certificate /etc/letsencrypt/live/git.linuxidc.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/git.linuxidc.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/git.linuxidc.com/chain.pem;
include snippets/letsencrypt.conf;
include snippets/ssl.conf;
# log files
access_log /var/log/nginx/git.linuxidc.com.access.log;
error_log /var/log/nginx/git.linuxidc.com.error.log;
# Handle / requests
location / {
proxy_redirect off;
proxy_pass http://127.0.0.1:3000;
}
}
Restart Nginx service for the change to take effect:
$sudo systemctl restart nginx
Next, change the Gitea domain and root URL. To do this, open the configuration file and edit the following lines:
$ Sudo nano /etc/gitea/app.ini
Gitea restart the service by typing the following command:
sudo systemctl restart gitea
Configuring Email Notifications
To make Gitea be able to send a notification e-mail, you can install Postfix or use of certain transactional mail services, such as SendGrid, MailChimp, MailGun or SES.
To enable email notifications, open the configuration file and edit the following lines:
$ Sudo nano /etc/gitea/app.ini
[mailer]
ENABLED = true
HOST = SMTP_SERVER:SMTP_PORT
FROM = SENDER_EMAIL
USER = SMTP_USER
PASSWD = YOUR_SMTP_PASSWORD
Make sure that you entered the correct SMTP server information.
Restart Gitea service for the change to take effect:
sudo systemctl restart gitea
To verify the settings and send a test email, please sign in Gitea, then go to: Site Administration> Configuration> SMTP mailer configuration.
Gitea also allows you to send to your channel is connected to the Slack Slack and notification by creating a Web Webhook.
Upgrade Gitea
To upgrade to the latest version of Gitea, just download and replace binary files.
01, stop Gitea services:
sudo systemctl stop gitea
02, download the latest version of Gitea and move / home / git directory:
VERSION=<THE_LATEST_GITEA_VERSION>
wget -O /tmp/gitea https://dl.gitea.io/gitea/${VERSION}/gitea-${VERSION}-linux-amd64
sudo mv /tmp/gitea /usr/local/bin
03, giving the binary executable permissions:
sudo chmod +x /usr/local/bin/gitea
04, start Gitea services:
sudo systemctl restart gitea
that's it.
to sum up
This tutorial will guide you through the installation on Ubuntu 18.04 Gitea process. Now, you should visit Gitea document page, and learn how to configure Gitea instance and create your first project.
If you have questions, please comment below.