How to Install Drone on Debian Latest

Drone is a popular open-source Continuous Integration and Continuous Deployment (CI/CD) platform utilized for automating the software delivery workflows. In this tutorial, you will learn how to install Drone on Debian latest version.

Prerequisites

Before starting the installation process, you will need the following prerequisites:

Step 1: Update the System Packages

Before installing the Drone, ensure that the system packages are up to date by running the following command:

sudo apt update && sudo apt upgrade -y

Step 2: Install Docker

Drone requires Docker to be installed on the host machine. Follow these steps to install Docker on your system:

  1. Install the Docker dependencies using the command:
sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y
  1. Download the Docker GPG key:
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
  1. Add the Docker repository to the APT sources:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
  1. Update the APT package index:
sudo apt update
  1. Install the Docker Community Edition:
sudo apt install docker-ce -y
  1. Start and enable the Docker service:
sudo systemctl start docker && sudo systemctl enable docker

You can verify the installation and enablement of Docker using the command:

sudo systemctl status docker

Step 3: Install Docker Compose

Drone requires Docker Compose to be installed on the host machine. Follow these steps to install Docker Compose:

  1. Download the latest Docker Compose version:
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  1. Make the downloaded file executable:
sudo chmod +x /usr/local/bin/docker-compose
  1. Create a symbolic link to the Docker Compose executable:
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

Verify the Docker Compose version using the command:

docker-compose --version

Step 4: Install Drone

Now that you have Docker and Docker Compose installed on your system, it's time to install Drone. Follow these steps to install Drone:

  1. Create a new directory for Drone:
sudo mkdir /opt/drone && sudo chown -R $USER:$USER /opt/drone
  1. Create a new Docker Compose file for Drone:
nano /opt/drone/docker-compose.yml
  1. Paste the following code into the file and save it:
version: '3'

services:
   drone-server:
     image: drone/drone:latest
     ports:
       - 80:80
       - 443:443
     volumes:
       - ./data:/data
       - /var/run/docker.sock:/var/run/docker.sock
     restart: always
     environment:
       - DRONE_SERVER_HOST=<YOUR_SERVER_IP>
       - DRONE_SERVER_PROTO=http
       - DRONE_RPC_SECRET=<YOUR_RPC_SECRET>

   drone-runner:
     image: drone/drone-runner-docker:latest
     volumes:
       - /var/run/docker.sock:/var/run/docker.sock
     restart: always
     environment:
       - DRONE_RPC_HOST=<YOUR_SERVER_IP>
       - DRONE_RPC_PROTO=http
       - DRONE_RPC_SECRET=<YOUR_RPC_SECRET>

Note: Replace with your server IP address and with a secure string for the application.

  1. Launch the Drone stack using the Docker Compose command:
docker-compose up -d

You can verify the installation of Drone by accessing the Drone Web Interface via a web browser by typing:

http://<YOUR_SERVER_IP>

Conclusion

In this tutorial, you learned how to install Drone on Debian latest version. With Drone installed, you can now start automating the testing and deployment of your software. Happy coding!

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!