How To Install Gitea On Ubuntu 18.04?

Embracing Gitea on Ubuntu 18.04

Venturing into the realms of version control systems opens doors to innovative tools like Gitea, a robust, self-hosted Git service. This guide unveils the steps to install Gitea effortlessly on an Ubuntu 18.04 environment. Dive into this seamless installation journey and empower your development workflow with Gitea’s versatility and user-friendly interface.

How To Install Gitea On Ubuntu 18.04?

Preparing the Ubuntu Environment

Before delving into the installation process, ensure your Ubuntu 18.04 system is primed for Gitea. Start by updating the package list using the terminal:

sudo apt update

Then, install essential tools like Git and MySQL, utilizing the following commands:

sudo apt install git mysql-server

Next, create a database for Gitea within MySQL:

sudo mysql -u root -p

Enter your MySQL root password and execute the following MySQL commands:

CREATE DATABASE gitea;
CREATE USER 'gitea'@'localhost' IDENTIFIED BY 'your_password_here';
GRANT ALL PRIVILEGES ON gitea.* TO 'gitea'@'localhost';
FLUSH PRIVILEGES;

This establishes a solid foundation, readying your system for the smooth installation of Gitea.

Downloading and Configuring Gitea

Navigate to the Gitea website to acquire the latest version link. Using wget, fetch the Gitea binary onto your system:

wget -O gitea https://dl.gitea.io/gitea/{{latest_version}}/gitea-{{latest_version}}-linux-amd64

Replace {{latest_version}} with the actual latest version available at the time of installation.

Proceed by allowing execution permissions to the downloaded binary:

chmod +x gitea

Create a dedicated system user to run Gitea securely:

sudo adduser --system --group --disabled-password --shell /bin/bash --home /home/git git

Configure Gitea by generating an app.ini file:

sudo mkdir -p /var/lib/gitea/{custom,data,indexers,public,log}
sudo chown git:git /var/lib/gitea/{data,indexers,log}
sudo chmod 750 /var/lib/gitea/{data,indexers,log}
sudo cp gitea /usr/local/bin/gitea
sudo chown root:git /usr/local/bin/gitea
sudo chmod 750 /usr/local/bin/gitea
sudo nano /etc/systemd/system/gitea.service

Within the gitea.service file, input the following configuration:

[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
Requires=mysql.service

[Service]
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/gitea/
ExecStart=/usr/local/bin/gitea web
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea

[Install]
WantedBy=multi-user.target

After saving the changes, enable and start the Gitea service:

sudo systemctl enable gitea
sudo systemctl start gitea

With these steps, Gitea becomes configured and ready for utilization, seamlessly integrating into your Ubuntu environment.

Accessing Gitea via Web Interface

To access Gitea’s web interface, navigate to your browser and enter your server’s IP address or domain name followed by the port 3000. For instance, http://your_server_ip:3000. The initial setup page should now appear, prompting you to configure your Gitea instance by setting up an administrator account, database connection details, and other relevant configurations.

Follow the on-screen instructions to complete the setup process, customizing Gitea to suit your requirements. Upon successful completion, you’ll gain access to Gitea’s user-friendly interface, ready to enhance your version control endeavors.

Conclusion

Understanding the intricate installation process of Gitea on Ubuntu 18.04 equips you with the prowess to streamline your version control operations. These meticulous steps pave the way for a seamless integration, ushering in a new era of collaborative and efficient development workflows.

How To Install Gitea On Ubuntu 18.04?

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top