lab environment:
Operating System: CentOS6.5
Source program: JSPGOU (Open Source Share: https://www.jb51.net/codes/552125.html , tort deleted)
tomcat:8.0.36
Database: mysql5.7
JAVA:JDK7u80
First, install and deploy
1, the initial configuration
Close selinux settings
setenforce 0 vi /etc/selinux/config
Modify the selinux disabled state
SELINUX=disabled
Configure the IP address (abbreviated: Reference [practice] drills Linux operating system 01-CentOS6 installation https://blog.51cto.com/14423403/2415768 )
Configure yum source (slightly: Reference [practice] drills Linux operating system 04- to configure yum source https://blog.51cto.com/14423403/2416049 )
2, the installation JDK
Decompression jdk7 (to download and upload)
tar -zxvf jdk-7u80-linux-x64.tar.gz
mkdir /usr/java
mv jdk1.7.0_80/ /usr/java/jdk17
Since the installation of centos general will own java, so there is no direct way to modify environment variables or updated version, hence the need for multiple versions to choose from.
alternatives --install /usr/bin/java java /usr/java/jdk17/bin/java 3
The java7 added to the system, if you copy and paste does not work, please copy the text into a document and then try
alternatives --config java
Select primary java, and input 3, press enter.
Modify environment variables, file editing environment variable
vi / etc / profile
In the final surface of the text, add the following:
export JAVA_7_HOME=/usr/java/jdk17 export JAVA_HOME=$JAVA_7_HOME export JRE_HOME=$JAVA_HOME/jre export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
Press wq to save and exit.
source /etc/profile
Reload environment variables
java -version
javac -version
Were tested, two show if the current version is java1.7.0_80, the installation proved successful. If one, for example javac -version displays an error, it proves that good is not installed .
3, install tomcat
tar -zxvf apache-tomcat-8.0.36.tar.gz
mkdir -p /data/service
mv apache-tomcat-8.0.36/ /data/service/jspgou
# Note apache directory behind the "/" symbol, jspgou This can be easily changed, here just because we installed open source website name called jspgou, so it will take the name of the directory.
Into the directory of tomcat
cd /data/service/jspgou/bin
we catalina.sh
In the path #JAVA_HOME note at the increase of java
JAVA_HOME=/usr/java/jdk17
: Wq save and exit.
./startup.sh
#starting program
ps -ef | grep tomcat
# Can check whether the process has been initiated, thus tomcat installation is complete.
打开浏览器,通过IP地址:8080进行访问,返回tomcat页面正面tomcat安装与启动正常。
如果发现限制访问或者无法访问,请检查防火墙配置,可以关掉防火墙测试
service iptables stop chkconfig iptables off
拷贝测试网站之前,先清理干净tomcat自带的网站内容
cd /data/service/jspgou
rm -rf webapps/ROOT/*
#删除tomcat里面的示例的ROOT的网站文件,千万不要删除webapps下面的所有文件了,还有些manager等文件夹,监控需要用到。
4、数据库安装与导入
安装Mysql5.7数据库(略:参考【实践演练】Linux操作系统06-Mysql5.7安装https://blog.51cto.com/14423403/2416054)
修改Mysql中文设置,由于网站需要使用中文,默认的编码可能会导致中文显示乱码,需要在初期设置好。
vi /etc/my.cnf
增加以下内容:
[mysqld] character-set-server=utf8 [client] default-character-set=utf8 [mysql] default-character-set=utf8
重启服务
service mysqld restart
登陆数据库
mysql -u root -p
为应用创建名为jspgou的数据库
create database jspgou default character set utf8 collate utf8_bin;
Create an account jspgou, and unauthorized access jspgou database, web applications specifically for this use
grant all on jspgou.* to jspgou@localhost identified by '1qaz!QAZ';
Refresh rights
flush privileges;
Use jspgou database
use jspgou;
View database tables, database tables should be empty at this time
show tables;
Import the database file, note that the path to self-modify the path jspgou.sql file upload
source /software/jspgouV6.1-ROOT/DBjspgou.sql
View database tables again and found a table has been successfully imported
show tables;
Exit Database
quit;
5, import the website source files
The source code package upload by WinSCP, copy the entire folder to ROOT directory tomcat container (ROOT main page is the source of the site)
mv ROOT /data/service/jspgou/webapps/
Setting connection profile tomcat with mysql database
cd /data/service/jspgou/webapps/ROOT/WEB-INF/config vi jdbc.properties
Find the configuration mysql database, modify the database name in accordance with the actual situation, the user name, password
jdbc.url=jdbc:mysql://DB_HOST:DB_PORT/jspgou?characterEncoding=UTF-8
jdbc.username=jspgou
jdbcpassword = 1qaz! GAS
Restart the database service, and then restart the tomcat service
service mysqld restart cd /data/service/jspgou/bin ./shutdown.sh ./startup.sh