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