I started looking for a replacement solution for Evernote that can store local notes or a personal web server. And that was how I discovered Leanote – an open source “inspired by Evernote” (this is how the developer presents it), with several additional features:
• local installation or personal web server;
• a more powerful text editor and more options;
• a markdown editor;
• possibility to edit in a similar way to vim or emacs;
• the opportunity to share notes and collaborate with colleagues;
• multiplatform application: for Linux, iOS and Windows;
• blogging: Publishing notes and creating a personal blog.
Leanote installation can be made from binary or from sources. The best way to install it is using binary files, so I’ll refer to it.
Installing MongoDB
Whether we install locally or on the web server, we will need to install the database – mongodb. In Arch Linux we find it in the community repository.
After installing mongodb, we need to start the service. Starting the service in Ubuntu/Fedora/CentOS/Red Hat:
sudo systemctl start mongod
Starting the service in Arch Linux:
sudo systemctl start mongodb
We will enable the service to start after a possible reboot of the machine (mongod or mongodb, as the case may be):
sudo systemctl enable mongod/mongodb
For checking the installation of mongodb:
$> Mongo
>show dbs
admin 0.000GB
local 0.000GB
The mongodb database configuration file is located at: /etc/mongod.conf or /etc/mongodb.conf.
Local installation of Leanote
tar xvfz download
Delete the archive:
rm -f download
Importing the original Leanote data
It is very simple – in the console we will write the command below:
$> mongorestore -h localhost -d leanote –dir the_path_to_the_LEANOTE_directory/mongodb_backup/leanote_install_data/
Now, Mongodb will create a new database. To view it:
$>mongo
> show dbs
admin 0.000GB
leanote 0.003GB
local 0.000GB
To tell Mongodb to use the new database:
use leanote
switched to db leanote
To display collections (a MySQL table):
show collections
albums
attachs
blog_comments
blog_likes
blog_singles
configs
email_logs
[…]
The configuration of Leanote
The application configuration file is located at the_path_to_the_LEANOTE_directory/conf/app.conf
I recommend changing app.secret with a number of other characters, but also changing the port on which the application will run (by default, Leanote is running on port 9000 – you can put any other port you want).
Run Leanote
Navigate to the directory where you unzipped the application, then in the bin and run the run.sh script:
$ cd the_path_to_the_LEANOTE_directory/bin
$> bash run.sh
The new service Leanote
I preferred to make a service running on a permanent basis. In CentOS or Arch Linux, you have to create a file named leanote.service in the /usr/lib/systemd/system directory (in Ubuntu this file will be in /lib/systemd/system/):
sudo vim /usr/lib/systemd/system/leanote.service
Inside it, you will write the following:
[Unit]
Description=Leanote
After=mongod.service
[Service]
Type=simple
ExecStart=the_path_to_the_LEANOTE_directory/bin/run.sh
[Install]
WantedBy = default.target
Now run the run.sh file:
sudo chmod + x the_path_to_the_LEANOTE_directory/bin/run.sh
Start the leanote.service and make sure it will start every time you will turn on your computer:
sudo systemctl start leanote.service
sudo systemctl enable leanote.service
sudo systemctl status leanote.service
At this point we have two services that run permanently and ensure the operation of Leanote: mongod.service and leanote.service.
In the browser, navigate to http://localhost:9000 (or the port you have set it to). A Leanote window will appear.
At the first use of Leanote you will need to create a local account; click Sign up and enter an email address and a password, then sign in using the Sign in button. You will then enter the application.