Get the App
SLTechnology News&Howtos  ›  Development  › 

How the Linux server deploys the JavaWeb project

Shulou Source: shulou.com Published: 2022-06-02 12:21:14 10月22日 Update

This article is about how the Linux server deploys the JavaWeb project. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Basic environment: Centos7, tomcat8, jdk8,MySQL5.6, nginx

Install JDK

Yum install java-1.8.0-openjdk*-y

With yum installation, there is no need to configure the system environment, and JDK is installed after executing this command.

Install Mysql

We use Mysql here. If you use MariaDB, the CVM is generally installed and you only need to upgrade it.

Installation steps:

# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm# rpm-ivh mysql-community-release-el7-5.noarch.rpm# yum install mysql-community-server

Restart the Mysql service:

# service mysqld restart

After reboot, we use the following command to enter MySQL, because MySQL does not have a password by default.

# mysql-u root

After entering MySQL, we use the following MySQL

Set password for 'root'@'localhost' = password (' password')

At this point, the MySQL database is basically installed, and sometimes in the development process, for convenience, you want to remotely connect to the database on the line through a local visualization tool. At this time, you can run the following command to open the remote connection to the database.

Grant all privileges on *. * to root@'%'identified by 'password'

Install tomcat

The deployment of tomcat is the easiest:

1. Download it directly and drag it to the / home folder of linux (download version is as follows)

2. Drag the packaged war file to the webapps folder through Xftp, which is no different from the operation under windows. Let's not talk about the details.

3. Start the tomcat server directive:

Stop service directive:

Execute trace log command

Cd / home/apache-tomcat-8.5.23/binnohup. / startup.sh &

Enter the editor to make changes, click esc when the changes are complete, and then type: wq so that you can save and exit. Then restart tomcat and the configuration takes effect.

Use Nginx as proxy server

1. Install gcc glossy + development class library

Install make:

Install the galleys:

Yum-y install gcc automake autoconf libtool make

2. Select the installation file directory

You can choose any directory, cd / usr/local/src for this article

Cd / usr/local/src

3. Install the PCR library

Ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ downloads the latest PCRE source package, and downloads, compiles and installs the PCRE package using the following command:

Cd / usr/local/srcwget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gztar-zxvf pcre-8.37.tar.gzcd pcre-8.34./configuremakemake install

4. Install the zlib library

Http://zlib.net/zlib-1.2.11.tar.gz downloads the latest zlib source package, and downloads, compiles and installs the zlib package using the following command:

Cd / usr/local/src wget http://zlib.net/zlib-1.2.11.tar.gztar-zxvf zlib-1.2.11.tar.gzcd zlib-1.2.11./configuremakemake install

5. Install openssl (some vps do not have ssl installed by default)

Cd / usr/local/srcwget https://www.openssl.org/source/openssl-1.0.1t.tar.gztar-zxvf openssl-1.0.1t.tar.gz

6. Install nginx

There are generally two versions of Nginx, stable version and development version. You can choose one of these two versions according to your purpose. Here are the detailed steps for installing Nginx into the / usr/local/nginx directory:

Cd / usr/local/srcwget http://nginx.org/download/nginx-1.1.10.tar.gztar-zxvf nginx-1.1.10.tar.gzcd nginx-1.1.10./configuremakemake install

7. Configure nginx

Because it is possible that apeache occupies port 80, the apeache port should not be modified as far as possible, so we choose to modify the nginx port.

Linux modify the installation directory\ conf\ nginx.conf under the path / usr/local/nginx/conf/nginx.conf,Windows.

Change the port to 8090 _ localhost and change it to your server ip address.

8. Restart, shut down, start nginx

Start

Startup code format: nginx installation directory address-c nginx configuration file address

For example:

[root@LinuxServer sbin] # / usr/local/nginx/sbin/nginx-c / usr/local/nginx/conf/nginx.conf

Stop it

1. Check the process number

Find the nginx master port

2. Kill the process

[root@LinuxServer ~] # kill-QUIT 2072

Restart

1. Verify that the nginx configuration file is correct

Method 1: enter the nginx installation directory sbin and enter the command. / nginx-t

See the following display of nginx.conf syntax is ok

Nginx.conf test is successful

Indicates that the configuration file is correct!

Nginx is configured correctly, and we can execute the restart Nginx command by entering the nginx executable directory sbin and entering the command. / nginx-s reload.

Thank you for reading! This is the end of the article on "how to deploy the JavaWeb project on the Linux server". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Tags: Commands services files directories configurations servers ports selections addresses data databases versions development input projects two content instructions folders methods Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Docker Linux Apple NVidia