How to deploy java applications in linux environment

王林
Release: 2023-06-03 08:03:26
forward
1520 people have browsed it

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!

Related labels:
source:yisu.com
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!