Linux environment to build
(注:建议在搭建环境之前,给虚拟机拍一个快照,方便恢复
)
1, turn off the firewall to prevent the installation database (MySQL) failure
1) In the virtual machine command line setup, enter the configuration window
2) Enter, enter the firewall settings.
3) setup is complete, exit
2, the installation JDK
1) View / root directory, enter the command line:ll
2) installation JDK, enter the command line: rpm -ivh jdk-8u11-linux-i586.rpm
and press Enter
注意:安装命令: rpm -ivh 文件名
.
3) the installation is complete, enter the command line version to see: java -version
andjavac -version
4) configuration environment variable
enter the command line: vi /etc/profile
edit text / etc / profile, in the last line of the input variable path, and then save and exit.
Variable path:
JAVA_HOME=/usr/java/jdk1.8.0_11
JRE_HOME=$JAVA_HOME/jre
CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib
PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export PATH CLASSPATH JAVA_HOME JRE_HOME
5) complete configuration environment, enter the command line: cat /etc/profile
check whether the
6) Check rewrite jdk version number (slightly)
3, the installation MySQL database
1) add to mount file
enter the command line: df -h
see if there are CD-ROM, if no disc, disconnecting the CD-ROM
CD not found. add manully
Enter the command line again: df -h
Check the mount is completed
In this case is not over yet, switch to the next DVD, install DBI documentation
Followed by the implementation:
cd /media/RHEL_5.4\ i386\ DVD/
Switching to a corresponding directory
find -name "*perl-DBI*"
Find Mounting File DBI
rpm -ivh ./Server/perl-DBI-1.52-2.el5.i386.rpm
Installation query to the DBI
2) Installing MySQL
installation services side:
rpm -ivh MySQL-server-community-5.0.37-0.rhel4.i386.rpm
.
Install the client:
rpm -ivh MySQL-client-community-5.0.37-0.rhel4.i386.rpm
.
Installation devel:
rpm -ivh MySQL-devel-community-5.0.37-0.rhel4.i386.rpm
.
Enter mysql
to see if the installation is complete.
注意:若输入mysql回车,出错:可输入service mysql start 重启Mysql即可
3) import the database file
to view the current existing database: Enter the command line:show databases;
Import database: enter mysql, enter the command:source /root/init_database.sql
View current database: Enter the command:show databases;
Exit mysql: Inputexit
4、 安装Tomcat
1) 在/root目录下,解压Tomcat,输入命令:unzip apache-tomcat-7.0.82
2) 修改apache-tomcat-7.0.82包中bin目录下的所有.sh文件权限,使之可执行。命令行:
cd apache-tomcat-7.0.82
切换至apache-tomcat-7.0.82目录
cd bin/
切换至bin目录
chmod a+x *.sh
给所有.sh 文件的所有用户加上x权限
3) 放置代码包
将代码包suqi.war放置apache-tomcat-7.0.82目录下的/webapps中,并修改名为suqi.war
命令:cp suqi.war ./apache-tomcat-7.0.82/webapps/suqi.war
然后查看./apache-tomcat-7.0.82/webapps目录,复制成功
4) 启动Tomcat
进入apache-tomcat-7.0.82/bin/目录,执行 ./startup.sh
文件,若显示Tomcat started,则成功
查看apache-tomcat-7.0.82/webapps,可以看到suqi文件夹以生成
5) 修改suqi 项目的配置,将其IP地址修改为主机地址。
切换至suqi/web-inf目录然后找到config.txt文件,命令行:
cd apache-tomcat-7.0.82/webapps/suqi/WEB-INF/
.
修改config.txt文件,命令:vi config.txt
,修改IP地址,然后保存::
6) 修改数据库访问权限
数据库只能本地IP访问,改成允许任何IP访问。命令行:
mysql
.
use mysql;
.
update user set host = ‘%’ where host = ‘localhost’
.
flush privileges;
--立即生效
exit
--退出
7) Restart Tomcat
to kill the Tomcat process, and then restart. Command line:
ps -ef |grep tomcat
Find the Tomcat process number
kill -9 15671
to kill the Tomcat process
Start Tomcat, the command line:
cd the Apache-Tomcat-7.0.82 / bin / bin directory switch to
./startup.sh
start Tomcat
5, background enter : http: // IP: 8080 / suqi / tms
6, the front desk browser, type : http: // IP: 8080 / suqi
7. Summary:
If the foreground or the background can not be accessed, usually a firewall problem, then need to turn off the firewall can command.
After the restart permanent:
On: chkconfig iptables start
Off:chkconfig iptables stop
With immediate effect, after the restart failure:
On: service iptables start
Off:service iptables stop
Check firewall status:service iptables status
However, when I set up the environment, computer joke, 环境搭建,配置都弄好后,后端可以打开项目,但是前台却无法进入,尝试了关闭防火墙,重启,甚至重装了三遍,但是都无济于事,最后,换了个火狐流浪器,一下子就OK了
.