当前位置:网站首页>Web project deployment

Web project deployment

2022-06-24 10:32:00 Ah Hui likes to sleep

Our project , After all, it should be deployed to the server , Will have the sense of accomplishment of ending the flower scattering ;

How to deploy to Linux Server for , Realize the real browser website to visit you ?

1. To have a Cloud server

Alibaba cloud , Tencent, cloud, etc.

2. preparation

Preparing the deployment environment

Both in root User down operation

download JDK

stay Linux Directly find corresponding jdk Version can

yum list | grep jdk

Install the corresponding version

yum install file name

download MYSql

install

  • install mariadb service

# yum install -y mariadb-server

  • install mariadb Command line client

# yum install -y mariadb

  • install mariadb C library

# yum install -y mariadb-libs

  • install mariadb Development kit

# yum install -y mariadb-devel

Change configuration

  • change /etc/my.cnf.d/client.cnf file

[client] Add a line to configure default-character-set=utf8

  • change /etc/my.cnf.d/mysql-clients.cnf file

[mysql] Add a line to configure default-character-set=utf8

  • change /etc/my.cnf.d/server.cnf To configure

[mysqld] Add configuration below

collation-server = utf8_general_ci

init-connect='SET NAMES utf8'

character-set-server = utf8

sql-mode = TRADITIONAL

start-up

Start the service

# systemctl start mariadb

  • Set the service to start automatically

# systemctl enable mariadb

  • View service status

# systemctl status mariadb

Test connection

  • Try connecting... Using the command line client

# mysql -uroot

download Tomcat

Tomcat stay yum Previous editions There is no need , You can search directly in the browser , Download zip , Decompression can be

tomcat Cross platform use

After installation , function

sh startup.sh

Observe for operation

ps aux | grep tomcat

0. What is deployment

Involved in the work " Environmental Science "

  • development environment : A machine used by programmers to write code .
  • Test environment : The tester tests the machine used by the program . It is usually a retired deployment machine .
  • Production environment ( The online environment ): The machine used when the final project is released . High requirements for stability .

Install the program copy to the production environment , This process is called " Deploy ". Also called " go online ".

This process requires copying the corresponding .class Files and dependent resource files ( Various configuration files , html etc. )

Once the program is successfully deployed , Then this program can be accessed by thousands of ordinary users in the Internet .

let me put it another way , If the program has BUG, This BUG It will be seen by millions of users .

The deployment process is critical , It is the most important part of program development . In case of deployment problems , It is very likely to lead to serious accidents ( The server Not available or something ).

To prevent deployment errors , Generally, there are some automatic deployment tools in the company ( Such as Jenkins etc. ). At present, we first use the manual deployment method To complete the deployment .

1. Database tables

Follow the previous database creation script , Run on the server , Create the same table structure

mysql -u[ Database user name ] -p[ Database password ] < [ Database script ].sql

Or create... Manually , Copy and paste

2. pack

Put the previously marked war Put the package in the specified directory (Tomcat webapps)

XShell You can directly drag and drop in ( Enter ahead of time webapps Catalog )

If you can't drag and drop files , install

yum install lrsz

Be careful :

Before war package Run locally , Access local database , Now on ECs , Access cloud server

Make sure the database , The connection is correct (URL,IP, user name , password , Cloud server , There is a corresponding database )

3. Is to verify the access

Enter the correct... In the browser URL You can access your own projects

原网站

版权声明
本文为[Ah Hui likes to sleep]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206240926244839.html