Home
nostr:pubkey:de7ecd1e2976a6adb2ffa5f4db81a7d812c8bb6698aa00dcf1e76adb55efd645 editou esta página há 2 anos atrás

To install Gogs on Ubuntu, follow these steps:

  1. Update the system and install necessary dependencies:

    sudo apt update
    sudo apt upgrade
    sudo apt install git
    
  2. Install and configure the database server. You can use SQLite, MySQL, or PostgreSQL. For this example, let's use SQLite:

    sudo apt install sqlite3
    
  3. Create a user and a directory for Gogs:

    sudo adduser --system --group --disabled-password --shell /bin/bash --home /home/gogs --gecos 'Git Version Control' gogs
    sudo mkdir -p /home/gogs/{custom,data,gogs,log}
    sudo chown -R gogs:gogs /home/gogs
    
  4. Download the latest Gogs binary release from GitHub:

    wget -O gogs.zip https://github.com/gogs/gogs/releases/latest/download/linux_amd64.zip
    
  5. Unzip the downloaded file and move it to the Gogs directory:

    sudo apt install unzip
    unzip gogs.zip
    sudo mv gogs /home/gogs/
    sudo chown -R gogs:gogs /home/gogs/gogs
    
  6. Set up the Gogs systemd service:

Create a new file called gogs.service:

   sudo nano /etc/systemd/system/gogs.service

Paste the following contents into the file and save it (Ctrl + X, Y, Enter):

   [Unit]
   Description=Gogs - Go Git Service
   After=syslog.target
   After=network.target

   [Service]
   LimitMEMLOCK=infinity
   LimitNOFILE=65535
   Type=simple
   User=gogs
   Group=gogs
   WorkingDirectory=/home/gogs
   ExecStart=/home/gogs/gogs/gogs web
   Restart=always
   Environment=USER=gogs HOME=/home/gogs GOGS_WORK_DIR=/home/gogs

   [Install]
   WantedBy=multi-user.target
  1. Enable and start the Gogs service:

    sudo systemctl enable gogs
    sudo systemctl start gogs
    
  2. Check the status of the Gogs service:

    sudo systemctl status gogs
    

If everything is running correctly, you should see a line similar to this:

   Active: active (running) since ...
  1. Gogs should now be running on port 3000. Open a web browser and navigate to http://your-server-ip:3000 to access the Gogs web installation interface.

  2. Follow the web installation steps to configure Gogs to your liking.

That's it! You have successfully installed Gogs on your Ubuntu server.