Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1612681
  • 博文数量: 101
  • 博客积分: 2465
  • 博客等级: 中尉
  • 技术积分: 2126
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-09 15:39
个人简介

https://minminmsn.com/

文章分类

全部博文(101)

文章存档

2018年(2)

2017年(2)

2016年(11)

2015年(14)

2014年(9)

2013年(16)

2012年(47)

分类: LINUX

2012-10-17 15:29:19

CentOS6.3 x86_64 mininstall 安装 apahce2.23+jdk1.7+tomecat7+mysql5.1.58

# uname -a

Linux localhost 2.6.32-279.el6.x86_64 #1 SMP Fri Jun 22 12:19:21 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

# cat /etc/redhat-release

CentOS release 6.3 (Final)

# rpm -qa |wc -l

244

一,安装apache

#yum –y install gcc

#tar –zxvf httpd-2.2.23.tar.gz

#cd httpd-2.2.23

#./configure –-prefix=/usr/local/apahce2

#make

#make install

#ln –s /usr/local/apache2/bin/apachectl /etc/init.d/apache

#vim /etc/init.d/apache

#apache

#chkconfig: 2345 85 15

#description: apache is a web server

#chkconfig --add apache

# chkconfig apache on

#service apache start

#yum –y install elinks

#elinks localhost测试

 

二,安装jdk

#tar –zxvf  jdk-7u7-linux-x64.tar.gz –C /usr/java

#vim /etc/profile

JAVA_HOME=/usr/java/jdk1.7.0_07

PATH=$JAVA_HOME/bin:$PATH

CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export JAVA_HOME

export PATH

export CLASSPATH

# source /etc/profile

# java -version

java version "1.7.0_07"

Java(TM) SE Runtime Environment (build 1.7.0_07-b10)

Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)

 

三,安装tomcat

#tar –zxvf apache-tomcat-7.0.32.tar.gz –C /usr/local

#mv /usr/local/tomcat-7.0.32 /usr/local/tomcat7

#vim /etc/profile

export TOMCAT_HOME=/usr/local/tomcat7

export CATALINA_HOME=/usr/local/tomcat7

# /usr/local/tomcat7/bin/startup.sh

Using CATALINA_BASE:   /usr/local/tomcat7

Using CATALINA_HOME:   /usr/local/tomcat7

Using CATALINA_TMPDIR: /usr/local/tomcat7/temp

Using JRE_HOME:        /usr/java/jdk1.7.0_07

Using CLASSPATH:       /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar

# netstat -an | grep :8

tcp    0      0 ::ffff:127.0.0.1:8005     :::*              LISTEN     

tcp    0      0 :::8009               :::*               LISTEN    

tcp    0      0 :::8080               :::*               LISTEN     

tcp    0      0 :::80                 :::*               LISTEN     

    #elinks localhsot:8080测试

设置tomcat自动启动

我觉得有好几种办法,比如写个自动启动脚本,或者把bin下某个文件copy到

/etc/init.d下再改改,但是我发现用这个同样可以自动启动

echo "/usr/local/tomcat7/bin/catalina.sh start" >>/etc/proflie

不过这个需要有用户登录才生效

后来发现放在/etc/rc.local这个文件下面同样可以,但是要加上

export JAVA_HOME=/usr/java/jkd1.7.0_07

这样才行


 

四,安装mysql

#groupadd  mysql

#useradd -g mysql  mysql

#tar –zxvf mysql-5.1.58.tar.gz

#cd mysql-5.1.58

#./configure --prefix=/usr/local/mysql --without-debug  --enable-thread-safe-client --enable-assembler --enable-profiling --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-charset=latin1 --with-extra-charsets=utf8,gbk   --with-mysqld-user=mysql --without-embedded-server --with-server-suffix=community --with-unix-socket-path=/usr/local/mysql/sock/mysql.sock --with-plugins=innobase

编译时会报错

错误点

1,checking for termcap functions library... configure: error: No curses/termca

解决

#yum -y install ncurses-devel

 

2,../depcomp: line 571: exec: g++: not found

make[1]: *** [my_new.o] Error 127

make[1]: Leaving directory `/home/mysql-5.1.58/mysys'

解决

#yum intall gcc-c++

 

3/bin/rm: cannot remove `libtoolT': No such file or directory

config.status: executing default commands

安装libtool  依赖autoconfautomake 

下面三条可以不用执行

#autoreconf --force --install

#libtoolize --automake --force

#automake --force --add-missing

不过安装libtool并按照这个方法做后,还会出现上面那个报错,但不影响结果

#make

#make install

# cp support-files/my-medium.cnf /etc/my.cnf

# cd /usr/local/mysql/bin/

# ./mysql_install_db --user=mysql

Installing MySQL system tables...

121016 15:04:30 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.

OK

Filling help tables...

121016 15:04:30 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.

OK

 

To start mysqld at boot time you have to copy

support-files/mysql.server to the right place for your system

 

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

 

/usr/local/mysql/bin/mysqladmin -u root password 'new-password'

/usr/local/mysql/bin/mysqladmin -u root -h localhost password 'new-password'

 

Alternatively you can run:

/usr/local/mysql/bin/mysql_secure_installation

 

which will also give you the option of removing the test

databases and anonymous user created by default.  This is

strongly recommended for production servers.

 

See the manual for more instructions.

 

You can start the MySQL daemon with:

cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &

 

You can test the MySQL daemon with mysql-test-run.pl

cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl

 

Please report any problems with the /usr/local/mysql/bin/mysqlbug script!

 

[root@localhost mysql]# chown -R root .

[root@localhost mysql]# chown -R mysql var

[root@localhost mysql]# chgrp -R mysql .

[root@localhost mysql]# ls -l

total 36

drwxr-xr-x.  2 root mysql 4096 Oct 16 14:57 bin

drwxr-xr-x.  2 root mysql 4096 Oct 16 14:57 docs

drwxr-xr-x.  3 root mysql 4096 Oct 16 13:56 include

drwxr-xr-x.  3 root mysql 4096 Oct 16 13:56 lib

drwxr-xr-x.  2 root mysql 4096 Oct 16 15:01 libexec

drwxr-xr-x. 10 root mysql 4096 Oct 16 15:01 mysql-test

drwxr-xr-x.  5 root mysql 4096 Oct 16 15:01 share

drwxr-xr-x.  5 root mysql 4096 Oct 16 15:01 sql-bench

drwx------.  4 mysql mysql 4096 Oct 16 15:04 var

 

# /usr/local/mysql/bin/mysqld_safe --user=mysql &

[1] 31365

 121016 15:13:13 mysqld_safe Logging to '/usr/local/mysql/var/localhost.err'.

121016 15:13:13 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var

 

自动启动

#cp support-files/mysql.server /etc/init.d/mysql

#chmod +x /etc/init.d/mysql

#chkconfig --add mysql

#chkconfig mysql on

五,设置防火墙

cat /etc/sysconfig/iptables

# Firewall configuration written by system-config-firewall

# Manual customization of this file is not recommended.

*filter

:INPUT ACCEPT [0:0]

:FORWARD ACCEPT [0:0]

:OUTPUT ACCEPT [0:0]

-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

-A INPUT -p icmp -j ACCEPT

-A INPUT -i lo -j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

-A INPUT -j REJECT --reject-with icmp-host-prohibited

-A FORWARD -j REJECT --reject-with icmp-host-prohibited

COMMIT

阅读(4335) | 评论(2) | 转发(0) |
给主人留下些什么吧!~~

minminmsn2012-11-22 17:45:21

hbxm977: 看的头都晕了.....
写得不好关于apache与tomcat连接这块没写

hbxm9772012-11-21 17:56:23

看的头都晕了