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 dnf/yum repository and install via dnf/yum, paste the following in your shell -
sudo curl https://download.gocd.org/gocd.repo -o /etc/yum.repos.d/gocd.repo
Once you have the repository setup, execute
sudo dnf install -y go-agent
Alternatively, if you have the agent RPM downloaded:
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 -
sudo install -m 0755 -d /etc/apt/keyrings
curl https://download.gocd.org/GOCD-GPG-KEY.asc | sudo gpg --dearmor -o /etc/apt/keyrings/gocd.gpg
sudo chmod a+r /etc/apt/keyrings/gocd.gpg
echo "deb [signed-by=/etc/apt/keyrings/gocd.gpg] https://download.gocd.org /" | sudo tee /etc/apt/sources.list.d/gocd.list
sudo apt-get update
Once you have the repository setup, execute
sudo apt-get install --install-recommends go-agent
Alternatively, if you have the agent DEB downloaded:
sudo dpkg -i go-agent-${version}.deb
Recommended dependencies are installed by default on most distributions so the option isn’t needed, however if you
choose not to install such dependencies you will need to install your own JRE and configure GoCD to use it in
wrapper-properties.conf
located within the configuration directory specified below.
Install on Docker containers
To run GoCD on container please use our official docker container images
If it possible to install via rpm/deb packages as well, however this is not normally recommended as the GoCD agent packages are intended to be installed with an init system rather than managed via the container entrypoint.
Managing the GoCD agent process
The GoCD agent script must be run with one of the following arguments:
Script | Description |
---|---|
service go-agent console | The GoCD agent will be started in the foreground |
service go-agent start | The GoCD agent will be started as a daemon in the background |
service go-agent stop | The GoCD agent will be stopped |
service go-agent restart | The 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:
Location | Description |
---|---|
/var/lib/go-agent |
the GoCD agent configuration and working directory |
/var/log/go-agent |
the GoCD agent log files |
/usr/share/go-agent |
the GoCD agent binaries and startup scripts |
/usr/share/go-agent/wrapper-config/wrapper-properties.conf |
the 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:
- Open the GoCD server dashboard
- 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.