Installing Sourcegraph on Manjaro

Introduction

Sourcegraph is a powerful code search and intelligence tool that developers use to quickly find and understand code. In this tutorial, we will be installing Sourcegraph on Manjaro to help you get started with this powerful tool.

Prerequisites

Before we begin, make sure that your Manjaro system is up-to-date and that you have administrative access to install packages.

Step 1: Install Docker

Sourcegraph runs on Docker containers, so you'll need to have Docker installed on your system. Open a terminal window and run the following command:

sudo pacman -S docker

This will install the Docker package onto your system. You'll also want to make sure that the Docker daemon is running by starting the service:

sudo systemctl start docker

And enabling it to start on boot:

sudo systemctl enable docker

Step 2: Install Docker Compose

Docker Compose helps you manage multi-container Docker applications, and we'll be using it to launch Sourcegraph. Run the following command to install Docker Compose onto your system:

sudo pacman -S docker-compose

Step 3: Clone the Sourcegraph Source Code

Next, you'll need to clone the Sourcegraph source code onto your system. This will give you access to the files that you'll need to setup and launch the application. Run the following command to clone the repository:

git clone https://github.com/sourcegraph/sourcegraph

Once the repository is cloned, change to the sourcegraph/cmd/server directory:

cd sourcegraph/cmd/server

Step 4: Configure Sourcegraph

Before we can launch Sourcegraph, we need to configure it. Copy the config.example.yml file:

cp cmd/server/config.example.yml cmd/server/config.yml

And open the config.yml file in your favorite text editor:

nano cmd/server/config.yml

In the file, find the auth.providers.github section and enter your GitHub OAuth client ID and secret.

auth.providers:
  - type: github
    openIdConnect:
      clientId: YOUR_CLIENT_ID_HERE
      clientSecret: YOUR_CLIENT_SECRET_HERE
    serviceType: "oauth"

Save the file and exit.

Step 5: Launch Sourcegraph

Finally, we're ready to launch Sourcegraph. Run the following command to launch Sourcegraph using Docker Compose:

docker-compose up

After a few minutes, Sourcegraph should be up and running at http://localhost:7080. Open a web browser and visit this URL to access the web application.

Conclusion

Congratulations! You have successfully installed and launched Sourcegraph on Manjaro. You can now use this powerful code search and intelligence tool to enhance your coding experience.

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!