`
rensanning
  • 浏览: 3547831 次
  • 性别: Icon_minigender_1
  • 来自: 大连
博客专栏
Efef1dba-f7dd-3931-8a61-8e1c76c3e39f
使用Titanium Mo...
浏览量:38135
Bbab2146-6e1d-3c50-acd6-c8bae29e307d
Cordova 3.x入门...
浏览量:607242
C08766e7-8a33-3f9b-9155-654af05c3484
常用Java开源Libra...
浏览量:682250
77063fb3-0ee7-3bfa-9c72-2a0234ebf83e
搭建 CentOS 6 服...
浏览量:89305
E40e5e76-1f3b-398e-b6a6-dc9cfbb38156
Spring Boot 入...
浏览量:401769
Abe39461-b089-344f-99fa-cdfbddea0e18
基于Spring Secu...
浏览量:69684
66a41a70-fdf0-3dc9-aa31-19b7e8b24672
MQTT入门
浏览量:91685
社区版块
存档分类
最新评论

搭建 CentOS 6 服务器(5) - Java(Ant/Maven/Gradle)、PHP(php-fpm)

 
阅读更多
(一)Java

(1)JDK

下载安装
# cd /usr/local/src
# wget --no-check-certificate --no-cookies - --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u76-b13/jdk-7u76-linux-x64.rpm -O jdk-7u76-linux-x64.rpm
# rpm -ivh jdk-7u76-linux-x64.rpm
   Preparing...            ########################################### [100%]
       1:jdk                ########################################### [100%]
   Unpacking JAR files...
            rt.jar...


OracleJDK下载方法变更:

变更前
引用
wget --no-check-certificate --no-cookies \
        --header "Cookie: oraclelicense=accept-securebackup-cookie" \
        http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.rpm


现在(URL里需要各版本的特殊hash值)
引用
wget --no-check-certificate --no-cookies \
        --header "Cookie: oraclelicense=accept-securebackup-cookie" \
        http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm


设置默认JDK
# alternatives --install /usr/bin/java java /usr/java/default/bin/java 776
# alternatives --config java
There is 1 program that provides 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/java/default/bin/java

Enter to keep the current selection[+], or type selection number: 1


设置环境变量
# vi /etc/profile.d/java.sh
    #!/bin/bash
    JAVA_HOME=/usr/java/default/
    PATH=$JAVA_HOME/bin:$PATH
    export PATH JAVA_HOME
    export CLASSPATH=.
# chmod +x /etc/profile.d/java.sh
# source /etc/profile.d/java.sh


确认JDK版本
# java -version
    java version "1.7.0_76"
    Java(TM) SE Runtime Environment (build 1.7.0_76-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode)
# echo $JAVA_HOME
    /usr/java/default


开启SSLv3
# cd /usr/java/default/jre/lib/security
# vi java.security
   #jdk.tls.disabledAlgorithms=SSLv3


导入GoDaddy证书
# cd /usr/local/src
# wget -O gd_bundle-g2-g1.crt 'https://certs.godaddy.com/repository/gd_bundle-g2-g1.crt'
# wget -O gdroot-g2_cross.crt 'https://certs.godaddy.com/repository/gdroot-g2_cross.crt'
# wget -O gd_intermediate.crt 'https://certs.godaddy.com/repository/gd_intermediate.crt'
# wget -O gd_cross_intermediate.crt 'https://certs.godaddy.com/repository/gd_cross_intermediate.crt'
# cd /usr/java/default/jre/lib/security/
# cp cacerts cacerts_default
# /usr/java/default/bin/keytool -list -keystore /usr/java/default/jre/lib/security/cacerts | grep -A 1 godaddy
   Enter keystore password:  changeit

   godaddyclass2ca, Jan 21, 2005, trustedCertEntry,
   Certificate fingerprint (SHA1): 27:96:BA:E6:3F:18:01:E2:77:26:1B:A0:D7:77:70:02:8F:20:EE:E4
   --
   godaddyrootg2ca, Jul 19, 2014, trustedCertEntry,
   Certificate fingerprint (SHA1): 47:BE:AB:C9:22:EA:E8:0E:78:78:34:62:A7:9F:45:C2:54:FD:E6:8B
# /usr/java/default/bin/keytool -import -trustcacerts  -alias godaddybundleg2g1 -file /usr/local/src/gd_bundle-g2-g1.crt -keystore /usr/java/default/jre/lib/security/cacerts
   Enter keystore password:  changeit
   Certificate was added to keystore
# /usr/java/default/bin/keytool -import -trustcacerts  -alias godaddyrootg2cross -file /usr/local/src/gdroot-g2_cross.crt -keystore /usr/java/default/jre/lib/security/cacerts
   Enter keystore password:  changeit
   Certificate was added to keystore
# /usr/java/default/bin/keytool -import -trustcacerts  -alias godaddyintermediate -file /usr/local/src/gd_intermediate.crt -keystore /usr/java/default/jre/lib/security/cacerts
   Enter keystore password:  changeit
   Certificate was added to keystore
# /usr/java/default/bin/keytool -import -trustcacerts  -alias godaddycrossintermediate -file /usr/local/src/gd_cross_intermediate.crt -keystore /usr/java/default/jre/lib/security/cacerts
   Enter keystore password:  changeit
   Certificate was added to keystore
# /usr/java/default/bin/keytool -list -keystore /usr/java/default/jre/lib/security/cacerts | grep -A 1 godaddy
   Enter keystore password:  changeit

   godaddyintermediate, Nov 13, 2015, trustedCertEntry,
   Certificate fingerprint (SHA1): 7C:46:56:C3:06:1F:7F:4C:0D:67:B3:19:A8:55:F6:0E:BC:11:FC:44
   --
   godaddybundleg2g1, Nov 13, 2015, trustedCertEntry,
   Certificate fingerprint (SHA1): 27:AC:93:69:FA:F2:52:07:BB:26:27:CE:FA:CC:BE:4E:F9:C3:19:B8
   --
   godaddyrootg2cross, Nov 13, 2015, trustedCertEntry,
   Certificate fingerprint (SHA1): 34:0B:28:80:F4:46:FC:C0:4E:59:ED:33:F5:2B:3D:08:D6:24:29:64
   godaddycrossintermediate, Nov 13, 2015, trustedCertEntry,
   Certificate fingerprint (SHA1): DE:70:F4:E2:11:6F:7F:DC:E7:5F:9D:13:01:2B:7E:68:7A:3B:2C:62
   --
   godaddyclass2ca, Jan 21, 2005, trustedCertEntry,
   Certificate fingerprint (SHA1): 27:96:BA:E6:3F:18:01:E2:77:26:1B:A0:D7:77:70:02:8F:20:EE:E4
   --
   godaddyrootg2ca, Jul 19, 2014, trustedCertEntry,
   Certificate fingerprint (SHA1): 47:BE:AB:C9:22:EA:E8:0E:78:78:34:62:A7:9F:45:C2:54:FD:E6:8B


删除GoDaddy证书
# /usr/java/default/bin/keytool -delete -alias godaddyig2 -keystore /usr/java/default/jre/lib/security/cacerts


(2)Ant

下载安装
# cd /usr/local/src
# wget http://mirrors.cnnic.cn/apache//ant/binaries/apache-ant-1.9.4-bin.zip
# unzip apache-ant-1.9.4-bin.zip
# mv apache-ant-1.9.4/ /opt/ant
# ln -s /opt/ant/bin/ant /usr/bin/ant


设置环境变量
# vi /etc/profile.d/ant.sh
    #!/bin/bash
    ANT_HOME=/opt/ant
    PATH=$ANT_HOME/bin:$PATH
    export PATH ANT_HOME
# chmod +x /etc/profile.d/ant.sh
# source /etc/profile.d/ant.sh


确认Ant版本
# ant -version
    Apache Ant(TM) version 1.9.4 compiled on April 29 2014
# echo $ANT_HOME
    /opt/ant


(3)Maven

下载安装
# cd /usr/local/src
# wget http://mirrors.cnnic.cn/apache/maven/maven-3/3.2.5/binaries/apache-maven-3.2.5-bin.zip
# unzip apache-maven-3.2.5-bin.zip
# mv apache-maven-3.2.5/ /opt/maven
# ln -s /opt/maven/bin/mvn /usr/bin/mvn


设置环境变量
# vi /etc/profile.d/maven.sh
    #!/bin/bash
    MAVEN_HOME=/opt/maven
    PATH=$MAVEN_HOME/bin:$PATH
    export PATH MAVEN_HOME
# chmod +x /etc/profile.d/maven.sh
# source /etc/profile.d/maven.sh


确认Maven版本
# mvn -version
    Apache Maven 3.2.5 .....
# echo $MAVEN_HOME
    /opt/maven


(4)Gradle

下载安装
# cd /usr/local/src
# wget https://downloads.gradle.org/distributions/gradle-3.0-bin.zip
# unzip gradle-3.0-bin.zip
# mv gradle-3.0/ /opt/gradle
# ln -s /opt/gradle/bin/gradle /usr/bin/gradle


设置环境变量
# vi /etc/profile.d/gradle.sh
  #!/bin/bash
  GRADLE_HOME=/opt/gradle
  PATH=$GRADLE_HOME/bin:$PATH
  export PATH GRADLE_HOME
# chmod +x /etc/profile.d/gradle.sh
# source /etc/profile.d/gradle.sh


确认Gradle版本
# gradle -version
  Gradle 3.0 .....
# echo $GRADLE_HOME
  /opt/gradle


(二)PHP

安装依赖库
# yum -y install bzip2-devel curl-devel libjpeg-devel libpng-devel freetype-devel libc-client-devel.i686 libc-client-devel libmcrypt-devel libxml2-devel krb5-devel 


下载安装
# cd /usr/local/src
# wget -O php-5.6.6.tar.gz http://cn2.php.net/get/php-5.6.6.tar.gz/from/this/mirror
# tar -zxvf php-5.6.6.tar.gz
# cd php-5.6.6
# ./configure --enable-bcmath --with-bz2 --enable-calendar --with-curl --enable-exif --enable-ftp --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --enable-gd-native-ttf --with-imap --with-imap-ssl --with-kerberos --enable-mbstring --with-mcrypt --with-mhash --with-mysql --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-zlib-dir --with-regex --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-soap --enable-sockets --with-xmlrpc --enable-zip --with-zlib --enable-inline-optimization --enable-mbregex --enable-opcache --enable-fpm --with-apxs2=/usr/local/apache2/bin/apxs --prefix=/usr/local/php
# make
# make install


配置PHP
# cd /usr/local/php/lib
# cp /usr/local/src/php-5.6.6/php.ini-development ./php.ini
# vi php.ini
    short_open_tag = On
    disable_functions = exec,passthru,shell_exec,system,proc_open,popen
    expose_php = Off
    display_errors = Off
    display_startup_errors = Off
    log_errors = On


设置环境变量
# vi /etc/profile.d/php.sh
    #!/bin/bash
    PHP_HOME=/usr/local/php
    PATH=$PHP_HOME/bin:$PATH
    export PATH PHP_HOME
    export CLASSPATH=.
# chmod +x /etc/profile.d/php.sh
# source /etc/profile.d/php.sh


确认PHP版本
# php -v
    PHP 5.6.6 (cli) (built: Mar  6 2015 16:57:48)
    Copyright (c) 1997-2015 The PHP Group
    Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies


追加模块(以pgsql为例)
# /usr/local/php/bin/php -m
    [PHP Modules]
    bcmath
    ......
    zlib

    [Zend Modules]
# php -m | grep pgsql
# cd /usr/local/src/php-5.6.6/ext/pgsql/
# phpize
# ./configure --with-pgsql=/usr/local/pgsql
# make
# make install
    Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
# vi /usr/local/php/lib/php.ini
    extension_dir="/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/"
    extension=pgsql.so
# php -m | grep pgsql


设置php-fpm
# cp /usr/local/src/php-5.6.6/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
# cd /usr/local/php/etc
# cp php-fpm.conf.default php-fpm.conf
# chmod +x php-fpm
# service php-fpm start
# service php-fpm status


链接nginx和php-fpm
# vi /usr/local/nginx/conf/nginx.conf
    location ~ \.php$ {
         root /usr/local/nginx/html;
         fastcgi_pass     127.0.0.1:9000;
         fastcgi_index    index.php;
         fastcgi_param    SCRIPT_FILENAME   $document_root$fastcgi_script_name;
         include fastcgi_params;
    }


FastCGI访问量大时易出现502,交给apache处理比较好。
引用
location ~ .(php)?$ {
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_pass http://127.0.0.1:88;
}


链接apache和php
# vi /usr/local/apache2/conf/httpd.conf
    LoadModule php5_module modules/libphp5.so

    <FilesMatch \.php$>
        SetHandler application/x-httpd-php
    </FilesMatch>

    DirectoryIndex index.php

    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
分享到:
评论

相关推荐

    centos安装jdk1.8时出现没有/lib/ld-linux.so.2:这个文件的原因分析

    -bash: /usr/local/jdk/jdk1.8.0_181/bin/java: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory 安装完后 java -version 查看版本出现: 原因是:没有那个文件或目录,找了很久发现需要...

    gradle-4.8.1-all.zip 快速下载

    Gradle 4.8.1 已发布,主要解决了以下 6 个问题: 1、 Maven Central 不再支持旧版 TLS 实现。如果 Gradle 在 JDK 7 上运行,会使依赖关系解析失败。 2、Gradle 4.8 破坏了 artifactory 和 bintray 插件的兼容性。 ...

    centos源码安装php-8.1.1+phpredis-4.2.0

    CentOS 源码安装 PHP 8.1.1 + PHPRedis 4.2.0 在本文中,我们将详细介绍如何在 CentOS 操作系统上从源码安装 PHP 8.1.1 和 PHPRedis 4.2.0。 安装依赖项 在安装 PHP 之前,我们需要安装一些依赖项。使用以下命令...

    CentOS-7-x86_64-DVD-2003镜像文件

    # CentOS-7-x86_64-DVD-1810.iso CentOS 7.6 DVD 版 4G http://mirrors.163.com/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-DVD-1810.iso # CentOS-7-x86_64-Everything-1810.iso CentOS 7.6 Everything版 10G ...

    gradle-7.6.4-all.zip 快速下载

    Gradle团队很兴奋地宣布Gradle 7.6.4。 此版本解决了安全漏洞: Apache Ant不安全临时文件漏洞...2、当类路径包含带有Java 21类的多版本jar时,Gradle 7.6.3无法进行增量编译 并包含Jackson和Maven依赖项的版本更新。

    CentOS-7-aarch64-Everything-2009.part05.rar

    CentOS 7.9版本(CentOS-7-aarch64-Everything-2009)适用于ARM64 (aarch64),必须集齐9个文件才能一起解压缩使用,9个文件下载地址: CentOS-7-aarch64-Everything-2009.part09.rar ... CentOS-7-aarch64-Everything-...

    php-5.6.37.tar.gz下载及php5.6源码安装说明

    cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf service php-fpm start 设置php为全局命令: 修改/etc/profile文件使其永久性生效,并对所有系统用户生效, 在文件末尾加上如下两行...

    CentOS-7-x86_64-Everything-1804 VMware workstation12

    CentOS-7-x86_64-Everything-1804 百度云盘资源路径!请笑纳 准备工作 1)下载VMware workstation12 百度云盘 链接:https://pan.baidu.com/s/1c6tE2cPy63y1vO1idHtAzw 提取码:duvd 2)下载CentOS7 方案一:...

    CentOS7 nginx离线安装gcc/pcre-devel/openssl-devel/zlib-devel包

    本教程将详细介绍如何在CentOS 7上离线安装GCC、PCRE-devel、OpenSSL-devel和Zlib-devel这些重要的开发工具包,这些都是构建和编译Nginx web服务器所必需的依赖。以下是一个详细的步骤指南。 首先,`CentOS7 nginx...

    centos系统编译安装nginx+php环境另加独立mysql教程.docx

    CentOS系统编译安装Nginx+PHP环境另加独立MySQL教程 本教程将指导您如何在...本教程指导您如何在CentOS系统上编译安装Nginx+PHP环境,并且另外安装独立的MySQL数据库服务器,旨在帮助您快速搭建Web应用程序环境。

    centos下hive连接mysql驱动 ,mysql-connector-java-8.0.26-1.el7.noarch.

    centos 下hive连接mysql驱动 ,mysql-connector-java-8.0.26-1.el7.noarch. 使用方法: 1.下载本rpm文件后,上传至你的服务器(虚拟机) 2. rpm -ivh mysql-connector-java-8.0.26-1.el7.noarch进行安装 3.安装完成...

    Jenkins_Maven_Git 持续集成及自动化部署 GentOS版

    ### Jenkins、Maven与Git在CentOS上的持续集成与自动化部署 #### 一、环境搭建概述 本篇文章主要介绍如何在CentOS系统上通过Jenkins、Maven与Git实现持续集成(CI)与自动化部署的过程。Jenkins作为CI/CD流水线的...

    php-5.6.29.tar.gz

    编译 ./configure --prefix=/usr/local/php --exec-prefix=/usr/local/php --bindir=/usr/local/php/bin --sbindir=/usr/local/php/sbin --includedir=/usr/local/php/include --libdir=/usr/local/php/lib/php --...

    consol/centos-xfce-vnc

    consol/centos-xfce-vnc 采用VNC或者浏览器 firefox/chrome 都可以连接。启动命令: docker run --rm -it -p 5901:5901 -p 6901:6901 --name test_cent_os consol/centos-xfce-vnc。默认密码 vncpassword

    centos7+nginx+php php-fpm

    php-fpm。放到/etc/init.d/目录。然后执行:chmod a+x php-fpm 然后就可以/etc/init.d/php-fpm start 或者systemctl start php-fpm

    centos7-mini下一键安装google-chrome脚本,完美解决中文字体报错,java实现html转pdf等

    # 上传centos7-mini-google-chrome-install.sh文件放到用户目录~下 $ cd ~ $ chmod -Rf 755 centos7-mini-google-chrome-install.sh $ ./centos7-mini-google-chrome-install.sh # 执行命令即可实现html保存为pdf $...

    http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

    http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

    在CentOS下使用nexus搭建maven私服的安装教程

    ### 在CentOS下使用Nexus搭建Maven私库的安装教程 #### 一、引言 随着企业级项目规模的不断扩大和技术栈的日益复杂,如何有效地管理项目中的依赖成为了一个重要的问题。Maven作为Java生态中最流行的构建工具之一,...

    centos maven eclipse开发换进搭建

    ### CentOS Maven Eclipse 开发环境搭建知识点详解 #### 一、Maven环境搭建 **1.1 安装Maven** **1.1.1 通过YUM安装Maven** 为了在CentOS上安装Maven,可以使用YUM(Yellowdog Updater Modified)包管理器来简化...

    how configure php-fpm 5.x and apache 2.4.x for virtualmin on centos 6

    ### 如何在CentOS 6上为Virtualmin配置PHP-FPM 5.x和Apache 2.4.x 本文将详细介绍如何在CentOS 6系统上为Virtualmin配置PHP-FPM 5.x和Apache 2.4.x。通过这种方式,我们可以显著提高Web服务器的性能,并实现更高效...

Global site tag (gtag.js) - Google Analytics