Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ permalink: /
>
> 本站地址:[https://codefather.cn](https://codefather.cn)

## 🌐 Translations

[English](./translations/en/README.md)

---


## 本站内容

- [编程学习路线](/学习路线)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
# Build a Cloud Note for Your Girlfriend in 3 Minutes!

> Author: [Programmer Yupi](https://yuyuanweb.feishu.cn/wiki/Abldw5WkjidySxkKxU2cQdAtnah)
>
> Website: [https://codefather.cn](https://codefather.cn)

Hello everyone, I'm Yupi. In the last post, I shared [6 Open-Source Note-Taking Software](http://mp.weixin.qq.com/s?__biz=MzI1NDczNTAwMA==&mid=2247503596&idx=2&sn=1c2f4d1b16631e9a5036e7b7774cfa59&chksm=e9c2291bdeb5a00d680292395cd4e6d1c91ad30d2ae55f7295a77b5cd1ac38e9b6debf905fa6&scene=21#wechat_redirect) and asked everyone to rate them.

The highest-rated one was Leanote Cloud Note, which has over 10,000 stars on GitHub. Let's take a look at the result:

![](https://pic.yupi.icu/5563/202311090919781.png)

With this private cloud note, you can record and share content anytime, anywhere, making it very convenient.

So today, I'll guide you step-by-step on how to set it up. The entire process is very simple and can be completed in just 3 minutes. No specialized knowledge is required, so feel free to follow along if you're interested.

> Video Tutorial: https://www.bilibili.com/video/BV1134y1R72i/

## Setting Up the Cloud Note

### 0. Preparation

First, open the Leanote project (https://github.com/leanote/leanote) and find the installation documentation in the project description.

It supports multiple operating systems. If you have a Linux server, you can install it directly on the server to ensure 24/7 operation. If not, you can also install it on your local computer.

There are two installation methods: package installation and source code installation. It is recommended to choose the former:

![](https://pic.yupi.icu/5563/202311090919750.png)

> Installation Documentation

Below, I'll mainly demonstrate the installation process on a Linux server.

### 1. Download the Project

You can manually find the download links for different versions of the installation package in the installation documentation, download it to your computer, and then upload it to the server.

Of course, a simpler way is to directly use the `wget` command on the server to download the installation package:

```
wget https://udomain.dl.sourceforge.net/project/leanote-bin/2.6.1/leanote-linux-amd64-v2.6.1.bin.tar.gz \
--no-check-certificate
```

Remember to add the `--no-check-certificate` option to the command; otherwise, the download might fail.

The download process looks like this:

![](https://pic.yupi.icu/5563/202311090919811.png)

Once the installation package is successfully downloaded, use the `tar` command to extract it:

```
tar -zxvf \
leanote-linux-amd64-v2.6.1.bin.tar.gz
```

Then, use the `ls` command to see the extracted project directory:

![](https://pic.yupi.icu/5563/202311090919747.png)

### 2. Start the Database

Since the project uses `Mongodb` to store note resources, we need to install it next.

#### 2.1 Install the Database

First, use the wget command to quickly download the Mongodb installation package to your server (or computer):

```
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.1.tgz
```

Then extract it:

```
tar -xzvf \
mongodb-linux-x86_64-3.0.1.tgz
```

Using the ls command, you can see the extracted mongodb directory:

![](https://pic.yupi.icu/5563/202311090919744.png)

Next, you need to use a command to start the database service, but the command file is located in the mongodb directory, and you have to enter that directory every time to execute it, which is very inconvenient!

Therefore, you can modify the `/etc/profile` file to configure the environment variable for the mongodb command:

```
# Modify the environment configuration file
sudo vim /etc/profile
```

After entering the text editor, press the arrow keys or directly `shift + g` to reach the bottom of the file, then press `o` to add a new line, and add your mongodb location to the environment variable:

```
export PATH=$PATH:$HOME/mongodb-linux-x86_64-3.0.1/bin
```

As shown:

![](https://pic.yupi.icu/5563/202311090919732.png)

> Add Environment Variable

Then press `esc`, and enter `:wq`, then press Enter to save and exit the editor:

![](https://pic.yupi.icu/5563/202311090919517.png)

> Exit Editor

Then use the `source` command to activate the configuration:

```
source /etc/profile
```

#### 2.2 Test

Next, create a `data` directory in the current directory to store data files:

```
mkdir data
```

Use the ls command to view the newly created directory:

![](https://pic.yupi.icu/5563/202311090919545.png)

Then use the `mongod` command to start the database, specifying the data directory as the storage location for data files. Remember to add a `$` symbol to indicate starting the database in the background:

```
mongod --dbpath data &
```

You'll see a lot of startup information:

![](https://pic.yupi.icu/5563/202311090919626.png)

> Start Database

Then enter the `mongo` command to connect to the started database:

```
mongo
```

You can enter `show dbs` to view the space occupied by data files:

![](https://pic.yupi.icu/5563/202311090919585.png)

### 3. Import Data

Next, you need to import the initial data of the Leanote application into the database, such as the initial account name and password.

Use the `mongorestore` command, with the -h parameter specifying the connection to the local database, -d specifying the database name, and --dir specifying the data files to import:

```
mongorestore -h localhost \
-d leanote \
--dir leanote/mongodb_backup/leanote_install_data/
```

After successful import, use the mongo command to connect to the database again, and you can see the imported collections and data:

![](https://pic.yupi.icu/5563/202311090919672.png)

> Imported Data

### 4. Modify Configuration

Next, you can modify the application's configuration, such as the startup port, domain name, security key, etc.

Use the vim command to edit the `${your leanote path}/conf/app.conf` file:

![](https://pic.yupi.icu/5563/202311090919709.png)

> Configuration File

If there are no special requirements, you can skip this step.

### 5. Start the Application

Finally, enter the project's bin directory and execute the startup script:

```
# Switch directory
cd leanote/bin
# Execute the startup script in the background
bash run.sh &
```

You'll see a lot of output, which you can ignore:

![](https://pic.yupi.icu/5563/202311090919317.png)

At this point, the project has been successfully started. Enter `http://${your server address or localhost}:9000` in your browser to access the cloud note. Explore it thoroughly!

If you cannot access the application:

1. Use the `netstat -ntlp` command to check if another application is already using port `9000`. If the port is occupied, you can modify the port number in the configuration file in the previous step and restart.

2. Go to your server provider's control panel and open port 9000 in the firewall.

------

That's all for this sharing. If it was helpful, please give Yupi a **like + follow**. Thank you!

![](https://pic.yupi.icu/5563/202311090919300.png)