How to Install Gogs on Debian Latest
Gogs is a self-hosted Git service that allows you to create and manage your own Git repositories. In this tutorial, we will walk through the steps required to install Gogs on Debian latest.
Prerequisites
Before we begin, make sure you have the following:
- A server or VPS running Debian latest
- A non-root user with sudo privileges
Step 1: Update and Upgrade System Packages
First, update the system package list and upgrade any outdated packages by running the following commands:
sudo apt update
sudo apt upgrade
Step 2: Install Required Dependencies
Gogs requires several dependencies to be installed on the system. Install the required dependencies by running the following command:
sudo apt install git build-essential libpam-dev
Step 3: Download Gogs
Download the latest stable version of Gogs from the official website.
wget https://dl.gogs.io/gogs_latest_linux_amd64.tar.gz
Step 4: Extract Gogs
Extract the downloaded Gogs archive to your desired directory. In this example, we'll use /opt/gogs as the installation directory.
sudo tar -xvf gogs_latest_linux_amd64.tar.gz -C /opt/
Step 5: Create Gogs User
Next, create a new user for Gogs to run as on the system. This ensures that Gogs doesn't run as the root user, which can be a security risk.
sudo adduser --system --group --disabled-login gogs
Note: --disabled-login flag ensures that the newly created user cannot login to the system.
Step 6: Configure Gogs
Navigate to the Gogs installation directory and edit the custom/conf/app.ini file to configure Gogs for your needs.
cd /opt/gogs/
sudo nano custom/conf/app.ini
Replace the following parameters with your own values:
- HTTP_PORT - The port number Gogs listens on. Default: 3000.
- ROOT_URL - The URL for your Gogs install. Default: http://localhost:3000.
- RUN_USER - The user that Gogs will run as on the system. Default: gogs.
- APP_NAME - The name of your Gogs instance.
- LFS_START_SERVER - Whether or not to start Git Large File Storage.
Save your changes and exit the editor.
Step 7: Start Gogs
Start the Gogs service by running the following command:
sudo -u gogs ./gogs web
You can now access your Gogs installation by opening your web browser and navigating to the URL that you set in step 6.
Conclusion
Congratulations! You have successfully installed Gogs on Debian latest. Now you can create and manage your own Git repositories on your own server.