CentOS7安装openjdk、tomcat和mysql流程介绍
首先是前戏,推荐一个远程工具Xshell和Xftp搭配使用,以下是Xshell的官网
http://www.netsarang.com/products/xsh_overview.html
1.openjdk
How to download and install prebuilt OpenJDK packages
JDK 8
Debian, Ubuntu, etc.
On the command line, type:
$ sudo apt-get install openjdk-8-jre
The openjdk-8-jre package contains just the Java Runtime Environment. If you want to develop Java programs then please install the openjdk-8-jdk package.
Fedora, Oracle Linux, Red Hat Enterprise Linux, etc.
On the command line, type:
$ su -c “yum install java-1.8.0-openjdk”
The java-1.8.0-openjdk package contains just the Java Runtime Environment. If you want to develop Java programs then install the java-1.8.0-openjdk-devel package.
以上说了不同系统的安装方式,还指出命令只是安装了JRE,如果你需要开发应用程序,还需要另外安装(已经用加粗标识),想安装其它版本详情看openjdk官网介绍
http://openjdk.java.net/install/
[root@VM_207_229_centos ~]# java -version
openjdk version "1.8.0_71"
OpenJDK Runtime Environment (build 1.8.0_71-b15)
OpenJDK 64-Bit Server VM (build 25.71-b15, mixed mode)
- 1
- 2
- 3
- 4
2.tomcat
# cd /usr/local
# wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.0.36/bin/apache-tomcat-8.0.36.tar.gz
# tar xzf apache-tomcat-8.0.36.tar.gz
# mv apache-tomcat-8.0.36 tomcat
# ls
apache-tomcat-8.0.36.tar.gz etc include lib64 logs sa share tomcat bin games lib libexec qcloud sbin src
- 1
- 2
- 3
- 4
- 5
- 6
- 7
个人习惯把tomcat放在/user/local下,下载后解压,再更名为tomcat
想要其它版本的话……在以下地址找好路径下载
https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/
修改配置文件conf/server.xml改为监听80端口,默认编码utf-8,并开启gzip压缩
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" executor="tomcatThreadPool" URIEncoding="utf-8"
compression="on"
compressionMinSize="50" noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain" />
<!-- A "Connector" using the shared thread pool-->
- 1
- 2
- 3
- 4
- 5
- 6
- 7
启动tomcat,在浏览器输入ip地址访问,看到tomcat小猫页面就行了。CentOS7开放80端口,Centos 7使用firewalld代替了原来的iptables。
<!-- 启动防火墙 -->
# systemctl start firewalld
<!-- 开启80端口,出现success表明添加成功 -->
# firewall-cmd --zone=public --add-port=80/tcp --permanent
<!-- 重启防火墙 -->
# systemctl restart firewalld.service
<!-- 检查端口 -->
# firewall-cmd --permanent --zone=public --list-ports
<!-- 自启动防火墙 -->
#systemctl enable firewalld
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
还有更改默认访问地址,不想见到tomcat小猫(此步骤看个人需要)
<Engine name="Catalina" defaultHost="www.caihongwen.cn">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
<Host name="www.caihongwen.cn" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<Context docBase="blog" path="" debug="0" reloadable="true"/>
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
</Engine>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
请在意Host之间添加了一段代码
<Context docBase="blog" path="" debug="0" reloadable="true"/>
- 1
这个blog是放在webapps的项目war包名,通过ip或域名直接进入博客,不会出现tomcat小猫管理页面,第一次启动tomcat稍慢,新增加的war包需要重启一次才能起效。还有一个要点是对外开启80端口。
3.mysql
使用RPM包进行安装,这种安装进程会自动完成系统的相关配置,比较方便。
另外有.tar.gz的压缩文件安装方式,推荐一个博客的介绍。
http://blog.csdn.net/superchanon/article/details/8546254/
卸载原有MySQL或者Mariadb安装程序
1、CentOs7版本默认情况下安装了mariadb-libs,必须先卸载才可以继续安装MySql。
a) 查找以前是否安装mariadb-libs
# rpm -qa | grep -i mariadb-libs
- 1
b)卸载已经安装的mariadb-libs
# yum remove mariadb-libs-5.5.44-2.el7.centos.x86_64
- 1
2、查找以前是否安装MySQL
# rpm -qa | grep -i mysql
- 1
有的话,也删除
安装MySQL
# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# rpm -ivh mysql-community-release-el7-5.noarch.rpm
# yum install mysql-community-server
- 1
- 2
- 3
成功安装之后重启mysql服务
# service mysqld restart
- 1
初次安装mysql是root账户是没有密码的,设置密码的方法
# mysql -uroot
mysql> set password for 'root'@'localhost' = password('mypasswd');
- 1
- 2
远程授权连接mysql
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypasswd' WITH GRANT OPTION;
FLUSH PRIVILEGES;
- 1
- 2
修改mysql默认编码
# vim /etc/my.cnf
- 1
作出以下修改
[client]
default-character-set=utf8
[mysqld]
character_set_server=utf8
- 1
- 2
- 3
- 4
然后重启mysql
# service mysqld restart
# mysql -uroot -p
mysql> show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
mysql> show variables like 'collation%';
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+----------------------+-----------------+
3 rows in set (0.00 sec)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
安装mysql-jdbc驱动
# yum install mysql-connector-java
- 1
完工!!!
远程连接mysql,如果连接不上的话,可能是没开放3306端口。
最后,分享一个mysql远程管理神器navicat,你懂的
http://pan.baidu.com/s/1mh87vGc
CentOS7安装openjdk、tomcat和mysql流程介绍的更多相关文章
- centos7安装jdk+tomcat+nginx+mysql
公司新项目要在linux下部署,搭建一下java运行环境,记录一下. 一.安装mysql 1去官网下载mysql,下载后并解压,我把mysql安装在/usr/local/mysql路径下 -linux ...
- Linux7(centOS7)安装jdk/tomcat/docker/mysql
jdk的rpm安装.tomcat的解压缩安装.docker的yum安装.mysql的docker安装 下载地址 1.1.jdk下载地址 https://www.oracle.com/java/tech ...
- Centos7安装配置Apache+PHP+Mysql+phpmyadmin
转载自: Centos7安装配置Apache+PHP+Mysql+phpmyadmin 一.安装Apache yum install httpd 安装成功后,Apache操作命令: systemctl ...
- centos7安装Lnmp(Linux+Nginx+MySql+Php+phpMyAdmin+Apache)
centos7安装Lnmp(Linux+Nginx+MySql+Php)及Apache Nginx是俄罗斯人编写的十分轻量级的HTTP服务器,Nginx是一个高性能的HTTP和反向代理服务器,Ng ...
- centos7最小版本安装nginx+tomcat+java+mysql运行环境
最近项目从windows搬到linux,由于项目组成员有限并且有其它紧急的任务需要处理,因而这个任务就落到我的头上了.下面记录下centos最小版本安装nginx+tomcat+mysql+java的 ...
- linux CentOS 安装 nginx+tomcat+java+mysql运行环境
本文介绍了CentOS7 64 Java,Tomcat,MySQL,Maven热部署等服务器环境的搭建过程. 服务器: 已经将所需要的工具(Xshell,Xftp.FileZilla等sftp上传工具 ...
- Linux基础--安装搭建tomcat+java+mysql
一.安装jdk 1.可选安装yum -y install lrzsz方便传文件.(yum -y意思是所有的都选yes) yum update -y 更新yum镜像 yum list lrzsz* 列 ...
- CentOS下安装JDK,Tomcat,Redis,Mysql,及项目发布
上传文件到服务器,安装lrzsz , 可以将本地的文件上传到linux系统上. 如果是CentOS则可以用yum install lrzsz 命令安装,更方便. 或:yum -y install lr ...
- linux下安装jdk+tomcat+eclipse+mysql
我的环境:主机是win7的,虚拟机是VWare Workstation 6.0 ,linux系统为Red Hat Enterprise Linux 5 64位 各软件版本:jdk是jdk-6u ...
随机推荐
- BZOJ2924 : [Poi1998]Flat broken lines
首先旋转坐标系 $x'=x-y$ $y'=-x-y$ 则对于一个点,它下一步可以往它左上角任意一个点连线. 根据Dilworth定理,答案=这个偏序集最长反链的长度. 设f[i]为到i点为止的最长反链 ...
- Xtreme8.0 - Back to Square 1 数学
Back to Square 1 题目连接: https://www.hackerrank.com/contests/ieeextreme-challenges/challenges/back-to- ...
- centos7安装rvm
导入钥匙$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 若是提示 ...
- windows下用nginx配置https服务器
1.安装nginx 先到nginx官网下在nginx http://nginx.org/en/download.html 将下载好的文件解压出来修改文件名为 nginx ,然后拷贝到C盘下,目录如下: ...
- Java+Windows+ffmpeg实现视频转换
最近由于项目需要,研究了一下如何用Java实现视频转换,“着实”废了点心思,整理整理,写出给自己备忘下. 思路 由于之前没有没法过相关功能的经验,一开始来真不知道从哪里入手.当然,这个解决,googl ...
- getRequestURI,getRequestURL的区别(转)
test1.jsp======================= <a href ="test.jsp?p=fuck">跳转到test2</a> test2 ...
- JVM Internals
http://blog.jamesdbloom.com/JVMInternals.html http://blog.csdn.net/column/details/talk-about-jvm.htm ...
- JAVA GC 图解
http://www.cnblogs.com/hnrainll/archive/2013/11/06/3410042.html http://www.blogjava.net/ldwblog/arch ...
- oracle HA 高可用性具体解释(之二,深入解析TAF,以及HA框架)
oracle HA 高可用性具体解释(之中的一个,client.server端服务具体解释):http://write.blog.csdn.net/postedit 我们已经看到TAF是的Oracle ...
- 在简历中使用STAR法则
一.什么是STAR法则? The STAR (Situation, Task, Action, Result) format is a job interview technique used by ...