--- layout: default navsection: installguide title: Install the API server ... h2. Prerequisites: # A GNU/Linux (virtual) machine # A domain name for your api server h2(#dependencies). Install dependencies
~$ sudo apt-get install \
    bison build-essential gettext libcurl3 libcurl3-gnutls \
    libcurl4-openssl-dev libpcre3-dev libpq-dev libreadline-dev \
    libsqlite3-dev libssl-dev libxslt1.1 postgresql sqlite3 sudo \
    wget zlib1g-dev
h2(#ruby). Install Ruby and bundler We recommend Ruby >= 2.1.
mkdir -p ~/src
cd ~/src
wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz
tar xzf ruby-2.1.2.tar.gz
cd ruby-2.1.2
./configure
make
sudo make install

sudo gem install bundler
h2. Download the source tree
~$ cd $HOME # (or wherever you want to install)
~$ git clone https://github.com/curoverse/arvados.git
See also: "Downloading the source code":https://arvados.org/projects/arvados/wiki/Download on the Arvados wiki. h2. Install gem dependencies
~$ cd arvados/services/api
~/arvados/services/api$ bundle install
h2. Configure the API server Edit the main configuration:
~/arvados/services/api$ cp -i config/application.yml.example config/application.yml
Choose a unique 5-character alphanumeric string to use as your @uuid_prefix@. An example is given that generates a 5-character string based on a hash of your hostname. The @uuid_prefix@ is a unique identifier for your API server. It also serves as the first part of the hostname for your API server. For a development site, use your own domain instead of arvadosapi.com. Make sure a clone of the arvados repository exists in @git_repositories_dir@:
~/arvados/services/api$ sudo mkdir -p /var/cache/git
~/arvados/services/api$ sudo git clone --bare ../../.git /var/cache/git/arvados.git
Generate a new secret token for signing cookies:
~/arvados/services/api$ rake secret
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
Put it in @config/application.yml@ in the production or common section:
    secret_token: zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
Consult @application.default.yml@ for a full list of configuration options. Always put your local configuration in @application.yml@ instead of editing @application.default.yml@. Generate a new database password. Nobody ever needs to memorize it or type it, so we'll make a strong one:
~/arvados/services/api$ ruby -e 'puts rand(2**128).to_s(36)'
6gqa1vu492idd7yca9tfandj3
Create a new database user with permission to create its own databases.
~/arvados/services/api$ sudo -u postgres createuser --createdb --encrypted --pwprompt arvados
[sudo] password for you: yourpassword
Enter password for new role: paste-password-you-generated
Enter it again: paste-password-again
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
Configure API server to connect to your database by creating and updating @config/database.yml@. Replace the @xxxxxxxx@ database password placeholders with the new password you generated above.
~/arvados/services/api$ cp -i config/database.yml.sample config/database.yml
~/arvados/services/api$ edit config/database.yml
Create and initialize the database.
~/arvados/services/api$ RAILS_ENV=development bundle exec rake db:setup
Set up omniauth:
~/arvados/services/api$ cp -i config/initializers/omniauth.rb.example config/initializers/omniauth.rb
Edit @config/initializers/omniauth.rb@. Set @APP_SECRET@ to the value of @app_secret@ from "installing the single sign on server":install-sso.html . You can now run the development server:
~/arvados/services/api$ bundle exec rails server --port=3030
h3. Apache/Passenger (optional) You can use "Passenger":https://www.phusionpassenger.com/ for deployment. Point it to the services/api directory in the source tree. To enable streaming so users can monitor crunch jobs in real time, add to your Passenger configuration in Apache:
PassengerBufferResponse off
h2(#admin-user). Add an admin user Point your browser to the API server's login endpoint:
https://localhost:3030/login
Log in with your google account. Use the rails console to give yourself admin privileges:
~/arvados/services/api$ bundle exec rails console
irb(main):001:0> Thread.current[:user] = User.all.select(&:identity_url).last
irb(main):002:0> Thread.current[:user].is_admin = true
irb(main):003:0> Thread.current[:user].update_attributes is_admin: true, is_active: true
irb(main):004:0> User.where(is_admin: true).collect &:email
=> ["root", "your_address@example.com"]