欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 运维知识 > linux >内容正文

linux

线上的java环境_Linux部署JavaWeb线上环境

发布时间:2025/10/17 linux 25 豆豆
生活随笔 收集整理的这篇文章主要介绍了 线上的java环境_Linux部署JavaWeb线上环境 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

1.ssh免密码登录

ssh-keygen -t rsa -C "18201225281@163.com"

cp id_rsa.pub

vim ~/.ssh/authorized_keys

登录 ssh root@172.22.3.144

传文件 scp local_file remote_username@remote_ip:remote_folder

tail /var/log/secure (查看ssh访问日志)

2.git安装配置

yum install git -y

ssh-keygen -t rsa -C "18201225281@163.com"

cp id_rsa.pub(/root/.ssh/id_rsa.pub) to github

3.java安装配置

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz"

vim /etc/profile

export JAVA_HOME=/usr/local/java

export PATH=$JAVA_HOME/bin:$PATH

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

source /etc/profile

4.maven安装配置

wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo

yum -y install apache-maven

5.mysql安装配置

wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz

tar -xvf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz

mv mysql-5.7.22-linux-glibc2.12-x86_64 /usr/local/mysql

mkdir /usr/local/mysql/data

groupadd mysql

useradd mysql -g mysql

chown -R mysql.mysql /usr/local/mysql

yum -y install numactl

/usr/local/mysql/bin/mysqld --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data --initialize

vim /etc/my.cnf

[mysqld]

datadir=/usr/local/mysql/data

basedir=/usr/local/mysql

socket=/tmp/mysql.sock

user=mysql

port=3306

character-set-server=utf8

# 取消密码验证

skip-grant-tables

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

# skip-grant-tables

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql

chkconfig mysql on

service mysql start

/usr/local/mysql/bin/mysql -u root -p

alter user 'root'@'localhost' identified by '@zz123456';

use mysql;

update user set host='%' where user = 'root';

flush privileges;

ln -s /usr/local/mysql/bin/mysql /usr/bin

6.tomcat安装配置

wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v8.0.53/bin/apache-tomcat-8.0.53.tar.gz

tar -zvxf apache-tomcat-8.0.53.tar.gz

mv apache-tomcat-8.0.53 /usr/local/tomcat8-admin

7.nginx安装配置

yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel

wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz

tar -zvxf pcre-8.35.tar.gz

./configure

make && make install

pcre-config --version(校验pcre是否安装成功)

wget http://nginx.org/download/nginx-1.6.2.tar.gz

tar -zvxf nginx-1.6.2.tar.gz

./configure

make && make install

ln -s /usr/local/lib/libpcre.so.1 /lib64/libpcre.so.1

/usr/local/nginx 配置文件路径

/usr/local/nginx/sbin/nginx -t 检测配置文件是否正确

/usr/local/nginx/sbin/nginx

/usr/local/nginx/sbin/nginx -s reload

/usr/local/nginx/sbin/nginx -s stop

rm -rf /usr/local/nginx 卸载nginx

nginx.conf

upstream tomcatServers {

server 127.0.0.1:9000;

}

server {

listen 80;

server_name localhost;

location / {

proxy_pass http://tomcatServers;

index index.html index.htm;

}

}

总结

以上是生活随笔为你收集整理的线上的java环境_Linux部署JavaWeb线上环境的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。