Original address: 3pub.cn/index.php/a…

The latest drain 2021 Alibaba Cloud CentOS7.7 1 core 1G LNMP installed PHP8.0

Tencent cloud activities spent 120 to buy a 1 core 2G cloud service, recording the whole process of installation for future preparation; Installation software configuration:

  • Nginx
  • Mysql
  • Redis
  • MongoDB
  • PHP7
    • swoole
    • yar
    • yac
    • yaf
    • redis
    • mongodb
  • PHP5
    • swoole
    • yar
    • yac
    • yaf
    • redis
    • mongodb
  • Python (python2.6 by default)
  • NodeJs
  • Lua
  • Supervisor
  • Golang
  • Git
  • NetCat

Preparations:

Viewing the Linux Version
[root@centos software]# cat /etc/issue CentOS release 6.8 (Final) Kernel on an mCopy the code
Install dependencies:
yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel enchant-devel pam-devel \ libc-client libc-client-devel libpng  libpng-devel freetype freetype-devel libpng \ libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel bzip2 \ bzip2-devel ncurses curl openssl-devel gdbm-devel db4-devel libXpm-devel \ libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel \ xmlrpc-c xmlrpc-c-develCopy the code

Create users and user groups

$groupadd WWW $useradd -g WWW WWW #Copy the code

Lua

Official website address:www.lua.org/download.ht…

$wget http://www.lua.org/ftp/lua-5.3.4.tar.gz $tar ZXF lua - 5.3.4. Tar. Gz [root @ centos lua - 5.3.4] # make Linux [root @ centos lua - 5.3.4] # make installCopy the code

Test ok

$lua Lua 5.3.4 Copyright (C) 1994-2017 Lua.org, puc-rio >Copy the code

Install luajitLuajit.org/download.ht…

$wget https://github.com/openresty/lua-nginx-module/archive/v0.10.15.tar.gz $tar ZXF v0.10.15. Tar. Gz $CD Lua-nginx-module-0.10.15 [root@centos lua-nginx-module-0.10.15]# make PREFIX=/usr/local/ [root@centos Lua - nginx - module - 0.10.15] # make install PREFIX = / usr/local /Copy the code

Nginx

$wget http://nginx.org/download/nginx-1.13.8.tar.gz -- 21:12:40-2018-03-06 Resolving http://nginx.org/download/nginx-1.13.8.tar.gz nginx.org... 95.211.80.227 206.251.255.63, 2001:1 af8:4060: a004:21: : e3,... Connecting to nginx.org | 95.211.80.227 | : 80... connected. HTTP request sent, awaiting response... 200 OK Length: 992237 (969K) [application/octet-stream] Saving to: "Nginx - 1.13.8. Tar. Gz" 100% [= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = >] 64.9 K/s in 992237 7.3s 2018-03-06 21:12:48 (132 KB/s) - saved [99223/992237] $tar ZXF nginx-1.13.8.tar.gz $CD Nginx-1.13.8 [root@centos nginx-1.13.8]# ls auto CHANGES changes.ru conf configure contrib HTML LICENSE man README SRCCopy the code

Prepare the required modules:

Ngx_devel_kit (NDK) module:Github.com/simpl/ngx_d…

Wget https://github.com/simplresty/ngx_devel_kit/archive/v0.3.1rc1.tar.gz tar - XZVF v0.3.1 rc1. Tar. GzCopy the code

Download the latest lua-nginx-Module module:Github.com/openresty/l…

Wget https://github.com/openresty/lua-nginx-module/archive/v0.10.12rc2.tar.gz.gz tar - XZVF v0.10.12 rc2. Tar. Download the latest gz # Redis2 nginx - the module module: https://github.com/openresty/redis2-nginx-module/releases wget https://github.com/openresty/redis2-nginx-module/archive/v0.15rc1.tar.gz tar ZXF v0.15 rc1. Tar. GzCopy the code

Download pcRE and compile:www.linuxfromscratch.org/blfs/view/s…

$wget https://downloads.sourceforge.net/pcre/pcre-8.41.tar.bz2 $tar JXF pcre - 8.41. Tar..bz2 $CD pcre - 8.41 $. / configure  --prefix=/usr/local/pcre --enable-utf8 --enable-unicode-properties $ make && make installCopy the code

Start loading nginx modules and compile parameters

$ ./configure --prefix=/usr/local/nginx --user=www --group=www \ --with-http_stub_status_module --with-http_ssl_module \ - with - pcre = / usr/local/SRC/pcre - 8.41 \ - add - the module = / usr/local/SRC/redis2 - nginx - module - 0.15 rc1 \ - add - the module = / usr/local/SRC/ngx_devel_kit - 0.3.1 rc1 \ - add - the module = / usr/local/SRC/lua - nginx - module - 0.10.12 rc2Copy the code

Set the soft chain

$ ln -s /usr/local/nginx/sbin/nginx  /usr/bin/nginx
$ which nginx
$ /usr/bin/nginx
Copy the code

Redis

# https://redis.io/download $wget http://download.redis.io/releases/redis-4.0.8.tar.gz $tar XZF redis - 4.0.8. Tar. Gz $ CD redis-4.0.8 $make $CD SRC $make install $CD.. $ mkdir -p /usr/local/redis/bin $ mkdir -p /usr/local/redis/ect $ cp redis.conf /usr/local/redis/ect/ $ mv mkreleasdhdr.sh redis-benchmark redis-check-aof redis-check-dump redis-cli redis-server redis-check-rdb redis-sentinel redis-trib.rb /usr/local/redis/bin $ ln /usr/local/redis/bin/redis-server /usr/bin/redis-server $ ln / usr/local/redis/bin/redis - cli/usr/bin/redis - cli $redis - server 6443:18 Mar 22:57:20 C. 008 # oO0OoO0OoO0Oo redis is # Redis version=4.0.8, bits=64, commit=00000000, modified=0, Pid =6443, just started 6443:C 18 Mar 22:57:20.008 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf 6443:M 18 Mar 22:57:20.009 # Not listening to IPv6: Unsupproted _) _ _) - ` ` __ '- _ _. - ` ` `. ` _.' '- _ Redis 4.0.8 (00000000/0), 64 - bit. - ` `. - ` ` `. ` ` ` \ / _, _' -. _ (', .-` | `, ) Running in standalone mode |`-._`-... - ` __... -.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 6443 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _. - '| ` - _ ` - _ ` - __. -' _. - '_. -' | | ` - _ ` - _ _. - '_. -' | ` - _ ` - _ ` - __. - '_. -' _. - '` - _ ` -. __. -' _. - '` -) _ _) -' ` - __. - ' 6443:M 18 Mar 22:57:20.011 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 6443:M 18 Mar 22:57:20.011 # Server initialized 6443:M 18 Mar 22:57:20.011 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. 6443:M 18 Mar 22:57:20.011 # WARNING You have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is Disabled. 6443:M 18 Mar 22:57:20.011 * Ready to accept connectionsCopy the code

Mysql

The official download the open source community free version download page dev.mysql.com/downloads/f… Cloud service download is too slow, local download is being uploaded to the server

Download the RPM package

https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.21-1.el6.x86_64.rpm-bundle.tar
Copy the code

Unpack the tar

$tar xf mysql-5.7.21-1.el6.x86_64. RPM -bundle.tar mysql-community-client-5.7.21-1.el6.x86_64. RPM Mysql - community - embedded - 5.7.21-1. El6. X86_64. RPM mysql - community - libs - compat - 5.7.21-1. El6. X86_64. RPM Mysql - community - common - 5.7.21-1. El6. X86_64. RPM mysql - community - embedded - devel - 5.7.21-1. El6. X86_64. RPM Mysql - community - server - 5.7.21-1. El6. X86_64. RPM mysql - community - devel - 5.7.21-1. El6. X86_64. RPM Mysql - community - libs - 5.7.21-1. El6. X86_64. RPM mysql - community - test - 5.7.21-1. El6. X86_64. RPMCopy the code

Install in the following order because there are dependencies between them

Common --> libs --> Clients --> server $RPM -ivh mysql-community-common-5.7.21-1.el6.x86_64.rpmCopy the code

Cause: This is due to an old version of GPG keys installed by yum

Reference Address:www.cnblogs.com/royfans/p/7…

$RPM -ivh mysql-community-libs-compat-5.7.21-1.el6.x86_64. RPM --force --nodeps $RPM -ivh Mysql -community-client-5.7.21-1.el6.x86_64. RPM --force --nodeps $RPM -ivh Mysql - community - server - 5.7.21-1. El6. X86_64. RPM -- force -- nodepsCopy the code

Check the installation

$which mysql /usr/bin/mysql $mysql -v mysql Ver 14.14 Distrib 5.7.21, for Linux (x86_64) using EditLine wrapperCopy the code

Start the mysql service

$ /etc/init.d/mysqld start Initializing MySQL database: [ OK ] Starting mysqld: [OK] $ps - aux | grep mysql root 24518 0.0 106216 0.0 1568 PTS / 1 S 01:22 0:00 / bin/sh/usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql mysql 24712 2.4 9.0 1171424 173212 PTS /1 Sl 01:22 0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log - pid - file = / var/run/mysqld/mysqld. Pid - socket = / var/lib/mysql/mysql. The sock root S + 24755 103320 888 PTS / 0.0 0.0 1 01:22 0:00 grep mysqlCopy the code

Changing the Mysql password

Viewing temporary Passwords
$grep password /var/log/mysqld.log 2018-03-19t17:22:19.429944z 1 [Note] A temporary password is generated for root@localhost: hqhY9>D+YvYZ $ mysql -h root -p set password = password("Mysql_123456");Copy the code

Create mysql user data directory

$ groupadd mysql
$ useradd -s /sbin/nologin -g mysql mysql
Copy the code
Create the data directory and mysql-files directory and change the permissions
$ mkdir -p /usr/local/mysql/data
$ mkdir -p /usr/local/mysql/mysql-files
$ chown -R root:mysql /usr/local/mysql
$ chown -R mysql:mysql /usr/local/mysql/data
$ chown -R mysql:mysql /usr/local/mysql/mysql-files
Copy the code

Supervisor

(Reference:Blog.csdn.net/xyang81/art…)

Install the Python package management tool (easy_install)

Easy_install is a command that comes with the setupTools package. Using easy_install actually calls setupTools to complete the module installation, so install setupTools.

$ wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py -O - | sudo python
Copy the code

The installation supervisor

$ easy_install supervisor
Copy the code

Run echo_supervisord_conf program to generate the supervisor initialization configuration file details view: supervisord.org/configurati…

$  mkdir /etc/supervisor
$  echo_supervisord_conf > /etc/supervisor/supervisord.conf
Copy the code

Starting the Supervisor Service

$ supervisord -c /etc/supervisor/supervisord.conf
Copy the code

PHP

Download the latest version php.net/get/php-7.2… Download version 5.6 at cn2.php.net/get/php-5.6…

$tar ZXF PHP - 7.2.3. Tar. Gz $CD PHP - 7.2.3 $wget - http://cn2.php.net/get/php-5.6.34.tar.gz/from/this/mirror - O c PHP - 5. Tar. Gz - 2018-03-22 00:27:43 - http://cn2.php.net/get/php-5.6.34.tar.gz/from/this/mirror Resolving cn2.php.net... 123.125.23.168, 123.125.23.169, 123.125.23.172,... Connecting to cn2.php.net | 123.125.23.168 | : 80... connected. HTTP request sent, awaiting response... 302 Found Location: http://cn2.php.net/distributions/php-5.6.34.tar.gz - 2018-03-22 00:27:43 - [following] http://cn2.php.net/distributions/php-5.6.34.tar.gz Connecting to cn2.php.net | 123.125.23.168 | : 80... connected. HTTP request sent, awaiting response... 200 OK Length: 19294951 (18M) [application/x-gzip] Saving to: "PHP - 5. Tar. Gz" 100% [= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = >] 19294951 2.44 M/s in 6.8 s 00:27:50 2018-03-22 (2.71 MB/s) - PHP-5.tar. gz saved [19294951/19294951 $tar ZXF php-5.tar.gzCopy the code

Install libmcrypt library

$ wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
$ tar xf libmcrypt-2.5.7.tar.gz
$ cd libmcrypt-2.5.7
$ ./configure
$ make && make install
Copy the code

Configure: WARNING: unrecognized options: –with-mcrypt php7.2 does not support these options

Solve installation problems:libxml2 configure: error: xml2-config not found. Please check your libxml2 installation.

 $ wget ftp://xmlsoft.org/libxml2/libxml2-2.9.1.tar.gz
 $ tar zxf libxml2-2.9.1.tar.gz
 $ cd libxml2-2.9.1
 $ ./configure
 $ make && make install
Copy the code
Create a directory
$ mkdir -p /usr/local/php7
$ mkdir -p /usr/local/php5
Copy the code

Install php7

$ ./configure --prefix=/usr/local/php7/ --with-config-file-path=/usr/local/php7/etc \ --with-config-file-scan-dir=/usr/local/php7/etc/conf.d --enable-fpm --with-fpm-user=www \ --with-fpm-group=www --enable-soap --with-openssl --with-openssl-dir --with-pcre-regex \ --with-zlib --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom \ --enable-exif --with-pcre-dir --enable-ftp --with-gd --with-jpeg-dir --with-png-dir \ --with-freetype-dir --with-gettext --with-gmp --with-mhash --enable-mbstring --with-libmbfl \ --with-onig --enable-pdo --with-pdo-mysql --with-zlib-dir --with-readline --enable-session \ --enable-shmop --enable-simplexml --enable-sockets --enable-sysvmsg --enable-sysvsem \ --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd \ --with-mysqli --without-pear --enable-pcntl --enable-bcmath  $ make && make installCopy the code

Installed php5

$ ./configure  --prefix=/usr/local/php5/ --with-config-file-path=/usr/local/php5/etc \
 --with-config-file-scan-dir=/usr/local/php5/etc/conf.d --enable-fpm --with-fpm-user=www \
 --with-fpm-group=www --enable-soap --with-openssl --with-openssl-dir --with-mcrypt \
 --with-pcre-regex --with-zlib --with-iconv --with-bz2 --enable-calendar --with-curl \
 --with-cdb --enable-dom --enable-exif --with-pcre-dir --enable-ftp --with-gd --with-jpeg-dir \
 --with-png-dir --with-freetype-dir --with-gettext --with-gmp --with-mhash --enable-mbstring \
 --with-libmbfl --with-onig --enable-pdo --with-pdo-mysql --with-zlib-dir --with-readline \
 --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sysvmsg \
 --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip \
 --enable-mysqlnd --with-mysqli --without-pear --enable-pcntl
Copy the code

Install PHP extensions

Redis extension

$wget http://pecl.php.net/get/redis-4.0.0.tgz $tar xf redis - 4.0.0. TGZ $CD redis - 4.0.0 $/ usr/local/php7 / bin/phpize $ ./configure --with-php-config=/usr/local/php7/bin/php-config $ make && make install $ make clean $ /usr/local/php5/bin/phpize $ ./configure --with-php-config=/usr/local/php5/bin/php-config $ make && make installCopy the code

Mongo extension

$tar xf mongo - 1.4.2. TGZ $CD mongo - 1.4.2 $/ usr/local/php7 / bin/phpize $. / configure --with-php-config=/usr/local/php7/bin/php-config $ make && make install $ make clean $ ./configure --with-php-config=/usr/local/php5/bin/php-config $ make && make installCopy the code

Swoole extension

$wget http://pecl.php.net/get/swoole-1.10.2.tgz $tar xf swoole - 1.10.2. TGZ $CD swoole - 1.10.2 $ /usr/local/php7/bin/phpize $ ./configure --with-php-config=/usr/local/php7/bin/php-config $ make && make install $ make clean $ ./configure --with-php-config=/usr/local/php5/bin/php-config $ make && make installCopy the code

Yac extension (php7)

$wget http://pecl.php.net/get/yac-2.0.2.tgz $tar xf yac - 2.0.2. TGZ $CD yac - 2.0.2 $/ usr/local/php7 / bin/phpize $ ./configure --with-php-config=/usr/local/php7/bin/php-config $ make && make installCopy the code

Yar Extension (PHP7)

$wget http://pecl.php.net/get/yar-2.0.4.tgz $tar xf yar - 2.0.4. TGZ $CD yar - 2.0.4 $/ usr/local/php7 / bin/phpize $ ./configure --with-php-config=/usr/local/php7/bin/php-config $ make && make installCopy the code

Yaf Extension (PHP7)

$wget http://pecl.php.net/get/yaf-3.0.6.tgz $tar xf yaf - 3.0.6. Taz $CD yaf - 3.0.6 $/ usr/local/php7 / bin/phpize $ ./configure --with-php-config=/usr/local/php7/bin/php-config $ make && make installCopy the code

Loading PHP configuration

extension=/usr/local/php7/lib/php/extensions/no-debug-non-zts-20170718/mongodb.so
extension=/usr/local/php7/lib/php/extensions/no-debug-non-zts-20170718/redis.so
extension=/usr/local/php7/lib/php/extensions/no-debug-non-zts-20170718/swoole.so
extension=/usr/local/php7/lib/php/extensions/no-debug-non-zts-20170718/yac.so
extension=/usr/local/php7/lib/php/extensions/no-debug-non-zts-20170718/yaf.so
extension=/usr/local/php7/lib/php/extensions/no-debug-non-zts-20170718/yar.so
Copy the code

Enabled PHP – FPM

[root@centos sbin]# /usr/local/php7/sbin/php-fpm -c /usr/local/php7/etc/php.ini -y /usr/local/php7/etc/php-fpm.conf -t [08-Apr-2018 15:54:10] NOTICE: configuration file /usr/local/php7/etc/php-fpm.conf test is successful [root@centos sbin]# /usr/local/php7/sbin/php-fpm -c /usr/local/php7/etc/php.ini -y /usr/local/php7/etc/php-fpm.conf [root@centos sbin]# ps -ef |grep php-fpm ...... Fifty processes were startedCopy the code

Php-fpm joins the service

1) Set php-fpm.conf to; Pid = run/php-fpm. Pid = run/php-fpm. Pid
2) Copy init.d. pp-fpm to /etc/init.d/php-fpm
$ cp /usr/local/src/php7/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
Copy the code
3) Copy init.d. p-fpm from PHP folder to /etc/init.d/php-fpm
4) Modify the php-fpm file
$php_fpm_BIN=@sbindir@/php-fpm $php_fpm_CONF= @sysConfDir@ /php-fpm.conf $php_fpm_PID= @localStatedir @/run/php-fpm.pid $php_fpm_CONF=/usr/local/php7/ sbin/php-fpm $php_fpm_CONF=/usr/local/php7/etc/php-fpm.conf $ php_fpm_PID=/usr/local/php7/var/run/php-fpm.pidCopy the code
5), and execution
$ chmod +x /etc/init.d/php-fpm
$ chkconfig --add php-fpm
$ chkconfig php-fpm on
$ service php-fpm status
    php-fpm (pid 814) is running...
    
Copy the code
You can now use the following command to manage phP-fpm
$ service php-fpm start
$ service php-fpm stop
$ service php-fpm restart
$ service php-fpm reload
Copy the code

Install Golang

Reference Address:

Golang download:golangtc.com/download

The download was too slow for me to use the thunderbolt and then upload the file

$CD/usr/local / $$tar xf wget HTTP: / / https://golangtc.com/static/go/1.9.2/go1.9.2.linux-amd64.tar.gz Linux-amd64.tar. gz $mkdir -p /usr/local/gopackage $sudo vim /etc/profile export GOROOT=/usr/local/go export GOPATH=/usr/local/gopackage export PATH=$PATH:$GOROOT/bin:$GOPATH/binCopy the code

Environmental variables take effect

$ source /etc/profile
Copy the code

Successful installation

$go Version go Version go1.9.2 Linux/AMD64Copy the code

Installing NetCat

$$tar wget https://sourceforge.net/projects/netcat/files/netcat/0.7.1/netcat-0.7.1.tar.gz - ZXVF netcat - 0.7.1. Tar. Gz - C /usr/local $CD /usr/local $mv netcat-0.7.1 netcat $CD /usr/local/netcat $./configure $make && make install $vim /etc/profile export NETCAT_HOME=/usr/local/netcat export PATH=$PATH:$NETCAT_HOME/bin $ source /etc/profileCopy the code

Install Git

$ yum install -y curl curl-devel zlib-devel openssl-devel perl cpio expat-devel gettext-devel $ wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.16.3.tar.gz $tar xf git - 2.16.3. Tar. Gz $CD git - 2.16.3 $ autoconf $ ./configure $ make $ sudo make installCopy the code

Exception handling

usr/bin/perl Makefile.PL PREFIX='/usr/local/git' INSTALL_BASE='' --localedir='/usr/local/git/share/locale' Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5  /usr/share/perl5 .) at Makefile.PL line 3. BEGIN failed--compilation aborted at Makefile.PL line 3. make[1]: *** [perl.mak] Error 2 make: *** [perl/perl.mak] Error 2Copy the code

— — — — — — — — — — — — — — here is the solution — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — –

$ yum install perl-ExtUtils-MakeMaker package
Copy the code

Install the mongo

Website:www.mongodb.com/download-ce…

$wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.6.3.tgz $tar xf Mongodb -linux-x86_64-rhel62-3.6.3. TGZ $mv mongodb-linux-x86_64-rhel62-3.6.3 /usr/local/mongo $sudo vim /etc/profile Export MONGOROOT=/usr/local/mongo export PATH=$PATH:$MONGOROOT/bin /usr/local/mongo/bin/mongoCopy the code

Enabling the Firewall

$ iptables -A INPUT -p tcp -m tcp --dport 27017 -j ACCEPT
Copy the code

Daemon and not authorized –auth

$ mongod --dbpath=/usr/local/mongo/data --logpath=/usr/local/mongo/log/mongodb.log --fork $ netstat -tunpl Proto Recv-Q Send -q Local Address Foreign Address State PID/Program name TCP 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 32268/mongod TCP 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 27532/mysqld TCP 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2064/nginx TCP 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 4971/ SSHD TCP 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1215/master $mongo use leanote db.createUser({user:"libenfu01",pwd:"lbf2131.",roles: [ "readWrite", "dbAdmin" ]}) Successfully added user: { "user" : "libenfu", "roles" : [ "readWrite", "dbAdmin" ] }Copy the code

Install Leanote (rely on Go Git)

reference:
$ go get github.com/revel/cmd/revel
$ wget https://github.com/leanote/leanote-all/archive/master.zip
$ unzip leanote-all-master.zip
$ mv ./leanote-all-master/src /usr/local/gopackage
Copy the code

Import initial Data

$ mongorestore -h localhost -d leanote --dir /usr/local/gopackage/src/github.com/leanote/leanote/mongodb_backup/leanote_install_data $ mongo $ show dbs; Admin 0.000GB config 0.000GB leanote 0.001GB local 0.000GB $use leanote switched to DB leanote $show collections albums attachs blog_comments blog_likes blog_singles configs email_logs files find_pwds group_users groups has_share_notes leanote.ShareNotes leanote.has_share_notes note_content_histories note_contents note_images note_tags notebooks notes reports sessions share_notebooks share_notes suggestions tag_count tags themes tokens traffics user_blogs users >Copy the code

Commissioning leanote

cd /usr/local/gopackage/src/github.com/leanote/leanote/bin
Copy the code

configuration

vi app.conf
Http. port=8080 Host =127.0.0.1 db.port=27017 db.dbname=leanote db.username= # Customize the database account Db. Password = # Customize the password of the database account mongodb://root:root123@localhost:27017/leanote # app The key must be changed by yourself app.secret=OIJiokioHoIOHUY072893bhJHui765GHjkgjJK8989GVghUIY788Copy the code

Install the Apache component (ab, htpasswd)

yum install httpd-tools
Copy the code

Python3.6 installation

$wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz $tar ZXF Python - 3.6.5. TGZ $CD Python - 3.6.5 $ . / configure -- prefix = / usr/local/python36 $make && make install $ln -s/usr/local/python36 / bin/python3.6 /usr/bin/pythonCopy the code

Python installation common problems (1) : zipimport ZipImportError: can ‘t decompress the data