Group Details Private

administrators

Member List

  • Mainframe Useful Commands
    MVS Console 表头2
    D A,L Display all active AS
    D ASM Display PAGE DS
    D ASM,ALL Display PAGE DS
    D ASM,PAGE=page_dsname Display PAGE DS
    D C Display Console
    D CF Display CF
    D ETR Display SYSPLEX timer
    D GRS,ALL Display GRS
    D GRS,RES=(*,dsname) Display DS ENQ
    D IOS,CONFIG Display IODF
    D IPLINFO Display IPLINFO
    posted in DATA MANAGEMENT SYSTEMS
  • IMS DL/I Return Code List and Explanations

    A List of IMS DL/I Return Codes with short explanations.

    IMS DL/I Return Codes Explanations
    blank call completed successfully
    AA the alternate PCB contains a transaction code instead of a logical terminal as a destination
    AB segment I/O area is missing from call statement
    AC hierarchical error on insert or get call
    AD function argument is not coded correctly
    AF size of variable length record is invalid for GSAM get access
    AH invalid SSA encountered on insert call
    AI error opening database
    AJ SSA specified for the call is invalid
    AK field name specified for qualified SSA is incorrectly coded
    AL batch program has issued a ROLS, ROLB, or SETS call and either the system log does not reside on disk or dynamic backout is not specified
    AM function specified is not compatible with one of segment sensitivity, program type, or PCB processing
    AO a physical I/O error has occurred
    AP a CHKP function issued a transaction oriented BMP or a message call has more than 4 parameters
    AT I/O area specified is too small
    AU length for SSAs specified exceeds the maximum allowed
    AY logical terminal name found in a response alternate PCB has more than one physical terminal assigned
    AZ a PURG or ISRT was ignored in a conversational program
    A1 logical terminal name specified incorrectly in I/O area for a CHNG call
    A2 PCB specified incorrectly for a CHNG call
    A3 PCB specified incorrectly for an ISRT or PURG call
    A4 security violation
    A5 parameter list specified incorrectly on ISRT or PURG call
    A6 ISRT function message length exceeds allowable length
    A7 ISRT function number of messages added exceeds maximum allowed
    A8 ISRT function issued to a response alternate PCB must follow ISRT to I/O PCB and these statements are reversed
    A9 ISRT function message to response alternate PCB ignored because SAMETRM=YES
    BA call not completed because data is not available, operations by current call up to this error have been backed out
    BB call not completed because data is not available, operations since last commit point have been backed out
    CA CMD function command verb invalid
    CB CMD function command from an AOI program not allowed
    CC after command completed successfully, IMS returned one or more command responses
    CD program does not have authority to execute a command listed in this CMD function
    CE IMS rescheduled a message as a result of a call with the function GU since the last CMD call
    CF message scheduled before IMS was started
    CG message retrieved by GU originated from an AOI user exit
    CH Automated Operator Interface (AOI) encountered a system error, current command not ignored
    CI IMS rescheduled a message as a result of a call with the function GU since the last CMD call and message scheduled before IMS was started
    CJ IMS rescheduled a message as a result of a call with the function GU since the last CMD call and message retrieved by GU originated from an AOI user exit
    CK message scheduled before IMS was started and message retrieved by GU originated from an AOI user exit
    CL IMS rescheduled a message as a result of a call with the function GU since the last CMD call, message scheduled before IMS was started, and message retrieved by GU originated from an AOI user exit
    CM exception response occurred when executing a command issued via CMD call
    CN value in PSBIOAZ field is incorrect
    DA REPL or DLET attempted to change segment key field
    DJ get hold issued after REPL or DLET
    DX DLET violated delete rule for segment
    FA arithmetic overflow error
    FC call type and segment type are incompatible
    FD resource deadlock
    FE FLD function received non blank status code in FSA
    FF MSDB did not contain free space when ISRT was issued
    FG FLD function received non blank status code in FSA and program has used all of buffer pool
    FH DEDB was not accessible when database call was issued or commit point was reached
    FI I/O area address not accessible to program
    FM randomizer did not return a DMAC address
    FN field name of FSA undefined in DBD and FLD function issued
    FP invalid hex or packed field in I/O area
    FS buffer limit for region exceeded
    FT number of SSAs exceeds limit of 15 for DEDB or 1 for MSDB
    FV verify operation failed at commit point
    FW program has used all of buffer pool
    GA call completed successfully but higher level crossed for GN or GNP call
    GB end of database reached on GN call
    GC attempted to cross unit-of-work boundary
    GD position in database lost
    GE segment not found
    GG processing with procopt of GON or GOT and concurrent update activity is occurring
    GK call completed successfully but different segment type on same level retrieved for GN or GNP call
    GL LOG request has an invalid log code
    GP GNP issued but parentage was not previously established
    II attempt to insert a segment with a duplicate key
    IX insert rule violation
    LB attempt to load a segment that already exists
    LC attempt to load a segment out of sequence
    LD attempt to load a segment whose parent does not exist
    LE hierarchical sequence in DBD does not match that in the segment to be loaded
    MR terminal name invalid on ISRT message call
    NA one or more databases not available
    NE during index maintenance, a segment was not found
    NI unique secondary index but duplicate key encountered
    NO physical I/O error
    NU information only, REPL DLET or ISRT may return BA status code
    QC GU message request failed
    QD GN requested but no more message segments exist
    QE GN not followed by GU message request
    QF length of message segment is less than 5 bytes
    QH terminal symbolic error encountered
    RA token does not match any on an outstanding SETS call
    RC ROLS call was rejected
    RX replace rule violation
    SA storage space for I/O area unavailable on SETS call
    SB attempted to set 10 levels (only 9 are allowed)
    SC SETS call was rejected
    TA CICS command level failed because PSB is not defined
    TC PSB in use by previous request
    TE unable to initialize the specified PSB
    TG no PSB scheduled for program
    TH no PSB scheduled for program
    TI path to segment is invalid
    TJ DL/I is not active
    TL encountered conflict in scheduling intent
    TN invalid system DIB was found
    TO path replace error found
    TP PROCOPT invalid
    TQ I/O PCB access not allowed in a local DL/I call
    TR CICS XDLIPRE exit cancelled a request
    TY database is not open
    TZ segment length longer than 64k
    UC during batch processing, a checkpoint record was written to the utility control facility (UCF) dataset
    UR during batch processing, IPL is restarted under UCF
    US during batch processing, an IPL is halted
    UX during batch processing both checkpoint and program halted
    VI during an insert or update length of variable length segment is too long

    posted in DATA MANAGEMENT SYSTEMS
  • 使用appnode是网站访问协议变成https
    安装Let's Encrypt

    进入APPNODE,在软件管家里找到Let's Encrypt,安装后创建帐户

    然后新建证书

    填入你的域名,开始创建。

    进入网站管理,选择你刚刚填入的网站。

    网站设置-->HTTPS-->选择手动配置并导入证书

    输入网址后自动变为https。

    posted in Linux
  • CentOS + Mongodb安装NodeBB
    环境

    关闭 SELinux

    vim /etc/sysconfig/selinux
    

    找到 SELINUX 然后修改成 disabled .

    SELINUX = disabled
    

    安装APPNODE
    INSTALL_AGENT=1 INSTALL_APPS=sitemgr INIT_SWAPFILE=1 INSTALL_PKGS='nginx-stable,php56(zend-guard-loader),pureftpd,mysql56' bash -c "$(curl -sS http://dl.appnode.com/install.sh)"
    

    AppNode是 Linux 下的一款集群部署的可视化控制面板,一键安装,具体功能的体验。
    提供:
    可视化管理,提升运维效率
    快速安装,轻松升级
    轻便高效,节约系统资源
    将支持主流的 Linux 发行版本 (目前仅支持 CentOS)
    集中式设计,快速切换管理
    软件丰富,按需安装
    遵循通用规范,系统更原汁原味
    开放的 API 结构,便于扩展和整合
    AppNode 提供系统信息、软件管家、文件管理、服务管理、进程管理、防火墙管理、 用户管理等基本的
    Linux运维功能,通过可视化操作界面降低了 Linux 使用的门槛。

    进入APPNODE,在软件管家安装node.js

    同样安装PM2进程管理


    安装Redis

    Redis 是一个优秀的内存缓存应用,也是 NodeBB 的一个数据库选择。

    1. 搜索 “Redis”

    2. 一键安装
      然后启动,并勾选自启,守护。


    安装MongoDB

    NodeBB 推荐使用 MongoDB ,但APPNODE里面搜不到,所以需要通过终端来安装。

    vim /etc/yum.repos.d/mongodb-org-3.4.repo
    --------------------------------------------------------------
    [mongodb-org-3.4]  
    name=MongoDB Repository  
    baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/  
    gpgcheck=1  
    enabled=1  
    gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
    

    安装

    yum -y install mongodb-org
    

    使用以下指令以启动 MongoDB 并设置开机自启。

    systemctl enable mongod
    systemctl start mongod
    

    配置MongoDB

    [root@li1877-76 ~]# mongo
    MongoDB shell version v3.4.13
    ....
    > use nodebb;
    switched to db nodebb
    > db.createUser( { user: "nodebb", pwd: "********", roles: [ { role: "readWrite", db: "nodebb" }, { role: "clusterMonitor", db: "admin" } ] } )
    Successfully added user: {
            "user" : "nodebb",
            "roles" : [
                    {
                            "role" : "readWrite",
                            "db" : "nodebb"
                    },
                    {
                            "role" : "clusterMonitor",
                            "db" : "admin"
                    }
            ]
    }
    > use admin
    switched to db admin
    > db.createUser( { user: "admin", pwd: "********", roles: [ { role: "readWriteAnyDatabase", db: "admin" }, { role: "userAdminAnyDatabase", db: "admin" } ] } )
    Successfully added user: {
            "user" : "admin",
            "roles" : [
                    {
                            "role" : "readWriteAnyDatabase",
                            "db" : "admin"
                    },
                    {
                            "role" : "userAdminAnyDatabase",
                            "db" : "admin"
                    }
            ]
    }
    > quit()
    [root@li1877-76 ~]# vi /etc/mongod.conf
    ------------------------
    security: 
      authorization: enabled
    ------------------------
    [root@li1877-76 ~]# service mongod restart
    Redirecting to /bin/systemctl restart mongod.service
    [root@li1877-76 ~]# mongo -u admin -p ******** --authenticationDatabase=admin
    MongoDB shell version v3.4.13
    connecting to: mongodb://127.0.0.1:27017
    MongoDB server version: 3.4.13
    > quit()
    

    打开 MongoDB 权限认证
    执行 vi /etc/mongod.conf ,找到 security: 这一行,取消注释并改为:

    security: 
      authorization: enabled
    

    获取nodebb

    首先重启一下服务器

    git clone -b v1.7.x https://github.com/NodeBB/NodeBB.git nodebb
    cd nodebb
    ./nodebb setup
    

    注意事项:

    1. URL used to access this NodeBB 这个问题填写域名http://www.xxx.com(别漏下 http前缀,域名末尾不加 / )
    2. 另外,NodeBB会默认监听本地端口 4567 ,我们后面还要使用 nginx 转发 80 端口的请求到4567 端口。
    3. 中间还有两次需要回答问题 Which database to use ,
      第一次是回答数据库程序名 mongo ,第二次回答所创建的数据库名 nodebb
    4. 这些回答都将被写入 NodeBB 的配置文件config.json,如果答错了可以随后手动修改

    nginx配置

    打开APPNODE


    PM2配置

    创建用PM2守护进程,并重启,nodebb已经成功上线!

    posted in Linux
  • bwh1-使用ezhttp选择php5.2版本后无法使用phpmyadmin

    关于ezhttp就不多解释了,贴个link过去看看,很详细的。

    wget --no-check-certificate centos.bz/ezhttp.zip?time=$(date +%s) -O ezhttp.zip
    unzip ezhttp.zip
    cd ezhttp-master
    chmod +x start.sh
    ./start.sh
    

    ezhttp默认版本的phpmyadmin不支持php5.2,所以需要自己重新下载个低版本的。

    wget https://files.phpmyadmin.net/phpMyAdmin/4.0.10.19/phpMyAdmin-4.0.10.19-all-languages.tar.gz
    tar xzvf phpMyAdmin-4.0.10.19-all-languages.tar.gz
    mkdir -p /home/wwwroot/phpmyadmin
    cp -a phpMyAdmin-4.0.10.19-all-languages/*  /home/wwwroot/phpmyadmin
    sed -i '1aexit;' /home/wwwroot/phpmyadmin/version_check.php
    

    这样就可以访问了。

    posted in Linux
  • CentOS6.5下安装MongoDB v3.05

    Linode的VPS准备在月底就终止续费了,所以尽可能多花时间在上面折腾。准备试着部署一下Nodeclub,看说明写的是

    线上跑的是 Node.js v4.4.0,MongoDB 是 v3.0.5,Redis 是 v3.0.3。

    Node.js系统上已经有了,就先开始安装MongoDB吧。

    [root@li1473-187 ~]# wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.0.5.tgz
    [root@li1473-187 ~]# tar -zxvf mongodb-linux-x86_64-rhel62-3.0.5.tgz
    [root@li1473-187 ~]# mv mongodb-linux-x86_64-rhel62-3.0.5 mongodb
    [root@li1473-187 ~]# mv mongodb /usr/local/
    [root@li1473-187 ~]# cd /usr/local/mongodb
    [root@li1473-187 mongodb]# ls
    bin  GNU-AGPL-3.0  README  THIRD-PARTY-NOTICES
    [root@li1473-187 mongodb]# mkdir db
    [root@li1473-187 mongodb]# mkdir logs
    [root@li1473-187 mongodb]# cd bin
    [root@li1473-187 bin]# ls
    bsondump  mongod     mongoexport  mongoimport  mongoperf     mongos     mongotop
    mongo     mongodump  mongofiles   mongooplog   mongorestore  mongostat
    [root@li1473-187 bin]# vim mongodb.conf
    dbpath=/usr/local/mongodb/db
    logpath=/usr/local/mongodb/logs/mongodb.log
    port=27017
    fork=true
    nohttpinterface=true
    [root@li1473-187 bin]# /usr/local/mongodb/bin/mongod --config /usr/local/mongodb/bin/mongodb.conf
    about to fork child process, waiting until server is ready for connections.
    forked process: 26170
    child process started successfully, parent exiting
    

    MongoDB已经启动起来了。下面加入开机自动启动mongodb

    [root@li1473-187 bin]# vim /etc/rc.d/rc.local
    /usr/local/mongodb/bin/mongod --config /usr/local/mongodb/bin/mongodb.conf
    [root@li1473-187 bin]# ps -ef|grep mongo
    root     26170     1  0 15:30 ?        00:00:00 /usr/local/mongodb/bin/mongod --config /usr/local/mongodb/bin/mongodb.conf
    root     26794 21916  0 15:31 pts/3    00:00:00 grep mongo
    

    重启系统后进入MongoDB

    [root@li1473-187 ~]# /usr/local/mongodb/bin/mongo
    MongoDB shell version: 3.0.5
    connecting to: test
    Server has startup warnings:
    2017-02-15T15:46:30.303+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
    2017-02-15T15:46:30.303+0800 I CONTROL  [initandlisten]
    > show dbs
    local  0.078GB
    > exit
    bye
    [root@li1473-187 ~]#
    

    测试可用,OVER!

    posted in Linux
  • CentOS6.5下Redis v3.03安装

    在CentOS6.5下安装Redis v3.03

    [root@li1473-187 ~]# wget http://download.redis.io/releases/redis-3.0.3.tar.gz
    [root@li1473-187 ~]# tar xzf redis-3.0.3.tar.gz
    [root@li1473-187 redis-3.0.3]# ls
    00-RELEASENOTES  CONTRIBUTING  deps     Makefile   README      runtest          runtest-sentinel  src    utils
    BUGS             COPYING       INSTALL  MANIFESTO  redis.conf  runtest-cluster  sentinel.conf     tests
    [root@li1473-187 redis-3.0.3]# make
    [root@li1473-187 redis-3.0.3]# cd src && make install
    
    Hint: It's a good idea to run 'make test' 😉
    
     INSTALL install
     INSTALL install
     INSTALL install
     INSTALL install
     INSTALL install
    [root@li1473-187 src]# make test
    You need tcl 8.5 or newer in order to run the Redis test
    make: *** [test] Error 1
    

    提示需要安装tcl8.5

    # wget http://downloads.sourceforge.net/tcl/tcl8.5.9-src.tar.gz
    # tar -zxvf tcl8.5.9-src.tar.gz
    # cd /tcl8.5.9-src/unix
    
    ./configure
    make
    make install
    

    再重新执行make test

    [root@li1473-187 src]# make test
    \o/ All tests passed without errors!
    
    Cleanup: may take some time... OK
    make[1]: Leaving directory '/root/redis-3.0.3/src'
    

    输入./src/redis-server启动 redis

    [root@li1473-187 redis-3.0.3]# ./src/redis-server
    11304:C 15 Feb 15:58:37.819 # Warning: no config file specified, using the default config. In order to specify a config file use ./src/redis-server /path/to/redis.conf
                    _._
               _.-``__ ''-._
          _.-``    `.  `_.  ''-._           Redis 3.0.3 (00000000/0) 64 bit
      .-`` .-```.  ```\/    _.,_ ''-._
     (    '      ,       .-`  | `,    )     Running in standalone mode
     |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
     |    `-._   `._    /     _.-'    |     PID: 11304
      `-._    `-._  `-./  _.-'    _.-'
     |`-._`-._    `-.__.-'    _.-'_.-'|
     |    `-._`-._        _.-'_.-'    |           http://redis.io
      `-._    `-._`-.__.-'_.-'    _.-'
     |`-._`-._    `-.__.-'    _.-'_.-'|
     |    `-._`-._        _.-'_.-'    |
      `-._    `-._`-.__.-'_.-'    _.-'
          `-._    `-.__.-'    _.-'
              `-._        _.-'
                  `-.__.-'
    

    打开另一个SSH,显示如下已经成功。

    [root@li1473-187 ~]# ./redis-3.0.3/src/redis-cli
    127.0.0.1:6379> set foo bar
    OK
    127.0.0.1:6379> get foo
    "bar"
    127.0.0.1:6379>
    

    修改 redis-3.0.3下配置文件

    [root@li1473-187 redis-3.0.3]# nano redis.conf
    找到 daemonize no 这项修改为 yes
    使服务端运行在后台
    新建 redis service脚本
    [root@li1473-187 redis-3.0.3]# touch /etc/rc.d/init.d/redis
    

    编辑/etc/rc.d/init.d/redis

    #!/bin/sh
    #chkconfig: 2345 86 14
    #description: Startup and shutdown script for Redis
    
    PROGDIR=/usr/redis #安装路径
    PROGNAME=redis-server
    DAEMON=$PROGDIR/$PROGNAME
    CONFIG=/usr/redis/redis.conf
    PIDFILE=/var/run/redis.pid
    DESC="redis daemon"
    SCRIPTNAME=/etc/rc.d/init.d/redis
    
    start()
    {
     if test -x $DAEMON
     then
     echo -e "Starting $DESC: $PROGNAME"
     if $DAEMON $CONFIG
     then
     echo -e "OK"
     else
     echo -e "failed"
     fi
     else
     echo -e "Couldn't find Redis Server ($DAEMON)"
     fi
    }
    
    stop()
    {
     if test -e $PIDFILE
     then
     echo -e "Stopping $DESC: $PROGNAME"
     if kill `cat $PIDFILE`
     then
     echo -e "OK"
     else
     echo -e "failed"
     fi
     else
     echo -e "No Redis Server ($DAEMON) running"
     fi
    }
    
    restart()
    {
     echo -e "Restarting $DESC: $PROGNAME"
     stop
     start
    }
    
    list()
    {
     ps aux | grep $PROGNAME
    }
    
    case $1 in
     start)
     start
     ;;
     stop)
     stop
     ;;
     restart)
     restart
     ;;
     list)
     list
     ;;
    
     *)
     echo "Usage: $SCRIPTNAME {start|stop|restart|list}" >&2
     exit 1
     ;;
    esac
    exit 0
    

    进入redis-3.0.3的src目录执行下面操作

    [root@li1473-187 src]# mkdir /usr/redis
    [root@li1473-187 src]# cp redis-server  /usr/redis
    [root@li1473-187 src]# cp redis-benchmark /usr/redis
    [root@li1473-187 src]# cp redis-cli  /usr/redis
    [root@li1473-187 src]# cp redis.conf  /usr/redis
    cp: cannot stat 'redis.conf': No such file or directory
    [root@li1473-187 src]# cd ..
    [root@li1473-187 redis-3.0.3]# ls
    00-RELEASENOTES  CONTRIBUTING  deps     Makefile   README      runtest          runtest-sentinel  src    utils
    BUGS             COPYING       INSTALL  MANIFESTO  redis.conf  runtest-cluster  sentinel.conf     tests
    [root@li1473-187 redis-3.0.3]# cp redis.conf /usr/redis
    [root@li1473-187 redis-3.0.3]#
    

    增加服务并设置开机启动。

    [root@li1473-187 rc.d]# chkconfig --add redis
    service redis does not support chkconfig
    [root@li1473-187 rc.d]# vim /etc/init.d/redis
    如果没加#chkconfig: 2345 86 14就会出现上面的错误。
    [root@li1473-187 rc.d]# chkconfig --add redis
    [root@li1473-187 rc.d]# chkconfig --level 2345 redis on
    [root@li1473-187 rc.d]# chkconfig --list redis
    redis           0:off   1:off   2:on    3:on    4:on    5:on    6:off
    [root@li1473-187 rc.d]#
    
    posted in Linux
  • CentOS6.5安装部署Nodeclub

    GitHub上是这样写的

    线上跑的是 Node.js v4.4.0,MongoDB 是 v3.0.5,Redis 是 v3.0.3。

    1. 安装 `Node.js/io.js[必须]` `MongoDB[必须]` `Redis[必须]`
    2. 启动 MongoDB 和 Redis
    3. `$ make install` 安装 Nodeclub 的依赖包
    4. `cp config.default.js config.js` 请根据需要修改配置文件
    5. `$ make test` 确保各项服务都正常
    6. `$ node app.js`
    7. visit `http://localhost:3000`
    8. done!
    

    前面准备工作已经做完,现在git一份源码吧

    [root@li1473-187 ~]# git --version
    git version 1.7.1
    [root@li1473-187 ~]# git clone https://github.com/cnodejs/nodeclub.git
    Initialized empty Git repository in /root/nodeclub/nodeclub/.git/
    remote: Counting objects: 10273, done.
    remote: Total 10273 (delta 0), reused 0 (delta 0), pack-reused 10273
    Receiving objects: 100% (10273/10273), 9.01 MiB | 3.35 MiB/s, done.
    Resolving deltas: 100% (6639/6639), done.
    [root@li1473-187 ~]# ls
    nodeclub
    [root@li1473-187 ~]# mv nodeclub /home/wwwroot/
    [root@li1473-187 ~# cd /home/wwwroot/
    [root@li1473-187 wwwroot]# ls
    default  ghost  Ghost-0.7.4-zh-full.zip  ghost1  nodeclub  testweb  wordpress-4.7.2-zh_CN.tar.gz
    [root@li1473-187 wwwroot]# cd nodeclub
    [root@li1473-187 nodeclub]# cp config.default.js config.js
    [root@li1473-187 nodeclub]# vim config.js
    [root@li1473-187 nodeclub]# make install
    warn不要紧
    [root@li1473-187 nodeclub]# node app.js
    [2017-02-15 20:37:25.587] [INFO] cheese - NodeClub listening on port 3000
    [2017-02-15 20:37:25.588] [INFO] cheese - God bless love....
    [2017-02-15 20:37:25.589] [INFO] cheese - You can debug your app with http://localhost:3000
    [2017-02-15 20:37:25.589] [INFO] cheese -
    

    成功启动。

    配置Nginx

    [root@li1473-187 ~]# cd /usr/local/nginx/conf/vhost
    [root@li1473-187 vhost]# ls
    ghost.kokwind.net.conf  test.kokwind.net.conf
    [root@li1473-187 vhost]# cp ghost.kokwind.net.conf club.kokwind.net
    [root@li1473-187 vhost]# vim club.kokwind.net
    server
     {
     listen 80;
     #listen [::]:80;
     server_name club.kokwind.net;
     index index.html index.htm index.php default.html default.htm default.php;
     root /home/wwwroot/nodeclub;
    
     include none.conf;
     #error_page 404 /404.html;
     include enable-php.conf;
    
     location / {
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header Host $http_host;
     proxy_pass http://localhost:3000;
     proxy_set_header REMOTE-HOST $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     }
     access_log /home/wwwlogs/nodeclub.log;
     }
    [root@li1473-187 vhost]# /etc/init.d/nginx reload
    Reload service nginx... done
    [root@li1473-187 vhost]# cd /home/wwwroot/nodeclub/
    [root@li1473-187 nodeclub]#
    

    使用pm2启动,pm2安装使用参考这里

    [root@li1473-187 nodeclub]# pm2 start app.js
    [PM2] Spawning PM2 daemon with pm2_home=/root/.pm2
    [PM2] PM2 Successfully daemonized
    [PM2] Starting /home/wwwroot/nodeclub/app.js in fork_mode (1 instance)
    [PM2] Done.
    ┌──────────┬────┬──────┬──────┬────────┬─────────┬────────┬─────┬───────────┬──────────┐
    │ App name │ id │ mode │ pid  │ status │ restart │ uptime │ cpu │ mem       │ watching │
    ├──────────┼────┼──────┼──────┼────────┼─────────┼────────┼─────┼───────────┼──────────┤
    │ app      │ 0  │ fork │ 5431 │ online │ 0       │ 0s     │ 0%  │ 10.5 MB   │ disabled │
    └──────────┴────┴──────┴──────┴────────┴─────────┴────────┴─────┴───────────┴──────────┘
     Use `pm2 show <id|name>` to get more details about an app
    [root@li1473-187 nodeclub]#
    

    打开网址

    posted in Linux
  • 在centos下安装nodejs, npm和Ghost博客

    之前研究过一段时间的Node.js,也找到过几个不错的站,其中Ghost博客就是一个用Node.js写的开源博客,好久没弄了,接下来尝试在新环境配置一下。

    默认是装过LNMP环境的,如果没有,先装nginx

    sudo yum install nginx -y
    sudo service nginx start 开启nginx
    sudo chkconfig nginx on 设置nginx为开机启动
    

    首先安装Node.js和npm

    [root@li1473-187 ~]# node -v
    -bash: node: command not found
    [root@li1473-187 ~]# curl -sL https://rpm.nodesource.com/setup | bash -
    [root@li1473-187 ~]# yum install -y nodejs
    [root@li1473-187 ~]# yum install -y gcc-c++ make
    [root@li1473-187 ~]# node -v
    v0.10.48
    [root@li1473-187 ~]# curl -L https://www.npmjs.com/install.sh | sh
    [root@li1473-187 ~]# npm -v
    4.2.0
    [root@li1473-187 ~]# sudo ln -s /usr/local/bin/node /usr/bin/node
    ln: creating symbolic link `/usr/bin/node': File exists
    

    接下来下载Ghost博客

    [root@li1473-187 ~]# curl -L https://ghost.org/zip/ghost-latest.zip -o ghost.zip
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 4091k  100 4091k    0     0  82370      0  0:00:50  0:00:50 --:--:--  237k
    [root@li1473-187 ~]# unzip -uo ghost.zip -d ghost
    [root@li1473-187 ~]# mv ghost /home/wwwroot/
    [root@li1473-187 ~]# cd /home/wwwroot/
    [root@li1473-187 wwwroot]# ls
    default  ghost  testweb  wordpress-4.7.2-zh_CN.tar.gz[root@li1473-187 wwwroot]# cd ghost/
    [root@li1473-187 ghost]# npm install –production
    npm WARN npm npm does not support Node.js v0.10.48
    npm WARN npm You should probably upgrade to a newer version of node as we
    npm WARN npm can't make any promises that npm will work with this version.
    npm WARN npm You can find the latest version at https://nodejs.org/
    npm ERR! arg Argument starts with non-ascii dash, this is probably invalid: [ '–production' ]
    npm ERR! addLocal Could not install /home/wwwroot/ghost/–production 
    
    

    3.安装到这里后发现版本不支持,卸载掉再研究吧。

    [root@li1473-187 ~]# yum remove nodejs npm -y
    

    重新安装Node.js,根据Ghost官方的建议,这次安装v0.10.40版本

    [root@li1473-187 ~]# wget http://nodejs.org/dist/v0.10.40/node-v0.10.40.tar.gz
    [root@li1473-187 ~]# tar zxvf node-v0.10.40.tar.gz
    [root@li1473-187 ~]# cd node-v0.10.40
    [root@li1473-187 ~]# ./configure
    [root@li1473-187 ~]# make && make install
    [root@li1473-187 ~]# node -v
    v0.10.40
    [root@li1473-187 ~]# npm -v
    1.4.28
    

    下载Ghost

    [root@li1473-187 ~]# wget http://dl.ghostchina.com/Ghost-0.7.4-zh-full.zip
    [root@li1473-187 ~]# unzip Ghost-0.7.4-zh-full.zip -d ghost
    [root@li1473-187 ~]# mv ghost /home/wwwroot/
    [root@li1473-187 ghost]# cd  /home/wwwroot/
    [root@li1473-187 wwwroot]# chmod -R 777 ghost
    chmod: changing permissions of 'ghost/.user.ini': Operation not permitted
    [root@li1473-187 wwwroot]# cd ghost
    [root@li1473-187 ghost]# cp config.example.js config.js
    [root@li1473-187 ghost]# ls
    config.example.js  content  Gruntfile.js  LICENSE       npm-shrinkwrap.json  PRIVACY-en.md  README-en.md  SECURITY-en.md
    config.js          core     index.js      node_modules  package.json         PRIVACY.md     README.md
    [root@li1473-187 ghost]# vim config.js
     production: {
     url: 'http://ghost.kokwind.net', 如果选择使用sqlite则在config.js中只需要修改url地址
     mail: {},
     database: {
     client: 'sqlite3',
     connection: {
     filename: path.join(__dirname, '/content/data/ghost.db')
     },
     debug: false
     },
    

    Ghost-0.7.4-zh-full这个版本默认集成 sqlite3 原生库,因sqlite读写数据量太大时会影响速度,我们也可以改用mysql

    首先 使用phpmyadmin,添加用户和数据库

    修改config.js,变成mysql

    [root@li1473-187 ~]# vim config.js
    production: {  
        url: 'http://ghost.kokwind.net', //这里是你自己VPS主机的域名
        mail: {},
        database: {
            client: 'mysql'
            connection: {
                host     : '127.0.0.1',
                user     : 'ghost', //mysql用户名
                password : 'xxxxxxxx', //密码
                database : 'ghost', //之前创建的ghost数据库名称
                charset  : 'utf8'
            },
        server: {
                host: '127.0.0.1',
                port: '2368'//若修改该端口记得在nginx中做相应改变
            }
        }
    

    配置nginx,PS:之前忘了写,在搬瓦工上配置才想起来,贴过来补上。

    [root@localhost ~]# cd /usr/local/nginx/conf/vhost
    [root@localhost vhost]# cp www.kokwind.net.conf blog.kokwind.net.conf
    [root@localhost vhost]# vim blog.kokwind.net.conf
    server
        {
            listen 80;
            #listen [::]:80;
            server_name xxx.kokwind.net; <-- 网址
            index index.html index.htm index.php default.html default.htm default.php;
            root  /home/wwwroot/ghost; <-- ghost路径
    
            include none.conf;
            #error_page   404   /404.html;
            include enable-php.conf;
    
            location / {
                proxy_set_header   X-Real-IP $remote_addr;
                proxy_set_header   Host      $http_host;
                proxy_pass         http://127.0.0.1:2368;
                proxy_set_header REMOTE-HOST $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            }
    
            access_log  /home/wwwlogs/ghost.log;
        }
    [root@localhost vhost]# /etc/init.d/nginx  reload
    Reload service nginx...  done
    

    现在可以启动ghost博客了

    [root@li1473-187 ~]# cd /home/wwwroot
    [root@li1473-187 wwwroot]# cd ghost
    [root@li1473-187 ghost]# ls
    config.example.js content Gruntfile.js LICENSE npm-debug.log package.json PRIVACY.md README.md
    config.js core index.js node_modules npm-shrinkwrap.json PRIVACY-en.md README-en.md SECURITY-en.md
    [root@li1473-187 ghost]# npm start
    
    > ghost@0.7.4 start /home/wwwroot/ghost
    > node index
    
    Migrations: Up to date at version 004
    Ghost is running in development...
    Listening on 127.0.0.1:2368
    Url configured as: http://localhost:2368
    Ctrl+C to shut down
    

    访问网址可以看到

    如果是通过 npm start 启动 Ghost 的话,只要你关闭了远程连接,Ghost 也就停了,所以需要安装 forever

    [root@li1473-187 bin]# which node
    /usr/local/bin/node
    [root@li1473-187 bin]# ln -s /usr/local/bin/node /usr/bin/node
    [root@li1473-187 bin]# npm install forever -g
    

    注意:这条指令将 forever 安装到全局环境。安装的时候系统会提示一些 WARN,这是因为 forever 依赖的 Node.js 版本过低,没关系,不用理会。

    [root@li1473-187 ~]# service nginx restart
    Stoping nginx...  done
    Starting nginx...  done
    [root@li1473-187 ~]# cd /home/wwwroot/ghost
    [root@li1473-187 ghost]# NODE_ENV=production forever start index.js
    warn:    --minUptime not set. Defaulting to: 1000ms
    warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
    info:    Forever processing file: index.js
    [root@li1473-187 ghost]#
    

    不顺利的开始,顺利的结局。over!

    追记:
    在搬瓦工上同样配置启动时,出现了下面的错误

    [root@localhost ghost]# npm start
    
    > ghost@0.7.4 start /home/wwwroot/ghost
    > node index
    
    
    ERROR: Cannot find module '/home/wwwroot/ghost/node_modules/sqlite3/lib/binding/node-v11-linux-ia32/node_sqlite3.node'
    
     Error: Cannot find module '/home/wwwroot/ghost/node_modules/sqlite3/lib/binding/node-v11-linux-ia32/node_sqlite3.node'
        at Function.Module._resolveFilename (module.js:338:15)
        at Function.Module._load (module.js:280:25)
    

    重装了一下sqlite3就好了

    [root@localhost ghost]# npm install sqlite3 --save
    |
    > sqlite3@3.1.1 install /home/wwwroot/ghost/node_modules/sqlite3
    > node-pre-gyp install --fallback-to-build
    
    posted in Linux
  • 使用SFTP协议上传下载文件到VPS

    在VPS没有装FTP的情况下,我们想把文件上传或者下载下来,可以使用SFTP,Mac os使用软件Yummy FTP pro 百度网盘下载

    posted in Linux

Looks like your connection to MainFrame was lost, please wait while we try to reconnect.