Home > Java > javaTutorial > Steps to build a personal blog using Java and Vue

Steps to build a personal blog using Java and Vue

WBOY
Release: 2023-04-22 11:49:08
forward
939 people have browsed it

服务器环境配置

安装JDK

网上资料很多

安装 MySQL

查看能否安装

rpm -qa | grep -i mysql
Copy after login

或者

yum list installed | grep mysql
Copy after login

删除历史版本

yum -y remove myql......
Copy after login

下载MySQL YUM

wget -i -c http://repo.mysql.com/mysql57-community-release-el7-11.noarch.rpm
Copy after login

安装YUM

rpm -ivh mysql57-community-release-el7-11.noarch.rpm
Copy after login

安装MySQL

yum install mysql-server
Copy after login

一路Y究竟。

启动MySQL

systemctl start mysqld
Copy after login

查看启动状态

systemctl status mysqld
Copy after login

更改密码

获取系统生成的临时密码
grep password /var/log/mysqld.log
Copy after login
使用临时密码登录
mysql -uroot -p// 输入零时密码
Copy after login
修改密码
# 升级密码alter user 'root'@'localhost' identified by '新密码';# 设置密码永不过期ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
Copy after login

安装git

yum install git   // 这个不行  版本太旧
Copy after login

安装jenkins

下载jenkins.war

  • java -jar jenkins.war --httpPort=6080

    端口号任意

安装nginx

网上教程很多

配置nginx

准备工作

  • 购买域名,并解析到当前服务器。

    https://www.kkrepo.com 这个域名做博客域名

    https://jenkins.kkrepo.com 这个域名做jenkins域名

  • 申请域名对应的免费证书

修改配置

配置文件目录结构

/etc/nginx

.

| - nginx.conf

| - conf.d

  | - ssl                                                                         //  存放证书的文件夹          | - www.kkrepo.com_bundle.crt          | - www.kkrepo.com.key          | - jenkins.kkrepo.com_bundle.crt          | - jenkins.kkrepo.com.key  | - www.conf                                                            // www.kkrepo.com 域名配置  | - jenkins.conf                                                        // jenkins.kkrepo.com 域名配置
Copy after login
nginx.conf配置
user  nginx;worker_processes  2;error_log  /var/log/nginx/error.log warn;pid        /var/run/nginx.pid;events {    worker_connections  1024;}http {    include       /etc/nginx/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  /var/log/nginx/access.log  main;    sendfile        on;    #tcp_nopush     on;    keepalive_timeout  65;    #gzip  on;        # 引入 conf.d 文件夹中的配置文件    include /etc/nginx/conf.d/*.conf;}
Copy after login
www.conf配置
server {  listen    80;  server_name kkrepo.com;  rewrite ^(.*)$ https://www.kkrepo.com$1 permanent;}server {  listen    80;  server_name www.kkrepo.com;  rewrite ^(.*)$ https://${server_name}$1 permanent;}server {  listen    443;  server_name kkrepo.com;  rewrite ^(.*)$ https://www.kkrepo.com$1 permanent;}server {  listen 443 ssl http2 default_server;  server_name www.kkrepo.com;  ssl_certificate  /etc/nginx/conf.d/ssl/www.kkrepo.com_bundle.crt;  ssl_certificate_key /etc/nginx/conf.d/ssl/www.kkrepo.com.key;  ssl_session_timeout 5m;  ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;  ssl_protocols TLSv1.2;  ssl_prefer_server_ciphers on;  location / {        proxy_set_header X-Real-IP $remote_addr;        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;        proxy_pass http://127.0.0.1:8080;  }   access_log logs/www.log main;}
Copy after login
jenkins.conf配置
upstream jenkins {  server 127.0.0.1:6080;}server {  listen    80;  server_name jenkins.kkrepo.com;  rewrite ^(.*)$ https://${server_name}$1 permanent;}server {  listen 443 ssl http2;  server_name jenkins.kkrepo.com;  root /usr/share/nginx/html;  ssl_certificate  /etc/nginx/conf.d/ssl/jenkins.kkrepo.com_bundle.crt;  ssl_certificate_key /etc/nginx/conf.d/ssl/jenkins.kkrepo.com.key;  ssl_session_timeout 5m;  ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;  ssl_protocols TLSv1.2;  ssl_prefer_server_ciphers on;  location / {    proxy_set_header Host $host:$server_port;        proxy_set_header X-Real-IP $remote_addr;        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;        proxy_set_header X-Forwarded-Proto $scheme;        proxy_redirect http:// https://;        proxy_pass http://jenkins;        # Required for new HTTP-based CLI        proxy_http_version 1.1;        proxy_request_buffering off;        proxy_buffering off; # Required for HTTP-based CLI to work over SSL        # workaround for https://issues.jenkins-ci.org/browse/JENKINS-45651        # add_header 'X-SSH-Endpoint' 'jenkins.domain.tld:50022' always;  }   access_log logs/jenkins.log main;}
Copy after login

nginx配置生效

nginx -s reload
Copy after login

安装 dockerdocker-compose

安装 docker

安装 docker-compose

安装 epel
yum install -y epel-release
Copy after login
安装 docker-compose
yum install -y docker-compose
Copy after login

安装 Maven

官网复制安装包链接

官网:https://maven.apache.org/download.cgi

安装包链接:apache-maven-3.6.3-bin.tar.gz

将安装包解压,放到 /usr/local 目录下

tar -xvf apache-maven-3.6.3-bin.tar.gz -C /usr/local/
Copy after login

配置环境变量

vi /etc/profile
Copy after login
export JAVA_HOME=/usr/local/jdk1.8.0_221export MVN_HOME=/usr/local/apache-maven-3.6.3export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/libexport PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin:$MVN_HOME/bin
Copy after login
source /etc/profilemvn -v
Copy after login

假如服务器速度慢的话,可以配置阿里云的 maven 仓库地址。

github 配置

SSH 配置

在服务器上生成 ssh,并将 pub key 配置到 github (Settings -> SSH and GPG keys)上。

Webhooks 配置

Steps to build a personal blog using Java and Vue

access tokens 配置

Steps to build a personal blog using Java and Vue

Jenkins 配置及持续集成

全局工具配置

Steps to build a personal blog using Java and VueSteps to build a personal blog using Java and Vue

Steps to build a personal blog using Java and Vue

源码管理

Steps to build a personal blog using Java and Vueimage-20200711120004709

构建触发器

Steps to build a personal blog using Java and Vueimage-20200711120043546

构建环境

Steps to build a personal blog using Java and Vueimage-20200711120128028

构建

Steps to build a personal blog using Java and Vue

构建后操作

遇到的问题及处理方案

mvn 命令未找到

问题形容

+ cd /root/.jenkins/workspace/Blog+ mvn clean package/tmp/jenkins3465102471897029074.sh:行5: mvn: 未找到命令Build step 'Execute shell' marked build as failureFinished: FAILURE
Copy after login

在 jenkins 的 构建 过程中,需要使用 maven 给项目打包,但是打包的时候,报找不到 mvn 命令异常。

Cause analysis

Because the environment variables of Java and maven are placed in /etc/profile, and /etc/profile will only be loaded when the customer logs in. jenkins When running the command, the no-login method is used. This method is When running the command, /etc/profile will not be loaded. jenkins can only look for executable files in the current path.

Solution

In the settings of jenkins, you can set global variables.

Manage Jenkins -> Configure System -> Global Properties-> Environment variables

Steps to build a personal blog using Java and Vue

##jenkins Pulling code is slow

Problem description

jenkins It takes more than ten minutes to pull the code every time, but when I clone myself on the server, it takes a long time Fast (can basically rule out network problems).

Cause analysis

  • The git version is too old

  • Every time git pulls, it deletes the original file and re-creates the entire file. Pull

Solution

  • For git version issues, update to the latest version

  • For Pull the project in full again and make the following configuration in the current

    job

Steps to build a personal blog using Java and Vue

Clear the check box, or Ignore the

.git directory in the deletion policy.

The above is the detailed content of Steps to build a personal blog using Java and Vue. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template