Linux JDK安装
查看Linux系统位数
- 查看linux系统位数
file /sbin/init 或者 file /bin/ls
file /bin/ls
/bin/ls: ELF `64-bit` LSB executable, x86-64, version 1 (SYSV), dynamically
linked (uses shared libs), for GNU/Linux 2.6.32
如果显示 64-bit
则为64位;如果显示为32 bit
则为32bit
- 查看Linux内核版本
uname -a
Linux VM_0_12_centos 3.10.0-514.26.2.el7.`x86_64` #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
x86_64
表示64位机器,i686
表示32位机器
下载jdk
下载到目录 /usr/local/src
cd /usr/local/src
- 64位jdk
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"
- 32位jdk
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-i586.tar.gz"
- 解压
以64位为例
tar -zxvf jdk-8u141-linux-x64.tar.gz - 修改配置文件:
- 修改用户path配置文件
vim ~/.bash_profile
source ~/.bash_profile - 全局配置
vim /etc/profile
source /etc/profile - 配置文件底部写入
# jdk 1.8+
JAVA_HOME=/usr/local/src/jdk1.8.0_141
JRE_HOME=$JAVA_HOME/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
-
生效
-
检验是否修改成功:
java -version
java version "1.8.0_141"
Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode) -
卸载自带JDK:参考
- 查看PATH:
echo $PATH - 查看自带的jdk:
rpm -qa | grep jdk
看到如下信息:
libgcj-4.1.2-44.el5
java-1.4.2-gcj-compat-1.4.2.0-40jpp.115 - 使用rpm -e --nodeps 命令删除上面查找的内容:
rpm -e --nodepsjava-1.4.2-gcj-compat-1.4.2.0-40jpp.115
Linux tomcat安装
- 下载 参考
cd /usr/local/src
apache-tomcat-8.5.9.tar.gz
链接:https://pan.baidu.com/s/1hw91XGOq59Yjxp0YjvE3sw
提取码:mzef - 解压:
tar zxvf apache-tomcat-8.5.9.tar.gz
移动到/usr/local/
cp -R apache-tomcat-8.5.12 /usr/local/apache-tomcat-8.5.12
cd /usr/local
赋755权限
sudo chmod 755 -R apache-tomcat-8.5.9该步骤视情况而定
- 在配置文件中加入
vim /etc/profile
#tomcat
export TOMCAT_HOME=/usr/local/apache-tomcat-8.5.9
生效 source /etc/profile
- 启动、关闭
./startup.sh
./shutdown.sh
4.日志清空
[root@localhost logs]# du -h catalina.out
448K catalina.out
[root@localhost logs]# true > catalina.out
[root@localhost logs]# du -h catalina.out
0 catalina.out
日志清空参考
Linux Maven3.3.9安装
- 下载
apache-maven-3.3.9-bin.tar.gz
wget http://mirrors.cnnic.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
- 解压:
tar zxvf apache-maven-3.3.9-bin.tar.gz
vim /etc/profile
移动
mv apache-maven-3.3.9 /usr/local/apache-maven
修改配置
MAVEN_HOME=/usr/local/apache-maven
export MAVEN_HOME
export PATH=${PATH}:${MAVEN_HOME}/bin
source /etc/profile
- 检验是否修改成功:
mvn -version
显示maven相关信息即可
Linux git安装
-
检查是否已经存在git
git --version
git version 1.8.3.1存在旧版本git
命令查看git所在的路径:
whereis git
git: /usr/bin/git /usr/local/git /usr/share/man/man1/git.1.gz存在旧版本git
-
依赖:
yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker -
下载git源码并解压
/usr/local/src/
wget https://github.com/git/git/archive/v2.3.0.zip
unzip git-2.3.0.zip
cd git-2.3.0 -
编译安装:
将其安装在“/usr/local/git”目录下。
make prefix=/usr/local/git all
make prefix=/usr/local/git install -
修改配置
vim /etc/profile
export PATH=/usr/local/git/bin:$PATH
生效
source /etc/profile -
再次检验
git --version
git version 2.3.0新版本git
网友评论