宝塔,xftp,xshell
阿里云的话就是在实例那里点远程连接,输入:
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
中途输入y确定安装
安装成功就是这样的页面:
在软件商店下好常用的软件
服务器买的核数小,每次在宝塔安装mysql都会崩,得自己手动装T T
CentOS7自带了另外一款数据库mariadb,mysql在安装时会和mariadb产生冲突。
因此需要先卸载mariadb , 再安装mysql。
查看
rpm -qa | grep -i mariadb
卸载
rpm -e --nodeps mariadb-libs-xxxx
下载rpm包
去官网找要下载的mysql版本,复制进来
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.13-1.el7.x86_64.rpm-bundle.tar
解压
tar xvf mysql-5.7.13-1.el7.x86_64.rpm-bundle.tar
按照以下命令的先后顺序依次安装(包与包之间有依赖关系)
[root@centos-linux ~]# rpm -ivh mysql-community-common-5.7.13-1.el7.x86_64.rpm
[root@centos-linux ~]# rpm -ivh mysql-community-libs-5.7.13-1.el7.x86_64.rpm
[root@centos-linux ~]# rpm -ivh mysql-community-client-5.7.13-1.el7.x86_64.rpm
[root@centos-linux ~]# rpm -ivh mysql-community-server-5.7.13-1.el7.x86_64.rpm
数据库初始化
mysqld --initialize --user=mysql
这里演示使用的 --initialize 初始化的,会生成一个 root 账户密码,密码在log文件里:
启动数据库,使用上面的密码登录
[root@centos-linux ~]# systemctl start mysqld
[root@centos-linux ~]# mysql -uroot -p*****
修改密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
注意,密码不要设置得太简单,有被黑掉的风险
开放远程连接权限
use mysql;
update user set host = '%' where user = 'root';
如果报错 去防火墙检查3306端口是否放开
查询想要的端口是否放开
firewall-cmd --query-port=3306/tcp
添加指定的想要放开的端口
firewall-cmd --add-port=3306/tcp --permanent
然后再查一次放开没,如果成功了就重新加载配置
firewall-cmd --reload
先用xftp把jar包放到服务器上
注意:jar包内置tomcat不用下tomcat,下了反而会8080冲突
nohup java -jar cardiovascular-0.0.1-SNAPSHOT.jar ?>> card.log 2>&1 &
查看日志看跑起来没有:
tail -f card.log
在conf文件夹修改nginx.conf
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 443 ssl;
server_name www.域名.cn;
ssl on;
ssl_certificate ../ssl/www.域名.cn.pem;
ssl_certificate_key ../ssl/www.域名.cn.key;
location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $host:$server_port;
}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
把申请域名后得到的key和pem文件,放到nginx的ssl文件夹中
完美收官!!