项目地址:https://github.com/leanote/leanote

1. Download the binary file of Leanote

Choose and download the binary file corresponding to your system from here.
Suppose it is saved in the /home/user1 folder, extract the .zip file there using:

  1. $> cd /home/user1
  2. $> unzip master.zip

This will create a Leanote directory under /home/user1.


2. Install the database — Mongodb

2.1 Download Mongodb and configure

You could download a more up-to-date version from the official site of Mongodb. Or, you could use the following links to get the versions that are validated to be working by the developers.
Fast download:

Save the file to /home/user1, then extract it:

  1. $> cd /home/user1
  2. $> tar -xzvf mongodb-linux-x86_64-3.0.1.tgz/

To make sure that you can reference the Mongodb command from anywhere, configure its environment variable by editing your ~/bash_profile or /etc/profile:

  1. sudo vim /etc/profile

Here I’m using the vim editor, feel free to use whatever text editor you prefer (e.g. nano). Add the following line to the file, and remember to replace with you own username and version strings:

  1. export PATH=$PATH:/home/user1/mongodb-linux-x86_64-3.0.1/bin

To make your modification take effect:

  1. $> source /etc/profile

2.2 Test Mongodb installation

To verify the installation of mongodb, make a new folder (e.g. data) under /home/user1 to store data:

  1. $> mkdir /home/user1/data

Then start the Mongodb database server. You might want it to run in the background, so append & to the end:

  1. $> mongod --dbpath /home/user1/data &

Now Mongodb is up and running, you can open a new terminal (or in the same terminal session if you have mongod run in the background) and launch it:

  1. $> mongo
  2. > show dbs

Should no error pops up, your Mongodb installation is complete, let’s import initial data to Mongodb.


3. Import initial Leanote data

Leanote‘s initial data is stored in PATH_TO_LEANOTE/mongodb_backup/leanote_install_data
Open a terminal and paste in the following command to import initial data. Note the difference between the version 2 and 3 of Mongodb:

  1. $> mongorestore -h localhost -d leanote --dir PATH_TO_LEANOTE/mongodb_backup/leanote_install_data/

Now Mongodb has created a Leanote database, you can have a peek into it, for instance query how many tables leanote database has:

  1. $> mongo
  2. > show dbs
  3. leanote 0.203125GB
  4. local 0.078125GB

Tell Mongodb to use our newly created leanote database:

  1. > use leanote
  2. switched to db leanote

Bit more playing around:

  1. > show collections # a collection in Mongodb is a table in mysql
  2. files
  3. has_share_notes
  4. note_content_histories
  5. note_contents
  6. notebooks
  7. ...

The initial users table has two accounts:

  1. user1 username: admin, password: abc123 (administrator who can manage Leanote)
  2. user2 username: demo@leanote.com, password: demo@leanote.com (just for demonstration)

4. Configure Leanote

The configuration of Leanote is controlled by this file: PATH_TO_LEANOTE/conf/app.conf.
One setting that you are strongly suggested to modify is app.secret, please change arbitrary number of digits of the string to something different, but keeping the string length unchanged. This is to avoid potential security issues.
Other optional changes you can make includes db.username, db.password (more on these in the Trouble Shooting section) and etc..


5. Run Leanote

If you have successfully come to this stage, there is just one more step to go:

  1. $> cd /home/user1/leanote/bin
  2. $> bash run.sh

If you see a message similar to this, Leanote has started successfully:

  1. ...
  2. TRACE 2013/06/06 15:01:27 watcher.go:72: Watching: /home/user1/leanote/bin/src/github.com/leanote/leanote/conf/routes
  3. Go to /@tests to run the tests.
  4. Listening on :9000...

Congratulations, now fire up you browser and enter http://localhost:9000 into the address bar. Voilà! Welcome to Leanote and happy note-taking!