


How to deploy java applications in linux environment
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
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
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
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;
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











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.

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

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 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 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 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.

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 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.
