Table of Contents
1. Install JDK
2. Install Tomcat
3. Install MySQL
Home Operation and Maintenance Linux Operation and Maintenance How to deploy java applications in linux environment

How to deploy java applications in linux environment

Jun 03, 2023 am 08:03 AM
linux java

1. Install JDK

Configure environment variables in /etc/profile

export JAVA_HOME=/usr/local/jdk
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
Copy after login

Let the environment variables take effect:

  • Permanent effect: Restart Linux

  • Temporarily effective: ./etc/profile or source /etc/profile The valid range is the current session [terminal]

Verification

java -version
Copy after login
2. Install Tomcat
tar xzvf apache-tomcat-7.0.68.tar.gz
cp -r apache-tomcat-7.0.68 /usr/local/tomcat
cd /usr/local/tomcat/bin

./startup.sh
tail -f tomcat/logs/catalina.out 
或者
tomcat/bin/startup.sh & tail
Copy after login
3. Install MySQL
tar xzvf mysql-5.7.27-linux-glibc2.12-x86_64.tar.gz
cp -r mysql-5.7.27-linux-glibc2.12-x86_64 /usr/local/mysql
groupadd mysql
useradd -r -g mysql mysql
cd /usr/local/mysql
chown -R mysql:mysql .
cd /usr/local/mysql/bin

./mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --lc_messages_dir=/usr/local/mysql/share --lc_messages=en_US

#记录 A temprary password is generated for root@localhost: ********

# mysql5.7 要求系统中 libtinfo.so.5,CentOS 中是 libtinfo.so.6.1。
ln -s /usr/lib64/libtinfo.so.6 /usr/lib64/libtinfo.so.5
ln -s /usr/lib64/libncurses.so.6 /usr/lib64/libncurses.so.5

cd /usr/local/mysql/support-files
cp mysql.server /etc/init.d/mysql
service mysql start
systemctl enable mysql

ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
# 密码是在初始化时 mysql 分配的 A temprary password is generated for root@localhost: ********
mysql -u root -p
# 此时修改的密码是针对前边-u 参数指定的用户
> set password=password("your password");
# MySQL默认只能在localhost上访问
> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'your password' WITH GRANT OPTION;
> flush privileges;
Copy after login

The above is the detailed content of How to deploy java applications in linux environment. For more information, please follow other related articles on the PHP Chinese website!

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

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1663
14
PHP Tutorial
1266
29
C# Tutorial
1237
24
Linux Architecture: Unveiling the 5 Basic Components Linux Architecture: Unveiling the 5 Basic Components Apr 20, 2025 am 12:04 AM

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

PHP's Impact: Web Development and Beyond PHP's Impact: Web Development and Beyond Apr 18, 2025 am 12:10 AM

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

laravel installation code laravel installation code Apr 18, 2025 pm 12:30 PM

To install Laravel, follow these steps in sequence: Install Composer (for macOS/Linux and Windows) Install Laravel Installer Create a new project Start Service Access Application (URL: http://127.0.0.1:8000) Set up the database connection (if required)

Docker on Linux: Containerization for Linux Systems Docker on Linux: Containerization for Linux Systems Apr 22, 2025 am 12:03 AM

Docker is important on Linux because Linux is its native platform that provides rich tools and community support. 1. Install Docker: Use sudoapt-getupdate and sudoapt-getinstalldocker-cedocker-ce-clicotainerd.io. 2. Create and manage containers: Use dockerrun commands, such as dockerrun-d--namemynginx-p80:80nginx. 3. Write Dockerfile: Optimize the image size and use multi-stage construction. 4. Optimization and debugging: Use dockerlogs and dockerex

How to generate public keys for git How to generate public keys for git Apr 17, 2025 pm 04:30 PM

How to generate a Git public key? Simply follow these steps: Open a terminal or command prompt; run the ssh-keygen -t rsa -b 4096 command; select the key saving location; enter a key phrase (optional); verify that the key has been created; copy the public key; add the public key to Git.

macOS and Linux: Comparing Their Features and Functionality macOS and Linux: Comparing Their Features and Functionality Apr 18, 2025 am 12:19 AM

macOS is suitable for valuing user experience and hardware and software integration, while Linux is suitable for requiring high customizability and flexibility. macOS is simple and easy to use, seamlessly integrated with Apple products; Linux is open source, adapted to various environments, and has rich community resources.

What does 'platform independence' mean in the context of Java? What does 'platform independence' mean in the context of Java? Apr 23, 2025 am 12:05 AM

Java's platform independence means that the code written can run on any platform with JVM installed without modification. 1) Java source code is compiled into bytecode, 2) Bytecode is interpreted and executed by the JVM, 3) The JVM provides memory management and garbage collection functions to ensure that the program runs on different operating systems.

CentOS: Security, Stability, and Performance CentOS: Security, Stability, and Performance Apr 21, 2025 am 12:11 AM

CentOS is the first choice for server and enterprise environments for its superior security, stability and performance. 1) Security provides forced access control through SELinux to improve system security. 2) Stability is supported by the LTS version for up to 10 years to ensure the stability of the system. 3) Performance significantly improves system response speed and resource utilization by optimizing kernel and system configuration.

See all articles