Traffic Ops - Installing

System Requirements

The user must have the following for a successful minimal install:


  1. Install PostgreSQL Database. For a production install it is best to install PostgreSQL on its own server/VM.

    See also

    For more information on installing PostgreSQL, see their documentation.

    #26 Example PostgreSQL Install Procedure
    yum update -y
    yum install -y
    yum install -y postgresql96-server
    su - postgres -c '/usr/pgsql-9.6/bin/initdb -A md5 -W' #-W forces the user to provide a superuser (postgres) password
  2. Edit /var/lib/pgsql/9.6/data/pg_hba.conf to allow the Traffic Ops instance to access the PostgreSQL server. For example, if the IP address of the machine to be used as the Traffic Ops host is add the line host  all   all md5 to the appropriate section of this file.

  3. Edit the /var/lib/pgsql/9.6/data/postgresql.conf file to add the appropriate listen_addresses or listen_addresses = '*', set timezone = 'UTC', and start the database

    #27 Starting PostgreSQL with systemd(1)
    systemctl enable postgresql-9.6
    systemctl start postgresql-9.6
    systemctl status postgresql-9.6 # Prints the status of the PostgreSQL service, to prove it's running
  4. Build a traffic_ops-version string.rpm file using the instructions under the Building Traffic Control page.

  5. Install a PostgreSQL client on the Traffic Ops host

    #28 Installing PostgreSQL Client from a Hosted Source
    yum install -y
  6. Install the Traffic Ops RPM. The Traffic Ops RPM file should have been built in an earlier step.

    #29 Installing a Generated Traffic Ops RPM
    yum install -y ./dist/traffic_ops-3.0.0-xxxx.yyyyyyy.el7.x86_64.rpm


    This will install the PostgreSQL client, psql as a dependency.

  7. Login to the Database from the Traffic Ops machine. At this point you should be able to login from the Traffic Ops (hostname to in the example) host to the PostgreSQL (hostname pg in the example) host

    #30 Example Login to Traffic Ops Database from Traffic Ops Server
    to-# psql -h pg -U postgres
    Password for user postgres:
    psql (9.6.3)
    Type "help" for help.
  8. Create the user and database. By default, Traffic Ops will expect to connect as the traffic_ops user to the traffic_ops database.

    #31 Creating the Traffic Ops User and Database
    to-# psql -U postgres -h pg -c "CREATE USER traffic_ops WITH ENCRYPTED PASSWORD 'tcr0cks';"
    Password for user postgres:
    to-# createdb traffic_ops --owner traffic_ops -U postgres -h pg
  9. Now, run the following command as the root user (or with sudo): /opt/traffic_ops/install/bin/postinstall. The postinstall script will first get all required Perl packages from CPAN. This may take a while, expect up to 30 minutes on the first install. If there are any prompts in this phase, please just answer with the defaults (some CPAN installs can prompt for install questions). When this phase is complete, you will see Complete! Modules were installed into /opt/traffic_ops/app/local. Some additional files will be installed, and then it will proceed with the next phase of the install, where it will ask you about the local environment for your CDN. Please make sure you remember all your answers and verify that the database answers match the information previously used to create the database.

    #32 Example Output
    to-# /opt/traffic_ops/install/bin/postinstall
    Database type [Pg]:
    Database type: Pg
    Database name [traffic_ops]:
    Database name: traffic_ops
    Database server hostname IP or FQDN [localhost]: pg
    Database server hostname IP or FQDN: pg
    Database port number [5432]:
    Database port number: 5432
    Traffic Ops database user [traffic_ops]:
    Traffic Ops database user: traffic_ops
    Password for Traffic Ops database user:
    Re-Enter Password for Traffic Ops database user:
    Writing json to /opt/traffic_ops/app/conf/production/database.conf
    Database configuration has been saved
    Database server root (admin) user [postgres]:
    Database server root (admin) user: postgres
    Password for database server admin:
    Re-Enter Password for database server admin:
    Download Maxmind Database? [yes]:
    Download Maxmind Database?: yes
    Generate a new secret? [yes]:
    Generate a new secret?: yes
    Number of secrets to keep? [10]:
    Number of secrets to keep?: 10
    Not setting up ldap
    Administration username for Traffic Ops [admin]:
    Administration username for Traffic Ops: admin
    Password for the admin user:
    Re-Enter Password for the admin user:
    Writing json to /opt/traffic_ops/install/data/json/users.json
    Do you want to generate a certificate? [yes]:
    Country Name (2 letter code): US
    State or Province Name (full name): CO
    Locality Name (eg, city): Denver
    Organization Name (eg, company): Super CDN, Inc
    Organizational Unit Name (eg, section):
    Common Name (eg, your name or your server's hostname):
    RSA Passphrase:
    Re-Enter RSA Passphrase:
    Traffic Ops url [https://localhost]:
    Traffic Ops url: https://localhost
    Human-readable CDN Name.  (No whitespace, please) [kabletown_cdn]: blue_cdn
    Human-readable CDN Name.  (No whitespace, please): blue_cdn
    DNS sub-domain for which your CDN is authoritative []:
    DNS sub-domain for which your CDN is authoritative:
    Writing json to /opt/traffic_ops/install/data/json/profiles.json
    Downloading Maxmind data
    --2017-06-11 15:32:41--
    Resolving ( 2400:cb00:2048:1::6810:262f, 2400:cb00:2048:1::6810:252f,, ...
    Connecting to (|2400:cb00:2048:1::6810:262f|:80... connected.
    ... much SQL output skipped
    Starting Traffic Ops
    Restarting traffic_ops (via systemctl):                    [  OK  ]
    Waiting for Traffic Ops to restart
    Success! Postinstall complete.
    Table 31 Explanation of the information that needs to be provided:
    Field Description
    Database type This requests the type of database to be used. Answer with the default - ‘Pg’ to indicate a PostgreSQL database.
    Database name The name of the database Traffic Ops uses to store the configuration information.
    Database server hostname IP or FQDN The hostname of the database server (pg in the example).
    Database port number The database port number. The default value, 5432, should be correct unless you changed it during the setup.
    Traffic Ops database user The username Traffic Ops will use to read/write from the database.
    Password for Traffic Ops The password for the database user that Traffic Ops uses.
    Database server root (admin) user name Privileged database user that has permission to create the database and user for Traffic Ops.
    Database server root (admin) user password The password for the privileged database user.
    Traffic Ops URL The URL to connect to this instance of Traffic Ops, usually https://<Traffic Ops host>/
    Human-readable CDN Name The name of the first CDN which Traffic Ops will be manage.
    DNS sub-domain for which your CDN is authoritative The DNS domain that will be delegated to this Traffic Control CDN.
    Administration username for Traffic Ops The Administration (highest privilege) Traffic Ops user to create. Use this user to login for the first time and create other users.
    Password for the admin user The password for the administrative Traffic Ops user.

Traffic Ops is now installed!

See also

Default Profiles for initial configuration of the Traffic Ops instance.

Upgrading Traffic Ops

To upgrade from older Traffic Ops versions, stop the service, use yum(8) to upgrade to the latest available Traffic Ops package, and use the admin tool to perform the database upgrade.


In order to upgrade to the latest version of Traffic Ops, please be sure that you have first upgraded to the latest available minor or patch version of your current release. For example, if your current Traffic Ops version is 3.0.0 and version 3.1.0 is available, you must first upgrade to 3.1.0 before proceeding to upgrade to 4.0.0. (Specifically, this means running all migrations, traffic_ops/app/db/seeds.sql, and traffic_ops/app/db/patches.sql for the latest of your current major version - which should be handled by the app/db/admin tool). The latest migration available before the release of 4.0.0 (pending at the time of this writing) was traffic_ops/app/db/migrations/20180814000625_remove_capabilities_for_reseed.sql, so be sure that migrations up to this point have been run before attempting to upgrade Traffic Ops.

See also

app/db/admin for more details about admin.

#33 Sample Script for Upgrading Traffic Ops
systemctl stop traffic_ops
yum upgrade traffic_ops
pushd /opt/traffic_ops/app/
./db/admin --env production upgrade

After this completes, see Installation for instructions on running the postinstall script. Once the postinstall script, has finished, run the following command as the root user (or with sudo): systemctl start traffic_ops to start the service.