|
软件包的位置
[iyunv@esxi2v02 soft]# pwd
/soft
需要安装的软件包
[iyunv@esxi2v02 soft]# ll
total 203756
-rw-r--r-- 1 root root 6697806 Apr 1 16:02 apache-tomcat-6.0.35.tar.gz
-rw-r--r-- 1 root root 7459741 Apr 1 16:02 apache-tomcat-7.0.23.tar.gz
-rw-r--r-- 1 root root 18673640 Apr 1 16:02 connect-web.war
-rw-r--r-- 1 root root 18402678 Apr 1 16:02 JavaCenter_Home_2.0_GBK.tar.bz2
drwxr-xr-x 10 root root 4096 Apr 1 16:11 jdk1.6.0_30
-rwxr--r-- 1 root root 85282052 Apr 1 16:03 jdk-6u30-linux-i586.bin
-rw-r--r-- 1 root root 66707283 Apr 1 16:03 jdk-7u2-linux-i586.rpm
-rw-r--r-- 1 root root 23019 Apr 1 16:03 mod_proxy_html.tar.bz2
-rw-r--r-- 1 root root 3834647 Apr 1 16:03 mysql-connector-java-5.1.16.tar.gz
-rw-r--r-- 1 root root 1545588 Apr 1 16:03 tomcat-connectors-1.2.32-src.tar.gz
安装介质
yum -y install gcc openssl-devel zlib-devel libtermcap-devel libxml2 libxml2-devel gcc-c++ make gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*
yum -y groupinstall "Development Tools" "Development libraries"
yum -y install apr-devel
增加执行权限
chmod u+x jdk-6u30-linux-i586.bin
运行文件
./jdk-6u30-linux-i586.bin
如果出错,这个是与操作系统的版本有关,分32位与64位,
find / -name "ld-linux.so.2"
lsb_release -a
如果是64位,则还需要安装这样的yum包
yum install glibc.i686
现在运行文件
./jdk-6u30-linux-i586.bin
移动文件
mv jdk1.6.0_30/ /usr/local/
[iyunv@esxi2v02 local]# echo "$JAVA_HOME"
/usr/local/jdk1.6.0_30
安装tomcat
[iyunv@esxi2v02 soft]# tar zxvf apache-tomcat-6.0.35.tar.gz -C /usr/local/
设置连接
[iyunv@esxi2v02 local]# ln -sv apache-tomcat-6.0.35/ tomcat
`tomcat' -> `apache-tomcat-6.0.35/'
[iyunv@esxi2v02 local]# vim /etc/profile
CATALINA_HOME=/usr/local/tomcat
export JAVA_HOME CATALINA_HOME
[iyunv@esxi2v02 local]# source /etc/profile
[iyunv@esxi2v02 local]# echo "$CATALINA_HOME"
/usr/local/tomcat
tomcat 的停止与启动
[iyunv@esxi2v02 tomcat]# bin/catalina.sh start
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/jdk1.6.0_30
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar
[iyunv@esxi2v02 tomcat]# bin/catalina.sh stop
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/jdk1.6.0_30
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar
访问网站的时候默认就需要是8080的端口
http://172.25.132.16:8080
netstat -natpl
安装tomcat-native
检查安装包
[iyunv@esxi2v02 bin]# rpm -qa | grep apr
apr-1.3.9-3.el6.x86_64
apr-devel-1.3.9-3.el6.x86_64
apr-util-devel-1.3.9-3.el6_0.1.x86_64
apr-util-1.3.9-3.el6_0.1.x86_64
apr-util-ldap-1.3.9-3.el6_0.1.x86_64
查看压缩包
[iyunv@esxi2v02 bin]# ls -l tomcat-native.tar.gz
-rw-r--r-- 1 root root 249259 Nov 28 2011 tomcat-native.tar.gz
解压tomcat-native.tar.gz,并编译
cd $CATALINA_HOME/bin
[iyunv@esxi2v02 bin]# tar zxvf tomcat-native.tar.g
[iyunv@esxi2v02 bin]# cd tomcat-native-1.1.22-src/
[iyunv@esxi2v02 tomcat-native-1.1.22-src]# cd jni/native/
[iyunv@esxi2v02 native]# pwd
/usr/local/tomcat/bin/tomcat-native-1.1.22-src/jni/native
[iyunv@esxi2v02 native]# ./configure --with-apr=/usr --with-ssl && make && make install
[iyunv@esxi2v02 native]# echo /usr/local/apr/lib/ > /etc/ld.so.conf.d/apr.conf
[iyunv@esxi2v02 native]# ldconfig -v | grep apr
/usr/local/apr/lib:
libaprutil-1.so.0 -> libaprutil-1.so.0.3.9
libapr-1.so.0 -> libapr-1.so.0.3.9
libgstdataprotocol-0.10.so.0 -> libgstdataprotocol-0.10.so.0.25.0
已配置成功
编写tomcat自动化脚本
[iyunv@esxi2v02 ~]# vim /etc/init.d/tomcat
#!/bin/bash
JAVA_OPTS='-Xms64m -Xmx128m'
JAVA_HOME=/usr/local/jdk1.6.0_30
CATALINA_HOME=/usr/local/tomcat
export JAVA_HOME CATALINA_HOME
exec $CATALINA_HOME/bin/catalina.sh $*
[iyunv@esxi2v02 ~]# chmod u+x /etc/init.d/tomcat
[iyunv@esxi2v02 ~]# /etc/init.d/tomcat stop
[iyunv@esxi2v02 ~]# /etc/init.d/tomcat start
[iyunv@esxi2v02 ~]# netstat -natpl
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 23007/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1825/cupsd
tcp 0 0 0.0.0.0:38754 0.0.0.0:* LISTEN 1676/rpc.statd
tcp 0 0 0.0.0.0:5672 0.0.0.0:* LISTEN 2161/qpidd
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2113/mysqld
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1658/rpcbind
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 20041/vsftpd
tcp 0 0 172.25.132.16:22 132.97.126.129:43267 ESTABLISHED 28187/0
tcp 0 0 172.25.132.16:3306 172.25.132.22:33209 ESTABLISHED 2113/mysqld
tcp 0 0 :::22 :::* LISTEN 23007/sshd
tcp 0 0 ::1:631 :::* LISTEN 1825/cupsd
tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 29923/java
tcp 0 0 :::8009 :::* LISTEN 29923/java
tcp 0 0 :::44015 :::* LISTEN 1676/rpc.statd
tcp 0 0 :::111 :::* LISTEN 1658/rpcbind
tcp 0 0 :::8080 :::* LISTEN 29923/java
配置文件进行配置
[iyunv@esxi2v02 conf]# pwd
/usr/local/tomcat/conf
[iyunv@esxi2v02 conf]# vim tomcat-users.xml
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-status"/>
<user username="tomcat" password="123456" roles="manager-gui,manager-script,manager-status"/>
可以通过这样的地址进行访问
http://172.25.132.16:8080/manager/status
MYSQL数据库连接
解压包
[iyunv@esxi2v02 soft]# tar zxvf mysql-connector-java-5.1.16.tar.gz
[iyunv@esxi2v02 soft]# cd mysql-connector-java-5.1.16
[iyunv@esxi2v02 mysql-connector-java-5.1.16]# mv mysql-connector-java-5.1.16-bin.jar /usr/local/tomcat/lib/
[iyunv@esxi2v02 mysql-connector-java-5.1.16]# cd /usr/local/tomcat/lib/
[iyunv@esxi2v02 lib]# ls
annotations-api.jar catalina-tribes.jar jasper.jar tomcat-coyote.jar tomcat-i18n-ja.jar
catalina-ant.jar ecj-3.7.jar jsp-api.jar tomcat-dbcp.jar
catalina-ha.jar el-api.jar mysql-connector-java-5.1.16-bin.jar tomcat-i18n-es.jar
catalina.jar jasper-el.jar servlet-api.jar tomcat-i18n-fr.jar
有MYSQL的JAVA的库就可以了
安装mysql
[iyunv@esxi2v02 lib]# rpm -qa | grep mysql
mysql-bench-5.1.52-1.el6_0.1.x86_64
mysql-connector-java-5.1.12-2.el6.x86_64
mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
mysql-5.1.52-1.el6_0.1.x86_64
mysql-test-5.1.52-1.el6_0.1.x86_64
mysql-server-5.1.52-1.el6_0.1.x86_64
mysql-devel-5.1.52-1.el6_0.1.x86_64
mysql-libs-5.1.52-1.el6_0.1.x86_64
php-mysql-5.3.3-3.el6.x86_64
卸载
[iyunv@esxi2v02 lib]# yum -y remove mysql
[iyunv@esxi2v02 lib]# rpm -qa | grep http
jakarta-commons-httpclient-3.1-0.6.el6.x86_64
httpd-manual-2.2.15-9.el6.noarch
httpd-devel-2.2.15-9.el6.x86_64
httpd-tools-2.2.15-9.el6.x86_64
httpd-2.2.15-9.el6.x86_64
[iyunv@esxi2v02 lib]# yum -y remove http
[iyunv@esxi2v02 lib]# yum -y remove php*
tar zxvf mysql-5.0.56.tar.gz
cat /etc/passwd | grep mysql
cd mysql-5.0.56
./configure --prefix=/usr/local/mysql/ --with-extra-charsets=all --with-charset=gbk --with-charset=utf8 && make && make install
cp -f support-files/my-medium.cnf /etc/my.cnf
/usr/local/mysql/bin/mysql_install_db --user=mysql
chown -R mysql.mysql /usr/local/mysql
chown -R mysql /usr/local/mysql/var
echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf && ldconfig && /usr/local/mysql/bin/mysqld_safe --user=mysql &
[iyunv@esxi2v02 mysql-5.0.56]# netstat -anpl |grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 18265/mysqld
cp support-files/mysql.server /etc/init.d/mysqld
chmod a+x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
export PATH=$PATH:/usr/local/mysql/bin
echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
[iyunv@esxi2v02 mysql-5.0.56]# /etc/init.d/mysqld start
Starting MySQL [ OK ]
[iyunv@esxi2v02 mysql-5.0.56]# mysqladmin -u root password '123456'
[iyunv@esxi2v02 mysql-5.0.56]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.56-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
这样MYSQL就可以搭建完成
搭建网站
[iyunv@esxi2v02 webapps]# pwd
/usr/local/tomcat/webapps
[iyunv@esxi2v02 webapps]# mkdir mybb
修改配置文件
[iyunv@esxi2v02 webapps]# vim ../conf/server.xml
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context docBase="mybbs" path=""/>
[iyunv@esxi2v02 webapps]# cd /soft/
[iyunv@esxi2v02 soft]# tar zxvf JavaCenter_Home_2.0_GBK.tar.bz2
[iyunv@esxi2v02 soft]# cd JavaCenter_Home_2.0_GBK
[iyunv@esxi2v02 JavaCenter_Home_2.0_GBK]# mv * /usr/local/tomcat/webapps/mybbs/
[iyunv@esxi2v02 JavaCenter_Home_2.0_GBK]# cd !$
cd /usr/local/tomcat/webapps/mybbs/
[iyunv@esxi2v02 mybbs]# /etc/init.d/tomcat stop
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/jdk1.6.0_30
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar
[iyunv@esxi2v02 mybbs]# /etc/init.d/tomcat start
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/local/jdk1.6.0_30
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar
[iyunv@esxi2v02 mybbs]# netstat -natpl
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 23007/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1825/cupsd
tcp 0 0 0.0.0.0:38754 0.0.0.0:* LISTEN 1676/rpc.statd
tcp 0 0 0.0.0.0:5672 0.0.0.0:* LISTEN 2161/qpidd
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 18265/mysqld
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1658/rpcbind
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 20041/vsftpd
tcp 0 752 172.25.132.16:22 132.97.126.129:45316 ESTABLISHED 31389/0
tcp 0 0 :::22 :::* LISTEN 23007/sshd
tcp 0 0 ::1:631 :::* LISTEN 1825/cupsd
tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 18583/java
tcp 0 0 :::8009 :::* LISTEN 18583/java
tcp 0 0 :::44015 :::* LISTEN 1676/rpc.statd
tcp 0 0 :::111 :::* LISTEN 1658/rpcbind
tcp 0 0 :::8080 :::* LISTEN 18583/java
tcp 0 0 ::1:35943 ::1:54204 TIME_WAIT -
tcp 0 0 ::ffff:127.0.0.1:58009 ::ffff:127.0.0.1:8005 TIME_WAIT -
tcp 0 0 ::1:58634 ::1:55584 TIME_WAIT -
http://172.25.132.16:8080/mybbs/install/
http://172.25.132.16:8080/mybbs/space.jsp?do=home
查看索引空间
SELECT CONCAT(ROUND(SUM(index_length)/(1024*1024*1024), 2), 'GB') AS 'Total Index Size' FROM information_schema.TABLES WHERE table_schema LIKE 'mybbs';
查看表空间
SELECT CONCAT(ROUND(SUM(data_length)/(1024*1024*1024), 2), ' GB') AS 'Total Data Size' FROM information_schema.TABLES WHERE table_schema LIKE 'mybbs';
查看所有表的信息
SELECT CONCAT(table_schema,'.',table_name) AS 'Table Name',
CONCAT(ROUND(table_rows/1000000,2),'M') AS 'Number of Rows',
CONCAT(ROUND(data_length/(1024*1024*1024),2),'G') AS 'Data Size',
CONCAT(ROUND(index_length/(1024*1024*1024),2),'G') AS 'Index Size' ,
CONCAT(ROUND((data_length+index_length)/(1024*1024*1024),2),'G') AS'Total'FROM information_schema.TABLES WHERE table_schema LIKE 'mybbs';
|
|