Linux -- Basic Application Statistics

Article directory

11. Build personal Leanote cloud notebook

Leanote It is the most bigger's cloud notes found so far, with the capabilities of markdown input, code highlighting, multi person collaboration, note history, note navigation, direct publishing to blog and so on.

Download and start MongoDB (Leanote relies on MongoDB as data store)

cd /home


tar -xzf mongodb-linux-x86_64-3.0.1.tgz

mkdir -p /data/db

Configure environment variables for MongoDB

echo 'export PATH=$PATH:/home/mongodb-linux-x86_64-3.0.1/bin' >> /etc/profile

source /etc/profile

Install leavenote

cd /home


tar -zxvf leanote-linux-amd64-v2.4.bin.tar.gz

vim /home/leanote/conf/app.conf
 # Search for the app.secret = item and change it to the following:

Initialize the database and start the notes service

mongorestore -h localhost -d leanote --dir /home/leanote/mongodb_backup/leanote_install_data/

nohup /bin/bash /home/leanote/bin/ >> /var/log/leanote.log 2>&1 &

Visit the leavenote cloud notebook


sign in

Enter the user name (admin) and password (abc123)

12. Building Firekylin personal blog

Firekylin is an open-source NodeJS blog system developed based on ThinkJS. You can quickly build your own firekylin personal blog from scratch. For more information, see

Purchase domain name, domain name resolution and ping test

yum install Node.js

curl --silent --location | sudo bash -

yum -y install nodejs

PM2 installation with NPM (some slow)

Install process management module PM2 through NPM. It is a process management module of Node.js, which is used to manage our personal website process

npm install pm2 -g

yum install mysql, start MySQL service, set MySQL account root password


rpm -ivh mysql-community-release-el7-5.noarch.rpm

yum install mysql-community-server -y

service mysqld restart

/usr/bin/mysqladmin -u root password ''

Source code installation Nginx

yum -y install pcre* zlib-devel openssl*

tar -zxf nginx-1.11.5.tar.gz -C /usr/src/

cd /usr/src/nginx-1.11.5/

./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-pcre

make && make install

useradd -r nginx

ln -s /usr/local/nginx/sbin/nginx /usr/sbin/

Unzip Firekylin, install program dependency, copy PM2 default.json file under the project to generate a new file pm2.json


tar zvxf latest.tar.gz

cd firekylin && npm install

cp pm2_default.json pm2.json

Modify the cwd configuration value in pm2.json file to the current path of the project / root/firekylin

  "apps": [{
    "name": "firekylin",
    "script": "www/production.js",
    "cwd": "/root/firekylin",
    "exec_mode": "fork",
    "max_memory_restart": "1G",
    "autorestart": true,
    "node_args": [],
    "args": [],
    "env": {


Then start the project with the following command

pm2 startOrReload pm2.json

Firekylin has been started successfully. You can directly access http: / / < your CVM IP address >: 8360 / with a browser to see the configuration interface of firekylin.

13. Experience CVM of CentOS system

Cloud server (Cloud Virtual Machine, CVM) provides you with secure and reliable elastic computing services. In just a few minutes, you can acquire and enable CVM in the cloud to meet your computing requirements.
Experience CVM with WebIDE

Access directly in browser Website

Select Region (currently only one Hangzhou can choose)

Create a Host, execute a command on your machine to install ide agent to achieve the effect

1. Click the "+" sign in the Hosts view to create a Host, copy the commands in the dialog box and execute them in the local command line terminal.

2. After successful execution, the command will output a prompt message, in which you will be prompted to add the PATH / Users/kevin/.ide_home/bin, 
/Users/kevin/.ide_home/bin is my local path. Your path will be a little different from mine, whichever you see,
The ide start command can only be executed after it is added to the PATH correctly, otherwise the command will be reported as no error
 (there will be differences in the path under windows system, mainly the content output by the console).

3. Next, run the command ide start on the local command line terminal to start the IDE agent service. At this time, on the WebIDE interface,
You can see that the host icon turns green (green icon indicates that the host is online, gray indicates that the host is offline).

4. Return to the WebIDE interface, click OK in the dialog box or click refresh in Hosts view to see your newly registered host.

Be careful:

Currently supports Mac and Linux, Windows 10 Pro, Enterprise, or Education.

Because the environment depends on docker and docker compose, it needs to be installed in advance.
Where docker version > = 1.13.0, docker compose version > = 1.11.0.

Modify PATH on Mac and Linux systems. If the shell is bash, you can modify the file ~ /. bashrc, and append PATH=$PATH:/Users/kevin/.ide_home/bin to the end of the file ~ /. bashrc. If the shell is zsh, you can modify ~ /. zshrc. /Users/kevin/.ide_home/bin is my local PATH. Your PATH will be a little different from mine, subject to what you see. If it is Windows, you need to set the environment PATH.

14. Maven installation and getting started

Apache Maven is a software project management and auto build tool provided by the Apache Software Foundation.


[root@localhost ~]# tar -zxf apache-maven-3.6.0-bin.tar.gz 
[root@localhost ~]# mv apache-maven-3.6.0/ /usr/local/maven
[root@localhost ~]# echo 'export PATH=$PATH:/usr/local/maven/bin' >> /etc/profile
[root@localhost ~]# source /etc/profile
[root@localhost ~]# mvn -v

Deploy java project

[root@localhost ~]# mkdir /tmp/test
[root@localhost ~]# cd /tmp/test
[root@localhost test]# mvn archetype:generate -DgroupId=com.kgc.kgcapp -DartifactId=kgcapp -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false		#Networking, waiting for download to complete

# archetype:generate operation type: generate means to create a project, old version maven, here is create
# -DgroupId=com.kgc.kgcapp project name
# -DartifactId=kgcapp project child name
# -Darchetypeartifactid = Maven archetype QuickStart framework for project creation
# -DinteractiveMode=false whether to create a project in interactive mode

15. Building a Laravel environment

Laravel is a concise and elegant PHP Web development framework. It can free you from the messy code like noodles; it can help you build a perfect Web APP, and each line of code can be concise and expressive.

Install EPEL and webstatic Libraries

yum install epel-release

rpm -Uvh

Install mariadb, start and self start, initialize (default root password is empty)

yum install mariadb mariadb-server -y 

systemctl start mariadb.service

systemctl enable mariadb.service


Install Apache, start and self start

yum install -y httpd

systemctl start httpd.service

systemctl enable httpd.service

Install PHP 7

yum install -y php70w php70w-mysql php70w-mcrypt php70w-dom php70w-mbstring

Install Composer and configure image acceleration (for subsequent php dependent library management), and configure domestic image source

curl -sS | php

mv composer.phar /usr/bin/composer

chmod +x /usr/bin/composer

composer config -g repo.packagist composer

Initialize the Laravel project

cd /var/www

composer create-project laravel/laravel test

cd test

chown apache:apache -R *
At this time, you can execute PHP artican serve -- host = to start the PHP server,
And visit http: / / < your CVM IP address >: 8000 to view your Laravel project.

In this way, we have completed the creation of a Laravel project.

16. Jenkins environment construction

Jenkins It is an open source software project. It is a continuous integration tool developed based on java. It is used to monitor the continuous and repeated work and aims to provide an open and easy-to-use software platform

① Method 1

#Memory 4G
wget -O /etc/yum.repos.d/jenkins.repo
rpm --import
yum -y install jenkins
systemctl start jenkins

② Method 2

Configure the environment of jdk (java development kit)

tar -zxf jdk-8u201-linux-x64.tar.gz -C /usr/local/

vim /etc/profile
export JAVA_HOME=/usr/local/jdk1.8.0_201/		#Declaration variable, installation path
export JRE_HOME=/usr/local/jdk1.8.0_201/jre		#jre (java runtime environment) running environment
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar		#Compile, tell class file location
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH	#Similar to soft connection
source /etc/profile

java -version

Download the official yum file, specify the download path and rename; connect to the Internet, and move the contos source out

[root@gitlab ~]# wget -O /etc/yum.repos.d/jenkins.repo	

Import the secret key required for yum file validation

[root@gitlab ~]# rpm --import


yum -y install jenkins


[root@localhost ~]# yum -y localinstall jenkins-2.190.2-1.1.noarch_2.rpm

[root@gitlab ~]# systemctl start jenkins	#Restart Jenkins
[root@gitlab ~]# systemctl stop firewalld	#Turn off firewall
[root@gitlab ~]# setenforce 0	#Closing sandbox

Firefox access, IP is the local IP, Jenkins default port 8080

Problem installing plug-in: Red Cross
 1. After the steps are completed, click retry at the bottom right to check again
 2. If there are other problems, baidu

17. Build wechat applet service

There is no doubt that applets are a major hot spot on the Internet this year. This experiment takes you from scratch to build a service based on NodeJS that can support the running of applets, including HTTPS deployment, session service and WebSocket service. Finally, use these services to realize a real-time scissors and stone cloth game.

18. Build wechat AI robot

This experiment takes you step by step to realize WeChat AI robot. During this period, it introduced the application of official account, application robot, how to configure the official account background, how to call robot API and so on.

19. Set up wechat subscription number background service

WeChat official account background Sometimes our own functions may not meet our needs. At this time, we need to build our own server.

Apply for wechat personal subscription number

register Developer account (three fields need to be obtained: AppID, Token and EncodingAESKey)
① AppID: log in to wechat public platform and enter development basic configuration in turn to get AppID

② In the basic configuration server configuration modify configuration form
URL fill in the domain name applied in the first step;
The Token user fills in according to the prompt, which is used to later verify the validity of the server;
EncodingAESKey click the random Build button to generate



Build HTTP service (use Node and Express to build an HTTP server)

Install NodeJS and NPM

curl --silent --location | sudo bash -

yum install nodejs -y

Write HTTP Server source code (add the name and version number of the server package)

mkdir -p /data/release/weapp

cd /data/release/weapp

vim package.json
    "name": "weapp",
    "version": "1.0.0"

Add Server source code

vim app.js
// Quote express To support HTTP Server Implementation
const express = require('express');

// Reference wechat public platform automatic reply message interface service middleware
var wechat = require('wechat');

// Create a express Example
const app = express();

// Configure wechat public platform parameters, and obtain them in the second step of the tutorial
var config = {
    token: 'youadminwen', // Fill in the `token`
    appid: 'wx52843a03b58edc4c', // Fill in the `appid`
    encodingAESKey: 'e31T2gWV6mBsSu1Dut8ufDPs1VlgooGIyoej2pa0IOc', // Fill in the`encodingAESKey`
    checkSignature: true // Optional, default is true. Since wechat public platform interface debugging tool does not send signature in clear text mode, please set it to false 


app.use('/', wechat(config, function (req, res, next) {
        content: 'Hello, Hello World!',
        type: 'text'

// Listening port, waiting for connection
const port = 5050;

// Output server startup log
console.log(`Server listening at${port}`);

Install PM2

npm install pm2 --global

Installing Express

cd /data/release/weapp

npm install express --save

20. Building Discuz Forum

Discuz It is a forum tool based on PHP web page, which can be deployed on both Linux and windows platforms.

Domain name resolution (I set it up in Alibaba cloud)

yum install mysql, start MySQL service, set MySQL account root password, and set power on auto start


rpm -ivh mysql-community-release-el7-5.noarch.rpm

yum install mysql-community-server -y

service mysqld restart

/usr/bin/mysqladmin -u root password ''

chkconfig mysqld on

yum install Apache components, start, set power on and self start

yum install httpd -y

service httpd start

chkconfig httpd on

Install PHP, start the PHP-FPM process, view the port, and set it to start automatically after power on

yum install php php-fpm php-mysql -y

service php-fpm start

netstat -anput | grep php-fpm

chkconfig php-fpm on

Installing Discuz



Configure Discuz (because PHP accesses / var/www/html / folder by default), authorize, restart Apache

cp -r upload/* /var/www/html/

chmod -R 777 /var/www/html

service httpd restart

Access IP and domain name

Published 5 original articles, won praise 0, visited 189
Private letter follow

Tags: yum jenkins MySQL PHP

Posted on Thu, 13 Feb 2020 06:11:16 -0500 by Chris92