Linux系统下配置Java环境及软件包安装教程
一、下载安装JDK
- 下载JDK
从官网[https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html]下载JDK
wget https://download.oracle.com/otn/java/jdk/8u152-b16/aa0333dd3019491ca4f6ddbe78cdb6d0/jdk-8u152-linux-x64.tar.gz?AuthParam=1578004220_f8db644c2289c5fb5d383663217c8f1f
- 安装JDK
tar -xzvf jdk-8u152-linux-x64.tar.gz
mv jdk1.8.0_152/ /usr/local/
vim /etc/profile.d/java.sh #在文件中添加如下内容
export JAVA_HOME=/usr/local/jdk1.8.0_152
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export PATH=$PATH:$JAVA_HOME/bin
chmod +x /etc/profile.d/java.sh
source /etc/profile.d/java.sh
java -version # 查看jdk版本号是否正确
二、下载安装Tomcat
- 下载Tomcat
从官网[http://tomcat.apache.org/]下载Tomcat
wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.27/bin/apache-tomcat-8.5.27.tar.gz
- 安装Tomcat
tar -xzvf apache-tomcat-8.5.27.tar.gz
mv apache-tomcat-8.5.27/ /usr/local/
vim /etc/profile.d/tomcat.sh #在文件中加入如下内容
export CATALINA_HOME=/usr/local/apache-tomcat-8.5.27
export PATH=$CATALINA_HOME/bin:$PATH
chmod +x /etc/profile.d/tomcat.sh
source /etc/profile.d/tomcat.sh
三、下载安装MySQL
- 下载MySQL
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
- 安装MySQL
tar -xzvf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.6.39-linux-glibc2.12-x86_64/ /usr/local/
chown -R root:root /usr/local/mysql-5.6.39-linux-glibc2.12-x86_64
groupadd mysql # 新建mysql用户组
useradd -r -g mysql mysql # 新建mysql用户
cd /usr/local/mysql-5.6.39-linux-glibc2.12-x86_64/
./scripts/mysql_install_db --datadir=/usr/local/mysql/data --user=mysql
# /usr/local/mysql/data/
chown -R root:mysql /usr/local/mysql/data
cp support-files/my-default.cnf /etc/my.cnf #复制配置文件
wget https://download.oracle.com/otn/java/jdk/8u152-b16/aa0333dd3019491ca4f6ddbe78cdb6d0/jdk-8u152-linux-x64.tar.gz?AuthParam=1578004220_f8db644c2289c5fb5d383663217c8f1f
tar -xzvf jdk-8u152-linux-x64.tar.gz
mv jdk1.8.0_152/ /usr/local/
vim /etc/profile.d/java.sh #在文件中添加如下内容
export JAVA_HOME=/usr/local/jdk1.8.0_152
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export PATH=$PATH:$JAVA_HOME/bin
chmod +x /etc/profile.d/java.sh
source /etc/profile.d/java.sh
java -version # 查看jdk版本号是否正确
- 下载Tomcat
从官网[http://tomcat.apache.org/]下载Tomcat
wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.27/bin/apache-tomcat-8.5.27.tar.gz
- 安装Tomcat
tar -xzvf apache-tomcat-8.5.27.tar.gz mv apache-tomcat-8.5.27/ /usr/local/ vim /etc/profile.d/tomcat.sh #在文件中加入如下内容 export CATALINA_HOME=/usr/local/apache-tomcat-8.5.27 export PATH=$CATALINA_HOME/bin:$PATH chmod +x /etc/profile.d/tomcat.sh source /etc/profile.d/tomcat.sh
三、下载安装MySQL
- 下载MySQL
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
- 安装MySQL
tar -xzvf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.6.39-linux-glibc2.12-x86_64/ /usr/local/
chown -R root:root /usr/local/mysql-5.6.39-linux-glibc2.12-x86_64
groupadd mysql # 新建mysql用户组
useradd -r -g mysql mysql # 新建mysql用户
cd /usr/local/mysql-5.6.39-linux-glibc2.12-x86_64/
./scripts/mysql_install_db --datadir=/usr/local/mysql/data --user=mysql
# /usr/local/mysql/data/
chown -R root:mysql /usr/local/mysql/data
cp support-files/my-default.cnf /etc/my.cnf #复制配置文件
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
tar -xzvf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.6.39-linux-glibc2.12-x86_64/ /usr/local/
chown -R root:root /usr/local/mysql-5.6.39-linux-glibc2.12-x86_64
groupadd mysql # 新建mysql用户组
useradd -r -g mysql mysql # 新建mysql用户
cd /usr/local/mysql-5.6.39-linux-glibc2.12-x86_64/
./scripts/mysql_install_db --datadir=/usr/local/mysql/data --user=mysql
# /usr/local/mysql/data/
chown -R root:mysql /usr/local/mysql/data
cp support-files/my-default.cnf /etc/my.cnf #复制配置文件
用户评论