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

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 依赖autoconf和automake

下面三条可以不用执行

#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

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏CaiRui

Centos6和7的区别

1、init系统 Linux 操作系统的启动首先从 BIOS 开始,接下来进入 boot loader,由 bootloader 载入内核,进行内核初始化。内核...

4479
来自专栏蓝天

Linux操作系统下IPTables配置方法详解

Chain RH-Firewall-1-INPUT (0 references)

3243
来自专栏ml

linux开关端口问题

linux开关端口问题: 我们知道一些常用的端口,比如mysql的端口为3306,sql的端口为:1433,以及tomcat的端口为 8008等等一样! ...

8376
来自专栏编程微刊

动态表格之查看、删除、编辑

2592
来自专栏运维小白

10.15 iptables filter表案例

iptables常用知识回顾点 iptables -I/-A/-D 后紧跟 链 ,可以是INPUT,OUTPUT,FORWARD iptables -P 用来指...

2019
来自专栏.net core新时代

使用工具安装,运行,停止,卸载Window服务

WSWinForm.exe介绍       WSWinForm.exe是我自己开发的一个实用的小工具,用于将任何EXE程序作为Windows服务运行。也就是说W...

20110
来自专栏Aloys的开发之路

package-info.java文件详解

pacakge-info.java介绍 pacakge-info.java是一个Java文件,可以添加到任何的Java源码包中。pacakge-info.jav...

2768
来自专栏运维小白

linux基础(day 33)

10.11 Linux网络相关 linux网络相关 ifconfig命令,可以查看虚拟网卡,而ip addr命令则不能查看 ifconfig查看网卡ip(yum...

2659
来自专栏Netkiller

Struts2 S2-046, S2-045 Firewall(漏洞防火墙)

开发中遇到一个问题,Struts2 已经升级到2.3.32但是故障依旧,绞尽脑汁找不出原因。此路不同另寻它路,我便想从运维角度暂时解决这个问题,给开发留出足够的...

2956
来自专栏编程

Debian/Ubuntu-shell脚本来管理iptables安全策略

前言 在Centos上都有iptables-services或者firewalld等iptables管理工具。那在Debian系列用什么管理工具呢? ? 使用D...

2299

扫码关注云+社区

领取腾讯云代金券