Gogs is a lightweight, self-hosted Git service that is easy to install and use. In this tutorial, we will guide you on how to install Gogs on OpenSUSE Latest.
Before installing Gogs, make sure that your system has the following dependencies installed:
sudo zypper install git sqlite3 nginx memcached
To install Gogs, follow these steps:
cd ~
wget https://dl.gogs.io/gogs_latest_linux_amd64.tar.gz
tar xvfz gogs_latest_linux_amd64.tar.gz
/opt
:sudo mv gogs /opt/
sudo useradd --system --shell /bin/bash --comment 'Gogs Git User' --user-group git
/opt/gogs
directory:sudo chown -R git:git /opt/gogs/
gogs
service file:sudo nano /etc/systemd/system/gogs.service
[Unit]
Description=Gogs
After=syslog.target
After=network.target
[Service]
User=git
Group=git
ExecStart=/opt/gogs/gogs web
Restart=always
Environment=USER=git HOME=/home/git
[Install]
WantedBy=multi-user.target
gogs
service:sudo systemctl daemon-reload
sudo systemctl start gogs
gogs
service to automatically start on boot:sudo systemctl enable gogs
sudo nano /etc/nginx/conf.d/gogs.conf
server {
listen 80;
server_name yourdomain.com;
access_log /var/log/nginx/gogs.access.log;
error_log /var/log/nginx/gogs.error.log;
location / {
proxy_pass http://localhost:3000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /static/ {
alias /opt/gogs/public/;
expires 24h;
add_header Cache-Control public;
access_log off;
}
location /avatars/ {
alias /opt/gogs/data/avatars/;
expires 24h;
add_header Cache-Control public;
access_log off;
}
}
sudo nginx -t
sudo systemctl reload nginx
Gogs should now be accessible via your browser at http://yourdomain.com
.
Congratulations! You have successfully installed Gogs on OpenSUSE Latest. You can now start using it to host your Git repositories.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!