-
Notifications
You must be signed in to change notification settings - Fork 245
How to Install & Run OpenFarm on an Ubuntu System
Follow these instructions to install and run OpenFarm (and the software it depends on) on an Ubuntu-like Linux system:
1. Install Git
sudo apt-get install git
2. Install Ruby
sudo apt-get install ruby
3. Install Rails
sudo apt-get install rails
4. Install ElasticSearch
This is more complex as ElasticSearch is not found in standard Ubuntu repositories. If you try to simply apt-get install
you will see the error “E: Unable to locate package elasticsearch”. Instead, enter the following commands, which will add ElasticSearch’s repository to apt and will install and configure ElasticSearch appropriately:
wget -qO - https://packages.elasticsearch.org/GPG-KEY-elasticsearch | sudo apt-key add -
sudo add-apt-repository "deb http://packages.elasticsearch.org/elasticsearch/1.4/debian stable main"
sudo apt-get update && sudo apt-get install elasticsearch
sudo update-rc.d elasticsearch defaults 95 10
5. Install MongoDB
Use the following commands to install MongoDB:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install -y mongodb-org
To install OpenFarm, enter these commands:
git clone https://github.com/openfarmcc/OpenFarm.git
cd OpenFarm
bundle install
First, install RVM:
gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
sudo apt-get install curl
curl -sSL https://get.rvm.io | bash -s stable
Then restart your terminal so that RVM commands will work, and issue this command:
rvm install ruby-2.2.0
Next, adjust your terminal (a.k.a. shell, console) settings:
- Open a terminal, or click on your terminal so that it gets focus.
- From the terminal application menu, select Edit > Profile Preferences.
- Select the Title and Command tab.
- Check the box labeled Run command as a login shell.
- Exit and restart the terminal.
Next, adjust OpenFarm:
cd OpenFarm
rvm --default use 2.2.0
And try again:
bundle install
If you get an error of this sort, you may need to install patron separately. Do this with the following command:
sudo gem install patron
If you get an error of this sort, you may need to install libcurl separately. Do this with the following commands:
sudo apt-get install libcurl3 libcurl3-gnutls libcurl4-openssl-dev
sudo gem install patron
bundle install
rake db:setup
echo "ENV['SECRET_KEY_BASE'] = '$(rake secret)'" >> config/app_environment_variables.rb
Then start the server:
rails s
This is a problem with ElasticSearch. This may be because it is not running. You can check if ElasticSearch is running by issuing the following command:
curl http://localhost:9200
If that command returns a 200 HTTP status code, ElasticSearch is running. If you instead see a message like "curl: (7) Failed to connect to localhost port 9200: Connection refused" this indicates that ElasticSearch is not running.
If ElasticSearch is running but you still encounter this error, try setting an environment variable to explicitly point to the correct location by adding the following line to the file config/app_environment_variables.rb
:
ENV['ELASTICSEARCH_URL'] = 'http://127.0.0.1:9200'
If ElasticSearch is not running, you can start it with the following command:
sudo /etc/init.d/elasticsearch start
If the process fails because Java is not installed, install it with the following commands:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installerx
export JAVA_HOME=jdk-install-dir
export PATH=$JAVA_HOME/bin:$PATH
Then start ElasticSearch with this command:
sudo /etc/init.d/elasticsearch start
And finally start the server:
rails s
An error of this sort will look something like this:
Failed - /home/roryaronson/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- rails/cli (LoadError)
from /home/roryaronson/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/bin/rails:7:in `<main>'
If you get an error of this sort, try re-bundling with the following command:
bundle install
A failure of this sort will look something like this:
Gem::RemoteFetcher::FetchError: Errno::ETIMEDOUT: Connection timed out - connect(2) for "rubygems.org" port 443 (https://rubygems.org/gems/railties-4.0.2.gem)
An error occurred while installing railties (4.0.2), and Bundler cannot
continue.
Make sure that `gem install railties -v '4.0.2'` succeeds before bundling.
This usually indicates a transient network error. Try issuing the bundle command again or perhaps waiting a while first to see if the problem goes away before reissuing the command.
An error of this sort will look something like this:
Failed - Gem::RemoteFetcher::FetchError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server session ticket A (https://rubygems.global.ssl.fastly.net/gems/tzinfo-0.3.41.gem)
An error occurred while installing tzinfo (0.3.41), and Bundler cannot continue.
Make sure that `gem install tzinfo -v '0.3.41'` succeeds before bundling.
If you get an error of this sort, you may need to explicitly install tzinfo. Do this with the following command:
gem install tzinfo
Then re-bundle with the following command:
bundle install
If that fails, one more thing you can try is to manually install the AWS SDK before making another re-bundling attempt. Do this with the following commands:
gem install aws-sdk-v1 -v '1.55.0'
bundle install
Next, try starting the server:
rails s
If this succeeds, the next step is to issue the following command:
rake db:setup
That should do the trick.
About OpenFarm
Development
- How to Contribute to OpenFarm
- Code of Conduct
- How to Install & Run OpenFarm on an OS X system and on an Ubuntu System
- Troubleshooting Common Issues
- How to Set Up an Amazon S3 Bucket for Use with OpenFarm
- Modular CSS
- The OpenFarm API and API Documentation
- How to Use Docker and Fig
Deployment
Reference