CentOS7.5 OneinStack install apache, nginx environment (including PostgreSQL, Kafka, RabbitMQ)

1. Preparation

# 安装之前先检查一下系统是否有默认安装的`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. Change the CentOSdefault yumsource to the domestic yummirror source

  1. Back up/etc/yum.repos.d/CentOS-Base.repo
    $ mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
    
  2. Download 163the yumsource configuration file to the folder above
    $ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
    
  3. Run yum makecachebuild cache
    $ yum makecache
    
  4. Update system
    $ yum -y update
    

3. has been mounted in homethe hard disk directory to mount datathe directory

$ 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. Interactive installation OneinStack

  • installation 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        # 卸载
    
  • Management Service
    # 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. Installation 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. Installation PostgreSQL

  1. installation
    $ 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. Initialize the PostgreSQLdatabase
    $ 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. Configure the default postgresuser and password and create a new user and database
    $ 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. Configuration PostgreSQL
    • Configuration PostgreSQL-MD5certification
      $ 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
      
    • Configuration PostgreSQL-Configure TCP/IP
      $ vi /data/pgsql/data/postgresql.conf 
      [...]
      listen_addresses = '*’
      [...]
      port = 5432
      [...]
      
  5. Install redis_fdwan external plug-table
    $ 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_fdwDetailed description usage
    1. CREATE SERVERSupport option(specified address and port)
    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 MAPPINGSupported option(designated password)
    password: The password to authenticate to the Redis server with. Default:
    3. CREATE FOREIGN TABLESupported option
    * specified database ID
    * table type ( hash, list, set, zsetor scalar)
    * keyprefix keyset singleton_keydesignatedKEY
    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. The installation MySQL 5.7of the UDFfunction

  • In CentOS7installed on your systemmysql-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 ../
    
  • In CentOS7installed on your systemmysql-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
    
  • In CentOS7installed on your systemgearman-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
    
  • Create a MySQLcustom function
    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. Install RabbitMQ

  1. Install 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. Install 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. Some basic operations on 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. View RabbitMQlogs

    • Log gives rabbitmqimportant information to start, such as nodename, $homedirectory, cookie hashvalues, log files, and other data storage directory;
    • The information given will indicate that there is no configuration file (as shown below), and this file is not installed by default
      $ cat /var/log/rabbitmq/[email protected]
      
  5. Open the web management interface

    Visit http: // localhost: 15672 through a browser
    shell $ rabbitmq-plugins enable rabbitmq_management

  6. rabbitmq.conf

    • Manually create a directory, copy the configuration sample files to the configuration directory and rename
      $ mkdir -p /etc/rabbitmq
      $ cp /usr/share/doc/rabbitmq-server-3.6.10/rabbitmq.config.example /etc/rabbitmq/rabbitmq.config
      
    • Configuration restart takes effect
      $ systemctl restart rabbitmq-server
      

    In addition, you can also build an environment configuration file:/etc/rabbitmq/rabbitmq-env.conf

  7. Set upiptables

    • tcp4369 The port is used for cluster neighbor discovery;
    • tcp5671, 5672A port for AMQP 0.9.1 and 1.0 clientsuse;
    • tcp15672Ports for http apithe rabbitadminaccess, the latter only in management pluginthe open;
    • tcp25672Ports for erlangdistributed nodes / communication tool
    $ 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. Installation kafka

  1. installation 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. installation 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. installation 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
    
    • Configure kafka, modifyserver.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
      
    • Configuration kafkaunderzookeeper

      $ 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
      
    • Create a startup kafkascript

      $ 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 &
      
    • Creating closed kafkascript

      $ 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 &
      
    • Add script execution permission

      $ chmod +x kafkastart.sh
      $ chmod +x kafkastop.sh
      
    • Set the script to automatically execute at boot

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

    • Step 1: Start 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
      
    • Step 2: Start kafka
      $ ./kafkastart.sh
      
    • Step 3: Test creation topic
      $ cd /www/server/kafka/bin 
      $ ./kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
      
    • Step 4: The listcommand to view the creation oftopic
      $ cd /www/server/kafka/bin
      $ ./kafka-topics.sh –list –zookeeper localhost:2181
      
    • Step 5: Production message test
      $ ./kafka-console-producer.sh --broker-list localhost:9092 --topic test 
      laoyang I love you! 
      
    • Step 6: Consumer message test
      $ ./kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
      I'm laoyang #之前测试输入的内容
      laoyang I love you!
      

    After the above 6 steps, kafka is successfully installed.

    • stop kafka
      • Step 1: Stop Kafka
        $ cd /usr/local/kafka
        $ ./kafkastop.sh
        
      • Step 2: Stop Zookeeper server
        $ /www/server/zookeeper/bin/zkServer.sh stop
        

10. To PHPadd an extension

  1. Add PostgreSQLextension
    $ 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. Add PDO-PostgreSQLextension
    $ 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. Add Gearmanextension
    $ 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. Add rabbitmq extension
    1. Install 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. Install amqp extension
      $ 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. To PHPadd zookeeperextensions
    • To PHPadd libzookeeperextensions
      $ 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
      
    • To PHPadd zookeeperextensions
      $ 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. Configuration PHPsupport for custom extensions
    $ 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 installation and use

  1. installation 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. Use ComposerinstallationThinkPHP 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
    

 

 

Published 23 original articles · won praise 2 · Views 5244

Guess you like

Origin blog.csdn.net/bianlitongcn/article/details/103288996