(1)vim /etc/ssh/sshd_config
(2)PasswordAuthentication yes
PermitRootLogin yes
(3)systemctl restart sshd进行重启
通过java -version查看系统是否默认安装,如果已安装通过下面命令移除:
yum -y remove java-1.7.0-openjdk*
yum -y remove java-1.8.0-openjdk*
在阿里服务器规则配置中增加8080/8080端口
yum install rng-tools(启动熵服务,解决tomcat启动慢问题)
systemctl start rngd-启动熵服务
systemctl daemon-reload、systemctl restart rngd-重新载入服务
设置Tomcat开机自启动:
在tomca/bin 目录下面,增加 setenv.sh 配置,catalina.sh启动的时候会调用,同时配置Java内存参数:
CATALINA_PID="$CATALINA_BASE/tomcat.pid"
JAVA_OPTS="-server -XX:PermSize=256M -XX:MaxPermSize=1024m -Xms512M -Xmx1024M -XX:MaxNewSize=256m"
在/usr/lib/systemd/system目录下增加tomcat.service(根据实际路径设置):
[Unit]
Description=Tomcat
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
Environment="JAVA_HOME=/usr/local/java"
PIDFile=/usr/local/tomcat/tomcat.pid
ExecStart=/usr/local/tomcat/bin/startup.sh
ExecReload=/bin/kill -s HUPMAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
使用tomcat.service命令:
开机启动
systemctl enable tomcat.service
启动tomcat
systemctl start tomcat.service
停止tomcat
systemctl stop tomcat.service
重启tomcat
systemctl restart tomcat.service
http://ip:8080/ 验证是否成功
在MySQL官网中下载yum源rpm安装包
yum localinstall xxx.rpm:使用安装源
yum install mysql-community-server:安装mysql
mysqld --initialize --user=mysql --console
配置my.cnf文件 [client]
socket=/var/lib/mysql/mysql.sock
default-character-set=utf8
[mysql]
default-character-set=utf8
socket=/var/lib/mysql/mysql.sock
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
通过mysql -uroot -p 以及临时密码进入mysql
alter user 'root'@'localhost'IDENTIFIED BY 'newpassword';
flush privileges;
解决Navicat 报错:1130-host is not allowed MySQL不允许从远程访问的方法:
mysql>usemysql;
mysql>update user set host = '%' where user ='root';
mysql>select host, user from user;
解决Client does not support authentication protocol requested by server; consider upgrading MySQL client:
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '你的密码';
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码';
SELECT plugin FROM mysql.user WHERE User = 'root';
mysql相关命令:
启动mysql
systemctl start mysqld
停止
systemctl stop mysqld
开机启动
systemctl enable mysqld
systemctl daemon-reload
vi /lib/systemd/system/nginx.service (下面文件路径不用重新设)
[Unit] Description=nginx
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
相关命令
启动nginx服务
systemctl start nginx.service
设置开机自启动
systemctl enable nginx.service
停止开机自启动
systemctl disable nginx.service
查看服务当前状态
systemctl status nginx.service
重新启动服务
systemctl restart nginx.service
查看所有已启动的服务
systemctl list-units --type=service
通过npm run build 打包出vue的dist,复制到服务器特定文件夹中
vim /usr/local/nginx/conf/nginx.conf配置路径 :
server { listen 8089;//指定端口 server_name localhost; root /opt/project/vue-appmanager/dist/;//存放项目目录 index index.html; location / { try_files $uri $uri/ /index.html; } } 复制代码