3789
Comment:
|
2510
|
Deletions are marked like this. | Additions are marked like this. |
Line 3: | Line 3: |
<<TableOfContents>> | EMEN2 has a number of dependencies, which are described on the [[EMEN2/Dependencies|EMEN2 dependencies]] page. However, because EMEN2 is often used with EMAN2, we have packaged all of the EMEN2 dependencies along with binary builds of EMAN2, which greatly simplifies installation. See the installation note below. |
Line 5: | Line 5: |
Generally, you will want to create a user account for running emen2, e.g. 'emen2.' This has the benefit of working well with the default config file. Running as any other user also works fine, you will just have to change one or two paths in config.yml. | = Install EMEN2 = |
Line 7: | Line 7: |
=== 1. Install Dependencies === You will first need to install the various [[EMEN2/Dependencies|EMEN2 dependencies]]. They are all straight-forward to install, and can generally be installed using Python's easy_install system. === 2. Download EMEN2 === Download the latest EMEN2 source code release and untar http://ncmi.bcm.edu/ncmi/software/software_details?selected_software=EMEN2 |
EMEN2 can be installed using either Python easy_install: |
Line 18: | Line 10: |
cd /home/emen2 tar -xvzf emen2.03.28.2010.tar.gz cd emen2 |
sudo python -m easy_install emen2 |
Line 23: | Line 13: |
If there is an existing source tree installed, you may want to rename it in case you need to revert to the previous version, e.g. mv emen2 emen2.old.03.20.2010. If you have an existing EMEN2 environment, I strongly recommend taking an additional tar backup of that directory before proceeding, in addition to normal backup procedures (log archive, db hot backup) in case you need to revert without the difficulty of performing a full recovery from archives. === 3. Create EMEN2 Environment === You will need to create a directory for your EMEN2 environment. A reasonable default is /home/emen2/db. It is strongly recommended to set the DB_HOME environment variable to this path for convenience. You will also need to add the parent of the EMEN2 source directory to your PYTHONPATH environment variable. Adjust the paths below, and place in your .bash_profile: |
Or by downloading the source, unpacking, and using Python distutils: |
Line 36: | Line 16: |
export DB_HOME=/home/emen2/db export PYTHONPATH=$PYTHONPATH:/home/emen2/ |
python ./setup.py build sudo python ./setup.py install |
Line 40: | Line 20: |
Create the DB_HOME directory and copy the default configuration file. | '''Note: Installing EMEN2 with EMAN2''' If you are using an EMAN2 binary distribution to take care of all the dependencies, you will need to use EMAN2's Python environment on Linux and Windows. On Linux, assuming you installed EMAN2 into your home folder, you would use ~/EMAN2/Python/bin/python as the interpreter. This will ensure that the correct dependencies are loaded and EMEN2 is installed in the correct location. On Mac OS X, EMAN2 uses the system default Python environment, so no special action is required. = Quick Start = Here is a "quick start" guide to install EMEN2, initialize an EMEN2 DB, and start the web server. The "-h" argument in the scripts below are references to a directory to keep the EMEN2 DB; the directory will be created if it does not exist. |
Line 43: | Line 29: |
mkdir $DB_HOME cp config/config.sample.yml $DB_HOME/config.yml |
python -m emen2.db --create -h $HOME/testdb |
Line 47: | Line 32: |
This will prompt for a "root" email address and password, and create a minimal EMEN2 environment. The email address will be used for password recovery and system messages if a mail server is provided in the configuration. The password can be left empty, but the system will not be secure at all. | |
Line 48: | Line 34: |
=== 4. Edit Configuration === Edit the various settings in $DB_HOME/config.yml. See [[EMEN2/config.yml]]. Primarily, you will want to check the path and network settings. A simple configuration will have most EMEN2 directories (db, applog, archive, db_hotbackup, emen2files, etc.) placed under the path specified by the "&root" element, which is /home/emen2/ by default. |
You can also quickly access the native Python API, by running the module with the '-i' flag. The "-e" flag specifies a list of extensions to load. |
Line 53: | Line 37: |
root: &root /home/emen2/ |
python -i -m emen2.db -h $HOME/testdb -e default,em,eman2,site |
Line 57: | Line 40: |
=== 5. Initialize EMEN2 Environment === After config.yml is to your liking, run |
To start the EMEN2 web server with default settings: |
Line 64: | Line 43: |
python ./setup.py | python -m emen2.web.server -h $HOME/testdb -e default,em,eman2,site |
Line 67: | Line 46: |
The rest of the EMEN2 environment will be created, skeleton parameter/protocol definitions will be installed, and a root user created. You will be prompted on the shell for a root password. | You will be able to access the server at http://localhost:8080 |
Line 69: | Line 48: |
=== 6. Test Web Server === |
Another way to start the web server is to run it as a Twisted Application, using twistd. |
Line 74: | Line 51: |
python ./TwistSupport.py | twistd emen2 -h $HOME/testdb -e default,em,eman2,site |
Line 77: | Line 54: |
You should be able to connect to this web server instance once it is "listening..." The default port is 8080. You may login with the root password you specified previously. === 7. Optional: Import === You may want to import the parameter and protocol definitions from the EMEN2 installation at the NCMI. In the future, these will be published in an open format, and made available by default. {{{ python ./clients/clone.py -- --defs --host http://ncmidb.bcm.edu }}} Note: the first "--" is intentional and required at the moment. Command arguments for the local database go before "--", arguments to the cloning script go after ("--defs") You will be prompted for two sets of credentials. First, an NCMI DB account, and second, the root password for the local database. If you do not have an NCMI DB account, you may specify "anonymous" as the username, and your email address as the password. === 8. Run as daemon === After you are satisfied with your setup, you can run EMEN2 in the background {{{ python ./emen2control.py --start }}} |
This will daemonize emen2, and log all messages to a file. You can specifiy the "-n -o" flags to twistd to prevent daemon and print the log to stdout. |
Installing and configuring EMEN2
EMEN2 has a number of dependencies, which are described on the EMEN2 dependencies page. However, because EMEN2 is often used with EMAN2, we have packaged all of the EMEN2 dependencies along with binary builds of EMAN2, which greatly simplifies installation. See the installation note below.
Install EMEN2
EMEN2 can be installed using either Python easy_install:
sudo python -m easy_install emen2
Or by downloading the source, unpacking, and using Python distutils:
python ./setup.py build sudo python ./setup.py install
Note: Installing EMEN2 with EMAN2
If you are using an EMAN2 binary distribution to take care of all the dependencies, you will need to use EMAN2's Python environment on Linux and Windows. On Linux, assuming you installed EMAN2 into your home folder, you would use ~/EMAN2/Python/bin/python as the interpreter. This will ensure that the correct dependencies are loaded and EMEN2 is installed in the correct location. On Mac OS X, EMAN2 uses the system default Python environment, so no special action is required.
Quick Start
Here is a "quick start" guide to install EMEN2, initialize an EMEN2 DB, and start the web server. The "-h" argument in the scripts below are references to a directory to keep the EMEN2 DB; the directory will be created if it does not exist.
python -m emen2.db --create -h $HOME/testdb
This will prompt for a "root" email address and password, and create a minimal EMEN2 environment. The email address will be used for password recovery and system messages if a mail server is provided in the configuration. The password can be left empty, but the system will not be secure at all.
You can also quickly access the native Python API, by running the module with the '-i' flag. The "-e" flag specifies a list of extensions to load.
python -i -m emen2.db -h $HOME/testdb -e default,em,eman2,site
To start the EMEN2 web server with default settings:
python -m emen2.web.server -h $HOME/testdb -e default,em,eman2,site
You will be able to access the server at http://localhost:8080
Another way to start the web server is to run it as a Twisted Application, using twistd.
twistd emen2 -h $HOME/testdb -e default,em,eman2,site
This will daemonize emen2, and log all messages to a file. You can specifiy the "-n -o" flags to twistd to prevent daemon and print the log to stdout.