Under Linux build environment (three) - environmental structures

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
Here Insert Picture Description

2) Enter, enter the firewall settings.
Here Insert Picture Description

3) setup is complete, exit
Here Insert Picture Description

2, the installation JDK

1) View / root directory, enter the command line:ll
Here Insert Picture Description

2) installation JDK, enter the command line: rpm -ivh jdk-8u11-linux-i586.rpmand press Enter

注意:安装命令: rpm -ivh 文件名.
Here Insert Picture Description

3) the installation is complete, enter the command line version to see: java -versionandjavac -version
Here Insert Picture Description

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/profilecheck whether theHere Insert Picture DescriptionHere Insert Picture Description

6) Check rewrite jdk version number (slightly)

3, the installation MySQL database

1) add to mount file
enter the command line: df -hsee if there are CD-ROM, if no disc, disconnecting the CD-ROM
Here Insert Picture Description

CD not found. add manully
Here Insert Picture Description
Here Insert Picture Description

Enter the command line again: df -hCheck the mount is completed
Here Insert Picture Description

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
Here Insert Picture Description

2) Installing MySQL
installation services side:
rpm -ivh MySQL-server-community-5.0.37-0.rhel4.i386.rpm.

Here Insert Picture Description

Install the client:
rpm -ivh MySQL-client-community-5.0.37-0.rhel4.i386.rpm.
Here Insert Picture Description

Installation devel:
rpm -ivh MySQL-devel-community-5.0.37-0.rhel4.i386.rpm.
Here Insert Picture Description

Enter mysqlto see if the installation is complete.
Here Insert Picture Description

注意:若输入mysql回车,出错:可输入service mysql start 重启Mysql即可

3) import the database file
to view the current existing database: Enter the command line:show databases;
Here Insert Picture Description

Import database: enter mysql, enter the command:source /root/init_database.sql
Here Insert Picture Description

View current database: Enter the command:show databases;
Here Insert Picture Description

Exit mysql: Inputexit

4、 安装Tomcat
1) 在/root目录下,解压Tomcat,输入命令:unzip apache-tomcat-7.0.82
Here Insert Picture Description

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权限
Here Insert Picture Description

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目录,复制成功
Here Insert Picture Description

4) 启动Tomcat
进入apache-tomcat-7.0.82/bin/目录,执行 ./startup.sh 文件,若显示Tomcat started,则成功
Here Insert Picture Description

查看apache-tomcat-7.0.82/webapps,可以看到suqi文件夹以生成
Here Insert Picture Description

5) 修改suqi 项目的配置,将其IP地址修改为主机地址。
切换至suqi/web-inf目录然后找到config.txt文件,命令行:
cd apache-tomcat-7.0.82/webapps/suqi/WEB-INF/ .

Here Insert Picture Description

修改config.txt文件,命令:vi config.txt,修改IP地址,然后保存::
Here Insert Picture Description

6) 修改数据库访问权限
数据库只能本地IP访问,改成允许任何IP访问。命令行:
mysql .
use mysql;.
update user set host = ‘%’ where host = ‘localhost’ .
flush privileges; --立即生效
exit --退出
Here Insert Picture Description

7) Restart Tomcat
to kill the Tomcat process, and then restart. Command line:
ps -ef |grep tomcatFind the Tomcat process number
kill -9 15671to kill the Tomcat process
Here Insert Picture Description

Start Tomcat, the command line:
cd the Apache-Tomcat-7.0.82 / bin / bin directory switch to
./startup.shstart Tomcat
Here Insert Picture Description

5, background enter : http: // IP: 8080 / suqi / tms
Here Insert Picture Description

6, the front desk browser, type : http: // IP: 8080 / suqi
Here Insert Picture Description

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 startOff:chkconfig iptables stop

With immediate effect, after the restart failure:
On: service iptables startOff:service iptables stop

Check firewall status:service iptables status

However, when I set up the environment, computer joke, 环境搭建,配置都弄好后,后端可以打开项目,但是前台却无法进入,尝试了关闭防火墙,重启,甚至重装了三遍,但是都无济于事,最后,换了个火狐流浪器,一下子就OK了.

Published 62 original articles · won praise 42 · views 3311

Guess you like

Origin blog.csdn.net/weixin_45375866/article/details/101039106