Installing GoCD agent on Linux

Installation of the GoCD agent using the package manager will require root access on the machine.

RPM based distributions (ie RedHat/CentOS/Fedora)

The GoCD agent RPM installer has been tested on RedHat Enterprise Linux and CentOS. It should work on most RPM based Linux distributions.

If you prefer to use the YUM repository and install via YUM, paste the following in your shell -

  1. sudo curl https://download.gocd.org/gocd.repo -o /etc/yum.repos.d/gocd.repo

Once you have the repository setup, execute

  1. sudo yum install -y go-agent

Alternatively, if you have the agent RPM downloaded:

  1. sudo rpm -i go-agent-${version}.noarch.rpm

Debian based distributions (ie Ubuntu)

The GoCD agent .deb installer has been tested on Ubuntu. However it should work on most Linux distributions which use debs.

If you prefer to use the APT repository and install via apt-get, paste the following in your shell -

  1. echo "deb https://download.gocd.org /" | sudo tee /etc/apt/sources.list.d/gocd.list
  2. curl https://download.gocd.org/GOCD-GPG-KEY.asc | sudo apt-key add -
  3. sudo apt-get update

Once you have the repository setup, execute

  1. sudo apt-get install go-agent

Alternatively, if you have the agent DEB downloaded:

  1. sudo dpkg -i go-agent-${version}.deb

Install on Docker containers

To run GoCD on container please use our official docker container images

For installing GoCD agent using rpm/deb packages on containers, starting from release 19.7.0 the following additional dependencies will be required.

On Fedora, install procps package, execute

  1. sudo yum install procps

On CentOS/RHEL, install sysvinit-tools package, execute

  1. sudo yum install sysvinit-tools

Managing the GoCD agent process

The GoCD agent script must be run with one of the following arguments:

ScriptDescription
service go-agent consoleThe GoCD agent will be started in the foreground
service go-agent startThe GoCD agent will be started as a daemon in the background
service go-agent stopThe GoCD agent will be stopped
service go-agent restartThe GoCD agent will be restarted

service utilizes the service manager (e.g systemd, upstart, init.d) used by your OS.

Location of GoCD agent files

The GoCD agent installs its files in the following locations on your filesystem:

LocationDescription
/var/lib/go-agentthe GoCD agent configuration and working directory
/var/log/go-agentthe GoCD agent log files
/usr/share/go-agentthe GoCD agent binaries and startup scripts
/usr/share/go-agent/wrapper-config/wrapper-properties.confthe configuration file to alter GoCD agent properties

Configuring the GoCD agent

After installing the GoCD agent, you must first configure the agent with the hostname (or IP address) of your GoCD server, in order to do this:

  • Open /usr/share/go-agent/wrapper-config/wrapper-properties.conf in your favourite text editor.
  • Follow the instructions in the file to configure the GoCD server url
  • Save the file and exit your editor.
  • Run service go-agent [start|restart] to (re)start the agent.

Registering your agent with the server

For security reasons, all newly installed GoCD agents need to be enabled on the GoCD server before work is assigned to them. This prevents an unauthorized person from getting access to your source code. To enable a newly installed GoCD agent, do the following:

  1. Open the GoCD server dashboard
  2. Follow the instructions here to find the agent you’ve just installed on the list and add the agent to your cloud. The GoCD server will now schedule work for this agent.