CentOS部署

----------------------------------------------------------------------------------------------------------------------

十多年的资阳网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。成都全网营销推广的优势是能够根据用户设备显示端的尺寸不同,自动调整资阳建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。成都创新互联公司从事“资阳网站设计”,“资阳网站推广”以来,每个客户项目都认真落实执行。重启系统

reboot

----------------------------------------------------------------------------------------------------------------------

JDK 下载地址

http://www.oracle.com/technetwork/java/javase/downloads/index.html

获取真实地址

http://download.oracle.com/otn-pub/java/jdk/7u60-b19/jdk-7u60-linux-x64.rpm?AuthParam=1402828126_1f9972f80e53983d3e83b549d51fb394

用wget下载

wget-Ojdk-7u60-linux-x64.rpmhttp://download.oracle.com/otn-pub/java/jdk/7u60-b19/jdk-7u60-linux-x64.rpm?AuthParam=1402828126_1f9972f80e53983d3e83b549d51fb394

修改文件名称

mvjdk-7u60-linux-x64.rpmjdk-7-linux-x64.rpm

更改文件权限

chmod755jdk-7u60-linux-x64.rpm

安装

rpm-ivhjdk-7u60-linux-x64.rpm

删除文件

rmjdk-7u60-linux-x64.rpm

配置java-home

查询java版本 java -version 如果版本不对则配置java-home

打开文件/etc/profile
在profile文件末尾加入:

exportJAVA_HOME=/usr/java/jdk1.7.0_60 exportPATH=$JAVA_HOME/bin:$PATH exportCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

重启登录

------------------------------------------------------------------------------------------------------------------------

Mysql 安装mysql

yuminstallmysqlmysql-servermysql-devel

启动mysql

servicemysqldstart

设置mysql密码

mysql mysql>;USEmysql; mysql>;UPDATEuserSETPassword=PASSWORD(\'123456\')WHEREuser=\'root\'; mysql>;FLUSHPRIVILEGES;

设置允许远程登录

mysql-uroot-p EnterPassword: mysql>GRANTALLPRIVILEGESON*.*TO\'root\'@\'%\'IDENTIFIEDBY\'123456\'WITHGRANTOPTION; mysql>FLUSHPRIVILEGES;

设为开机启动

chkconfigmysqldon

------------------------------------------------------------------------------------------------------------------------

Apache 安装Apache

yuminstallhttpdhttpd-devel

卸载

yum-yremovehttpd*

启动apache

servicehttpdstart

设为开机启动

chkconfighttpdon

配置 文件位置/etc/httpd/conf/httpd.conf

设置虚拟主机目录

在文件的最后添加

Listen9999 NameVirtualHost*:9999 ServerNamelocalhost:9999 DocumentRoot"/data/staticFile"

------------------------------------------------------------------------------------------------------------------------------

Tomcat 安装tomcat

yum-yinstalltomcat6

启动tomcat

servicetomcat6start

设为开机启动

chkconfigtomcat6on

默认的tomcat文件夹路径

/usr/share/tomcat6

配置(tomcat/conf/server.xml)

www.aa.com www.bb.com

----------------------------------------------------------------------------------------------------------------------

防火墙

文件路径/etc/sysconfig/iptables(可能不存在,自己新建个就行)

我的配置

#Generatedbyiptables-savev1.4.7onFriJun2715:46:012014 *filter :INPUTACCEPT[0:0] :FORWARDACCEPT[0:0] :OUTPUTACCEPT[5:748] -AINPUT-mstate--stateRELATED,ESTABLISHED-jACCEPT -AINPUT-picmp-jACCEPT -AINPUT-ilo-jACCEPT -AINPUT-ptcp-mstate--stateNEW-mtcp--dport22-jACCEPT -AINPUT-ptcp-mstate--stateNEW-mtcp--dport80-jACCEPT -AINPUT-ptcp-mstate--stateNEW-mtcp--dport8080-jACCEPT -AINPUT-ptcp-mstate--stateNEW-mtcp--dport3306-jACCEPT -AINPUT-ptcp-mstate--stateNEW-mtcp--dport9999-jACCEPT -AFORWARD-jREJECT--reject-withicmp-host-prohibited COMMIT #CompletedonFriJun2715:46:012014 #Generatedbyiptables-savev1.4.7onFriJun2715:46:012014 *nat :PREROUTINGACCEPT[35:1782] :POSTROUTINGACCEPT[107:8216] :OUTPUTACCEPT[107:8216] -APREROUTING-ptcp-mtcp--dport80-jREDIRECT--to-ports8080 COMMIT #CompletedonFriJun2715:46:012014

端口允许

iptables-AINPUT-ptcp-mstate--stateNEW-mtcp--dport22-jACCEPT iptables-AINPUT-ptcp-mstate--stateNEW-mtcp--dport80-jACCEPT iptables-AINPUT-ptcp-mstate--stateNEW-mtcp--dport8080-jACCEPT iptables-AINPUT-ptcp-mstate--stateNEW-mtcp--dport3306-jACCEPT

端口转发

iptables-tnat-APREROUTING-ptcp--dport80-jREDIRECT--to-port8080

配置保存

serviceiptablessave

防火墙启动

serviceiptablesstart

防火墙开机启动

chkconfigiptableson


新闻名称:CentOS部署
文章源于:http://scyanting.com/article/cpghoe.html