Linux安装JDK,MySql,Tomcat , Maven

vps安装必要软件后记录备忘。 
环境:搬瓦工vps,CentOS6
内容:
一:下载
1:JDK下载
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u71-b14/jdk-7u71-linux-x64.rpm
 
2:Tomcat下载
 
3:MySql下载
 
二:安装
1:安装JDK
rpm -ivh jdk-7u71-linux-x64.rpm
java
javac
java -version
配置JDK环境变量 
vi + /etc/profile
向配置文件写入 
JAVA_HOME=/usr/java/jdk1.7.0_71
JRE_HOME=/usr/java/jdk1.7.0_71/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
source /etc/profile //使修改立即生效
echo $PATH //查看PATH值
 
2:解压缩Tomcat
tar -zxvf apache-tomcat-7.0.72.tar.gz
 
3:安装MySql
tar -xvf mysql-5.7.16-1.el6.x86_64.rpm-bundle.tar
按顺序安装      rpm -ivh mysql-community-common-5.7.16-1.el6.x86_64.rpm
        rpm -ivh mysql-community-libs-5.7.16-1.el6.x86_64.rpm
        rpm -ivh mysql-community-client-5.7.16-1.el6.x86_64.rpm
        rpm -ivh mysql-community-server-5.7.16-1.el6.x86_64.rpm
如提示 libaio.so.1()(64bit) 或 libnuma.so.1()(64bit)
运行 yum install libaio 或 yum install numactl (或 yum install perl-Time-HiRes per-devel)
注:安装时如提示rpm包有冲突 运行rpm -qa|grep mariadb 看需要卸载那些
       运行rpm -e --nodeps mariadb-xxxxx将显示出来的rpm包全部卸载
运行rpm -ivh mysql-community-server-5.7.16-1.el6.x86_64.rpm时
如果出现报错 warning: mysql-community-server-5.7.16-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
原因:这是由于yum安装了旧版本的GPG keys 
解决办法:rpm -ivh mysql-community-server-5.7.16-1.el6.x86_64.rpm --force --nodeps 
 
启动MySql服务
service mysql start
service mysqld start
netstat -tlunp
在日志中查看MySql初始密码,比如查询到的密码为:V?WqhyRfp4j(   
cat /var/log/mysqld.log | more   
输入刚才查到的密码 V?WqhyRfp4j(   登陆MySql
mysql -uroot -p
修改初始密码 
alter user 'root'@'localhost'  identified  by  '将要修改的密码';
允许Mysql远程登陆
grant all privileges on *.* to 'root'@'%' identified by '修改后的密码';
取消大小写敏感 
cd /etc
vi my.cnf
插入lower_case_table_names=1 
重启MySql
service mysqld restart  

MySql导数据报错  
 Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
cd /etc
vi my.cnf
加上sql_mode='NO_ENGINE_SUBSTITUTION'
 重启MySql
service mysqld restart  


安装maven
 
cd /home
tar -xzvf apache-maven-3.3.9-bin.tar.gz 
rm -rf apache-maven-3.3.9-bin.tar.gz 
vi /etc/profile
写入
MAVEN_HOME=/home/apache-maven-3.3.9
export MAVEN_HOME
export PATH=${PATH}:${MAVEN_HOME}/bin
使生效
source /etc/profile
测试
mvn -v


yum安装mysql

#yum -y install mysql mysql-server mysql-devel
# yum install mariadb-server -y
启动mysql服务进程
 # systemctl start mariadb.service
加入开机启动
 # systemctl enable mariadb.service
 # mysql  

如何设置mysql root密码
# mysql_secure_installation 
回车、回车、。。。、输入密码
登录
mysql -uroot -p

忽略大小写
打开/etc/my.cnf文件
命令行竟然以!开头,加载/etc/my.cnf.d下的所有文件
去/etc/my.cnf.d文件夹下找到server.cnf
在[mysqlld]下加上
lower_case_table_names=1
   
重启
systemctl restart  mariadb.service
 








posted @ 2018-09-16 23:13  面向bug编程  阅读(191)  评论(0编辑  收藏  举报