Karp 的技术博客

腾讯云做活动花了120买了台 1核2G的云服, 记录下装机全过程为以后准备;
安装软件配置 :

  • Nginx
  • Mysql
  • Redis
  • MongoDB
  • PHP7

    • swoole
    • yar
    • yac
    • yaf
    • redis
    • mongodb
  • PHP5

    • swoole
    • yar
    • yac
    • yaf
    • redis
    • mongodb
  • Python (默认自带python2.6)
  • NodeJs
  • Lua
  • Supervisor
  • Golang
  • Git
  • NetCat

准备工作:

查看 linux 版本

[root@centos software]# cat /etc/issue
CentOS release 6.8 (Final)
Kernel \r on an \m

安装依赖:

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-devel

创建用户及用户组

$ groupadd www
$ useradd -g www www     #创建www用户到www用户组

Lua

官网地址: http://www.lua.org/download.html

$ 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 install

测试 Ok

$ lua
Lua 5.3.4  Copyright (C) 1994-2017 Lua.org, PUC-Rio
>

安装 luajit http://luajit.org/download.html

$ 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/

Nginx

$ wget http://nginx.org/download/nginx-1.13.8.tar.gz
--2018-03-06 21:12:40--  http://nginx.org/download/nginx-1.13.8.tar.gz
Resolving nginx.org... 95.211.80.227, 206.251.255.63, 2001:1af8: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%[=============================================================================================>] 992,237     64.9K/s   in 7.3s    

2018-03-06 21:12:48 (132 KB/s) - “nginx-1.13.8.tar.gz” saved [992237/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  src

准备模块所需 :

下载ngx_devel_kit(NDK 模块 :https://github.com/simpl/ngx_devel_kit/tags

wget https://github.com/simplresty/ngx_devel_kit/archive/v0.3.1rc1.tar.gz
tar -xzvf v0.3.1rc1.tar.gz

下载最新的lua-nginx-module 模块 :https://github.com/openresty/lua-nginx-module/tags

wget https://github.com/openresty/lua-nginx-module/archive/v0.10.12rc2.tar.gz.gz
tar -xzvf v0.10.12rc2.tar.gz

下载最新的 redis2-nginx-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.15rc1.tar.gz

下载 pcre 并编译: http://www.linuxfromscratch.org/blfs/view/svn/general/pcre.html

$ 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 install

开始加载的nginx 模块及编译参数

$ ./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-module=/usr/local/src/redis2-nginx-module-0.15rc1 \
 --add-module=/usr/local/src/ngx_devel_kit-0.3.1rc1 \
 --add-module=/usr/local/src/lua-nginx-module-0.10.12rc2

设置软链

$ ln -s /usr/local/nginx/sbin/nginx  /usr/bin/nginx
$ which nginx
$ /usr/bin/nginx

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:C 18 Mar 22:57:20.008 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    6443:C 18 Mar 22:57:20.008 # 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 connections

Mysql

官方下载 社区开源免费版

下载网页 https://dev.mysql.com/downloads/file/?id=474703

云服下载太慢了, 本地下载在上传到服务器

下载rpm包

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

解压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.rpm

按照以下顺序进行安装,因为它们之间存在依赖关系
common --> libs --> clients --> server

$ rpm -ivh mysql-community-common-5.7.21-1.el6.x86_64.rpm

安装时抛错 --force --nodeps 完美解决 原因:这是由于yum安装了旧版本的GPG keys造成的

参考地址: https://www.cnblogs.com/royfans/p/7243641.html

$ 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 --nodeps
检查安装
$ which mysql
/usr/bin/mysql
$ mysql -V
mysql  Ver 14.14 Distrib 5.7.21, for Linux (x86_64) using  EditLine wrapper
启动mysql服务
$ /etc/init.d/mysqld start
Initializing MySQL database:  
                                                           [  OK  ]
Starting mysqld:                                           [  OK  ]

$  ps -aux |grep mysql
root     24518  0.0  0.0 106216  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.sock
root     24755  0.0  0.0 103320   888 pts/1    S+   01:22   0:00 grep mysql

修改Mysql 密码

查看临时密码

$ 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");

创建mysql 用户数据目录

$ groupadd mysql
$ useradd -s /sbin/nologin -g mysql mysql

创建data目录和mysql-files目录,并修改权限

$ 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

Supervisor

(参考文献:http://blog.csdn.net/xyang81/article/details/51555473)

安装python包管理工具(easy_install)

easy_install是setuptools包里带的一个命令,使用easy_install实际上是在调用setuptools来完成安装模块的工作,所以安装setuptools即可。

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

安装supervisor

$ easy_install supervisor

运行echo_supervisord_conf程序生成supervisor的初始化配置文件详情查看:
http://supervisord.org/configuration.html

$  mkdir /etc/supervisor
$  echo_supervisord_conf > /etc/supervisor/supervisord.conf

启动Supervisor服务

$ supervisord -c /etc/supervisor/supervisord.conf

PHP

下载最新版本 http://php.net/get/php-7.2.3.tar.gz/from/this/mirror
下载5.6版本 http://cn2.php.net/get/php-5.6.34.tar.gz/from/this/mirror

$ tar zxf php-7.2.3.tar.gz
$ cd php-7.2.3
$ wget -c http://cn2.php.net/get/php-5.6.34.tar.gz/from/this/mirror -O 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 [following]
--2018-03-22 00:27:43--  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%[=================================================>] 19,294,951  2.44M/s   in 6.8s    

2018-03-22 00:27:50 (2.71 MB/s) - “php-5.tar.gz” saved [19294951/19294951
$ tar zxf php-5.tar.gz

安装 libmcrypt

$ 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
异常:configure: WARNING: unrecognized options: --with-mcrypt php7.2 不支持以上三个选项,删掉即可

解决安装问题: 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

创建目录

$ mkdir -p /usr/local/php7
$ mkdir -p /usr/local/php5

安装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 install 

安装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

安装php扩展

redis扩展

 $ 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 install

mongodb扩展

$ tar xf mongodb-1.4.2.tgz
$ cd mongodb-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 install

swoole 扩展

$ 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 install

Yac 扩展 (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 install

Yar 扩展 (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 install

Yaf扩展 (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 install

加载PHP配置

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

启用php-fpm

#优化php-fpm配置后 检测配置  dynamic 模式 使用socket方式连接

[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

...... 启了50个进程

php-fpm 加入 service 服务

1)、设置php-fpm.conf,将;pid = run/php-fpm.pid前面分号去掉
2)、将解压后的php文件夹下的init.d.php-fpm拷贝到/etc/init.d/php-fpm
$ cp /usr/local/src/php7/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
3)、将解压后的php文件夹下的init.d.php-fpm拷贝到/etc/init.d/php-fpm
4)、修改 php-fpm 文件

$ php_fpm_BIN=@sbindir@/php-fpm
$ php_fpm_CONF=@sysconfdir@/php-fpm.conf
$ php_fpm_PID=@localstatedir@/run/php-fpm.pid

改成

$ php_fpm_BIN=/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.pid

5)、执行

$ 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...

以后可以使用如下命令管理php-fpm

$ service php-fpm start
$ service php-fpm stop
$ service php-fpm restart
$ service php-fpm reload

安装Golang

参考地址:
Golang下载 : https://golangtc.com/download
下载太慢了 我用的迅雷 然后上传的文件

$ cd /usr/local/
$ wget https://golangtc.com/static/go/1.9.2/go1.9.2.linux-amd64.tar.gz
$ tar xf go1.9.2.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/bin

环境变量生效

$ source /etc/profile

安装成功

$ go version
go version go1.9.2 linux/amd64

安装NetCat

$ wget  https://sourceforge.net/projects/netcat/files/netcat/0.7.1/netcat-0.7.1.tar.gz
$ tar -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/profile

安装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 install

异常处理

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 2

--------------下面是解决方法--------------------------------------------------------

$ yum install perl-ExtUtils-MakeMaker package

安装MongoDB

官网:https://www.mongodb.com/download-center

$ 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
# 环境变量生效
$ source /etc/profile
$ which mongo
  /usr/local/mongo/bin/mongo

开启防火墙

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

守护进程且不授权 --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" ] }

安装 Leanote (依赖go git)

参考文献: https://www.idaybreak.com/install-leanote-server.html

$ 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

导入初始数据

$ 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
>

试运行 leanote

cd /usr/local/gopackage/src/github.com/leanote/leanote/bin

配置

vi app.conf
# 访问端口 可以自定义
http.port=8080
# 访问域名
site.url=http://
# 管理员用户名(默认用户名admin,密码abc123)
adminUsername=admin
# MongoDB 数据库配置
db.host=127.0.0.1
db.port=27017
db.dbname=leanote
db.username= #自定义数据库帐户
db.password= #自定义数据库帐户密码
mongodb://root:root123@localhost:27017/leanote
# app密钥 必须要自己修改 随便改成任意大小写字母加数字组合
app.secret=OIJiokioHoIOHUY072893bhJHui765GHjkgjJK8989GVghUIY788

安装 apache 组件 (ab, htpasswd)

yum install httpd-tools

Python3.6 安装

$ 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/python

Python安装常见问题(1):zipimport.ZipImportError: can't decompress data

php centos

版权属于:karp
作品采用:本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。
更新于: 2018年02月27日 14:01
5

目录

来自 《腾讯云 Centos 安装 PHP 开发环境》