CentOS 6.7 安装mysql tomcat jdk redis
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 6.7 安装mysql tomcat jdk redis相关的知识,希望对你有一定的参考价值。
1.mysql安装
http://blog.csdn.net/xxd851116/article/details/22947891(自动安装)
http://blog.csdn.net/bingjianit/article/details/54384299(自动安装出现的问题)
准备:
yum install lrzsz
mysql-client-5.6.29-1.linux_glibc2.5.x86_64.rpm
MySQL-server-5.6.29-1.linux_glibc2.5.x86_64.rpm
MySQL-devel-5.6.29-1.linux_glibc2.5.x86_64.rpm
查看当前安装的mariadb包:
[[email protected] 桌面]# rpm -qa | grep mariadb
将它们统统强制性卸载掉:(有什么删什么,不一定是下面三个包)
[[email protected] 桌面]# rpm -e --nodeps mariadb-libs-5.5.35-3.el7.x86_64
[[email protected] 桌面]# rpm -e --nodeps mariadb-5.5.35-3.el7.x86_64
[[email protected] 桌面]# rpm -e --nodeps mariadb-server-5.5.35-3.el7.x86_64
把这mysql个包上传到服务器上
用# rpm -ivh
MySQL-client-5.6.29-1.linux_glibc2.5.x86_64.rpm
rpm -ivh
MySQL-devel-5.6.29-1.linux_glibc2.5.x86_64.rpm
rpm -ivh
MySQL-server-5.6.29-1.linux_glibc2.5.x86_64.rpm
安装好.
修改配置文件
5 |
[[email protected] rpm]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf |
给权限 chown -R mysql.mysql /var/lib/mysql
初始化MySQL及设置密码 yum -y install autoconf(安装data::dumper模块) |
|
6 [[email protected] rpm]# /usr/bin/mysql_install_db
开启mysql
bin/mysqld_safe --user=mysql
(
如果碰到不能启动的情况,可使用以下方案
1.关闭seLinux
(网上找教程)
2.权限不足,用chown给mysql赋权
chown -R mysql.mysql /var/lib/mysql
3.重新初始化mysql
mysql_install_db --user=mysql
)
启动mysql
service mysql start
修改数据库密码:
mysql –u root –p (按回车进入数据库,默认没有密码)
update user set
password=password(‘root2016‘) where user=‘root‘;
update user set
host=‘%‘
where user=‘root‘
and host=‘localhost‘;
//
联网权限
flush privileges;//
刷新
exit
设置开机启动
chkconfig mysql on
参考网址
http://www.centoscn.com/mysql/2015/0624/5729.html
http://www.cnblogs.com/kreo/p/4392090.html
http://www.2cto.com/database/201501/371451.html
\\
2.安装tomcat7
http://www.cnblogs.com/zhoulf/archive/2013/02/04/2891633.html
http://www.cnblogs.com/kreo/p/4368811.html(cent7)
[[email protected] local]# cd /usr/local
[[email protected] local]# tar -zxv -f apache-tomcat-7.0.29.tar.gz //
解压压缩包
[[email protected] local]# rm -rf
apache-tomcat-7.0.29.tar.gz // 删除压缩包
[[email protected] local]# mv apache-tomcat-7.0.29
tomcat
增加8080端口到防火墙配置中,执行以下操作:
[[email protected]
~]# vi + /etc/sysconfig/iptables -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT |
[[email protected] java]# service iptables restart
#安装iptables
yum install -y iptables
#升级iptables
yum update iptables
#安装iptables-services
yum install iptables-services
#停止firewalld服务
systemctl stop firewalld
#禁用firewalld服务
systemctl mask firewalld
编辑Tomcat配置文件
#vi /usr/local/apache-tomcat/conf/server.xml
2
打开配置文件里找到下面这一段<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
3
输入命令 i 进行,将8080 修改为 80
4
输入命令:wq 保存并退出
Tomcat启动时卡在“INFO: Deploying web application directory ”
http://www.cnblogs.com/vinozly/p/5011138.html
lsof -i:80 查看80是否被占用
3.安装JDK
export JAVA_HOME="/usr/local/java/jdk1.8.0_111"
if ! grep "JAVA_HOME=/usr/local/java/jdk1.8.0_111" /etc/environment
then
echo "JAVA_HOME=/usr/local/java/jdk1.8.0_111" | sudo tee -a /etc/environment
echo "export JAVA_HOME" | sudo tee -a /etc/environment
echo "PATH=$PATH:$JAVA_HOME/bin" | sudo tee -a /etc/environment
echo "export PATH" | sudo tee -a /etc/environment
echo "CLASSPATH=.:$JAVA_HOME/lib" | sudo tee -a /etc/environment
echo "export CLASSPATH" | sudo tee -a /etc/environment
fi
rpm –ivh 文件名 (Eg: rpm -ivh jdk-8u73-linux-i586.rpm)
接着是配置环境变量
#vi /etc/profile
在该profile文件中最下面添加:
JAVA_HOME=/usr/java/jdk1.8.0_111
JRE_HOME=/usr/java/jdk1.8.0_111/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/jt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
JAVA_HOME=/usr/java/jdk1.7.0_79
JRE_HOME=/usr/java/jdk1.7.0_79/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/jt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
#set environment
export JAVA_HOME="/usr/local/java/jdk1.8.0_111"
if ! grep "JAVA_HOME=/usr/local/java/jdk1.8.0_111" /etc/environment
then
echo "JAVA_HOME=/usr/local/java/jdk1.8.0_111" | sudo tee -a /etc/environment
echo "export JAVA_HOME" | sudo tee -a /etc/environment
echo "PATH=$PATH:$JAVA_HOME/bin" | sudo tee -a /etc/environment
echo "export PATH" | sudo tee -a /etc/environment
echo "CLASSPATH=.:$JAVA_HOME/lib" | sudo tee -a /etc/environment
echo "export CLASSPATH" | sudo tee -a /etc/environment
fi
#update environment
source /etc/environment
ehco "jdk is installed !"
http://www.cnblogs.com/amosli/p/4025519.html 自动安装
4.安装redis
http://blog.csdn.net/lk10207160511/article/details/50364088
http://blog.csdn.net/jy0902/article/details/19248299
以上是关于CentOS 6.7 安装mysql tomcat jdk redis的主要内容,如果未能解决你的问题,请参考以下文章
在linux(CentOS-6.7_x86_64)上安装mysql成功记录