一、软件源备份及切换
- 备份:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
- 下载新的CentOS-Base.repo 到/etc/yum.repos.d/
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
- 之后运行
yum makecache
生成缓存
二、JDK安装(rpm方式)
1. 清理系统默认自带的 JDK
- 如果安装 CentOS 时默认安装了例如 openJDK 等,请先执行
rpm -qa | grep jdk
查看已经自带的 jdk ,然后卸载sudo yum remove XXX
(XXX 为上一个命令查到的结果)
2. 创建 /usr/java
目录(rpm 方式默认安装路径: /usr/java/
)
mkdir /usr/java
3. 下载 jdk-8u131-linux-x64.rpm
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm
4. 赋予所用用户权限
sudo chmod 777 jdk-8u131-linux-x64.rpm
- (注:第一个 7 为 读写,第二个 7 为 用户组,第三个 7 为 其他人)
5. 安装: sudo rpm -ivh jdk-8u131-linux-x64.rpm
6. JDK 配置环境变量
sudo vim /etc/profile
- 在最下方添加
export JAVA_HOME=/usr/java/jdk1.8.0_131
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
- 使配置生效:
source /etc/profile
三、Tomcat 安装
- 下载:
wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.31/bin/apache-tomcat-8.5.31.tar.gz
- 解压缩:
sudo tar -zxvf apache-tomcat-8.5.31.tar.gz
- 重命名:
mv apache-tomcat-8.5.31.tar.gz tomcat
- 移动 tomcat 文件夹至 /usr/local/tomcat:
mv /root/tomcat /usr/local/tomcat
- 给 tomcat 的bin目录授权
chmod -R 777 /usr/local/tomca/
- 配置环境变量
sudo vim /etc/profile
export CATALINA_HOME=/usr/local/tomcat
alias tomcat_start='sudo sh /usr/local/tomcat/bin/startup.sh'
alias tomcat_stop='sudo sh /usr/local/tomcat/bin/shutdown.sh'
- 保存,退出,
source /etc/profile
,使其生效 -
tomcat_start
启动;tomcat_stop
停止
- 配置 UTF-8 字符集
- 进入 tomcat 安装的 conf 文件夹,编辑 server.xml
vim ${CATALINA_HOME}/conf/server.xml
- 找到配置 8080 默认端口的位置,在 xml 节点末尾添加 URIEncoding="UTF-8"
- 保存退出
四、Maven 配置
- 下载 :
curl -O https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.5.3/binaries/apache-maven-3.5.3-bin.tar.gz
- 解压:
tar -zxvf apache-maven-3.5.3-bin.tar.gz
- 移动:
mv apache-maven-3.5.3 /usr/local/maven/
- 配置变量:
# Maven
export MAVEN_HOME=/usr/local/maven
export PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin
- 生效:
source /etc/profile
- 检测:
mvn -v
五、IDEA 安装
- 下载 :
curl -O https://download.jetbrains.8686c.com/idea/ideaIU-2018.1.3.tar.gz
- 解压:
tar -zxvf ideaIU-2018.1.3.tar.gz
- 移动:
sudo mv idea-IU-181.4892.42 /usr/local/idea/
- 下载破解文件:https://pan.baidu.com/s/1UOPd_6ks7T1ef2xzNA0CqQ
- 移动破解文件:
mv idea_key.jar /usr/local/idea/bin/idea_key.jar
- 在
bin
下的idea.vmoptions
和idea64.vmoptions
文件内容最后添加-javaagent:/usr/local/idea/bin/idea_key.jar
sudo /etx/profile
# IDEA
export IDEA_HOME=/usr/local/idea
export PATH=$PATH:$IDEA_HOME/bin
alias idea_start='sudo sh /usr/local/idea/bin/idea.sh'
source /etc/profile
- 启动IDEA:
idea_start
- 输入 Activation Code
BIG3CLIK6F-eyJsaWNlbnNlSWQiOiJCSUczQ0xJSzZGIiwibGljZW5zZWVOYW1lIjoibGFuIHl1IiwiYXNzaWduZWVOYW1lIjoiIiwiYXNzaWduZWVFbWFpbCI6IiIsImxpY2Vuc2VSZXN0cmljdGlvbiI6IkZvciBlZHVjYXRpb25hbCB1c2Ugb25seSIsImNoZWNrQ29uY3VycmVudFVzZSI6ZmFsc2UsInByb2R1Y3RzIjpbeyJjb2RlIjoiQUMiLCJwYWlkVXBUbyI6IjIwMTctMTEtMjMifSx7ImNvZGUiOiJETSIsInBhaWRVcFRvIjoiMjAxNy0xMS0yMyJ9LHsiY29kZSI6IklJIiwicGFpZFVwVG8iOiIyMDE3LTExLTIzIn0seyJjb2RlIjoiUlMwIiwicGFpZFVwVG8iOiIyMDE3LTExLTIzIn0seyJjb2RlIjoiV1MiLCJwYWlkVXBUbyI6IjIwMTctMTEtMjMifSx7ImNvZGUiOiJEUE4iLCJwYWlkVXBUbyI6IjIwMTctMTEtMjMifSx7ImNvZGUiOiJSQyIsInBhaWRVcFRvIjoiMjAxNy0xMS0yMyJ9LHsiY29kZSI6IlBTIiwicGFpZFVwVG8iOiIyMDE3LTExLTIzIn0seyJjb2RlIjoiREMiLCJwYWlkVXBUbyI6IjIwMTctMTEtMjMifSx7ImNvZGUiOiJEQiIsInBhaWRVcFRvIjoiMjAxNy0xMS0yMyJ9LHsiY29kZSI6IlJNIiwicGFpZFVwVG8iOiIyMDE3LTExLTIzIn0seyJjb2RlIjoiUEMiLCJwYWlkVXBUbyI6IjIwMTctMTEtMjMifSx7ImNvZGUiOiJDTCIsInBhaWRVcFRvIjoiMjAxNy0xMS0yMyJ9XSwiaGFzaCI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