美文网首页
CentOS7.5利用OneinStack搭建环境(包括Post

CentOS7.5利用OneinStack搭建环境(包括Post

作者: GadflyBSD | 来源:发表于2018-08-21 11:28 被阅读0次

    1、准备

    # 安装之前先检查一下系统是否有默认安装的`apache`或者`php`
    $ rpm -qa|grep httpd
    $ rpm -qa|grep php
    $ rpm -qa|grep mysql
    
    # 把上面指令列出来的包删除
    $ rpm -e ****(包名)
    
    # 安装一些必备的包
    $ yum -y install gcc gcc-c++ make screen wget net-tools curl python
    $ screen -S bt
    
    # 编译安装`hiredis`
    $ git clone https://github.com/redis/hiredis.git
    $ cd hiredis
    $ make && make install
    $ mkdir /usr/lib/hiredis
    $ cp libhiredis.so /usr/lib/hiredis
    $ mkdir /usr/include/hiredis
    $ cp hiredis.h /usr/include/hiredis
    $ echo '/usr/local/lib' >>/etc/ld.so.conf 
    $ ldconfig
    

    2、修改CentOS默认yum源为国内yum镜像源

    1. 备份/etc/yum.repos.d/CentOS-Base.repo
      $ mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
      
    2. 下载163yum源配置文件到上面那个文件夹内
      $ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
      
    3. 运行yum makecache生成缓存
      $ yum makecache
      
    4. 更新系统
      $ yum -y update
      

    3. 将已经挂载在 home 目录上的硬盘挂载到 data 目录上

    $ df -h                   #(查看分区情况及数据盘名称)
    $ mkdir /data              #(如果没有data目录就创建,否则此步跳过)
    $ umount /home            #(卸载硬盘已挂载的home目录)
    $ mount /dev/mapper/centos-home /data    #(挂载到data目录)
    $ vi /etc/fstab           #(编辑fstab文件修改或添加,使重启后可以自动挂载)
    $ mount /dev/mapper/centos-home /data ext3 auto 0 0
    

    4. 交互式安装 OneinStack

    • 安装 OneinStack
      $ wget http://mirrors.linuxeye.com/oneinstack-full.tar.gz
      $ tar xzf oneinstack-full.tar.gz
      $ cd oneinstack
      $ screen -S oneinstack 
      # 如果网路出现中断,可以执行命令`screen -R oneinstack`重新连接安装窗口
      $ ./install.sh          # 安装
      $ ./addons.sh           # 添加附加组件
      $ ./vhost.sh            # 添加虚拟主机
      $ ./pureftpd_vhost.sh   # 管理FTP账号
      $ ./backup_setup.sh     # 备份
      $ ./upgrade.sh          # 更新版本
      $ ./uninstall.sh        # 卸载
      
    • 管理服务
      # webmin
      $ rpm -Uvh https://prdownloads.sourceforge.net/webadmin/webmin-1.881-1.noarch.rpm
      
      # Nginx/Tengine/OpenResty
      $ service nginx {start|stop|status|restart|reload|configtest}
      
      # MySQL/MariaDB/Percona:
      $ service mysqld {start|stop|restart|reload|status}
      
      # PostgreSQL
      $ service postgresql {start|stop|restart|status}
      
      # MongoDB
      $ service mongod {start|stop|status|restart|reload}
      
      # PHP
      $ service php-fpm {start|stop|restart|reload|status}
      
      # HHVM
      $ service supervisord {start|stop|status|restart|reload}
      
      # Apache
      $ service httpd {start|restart|stop}
      
      # Tomcat
      $ service tomcat {start|stop|status|restart}
      
      # Pure-Ftpd
      $ service pureftpd {start|stop|restart|status}
      
      # Redis
      $ service redis-server {start|stop|status|restart}
      
      # Memcached
      $ service memcached {start|stop|status|restart|reload}
      

    5. 安装 Gearman

    $ yum install -y uuid-devel libuuid libuuid-devel uuid boost-devel libevent libevent-devel gperf
    $ wget https://launchpad.net/gearmand/1.2/1.1.12/+download/gearmand-1.1.12.tar.gz
    $ tar zxvf gearmand-1.1.12.tar.gz
    $ cd gearmand-1.1.12
    $ ./configure --prefix=/usr/local/gearmand
    $ make && make install
    $ vi /etc/init.d/gearmand
    #!/bin/bash  
    # chkconfig: - 85 15  
    #descrīption: service(/usr/local/gearmand/sbin/gearmand)  
    . /etc/rc.d/init.d/functions  
    start() {  
       echo -n $"Starting $prog"  
       echo -e " gearman :                                               [确定]"  
       /usr/local/gearmand/sbin/gearmand &  
       sleep 1  
       echo -e "running..."  
    }  
    stop() {  
       echo -n $"Stopping $prog"  
       echo -e " gearman :                                               [确定]"  
       kill -9 `ps -ef | grep "/usr/local/gearmand/sbin/gearmand" | awk '{print $2}' | awk 'NR==1'`  
       sleep 1  
       echo -e "stoped"  
    }  
    case "$1" in  
       start)  
          start  
          ;;  
       stop)  
          stop  
          ;;  
       restart)  
          stop  
          start  
          ;;  
       status)  
          ps -ef | grep "/usr/local/gearmand/sbin/gearmand"  
          ;;  
       *)  
          echo $"Usage: $prog {start|stop|restart|status}" >&2  
          exit 1  
          ;;  
    esac  
    exit 0  
    $ chkconfig --add gearmand
    $ chkconfig gearmand on
    $ chkconfig --list
    

    6. 安装 PostgreSQL

    1. 安装
      $ yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
      $ yum install postgresql96 postgresql96-server postgresql96-contrib postgresql96-devel postgresql96-libs
      
    2. 初始化 PostgreSQL 数据库
      $ mkdir /data/pgsql
      $ chown -R postgres:postgres /data/pgsql
      $ su postgres
      $ /usr/pgsql-9.6/bin/initdb -D /data/pgsql/data
      $ vi /usr/lib/systemd/system/postgresql-9.6.service
      Environment=PGDATA=/data/pgsql/data
      $ systemctl daemon-reload
      $ systemctl enable postgresql-9.6
      $ systemctl start postgresql-9.6
      
    3. 配置默认 postgres 用户及密码并创建新的用户和数据库
      $ cd data
      $ su postgres
      $ createuser gadfly
      $ createdb gadfly_db
      $ psql
      psql (9.6)
      Type "help" for help.
      Postgres=# 
      postgres=# \password postgres
      Enter new password:
      Enter it again:
      postgres=# CREATE EXTENSION adminpack;
      CREATE EXTENSION
      postgres=# alter user gadfly with encrypted password 'centos';
      ALTER ROLE 
      postgres=# grant all privileges on database gadfly_db to gadfly;
      GRANT
      postgres=# \q
      $ exit
      
    4. 配置 PostgreSQL
      • 配置 PostgreSQL-MD5 认证
        $ vi /data/pgsql/data/pg_hba.conf
        # "local" is for Unix domain socket connections only
        local        all      all                     md5
        # IPv4 local connections:
        host        all      all    192.168.1.0/24    md5
        host        all      all    127.0.0.1/32      md5
        # IPv6 local connections:
        host        all      all    ::1/128           md5
        
      • 配置 PostgreSQL-Configure TCP/IP
        $ vi /data/pgsql/data/postgresql.conf 
        [...]
        listen_addresses = '*’
        [...]
        port = 5432
        [...]
        
    5. 安装 redis_fdw 外部表插件
      $ git clone -b REL9_6_STABLE https://github.com/pg-redis-fdw/redis_fdw.git
      $ cd redis_fdw
      $ export PATH=/usr/pgsql-9.6//bin:$PATH
      $ make USE_PGXS=1
      $ make USE_PGXS=1 install
      $ su postgres
      bash-4.2$ psql -U postgres -d postgres
      postgres=# create extension redis_fdw;
      CREATE EXTENSION
      postgres=# CREATE SERVER redis_server
      postgres-#     FOREIGN DATA WRAPPER redis_fdw
      postgres-#     OPTIONS (address '127.0.0.1', port '6379');
      CREATE SERVER
      postgres=# CREATE USER MAPPING FOR PUBLIC
      postgres-#     SERVER redis_server
      postgres-#     OPTIONS (password '');
      CREATE USER MAPPING
      

      redis_fdw 详细的用法介绍
      1. CREATE SERVER 支持的 option(指定地址和端口)
      address: The address or hostname of the Redis server. Default: 127.0.0.1 port: The port number on which the Redis server is listening. Default: 6379
      2. CREATE USER MAPPING 支持的 option (指定密码)
      password: The password to authenticate to the Redis server with. Default:
      3. CREATE FOREIGN TABLE 支持的 option
      * 指定数据库ID
      * 表类型(hash,list,set,zsetscalar)
      * key 前缀 key 集合 singleton_key 指定 KEY
      conf database: The numeric ID of the Redis database to query. Default: 0 tabletype: can be 'hash', 'list', 'set' or 'zset' Default: none, meaning only look at scalar values. tablekeyprefix: only get items whose names start with the prefix Default: none tablekeyset: fetch item names from the named set Default: none singleton_key: get all the values in the table from a single named object. Default: none, meaning don't just use a single object.

    7. 安装MySQL 5.7UDF函数

    • CentOS7 系统上安装 mysql-udf-http
      $ export PKG_CONFIG=/usr/bin/pkg-config
      $ export PKG_CONFIG_PATH=/usr/share/pkgconfig:/usr/lib/pkgconfig
      $ echo "/usr/local/mysql/lib" > /etc/ld.so.conf.d/mysql.conf
      $ /sbin/ldconfig
      $ git clone https://github.com/y-ken/mysql-udf-http.git
      $ cd mysql-udf-http
      $ chmod +x ./configure
      $ ./configure --with-mysql=/usr/local/mysql/bin/mysql_config --prefix=/usr --libdir=/usr/local/mysql/lib/plugin
      $ make && make install
      $ cd ../
      
    • CentOS7 系统上安装 mysql-udf-sys
      $ git clone https://github.com/mysqludf/lib_mysqludf_sys.git
      $ cd lib_mysqludf_sys
      $ gcc -DMYSQL_DYNAMIC_PLUGIN -fPIC -Wall -I/usr/local/mysql/include -I. -shared lib_mysqludf_sys.c -o lib_mysqludf_sys.so
      $ cp lib_mysqludf_sys.so /usr/local/mysql/lib/plugin
      
    • CentOS7 系统上安装 gearman-mysql-udf
      $ wget https://launchpad.net/gearman-mysql-udf/trunk/0.6/+download/gearman-mysql-udf-0.6.tar.gz
      $ tar xf gearman-mysql-udf-0.6.tar.gz -C ./  
      $ cd gearman-mysql-udf-0.6  
      $ ./configure --with-mysql=/usr/local/mysql/bin/mysql_config --libdir=/usr/local/mysql/lib/plugin 
      $ make && make install
      
    • 创建 MySQL 自定义函数
      mysql> DROP FUNCTION IF EXISTS http_get; 
      mysql> DROP FUNCTION IF EXISTS http_post; 
      mysql> DROP FUNCTION IF EXISTS http_put; 
      mysql> DROP FUNCTION IF EXISTS http_delete; 
      mysql> create function http_get returns string soname 'mysql-udf-http.so';
      mysql> create function http_post returns string soname 'mysql-udf-http.so'; 
      mysql> create function http_put returns string soname 'mysql-udf-http.so'; 
      mysql> create function http_delete returns string soname 'mysql-udf-http.so';
      mysql> DROP FUNCTION IF EXISTS lib_mysqludf_sys_info; 
      mysql> DROP FUNCTION IF EXISTS lib_mysqludf_sys_info;
      mysql> DROP FUNCTION IF EXISTS sys_set;
      mysql> DROP FUNCTION IF EXISTS sys_exec;
      mysql> DROP FUNCTION IF EXISTS sys_eval;
      mysql> CREATE FUNCTION lib_mysqludf_sys_info RETURNS string SONAME 'lib_mysqludf_sys.so';
      mysql> CREATE FUNCTION sys_get RETURNS string SONAME 'lib_mysqludf_sys.so';
      mysql> CREATE FUNCTION sys_set RETURNS int SONAME 'lib_mysqludf_sys.so';
      mysql> CREATE FUNCTION sys_exec RETURNS int SONAME 'lib_mysqludf_sys.so';
      mysql> CREATE FUNCTION sys_eval RETURNS string SONAME 'lib_mysqludf_sys.so';
      mysql> DROP FUNCTION IF EXISTS gman_do_background;
      mysql> DROP FUNCTION IF EXISTS gman_servers_set;
      mysql> CREATE FUNCTION gman_do_background RETURNS STRING SONAME 'libgearman_mysql_udf.so';
      mysql> CREATE FUNCTION gman_servers_set RETURNS STRING SONAME 'libgearman_mysql_udf.so';
      

    8. 安装RabbitMQ

    1. 安装Erlang

      $ rpm --import https://packages.erlang-solutions.com/rpm/erlang_solutions.asc
      $ rpm -Uvh https://bintray.com/rabbitmq/rpm/download_file?file_path=erlang%2F21%2Fel%2F7%2Fx86_64%2Ferlang-21.0.2-1.el7.centos.x86_64.rpm
      
    2. 安装RabbitMQ

      $ rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc
      $ wget https://dl.bintray.com/rabbitmq/all/rabbitmq-server/3.7.7/rabbitmq-server-3.7.7-1.el7.noarch.rpm
      $ yum install rabbitmq-server-3.7.7-1.el7.noarch.rpm
      
    3. 关于RabbitMQ的一些基本操作

      $ chkconfig rabbitmq-server on  # 添加开机启动RabbitMQ服务
      $ service rabbitmq-server start # 启动服务
      $ service rabbitmq-server status  # 查看服务状态
      $ service rabbitmq-server stop   # 停止服务
      
      # 查看当前所有用户
      $ rabbitmqctl list_users
      
      # 查看默认guest用户的权限
      $ rabbitmqctl list_user_permissions guest
      
      # 由于RabbitMQ默认的账号用户名和密码都是guest。为了安全起见, 先删掉默认用户
      $ rabbitmqctl delete_user guest
      
      # 添加新用户
      $ rabbitmqctl add_user username password
      
      # 设置用户tag
      $ rabbitmqctl set_user_tags username administrator
      
      # 赋予用户默认vhost的全部操作权限
      $ rabbitmqctl set_permissions -p / username ".*" ".*" ".*"
      
      # 查看用户的权限
      $ rabbitmqctl list_user_permissions username
      
    4. 查看RabbitMQ日志

      • 日志中给出了 rabbitmq 启动的重要信息,如 node 名,$home 目录,cookie hash 值,日志文件,数据存储目录等;
      • 给出的信息会指出无配置文件(如下图),默认安装没有此文件
        $ cat /var/log/rabbitmq/rabbit@rmq-node1.log
        
    5. 开启web管理接口

      通过浏览器访问 http://localhost:15672
      shell $ rabbitmq-plugins enable rabbitmq_management

    6. rabbitmq.conf

      • 手工建目录,将配置样例文件拷贝到配置目录并改名
        $ mkdir -p /etc/rabbitmq
        $ cp /usr/share/doc/rabbitmq-server-3.6.10/rabbitmq.config.example /etc/rabbitmq/rabbitmq.config
        
      • 配置重启生效
        $ systemctl restart rabbitmq-server
        

      另外还可以建环境配置文件:/etc/rabbitmq/rabbitmq-env.conf

    7. 设置iptables

      • tcp4369 端口用于集群邻居发现;
      • tcp56715672 端口用于 AMQP 0.9.1 and 1.0 clients 使用;
      • tcp15672 端口用于 http apirabbitadmin 访问,后者仅限在 management plugin 开启时;
      • tcp25672 端口用于 erlang 分布式节点/工具通信
      $ vi /etc/sysconfig/iptables
      -A INPUT -p tcp -m state --state NEW -m tcp --dport 4369 -j ACCEPT
      -A INPUT -p tcp -m state --state NEW -m tcp --dport 5671 -j ACCEPT
      -A INPUT -p tcp -m state --state NEW -m tcp --dport 5672 -j ACCEPT
      -A INPUT -p tcp -m state --state NEW -m tcp --dport 15672 -j ACCEPT
      -A INPUT -p tcp -m state --state NEW -m tcp --dport 25672 -j ACCEPT
      $ service iptables restart
      

    9、安装 kafka

    1. 安装 JDK

      $ yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel java-1.8.0-openjdk-javadoc
      $ vi  /etc/profile
      export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el7_5.x86_64
      export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
      export PATH=$PATH:$JAVA_HOME/bin
      $ source /etc/profile     #使配置文件立即生效
      
    2. 安装 zookeeper

      $ cd /www/software
      $ wget https://archive.apache.org/dist/zookeeper/zookeeper-3.4.9/zookeeper-3.4.9.tar.gz
      $ tar -zxvf zookeeper-3.4.9.tar.gz
      $ mv /www/software/zookeeper-3.4.9 /www/server/zookeeper
      $ vi /etc/profile
      export ZOOKEEPER_HOME=/www/server/zookeeper
      export PATH=$ZOOKEEPER_HOME/bin:$PATH
      export PATH
      $ source /etc/profile
      $ cd /www/server/zookeeper/conf
      $ cp zoo_sample.cfg zoo.cfg
      $ vi /www/server/zookeeper/conf/zoo.cfg
      # zookeeper 定义的基准时间间隔,单位:毫秒
      tickTime=2000
      # 数据文件夹
      dataDir=/www/server/zookeeper/data
      # 日志文件夹
      dataLogDir=/www/server/zookeeper/logs
      # 客户端访问 zookeeper 的端口号
      clientPort=2181
      $ /www/server/zookeeper/bin/zkServer.sh start 
      ZooKeeper JMX enabled by default
      Using config: /www/server/zookeeper/bin/../conf/zoo.cfg
      Starting zookeeper ... STARTED
      
      # 安装 `zookeeper c client`
      $ cd /www/server/zookeeper/src/c
      $ ./configure
      $ make && make install
      
    3. 安装 kafka

      $ cd /www/software
      $ wget https://archive.apache.org/dist/kafka/1.1.0/kafka_2.12-1.1.0.tgz
      $ tar -xzvf kafka_2.12-1.1.0.tgz
      $ mv /www/software/kafka_2.12-1.1.0 /www/server/kafka
      
      • 配置 kafka,修改 server.properties

        $ mkdir /www/wwwlogs/kafka                #创建kafka日志目录
        $ cd /www/server/kafka/config             #进入配置目录
        $ vi server.properties                    #编辑修改相应的参数
        broker.id=0
        port=9092                                 #端口号
        host.name=192.168.137.254                 #服务器IP地址,修改为自己的服务器IP
        log.dirs=/www/wwwlogs/kafka               #日志存放路径,上面创建的目录
        zookeeper.connect=localhost:2181    #zookeeper地址和端口,单机配置部署,localhost:2181
        
      • 配置 kafka 下的 zookeeper

        $ mkdir /www/server/zookeeper        #创建zookeeper目录
        $ mkdir /www/wwwlogs/zookeeper    #创建zookeeper日志目录
        $ cd /www/server/kafka/config              #进入配置目录
        $ vi zookeeper.properties                 #编辑修改相应的参数 
        dataDir=/www/server/kafka/zookeeper        #zookeeper数据目录 
        dataLogDir=/www/server/kafka/log/zookeeper #zookeeper日志目录 
        clientPort=2181 
        maxClientCnxns=100 
        tickTime=2000 
        initLimit=10
        
      • 创建启动 kafka 脚本

        $ vi kafkastart.sh
        #!/bin/bash
        #启动zookeeper
        /www/server/kafka/bin/zookeeper-server-start.sh /www/server/kafka/config/zookeeper.properties &
        sleep 3 #等3秒后执行
        #启动kafka
        /www/server/kafka/bin/kafka-server-start.sh /www/server/kafka/config/server.properties &
        
      • 创建关闭 kafka 脚本

        $ vi kafkastop.sh
        #!/bin/bash
        #关闭zookeeper
        /www/server/kafka/bin/zookeeper-server-stop.sh /www/server/kafka/config/zookeeper.properties &
        sleep 3 #等3秒后执行
        $ /www/server/kafka/bin/kafka-server-stop.sh /www/server/kafka/config/server.properties &
        
      • 添加脚本执行权限

        $ chmod +x kafkastart.sh
        $ chmod +x kafkastop.sh
        
      • 设置脚本开机自动执行

        $ vi /etc/rc.d/rc.local                 # 编辑,在最后添加一行
        $ sh /www/server/kafka/kafkastart.sh &   # 设置开机自动在后台运行脚本
        $ sh /www/server/kafka/kafkastart.sh     # 启动kafka
        $ sh /www/server/kafka/kafkastop.sh      # 关闭kafka
        
    4. 测试 kafka

      • 步骤1:启动 zookeeper
        $ /www/server/zookeeper/bin/zkServer.sh start
        JMX enabled by default
        Using config: /home/laoyang/zookeeper/bin/../conf/zoo.cfg
        grep: /home/laoyang/zookeeper/bin/../conf/zoo.cfg: No such file or directory
        Starting zookeeper ... STARTED
        
      • 步骤2:启动 kafka
        $ ./kafkastart.sh
        
      • 步骤3:测试创建 topic
        $ cd /www/server/kafka/bin 
        $ ./kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
        
      • 步骤4:通过 list命令查看创建的 topic
        $ cd /www/server/kafka/bin
        $ ./kafka-topics.sh –list –zookeeper localhost:2181
        
      • 步骤5:生产消息测试
        $ ./kafka-console-producer.sh --broker-list localhost:9092 --topic test 
        laoyang I love you! 
        
      • 步骤6:消费消息测试
        $ ./kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
        I'm laoyang #之前测试输入的内容
        laoyang I love you!
        

      经过以上6步,代表kafka安装成功。

      • 停止 kafka
        • 步骤1:停止 Kafka
          $ cd /usr/local/kafka
          $ ./kafkastop.sh
          
        • 步骤2:停止 Zookeeper server
          $ /www/server/zookeeper/bin/zkServer.sh stop
          

    10. 为 PHP 添加扩展

    1. 添加 PostgreSQL 扩展
      $ cd ~/oneinstack/src
      $ tar zxvf php-7.2.6.tar.gz
      $ cd php-7.2.6/ext/pgsql
      $ /usr/local/php/bin/phpize
      $ ./configure --with-php-config=/usr/local/php/bin/php-config --with-pgsql=/usr/pgsql-9.6
      $ make && make install
      
    2. 添加 PDO-PostgreSQL 扩展
      $ cd ~/oneinstack/src/php-7.2.6/ext/pdo_pgsql
      $ /usr/local/php/bin/phpize
      $ ./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-pgsql=/usr/pgsql-9.6
      $ make && make install
      
    3. 添加 Gearman 扩展
      $ git clone https://github.com/wcgallego/pecl-gearman.git
      $ cd pecl-gearman
      $ /usr/local/php/bin/phpize
      $ ./configure --with-php-config=/usr/local/php/bin/php-config --with-gearman=/usr/local/gearmand/
      $ make && make install
      
    4. 添加rabbitmq扩展
      1. 安装rabbitmq-c
        $ yum install libtool autoconf
        $ wget https://github.com/alanxz/rabbitmq-c/archive/v0.9.0.tar.gz
        $ tar zxvf v0.9.0.tar.gz
        $ cd rabbitmq-c-0.9.0/
        $ autoreconf -i
        #这一步是在rabbitmq-c的根目录下创建一个build子目录
        $ mkdir build && cd build
        
        # 这一步是让cmake根据../CMakeList.txt,即rabbitmq-c的根目录下的CMakeList.txt创建Makefile文件
        # Makefile文件会被创建到build目录中
        $ cmake -DCMAKE_INSTALL_PREFIX=/usr/local/rabbitmq-c ..
        
        # 这一步是真正的build rabbitmq-c库的,注意,不要漏掉点 ‘.‘
        $ cmake --build . --target install
        $ ln -s /usr/local/rabbitmq-c/lib64 /usr/local/rabbitmq-c/lib
        
      2. 安装amqp扩展
        $ wget http://pecl.php.net/get/amqp-1.9.3.tgz
        $ tar zxvf amqp-1.9.3.tgz
        $ cd amqp-1.9.3
        $ phpize
        $ ./configure --with-php-config=/usr/local/php/bin/php-config --with-amqp --with-librabbitmq-dir=/usr/local/rabbitmq-c
        $ make
        $ make install
        
    5. PHP 添加 zookeeper 扩展
      • PHP 添加 libzookeeper 扩展
        $ git clone https://github.com/Timandes/libzookeeper.git
        $ cd libzookeeper
        $ /www/server/php/72/bin/phpize
        $ ./configure --with-php-config=/www/server/php/72/bin/php-config --with-libzookeeper=/usr/local/bin/cli_mt
        $ make && make install
        
      • PHP 添加 zookeeper 扩展
        $ git clone -b php7 https://github.com/jbboehr/php-zookeeper.git
        $ cd /www/server/php-zookeeper
        $ /www/server/php/72/bin/phpize
        $ ./configure --with-php-config=/www/server/php/72/bin/php-config
        $ make && make install
        
    6. 配置 PHP 支持自定义扩展
      $ vi /usr/local/php/etc/php.d/90-pgsql.ini
      extension=pgsql.so
      extension=pdo_pgsql.so
      extension=gearman.so
      extension=amqp.so
      $ service httpd restart
      

    11. Composer安装和使用

    1. 安装 Composer
      # 下载composer.phar 
      $ wget https://dl.laravel-china.org/composer.phar -O /usr/local/bin/composer
      
      # 把composer.phar移动到环境下让其变成可执行 
      $ chmod a+x /usr/local/bin/composer
      $ composer config -g repo.packagist composer https://packagist.phpcomposer.com
      
      # 测试
      $ composer -V 
      
    2. 使用 Composer 安装 ThinkPHP 5.1
      $ composer create-project topthink/think thinkphp5.1 --prefer-dist
      $ cd thinkphp5.1
      $ composer require topthink/think-swoole
      $ composer require flc/alidayu
      $ composer require topthink/think-helper
      $ composer require topthink/think-image
      $ composer require topthink/think-captcha
      $ composer require nmred/kafka-php
      $ composer require adodb/adodb-php
      $ composer require phpoffice/phpspreadsheet
      $ composer require phpoffice/phpexcel
      $ composer require phpoffice/phpword
      $ composer require tecnickcom/tcpdf
      $ composer require mpdf/mpdf
      $ composer require gmars/tp5-qiniu
      $ composer require apache/log4php
      $ composer require ccampbell/chromephp
      $ composer require php-amqplib/php-amqplib
      

    相关文章

      网友评论

          本文标题:CentOS7.5利用OneinStack搭建环境(包括Post

          本文链接:https://www.haomeiwen.com/subject/xumdiftx.html