昨天心思来潮,把前面分享的项目部署阿里云上,也算是温习linux环境部署,以免忘记了!
服务器来源:前几天阿里云搞活动,免费半年,既然你都送了,我不要也不好意思。
这里我不负责教你如何用SSH连接阿里云服务器。
好了,开整!!!
1.JDK8
1.1 下载JDK1.8,wget http://download.oracle.com/otn/java/jdk/8u102-b14/jdk-8u102-linux-x64.rpm,嫌弃阿里云速度慢,可以自己本地下载下来了再传到阿里云上。
1.2 rpm -ivh jdk-8u102-linux-x64.rpm 等待指令执行完毕
1.3 执行 java -version查看是否安装好
2.Nginx
2.1 下载Nginx wget http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.10.2-1.el7.ngx.x86_64.rpm
2.2 rpm -ivh nginx-1.10.2-1.el7.ngx.x86_64.rpm 等待指令执行完毕
2.3 执行 nginx 启动(nginx -s stop 停止,nginx -s reload 重启)
3.Tomcat
3.1 wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v8.0.39/bin/apache-tomcat-8.0.39.tar.gz
3.2 tar -zxvf apache-tomcat-8.0.39.tar.gz
4.MySQL5.7.17
PS:为了安装这个最新版,我真的是郁闷惨了,这也怪mysql越做越大,下载越来越不方便。
4.1 磨刀,找个国内的mysql镜像,阿里云没有,在souhu找到了:http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.17-1.el5.x86_64.rpm-bundle.tar,这个镜像在阿里云的速度能达到3M/s,足矣。
4.2 wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.17-1.el5.x86_64.rpm-bundle.tar
4.3 解压:tar –xvf mysql-5.7.17-1.el5.x86_64.rpm-bundle.tar 解压出来rpm包,具体几个忘了
4.4 安装这些RPM包:
需要按顺序去安装
第一:rpm -ivh mysql-community-common-5.7.13-1.el7.x86_64.rpm
这时候有可能会遇到包冲突,错误如下:
file /usr/share/mysql/slovak/errmsg.sys from install of mysql-community-common-5.7.13-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
file /usr/share/mysql/spanish/errmsg.sys from install of mysql-community-common-5.7.13-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
file /usr/share/mysql/swedish/errmsg.sys from install of mysql-community-common-5.7.13-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
file /usr/share/mysql/ukrainian/errmsg.sys from install of mysql-community-common-5.7.13-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
file /usr/share/mysql/charsets/Index.xml from install of mysql-community-common-5.7.13-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
file /usr/share/mysql/charsets/armscii8.xml from install of mysql-community-common-5.7.13-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
这只是部分
卸载掉冲突的包:yum remove mariadb-libs-1*
卸载完了继续安装:
第一个: rpm -ivh mysql-community-common-5.7.13-1.el7.x86_64.rpm
第二个:rpm -ivh mysql-community-libs-5.7.13-1.el7.x86_64.rpm
第三个:rpm -ivh mysql-community-client-5.7.13-1.el7.x86_64.rpm
第四个:rpm -ivh mysql-community-server-5.7.13-1.el7.x86_64.rpm
最后启动mysql:
service mysqld restart
mysql
这时候又会碰到困难,没有密码进不去:
exit
vi /ect/my.cnf 的最后面加上一行:
skip-grant-tables
:wq!保存退出
重启mysql服务:service mysqld restart
然后再连接mysql就可以了
进入mysql:
use mysql;
update mysql.user set authentication_string=password('123123') where user='root';
然后再把my.cnf里面加的那行删掉,然后再用root账号和密码进入mysql
进去之后需要重新设置root密码:
ALTER USER 'root'@'localhost' IDENTIFIED BY '密码';
这个密码必须符合密码规范
flush privileges;(使立即生效)
设置远程可以登录:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
FLUSH PRIVILEGES;
然后用远程访问吧。