Azure DevOps provides powerful CI/CD capabilities, but setting up self-hosted agents can be challenging. This guide demonstrates a streamlined approach to configuring Azure DevOps agents on CentOS 7 servers. Ensure you have administrative access to a CentOS 7 machine before proceeding.### Obtaining the Linux Agent Package
Navigate to your Azure DevOps organization's agent pool management section to download the Linux agent package. Select the appropriate Linux package version from the available options and save it locally for transfer to your server.### Transferring Files to the Target Server
Use your preferred SCP client to upload the agent package to your CentOS 7 server. Once uploaded, execute these commands to prepare the environment: ``` mkdir buildagent && cd buildagent tar xvf /home/user/azdo-agent-linux-x64-2.160.2.tar.gz
After extraction, you'll see the agent directory structure with configuration scripts and binaries. ### Installing Required Dependencies
Before configuraton, install all necessary system dependencies: ```
./bin/installdependencies.sh
This script ensures all prerequisite packages are installed for proper agent functionality. ### Configuring the Agent
The agent can be configured interactively or via automated scripts. Execute the configuration script with appropriate parameters: ```
./config.sh --unattended
--organization-url https://dev.azure.com/yourorg
--auth pat
--token your-personal-access-token
--agent-name centos7-agent-01
--pool Default
--replace
Key configuration options include: - **PAT (Personal Access Token)**: Recommended authentication method requiring a pre-generated token
- **Negotiate**: Alternative authentication using Windows credentials (not available on Linux)
- **Integrated**: Windows-only authentication option
If encountering the "Must not run with sudo" error, you can temporarily set an environment variable: ```
export AGENT_ALLOW_RUNASROOT=1
./config.sh [parameters]
Installing as a System Service
Configure the agent to run as a presistent service: ``` sudo ./svc.sh install yourusername sudo ./svc.sh start
Verify the agent appears online in your Azure DevOps agent pool after a few minutes. ### Installing Updated Git Version
Azure DevOps requires Git 2.9.0 or later. Use the IUS repository for newer packages: ```
rpm -Uvh https://repo.ius.io/ius-release-el7.rpm
yum install -y git224
This installs Git 2.24 from the IUS community repository. ### Configuring Docker for Containerized Builds
For Docker-based pipelines, install and configure Docker: ``` curl -fsSL https://get.docker.com -o install-docker.sh sh install-docker.sh
Configure Docker daemon
mkdir -p /etc/docker cat > /etc/docker/daemon.json <
Add the service user to the docker group if needed: ```
sudo usermod -aG docker yourusername
Your Azure DevOps agent is now ready to handle builds, releases, and pipeline deployments on your CentOS 7 infrastructure.