Skip to content

Setup Manager and First Node: Ubuntu

Kyle Matsuda edited this page Nov 24, 2020 · 3 revisions

This is a quick guide to setting up the Labrad manager and your first node on Ubuntu.

Currently, the Labrad manager is setup and running on the main control computer ("bialkali"). In the unfortunate event that this computer dies, these instructions should be sufficient for getting Labrad running again. These instructions can also be used to setup an independent Labrad testbed for debugging new servers, etc.

  1. Make sure you're using Python 2!

  2. Install pylabrad and anything other python packages you need: pip install pylabrad

  3. Install the Labrad manager. To do this, download the latest version of the binary distribution here and extract somewhere (e.g., ~/labrad). The manager needs Java to run, so install Java if needed: sudo apt install openjdk-8-jdk

Next, we need to setup a service to run the Labrad manager. We could just do this manually by running the Labrad manager. For example, if we had extracted the scalabrad distro to ~/labrad, we would just need to run ~/labrad/bin/labrad to start the manager (and pass in some arguments). However, it's more convenient to just set up a systemd service here so it runs automatically.

  1. To do this, copy labrad_tools/systemd/labrad-manager.service to /etc/systemd/system. You'll probably need to edit the file before things work. Here is roughly what the file looks like:
[Unit]
Description=labrad manager
After=syslog.target

[Service]
Type=simple
User=username
Group=username
WorkingDirectory=/home/username/labrad_tools
ExecStart=/home/username/labrad/bin/labrad --tls-required=false --password=password
StandardOutput=syslog
StandardError=syslog

[Install]
WantedBy=multi-user.target

Above you'll want to set username to your Linux username. Set password to your desired Labrad password. WorkingDirectory should match the directory of your labrad_tools repo; ExecStart should have the path to your Labrad manager executable. You may also need to set the JAVA_HOME environment variable. To do this, add the following line to /etc/environment/: JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/" (the exact path will depend on your Java installation). Then log out and back in to reload the environment variables.

  1. Check that the service is working correctly. First, run sudo systemctl daemon-reload (this must be done every time a systemd service is modified). Next, run sudo systemctl start labrad-manager.service to start the service, and sudo systemctl status labrad-manager.service to check the status. You should see a green circle indicating that the service is active. There is a log that will tell you if any errors occurred when running the manager. Finally, run sudo systemctl enable labrad-manager.service to run the manager automatically on startup.

  2. Next, we need to configure a few environment variables. To do this, edit /etc/environment (needs root). We need to add the following lines:

LABRADHOST=localhost
LABRADPASSWORD=your_labrad_password
LABRADNODE=name_of_your_node
LABRAD_TLS=off

You'll need to log out and log back in again to load the new environment variables.

  1. Now, we should be able to check that Labrad is at least running correctly. Run ipython and then try the following:
import labrad
cxn = labrad.connect()
cxn.servers

This should print a list of running servers (e.g., auth, manager, registry). If there are no errors, then you are good to go!

  1. Start your node. This is easy! Just do python -m labrad.node. To check if it worked, follow the directions in (6) again. You should see a new server appear in the list, with the name of $LABRADNODE (for example, if you set LABRADNODE=test, you should see a new server node_test). You can now start servers on your new node.

Finally, we can optionally add the path to the labrad_tools folder to the Registry, so Labrad can automatically detect the available servers. This also allows us to start and stop several servers at once using labrad_tools/nodecontrol (as opposed to starting the python script for each server manually).

  1. Adding a new path to the Registry.

Table of contents

Intro

Getting started

Clone this wiki locally