Learn how to – Install GitBucket on Ubuntu / Debian Linux.
GitBucket is a web-based Git platform powered by Scala. In our previous guides, we covered how to install GitLab, Gitea, and SVN. In this post, we will discuss how you can install GitBucket on Ubuntu 18.04 / Ubuntu 19.04 / Ubuntu 16.04. Here are few
- Provides an intuitive UI
- It is easy to install
- Features can be extended by plugins
- Has API compatibility with GitHub
- Support for GitLFS
- Support for both Public and Private Git repositories.
- Repository viewer including an online file editor
- LDAP integration for
account s and groups management
Install GitBucket on Ubuntu / Debian
The main requirement of GitBucket is Java8. Ensure this is installed on your Ubuntu / Debian Linux.
sudo apt install -y default-jdk
Once you have Java installed, download the latest gitbucket.war from the releases page. As of this writing, this is version 4.33.1
.
curl -s https://api.github.com/repos/gitbucket/gitbucket/releases/latest |grep browser_download_url | cut -d '"' -f 4 | grep '.war$' | wget -i -
Create gitbucket user and group.
sudo groupadd -g 555 gitbucket
sudo useradd
-g gitbucket --no-user-group
--home-dir /opt/gitbucket --no-create-home
--shell /usr/sbin/nologin
--system --uid 555 gitbucket
Create /opt/gitbucket directory
sudo mkdir /opt/gitbucket
Move gitbucket.war
file to /opt/gitbucket
sudo mv gitbucket.war /opt/gitbucket
Make the owner of the GitBucket to be the gitbucket:gitbucket user:
sudo chown -R gitbucket:gitbucket /opt/gitbucket
Configure Systemd service for GitBucket
You can run Java Applications with Systemd. Read more on How to run Java Jar Application with Systemd on Linux
Create systemd service file.
sudo vim /etc/systemd/system/gitbucket.service
Add
# GitBucket Service
[Unit]
Description=Manage Java service
[Service]
WorkingDirectory=/opt/gitbucket
ExecStart=/usr/bin/java -Xms128m -Xmx256m -jar gitbucket.war
User=gitbucket
Group=gitbucket
Type=simple
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
You can specify following options:
--port=[NUMBER]
--prefix=[CONTEXTPATH]
--host=[HOSTNAME]
--gitbucket.home=[DATA_DIR]
--temp_dir=[TEMP_DIR]
--max_file_size=[MAX_FILE_SIZE]
If your Java is in a different path, locate it with which java
and set path in systemd unit file.
Reload Systemd after adding the file
sudo systemctl daemon-reload
Start service and set it to start at boot.
sudo systemctl enable --now gitbucket
Confirm service Status
$ sudo systemctl status gitbucket
gitbucket.service - Manage Java service
Loaded: loaded (/etc/systemd/system/gitbucket.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2019-03-13 21:43:01 PDT; 6min ago
Main PID: 1751 (java)
Tasks: 27 (limit: 1110)
CGroup: /system.slice/gitbucket.service
`-1751 /usr/bin/java -Xms128m -Xmx256m -jar gitbucket.war
Mar 13 21:43:07 ubuntu-01 java[1751]: 21:43:07.439 [main] INFO o.quartz.impl.DirectSchedulerFactory - Quartz scheduler 'QuartzScheduler~job
Mar 13 21:43:07 ubuntu-01 java[1751]: 21:43:07.439 [main] INFO o.quartz.impl.DirectSchedulerFactory - Quartz scheduler version: 2.3.0
Mar 13 21:43:07 ubuntu-01 java[1751]: 21:43:07.442 [main] INFO org.quartz.core.QuartzScheduler - Scheduler QuartzScheduler~job_$_job started.
Mar 13 21:43:07 ubuntu-01 java[1751]: [INFO] [03/13/2019 21:43:07.462] [main] [[QuartzScheduler~job]] Initialized calendars:
Mar 13 21:43:07 ubuntu-01 java[1751]: [INFO] [03/13/2019 21:43:07.467] [main] [[QuartzScheduler~job]] Setting up scheduled job 'Daily', with 'com.types
Mar 13 21:43:07 ubuntu-01 java[1751]: 21:43:07.494 [main] INFO o.scalatra.servlet.ScalatraListener - The cycle class name from the config: ScalatraBoo
Mar 13 21:43:07 ubuntu-01 java[1751]: 21:43:07.496 [main] INFO o.scalatra.servlet.ScalatraListener - Initializing life cycle class: ScalatraBootstrap
Mar 13 21:43:08 ubuntu-01 java[1751]: 2019-03-13 21:43:08.072:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@ebe067d{/,file:///opt/gitbu
Mar 13 21:43:08 ubuntu-01 java[1751]: 2019-03-13 21:43:08.100:INFO:oejs.AbstractConnector:main: Started ServerConnector@998af42{HTTP/1.1,[http/1.1]}{0.
Mar 13 21:43:08 ubuntu-01 java[1751]: 2019-03-13 21:43:08.101:INFO:oejs.Server:main: Started @6821ms
Access Gitbucket Web UI
Go to http://[hostname]:8080/
to access the Gitbucket web interface.
Go to Login section.
The default logins are:
Username: root
Password: root
Change root password under Account Settings
What next?
By default, GitBucket run on embedded H2 database. For Production use, it is recommended to configure to use external database
Also consider to:
1.
Configure SMTP for email alerting
2.
Configure Additional Plugins
You can find more plugins made by the community at GitBucket community plugins.
3.
Enabling SSH access to repository
Performing GitBucket Backup
The backup of a GitBucket installation should be consistent between the database state and the state of the git repositories. There is a backup script available for automating this task. Check GitBucket backup guide for more details.
Git Learning Video Courses
- The Git & Github Bootcamp
- Git Going Fast: One Hour Git Crash Course
- Git Complete: The definitive, step-by-step guide to Git
- Complete Git Guide: Understand and master Git and GitHub
- Git & GitHub For Beginners – Master Git and GitHub
Related Articles:
- How to Install and Use lazygit – A simple terminal UI for git commands
- Gitleaks – How to Audit git repository for secrets
- How To Secure GitLab Server with SSL
- How to Configure GitLab FreeIPA Authentication
Leave a Reply
You must be logged in to post a comment.