How to Install Sourcegraph on Void Linux

Sourcegraph is a code search and intelligence tool that helps developers search, navigate, and understand code repositories. This tutorial will guide you through the process of installing Sourcegraph on a Void Linux system.

Prerequisites

Before starting, make sure that your system has the following prerequisites:

Step 1: Install Docker

Sourcegraph requires Docker to run, so the first step is to install Docker on your system. Run the following command to install Docker:

sudo xbps-install -S docker

Once Docker is installed, start the Docker daemon by running:

sudo systemctl start docker

You can check that Docker is running by running:

sudo docker ps

This should give you a list of running Docker containers.

Step 2: Download and Run Sourcegraph

The next step is to download and run Sourcegraph using Docker. Run the following command to download and start the Sourcegraph container:

sudo docker run --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.30.1

This command will download the Sourcegraph image and start a container with the following options:

Note that the sourcegraph/server:3.30.1 image tag may be different depending on the latest version available at the time of installation.

After running this command, you should see logs from the Sourcegraph server:

...
> sourcegraph@3.30.1 start /usr/local/src/sourcegraph
> node ./sbin/sourcegraph.js .

info: Frontend URL: http://localhost:7080/
info: Docker images:
info:             debian:stretch-20190812-slim
info:             golang:1.13.8-alpine
info:             postgres:10.11
info:             sourcegraph/ignite:20191204
info:             sourcegraph/server:3.30.1
info: Postgres is at 127.0.0.1:5432
info: Access Sourcegraph at http://localhost:7080/

This means that Sourcegraph is now running.

Step 3: Access Sourcegraph

You can now access Sourcegraph by opening a web browser and navigating to http://localhost:7080/. You should see the Sourcegraph homepage:

Sourcegraph Homepage

Conclusion

Congratulations! You have successfully installed Sourcegraph on your Void Linux system. You can now use Sourcegraph to search, navigate, and understand code 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!