• 我的centos上安装 jdk+apache+tomcat+tomcatconnector+myql 安装道路


    Apache+tomcat+mysql安装步骤

    预编译坏境安装

    01 yum -y install make
    02 yum -y install perl
    03 yum -y install vim-common*
    04 yum -y install gcc*
    05 yum -y install ncurses*
    06 yum -y install zlib*
    07 yum -y install glib*
    08 yum -y install libxml2*
    09 yum -y install libtool*
    10 yum -y install gd*
    11 yum -y install libpng*
    12 yum -y install libjpeg*
    13 yum -y install libevent*
    14 yum -y install freetype*
    15 yum -y install openssl*
    16 yum -y install curl*
    17 yum -y install unzip
    18 yum -y install krb5*
    19 yum -y install e2fsprogs*
    20 yum -y install libidn*
    21 yum -y install nano
    22 yum -y install gettext*
    23 yum -y install flex*
    24 yum -y install gmp*
    25 yum -y install bzip2
    26
    27 mkdir /root/src
    28 cd /root/src


    ##=====================================================================================================================================================

    1 安装jdk
    1. 安装jdk
    [root@www ]#rpm -ivh jdk-7u45-linux-x64.rpm
    2. 修改 /etc/profile 默jdk认安装在 /usr/java 目录
    [root@www java]# vi /etc/profile
    在末尾追加以下信息
    JAVA_HOME=/usr/java/jdk1.7.0_45
    JRE_HOME=$JAVA_HOME/jre
    CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
    PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

    export JAVA_HOME JRE_HOME CLASSPATH PATH



    [root@www java]#source /etc/profile
    3.测试
    [root@www java]# java -version


    ##=====================================================================================================================================================
    #apache安装
    1.下载所需软件包:

    wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz

    wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz

    wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip


    具体步骤如下:

    a:解决apr not found问题>>>>>>

    [root@xt test]# tar -zxf apr-1.4.5.tar.gz
    [root@xt test]# cd apr-1.4.5
    [root@xt apr-1.4.5]# ./configure --prefix=/usr/local/apr
    [root@xt apr-1.4.5]# make && make install


    b:解决APR-util not found问题>>>>

    [root@xt test]# tar -zxf apr-util-1.3.12.tar.gz
    [root@xt test]# cd apr-util-1.3.12
    [root@xt apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util -with- apr=/usr/local/apr
    [root@xt apr-util-1.3.12]# make && make install


    c:解决pcre问题>>>>>>>>>

    [root@xt test]#unzip -o pcre-8.10.zip
    [root@xt test]#cd pcre-8.10
    [root@xt pcre-8.10]#./configure --prefix=/usr/local/pcre
    [root@xt pcre-8.10]#make && make install

    2.最后编译Apache时加上:

    --with-apr=/usr/local/apr
    --with-apr-util=/usr/local/apr-util/
    --with-pcre=/usr/local/pcre

    成功编译完成~

    安装apache:
    ./configure --prefix=/usr/local/apache --enable-so --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
    make && make install
    启动apache:
    /usr/local/apache/bin/apachect1 start


    设置防火墙: 打开80端口:
    ①/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT //打开80端口
    ②/etc/rc.d/init.d/iptables save //保存防火墙规则


    ##=====================================================================================================================================================

    3 安装tomcat
    1.下载tomcat包
    [root@www java]# wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-6/v6.0.36/bin/apache-tomcat-6.0.36.tar.gz
    2. 解压包
    [root@www java]# tar -zxvf apache-tomcat-6.0.36.tar.gz
    [root@www java]# mv apache-tomcat-6.0.36/* /usr/local/tomcat
    [root@www java]# vi /usr/local/tomcat/bin/catalina.sh
    加入一行:
    JAVA_HOME=/usr/java /jdk1.5.0_22
    [root@www java]# /usr/local/tomcat/bin/startup.sh

    打开/etc/profile,,加入下面几行:
    TOMCAT_HOME=/usr/local/tomcat
    CATALINA_HOME=/usr/local/tomcat
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib
    export TOMCAT_HOME CATALINA_HOME LD_LIBRARY_PATH
    运行 source /etc/profile

    ##=====================================================================================================================================================

    4 安装tomcat-connector

    [root@www java]# wget http://archive.apache.org/dist/jakarta/tomcat-connectors/jk/source/jk-1.2.15/jakarta-tomcat-connectors-1.2.15-src.tar.gz

    [root@www java]# tar xzvf jakarta-tomcat-connectors-1.2.15-src.tar.gz
    [root@www java]# cd jakarta-tomcat-connectors-1.2.15-src/jk/native
    [root@www jakarta-tomcat-connectors-1.2.15-src ]# ./configure --with-apxs=/usr/local/apache2/bin/apxs

    [root@www jakarta-tomcat-connectors-1.2.15-src]# make
    [root@www java]# cp /usr/local/apache2 /mod_jk.so /usr/local/apache2/modules/

    5 在/usr/local/apache2/conf/下面建立两个配置文件mod_jk.conf和workers.properties。

    [root@www java]# vi mod_jk.conf

    添加以下内容:

    JkWorkersFile /usr/local/apache2/conf/workers.properties

    # Where to put jk logs
    JkLogFile /usr/local/apache2/logs/mod_jk.log
    # Set the jk log level [debug/error/info]
    JkLogLevel info
    # Select the log format
    JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
    # JkOptions indicate to send SSL KEY SIZE,
    JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
    # JkRequestLogFormat set the request format
    JkRequestLogFormat "%w %V %T"
    # 将所有servlet 和jsp请求通过ajp13的协议送给Tomcat,让Tomcat来处理
    JkMount /servlet/* worker1
    JkMount /*.jsp worker1

    [root@www java]# vi workers.properties
    添加以下内容:

    # Defining a worker named worker1 and of type ajp13
    worker.list=worker1

    # Set properties for worker1
    worker.worker1.type=ajp13
    worker.worker1.host=localhost
    worker.worker1.port=8009
    worker.worker1.lbfactor=50
    worker.worker1.cachesize=10
    worker.worker1.cache_timeout=600
    worker.worker1.socket_keepalive=1
    worker.worker1.socket_timeout=300

    再配置httpd.conf,作以下修改:

    [root@www java]# vi /usr/local/apache2/ conf/httpd.conf

    增加关于加载mod_jk的语句:

    LoadModule jk_module modules/mod_jk.so
    Include /usr/local/apache2/conf/mod_jk.conf

    #您的站点项目所在路径,应与tomcat中的目录设置相同

    DocumentRoot "/usr/local/tomcat/webapps"

    #默认首页

    DirectoryIndex index.html index.htm index.jsp

    ##=========================================================================================================================安装mysql============================


    1.下载MySQL
    下载源码的版本

    2.安装之前先卸载CentOS自带的MySQL
    [root@localhost ~]# yum remove mysql

    3.编译安装Cmake
    下载cmake源码包:http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz

    从共享目录移至usr目录
    [root@localhost ~]# mv /mnt/hgfs/Share-CentOS/cmake-2.8.4.tar.gz /usr/cmake-2.8.4.tar.gz
    [root@localhost ~]# cd /usr

    解压并安装cmake
    [root@localhost usr]# tar xzvf cmake-2.8.4.tar.gz
    [root@localhost usr]# cd cmake-2.8.4
    [root@localhost cmake-2.8.4]# ./bootstrap
    [root@localhost cmake-2.8.4]# gmake
    [root@localhost cmake-2.8.4]# gmake install

    4.正式开始安装MySQL
    添加MySQL用户和用户组
    [root@localhost ~]# groupadd mysql
    [root@localhost ~]# useradd -g mysql mysql

    MySQL源码包从共享文件夹移至/usr并解压
    [root@localhost ~]mv /mnt/hgfs/Share-CentOS/mysql-5.5.22.tar.gz /usr/mysql-5.5.22.tar.gz
    [root@localhost usr]# tar xzvf mysql-5.5.22.tar.gz
    [root@localhost usr]# cd mysql-5.5.22

    Cmake运行
    [root@localhost mysql-5.5.22]# cmake .

    开始编译安装
    [root@localhost mysql-5.5.22]# make && make install

    进入安装目录,将程序二进制的所有权改为root,数据目录的说有权改为mysql用户,更新授权表
    [root@localhost mysql-5.5.22]# cd /usr/local/mysql/
    [root@localhost mysql]# chown -R root .
    [root@localhost mysql]# chown -R mysql .
    [root@localhost mysql]# chgrp -R mysql .
    [root@localhost mysql]# scripts/mysql_install_db --user=mysql

    安全启动MySQL(默认密码为空)
    [root@localhost mysql]#./bin/mysqld_safe --user=mysql&


    设置选项文件,将配置文件拷贝到/etc下
    [root@localhost mysql]# cp support-files/my-server.cnf /etc/mysql.cnf

    设置开机自启动
    [root@localhost mysql]# cp support-files/mysql.server /etc/init.d/mysql
    [root@localhost mysql]# chmod +x /etc/init.d/mysql

    [root@localhost mysql]# chkconfig mysql on

    通过服务来启动和关闭Mysql
    [root@localhost ~]# service mysql start
    [root@localhost ~]# service mysql stop


    连接本机MySQL
    [root@localhost mysql]#mysql –u root –p
    提示输入password,默认为空,按Enter即可

    断开连接
    mysql>exit;

    为root账户设置密码
    [root@localhost ~]# cd /usr/local/mysql/bin
    [root@localhost mysql]# ./bin/mysqladmin -u root password 123456
    Enter Password:123456

    5.安装设置完毕,之后使用只需启动-连接-断开-关闭,命令如下:
    [root@CentOS mysql]# service mysql start
    Starting MySQL.. [确定]
    [root@CentOS mysql]# mysql -u root -p
    Enter password:
    Welcome to the MySQL monitor. Commands end with ; or g.
    Your MySQL connection id is 1
    Server version: 5.5.22 Source distribution

    Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

    mysql> show databases;
    +--------------------+
    | Database |
    +--------------------+
    | information_schema |
    | mysql |
    | performance_schema |
    | test |
    +--------------------+
    4 rows in set (0.07 sec)

    mysql> exit;
    Bye
    [root@CentOS mysql]# service mysql stop
    Shutting down MySQL. [确定]

    6.其它:
    查看进程命令 ps –ef|grep mysqld
    kill进程命令 kill –9 进程号

  • 相关阅读:
    纯JS制作选项卡--JavaScript实例集锦(初学)
    超级简单实用的CSS3动画,增添网页效果
    3种方法实现图片瀑布流的效果(纯JS,Jquery,CSS)
    CSS动画小结
    遗忘比死亡更可怕
    matplotlib笔记2
    matplotlib笔记1
    pandas数据结构之Panel笔记
    pandas数据结构之Series笔记
    ndarray笔记续
  • 原文地址:https://www.cnblogs.com/roland1982/p/3513377.html
Copyright © 2020-2023  润新知