-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
These instructions are written for Ubuntu 16.04. If you require any platform-specific assistance in setting DIMEdb up, please feel free to open an issue.
For ease of management, we recommend setting up and using a Python virtual environment. virtualenv
allows users to set up multiple Python projects that have entirely different requirements on the same system.
To set up a virtual environment, first you will need to install pip, the package management tool for python.
sudo apt-get install python-pip
Once you have done that, you can then install virtualenv using the following command:
pip install virtualenv
You then need to set up a directory to store your virtual environments, create one and navigate to it using:
mkdir ~/PythonEnvironments && cd ~/PythonEnvironments
Once this has completed, create a new virtual environment:
virtualenv dimedb
Once that has completed, activate the environment:
source dimedb/bin/activate
Now, install the requisites using the provided requirements.txt
file:
pip install -r /dir/to/dimedb/requirements.txt
All of the requirements should now install. To exit the virtual environment, just type deactivate
.
MongoDB is already included in the standard Ubuntu package repository, but the recommended installation source is from the official MongoDB repository.
To do this, firstly you are required to import the key for the official MongoDB repository to your sources list.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
Now you are required to add the repository details through the addition of the packages list.
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list && sudo apt-get update
Once completed, you can now install the MongoDB package.
sudo apt-get install -y mongodb-org
We're not quite finished(!) We now need to tell systemd
how to manage the resource.
First of all, create a new service
file in the /etc/systemd/system/
directory.
sudo vim /etc/systemd/system/mongodb.service
Paste in the following text.
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf
[Install]
WantedBy=multi-user.target
Then save and close the file (for the vim virgins to do this press Esc
and then type :wq
).
Now set up the service to run by default.
sudo systemctl start mongodb && sudo systemctl enable mongodb
mongoimport --db dimedb --collection metabolites --type json --file dimedb.json --jsonArray
PostgreSQL, often simply Postgres, is an object-relational database management system (ORDBMS) with an emphasis on extensibility and standards-compliance. As a database server, its primary function is to store data securely, supporting best practices, and to allow for retrieval at the request of other software applications. It can handle workloads ranging from small single-machine applications to large Internet-facing applications with many concurrent users.
To install PostgreSQL 9.5, add the official PostgreSQL apt repository to your sources file using the following commands.
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -
Once you've added the official PostgreSQL repository to your system, you are required to update your system to install it.
You can do this with the following commands.
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
DIMEdb also makes use of the PostgreSQL development toolkit, so you need to install that too using the following command.
sudo apt-get install postgresql-server-dev-9.5
After installing PostgreSQL database server, by default it creates a user ‘postgres’ with role ‘postgres’. It also creates a system account with same name ‘postgres’. So to connect to postgres server, login to your system as user postgres and connect database.
sudo -i -u postgres
Now to create a user for DIMEdb, I'd recommend using the createuser
command.
createuser --interactive
Once you've set up a new psql user, you now need to create the database using the following commands.
createdb dimedb
psql -d dimedb
And now you need to attach a password to your user account, using the following command.
ALTER USER uid WITH PASSWORD 'password';
Ensuring to replace uid
and password
to your credentials.