您的位置:首页 > 编程语言 > Java开发

初步搭建javaWeb开发环境

2017-08-03 11:30 525 查看
基于centOs 6.5

以下在服务器上的操作都是基于可视化工具SSH Secure Shell Client   下载链接  http://ultra.pr.erau.edu/~jaffem/tutorial/SSH_secure_shell_client.htm

完成安装后会出现两个图标:

    上面的是进入文件模式
 下面的是命令行模式  。以下搭建过程两个结合使用

1、命令行 下载安装jdk

yum list java*-------查看yum里的jdk

yum install java-1.7.0-openjdk* -y------选择自己需要的版本 下载安装jdk
java -version------查看系统下刚安装的jdk版本 看是否一致

2、下载安装tomcat

# cd /mydata/tomcatMap----进入你想要安装的文件夹下 我是在根目录下创建了mydata目录 /tomcatMap用于放tomcat文件
# wget https://mc.qcloudimg.com/static/archive/fa66329388f85c08e8d6c12ceb8b2ca3/apache-tomcat-7.0.77.tar.gz---- 下载tomcat
# tar -zxf apache-tomcat-7.0.77.tar.gz-----解压
# mv apache-tomcat-7.0.77 /mydata/tomcatMap/tomcat7-master------在同目录下进行重命名
# cd /mydata/tomcatMap/tomcat7-master/bin----进入bin目录
# chmod 777 *.sh----给bin下的所有脚本权限
# ./startup.sh----启动

# wget http://localhost:8080/------本机上内部访问tomcat 看是否能正常启动

这样走下来并没有给tomcat配置jre 但是查看tomcat当前使用的jdk版本 发现正是我刚下载的jdk1.7.0版本的 所以不用再进行配置



3、安装mysql

# yum install -y mysql-server mysql mysql-devel-----安装mysql
# mysql_secure_installation-----初始密码设置等配置
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED
FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):<–初次运行直接回车
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
New password: <– 设置root用户的密码
Re-enter new password: <– 再输入一次你设置的密码
Password updated successfully!
Reloading privilege tables..
… Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] <– 是否删除匿名用户,我是直接回车
… Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] <–是否禁止root远程登录,根据自己的需求选择Y/n并回车,我是选择n
… Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] <– 是否删除test数据库,直接回车
- Dropping test database…
… Success!
- Removing privileges on test database…
… Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] <– 是否重新加载权限表,直接回车
… Success!
Cleaning up…
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
# service mysqld restart------安装后重启动生效
# mysql -uroot -p*******-------使用初始设置的密码进行登录 查看

遇见问题1:mysql仅进行以上步骤后 使用本地Navicat 无法 用root账户登录远程数据库 下面我授权admin账户举例说明
1) 首先进入云服务器管理中心开放针对此操作系统你需要的端口号 入22 80 88 8080等
2) 进入mysql数据库 针对user表 进行授权
---grant all privileges on *.* to a****@'%' identified by '*******' with grant option;-----以a****为用户名
******为密码进行登陆的 % (任何IP)
--- flush privileges;---------一定要记得刷新权限



3)之前我是经过这两步依然连接不上 于是又找了个方法:找到防火墙文件 直接download下来 用好使的编辑器打开
防火墙文件位置:/etc/sysconfig/iptables



新增后保存上传到原来位置覆盖原文件 重新启动

service iptables restart ----重启生效

这只是最初步的步骤 能通 不过后续用起来也会有很多问题需要去解决

     
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息