search
HomeJavajavaTutorialSteps to build a personal blog using Java and Vue

服务器环境配置

安装JDK

网上资料很多

安装 MySQL

查看能否安装

rpm -qa | grep -i mysql

或者

yum list installed | grep mysql

删除历史版本

yum -y remove myql......

下载MySQL YUM

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

安装YUM

rpm -ivh mysql57-community-release-el7-11.noarch.rpm

安装MySQL

yum install mysql-server

一路Y究竟。

启动MySQL

systemctl start mysqld

查看启动状态

systemctl status mysqld

更改密码

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

安装git

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

安装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 域名配置
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;}
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;}
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;}

nginx配置生效

nginx -s reload

安装 docker 及 docker-compose

安装 docker

安装 docker-compose

安装 epel 源
yum install -y epel-release
安装 docker-compose
yum install -y docker-compose

安装 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/

配置环境变量

vi /etc/profile
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
source /etc/profilemvn -v

假如服务器速度慢的话,可以配置阿里云的 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

在 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!

Statement
This article is reproduced at:亿速云. If there is any infringement, please contact admin@php.cn delete
How do I use Maven or Gradle for advanced Java project management, build automation, and dependency resolution?How do I use Maven or Gradle for advanced Java project management, build automation, and dependency resolution?Mar 17, 2025 pm 05:46 PM

The article discusses using Maven and Gradle for Java project management, build automation, and dependency resolution, comparing their approaches and optimization strategies.

How do I create and use custom Java libraries (JAR files) with proper versioning and dependency management?How do I create and use custom Java libraries (JAR files) with proper versioning and dependency management?Mar 17, 2025 pm 05:45 PM

The article discusses creating and using custom Java libraries (JAR files) with proper versioning and dependency management, using tools like Maven and Gradle.

How do I implement multi-level caching in Java applications using libraries like Caffeine or Guava Cache?How do I implement multi-level caching in Java applications using libraries like Caffeine or Guava Cache?Mar 17, 2025 pm 05:44 PM

The article discusses implementing multi-level caching in Java using Caffeine and Guava Cache to enhance application performance. It covers setup, integration, and performance benefits, along with configuration and eviction policy management best pra

How can I use JPA (Java Persistence API) for object-relational mapping with advanced features like caching and lazy loading?How can I use JPA (Java Persistence API) for object-relational mapping with advanced features like caching and lazy loading?Mar 17, 2025 pm 05:43 PM

The article discusses using JPA for object-relational mapping with advanced features like caching and lazy loading. It covers setup, entity mapping, and best practices for optimizing performance while highlighting potential pitfalls.[159 characters]

How does Java's classloading mechanism work, including different classloaders and their delegation models?How does Java's classloading mechanism work, including different classloaders and their delegation models?Mar 17, 2025 pm 05:35 PM

Java's classloading involves loading, linking, and initializing classes using a hierarchical system with Bootstrap, Extension, and Application classloaders. The parent delegation model ensures core classes are loaded first, affecting custom class loa

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)