How to install Sourcegraph on Ubuntu

Published: 16 February 2023
on channel: Quickloss3
297
like

Update Server:
apt update && apt upgrade -y

Istall Docker:
sudo apt -y install lsb-release gnupg apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubu... | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/docker.gpg
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo usermod -aG docker $USER
newgrp docker

Start Sourcegraph container:


docker run -d --name sourcegraph \
--publish 7080:7080 \
--publish 127.0.0.1:3370:3370 \
--rm \
--volume ~/.sourcegraph/config:/etc/sourcegraph \
--volume ~/.sourcegraph/data:/var/opt/sourcegraph \
sourcegraph/server:3.36.3


docker ps
docker rm -f sourcegraph
sudo vim /etc/systemd/system/sourcegraph.service
paste
[Unit]
Description=Sourcegraph code search and navigation engine
Documentation=https://about.sourcegraph.com/docs
After=network-online.target
Wants=network-online.target


[Service]
Restart=on-failure
TimeoutStartSec=5
ExecStartPre=-/usr/bin/docker kill sourcegraph
ExecStartPre=-/usr/bin/docker rm sourcegraph


ExecStart=/usr/bin/docker run \
--name sourcegraph \
-p 7080:7080 \
-p 127.0.0.1:3370:3370 \
-v /var/sourcegraph/config:/etc/sourcegraph \
-v /var/sourcegraph/data:/var/opt/sourcegraph \
-v /var/run/docker.sock:/var/run/docker.sock \
sourcegraph/server:3.36.3


ExecStop=-/usr/bin/docker kill sourcegraph
ExecStop=-/usr/bin/docker rm sourcegraph


sudo systemctl daemon-reload
sudo systemctl start sourcegraph.service
systemctl status sourcegraph.service


Access Sourcegraph:
server_ip:7080


Watch video How to install Sourcegraph on Ubuntu online without registration, duration hours minute second in high quality. This video was added by user Quickloss3 16 February 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 297 once and liked it like people.