- CentOS 安装JDK笔记
- CentOS 安装Mysql笔记
- CentOS 安装Maven笔记
CentOS 安装JDK笔记
系统环境:centos-6.5
安装方式:rpm安装
软件:jdk-7-linux-i586.rpm
下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html检验系统原版本
先查看是否安装了OpenJDK版本,如果是,卸载掉,换成sun版本的。换的原因各家有各家的说法。。。。
[root@localhost ~]# java -version
java version “1.7.0_24”
OpenJDK Runtime Environment (build 1.7.0_24-b18)
OpenJDK HotSpot(TM) Client VM (build 24.45-b08, mixed mode, sharing)
进一步查看JDK信息:
```
[root@localhost ~]# rpm -qa | grep java
tzdata-java-2012c-1.el6.noarch
java-1.7.0-openjdk-1.7.0.45-1.45.1.11.1.el6.x86_64
```
卸载OpenJDK,执行以下操作:
```
[root@localhost ~]# rpm -e –nodeps tzdata-java-2012c-1.el6.noarch
[root@localhost ~]# rpm -e –nodeps java-1.7.0-openjdk-1.7.0.45-1.45.1.11.1.el6.x86_64
```
安装JDK
上传新的jdk-7-linux-i586.rpm软件:
注意,如果是x64系统,需要使用jdk-7u79-linux-x64.rpm
下载地址:http://www.oracle.com/technetwork/cn/java/javase/downloads/jdk7-downloads-1880260.html[root@localhost ckb]# rpm -ivh jdk-7-linux-i586.rpm
JDK默认安装在/usr/java中。
验证安装
执行以下操作,查看信息是否正常:
```
[root@localhost bin]# java
[root@localhost bin]# javac
[root@localhost bin]# java -version
java version “1.7.0_45”
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) Client VM (build 24.45-b08, mixed mode, sharing)
```
无需配置环境变量。
CentOS 安装Mysql笔记
Step 1
下载yum的repo rpm package。
如果是CentOS6:wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
如果是CentOS7:wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Step 2:
安装。
CentOS 6 : rpm -ivh mysql-community-release-el6-5.noarch.rpm
CentOS 7 : rpm -ivh mysql-community-release-el7-5.noarch.rpm
Step 3:
安装服务端。
CentOS 6 : yum install -y mysql-server
CentOS 7 : yum install -y mysql-community-server
Step 4:
启动MySQL服务。
CentOS 6 : /etc/init.d/mysqld start
CentOS 7 : service mysqld restart
Step 5:(只针对CentOS7)
开启3306端口的防火墙,用于外网访问数据库。
```
firewall-cmd –zone=public –add-port=3306/tcp –permanent
firewall-cmd –reload
```
具体参考:
http://sharadchhetri.com/2013/12/26/install-mysql-server-5-6-in-centos-6-x-and-red-hat-6-x-linux/
```
use mysql;
UPDATE user SET Password = PASSWORD(‘newpass’) WHERE user = ‘root’;
Grant all privileges on . to ‘root’@’%’ identified by ‘password’ with grant option;
select host, user from user;
flush privileges;
```
卸载方案:
```
yum remove mysql mysql-server mysql-libs mysql-server;
find / -name mysql 将找到的相关东西delete掉;
rpm -qa|grep mysql(查询出来的东东yum remove掉)
```
CentOS 安装Maven笔记
- 首先从官网上 http://maven.apache.org/ 下载最新版Maven。我用的是apache-maven-3.0.4-bin.tar.gz。将下载后的文件拷贝到 /usr/local/目录下;
- 执行
tar -zxvf apache-maven-3.0.4-bin.tar.gz
命令解压文件; - 解压后会生成apache-maven-3.0.4目录,删除apache-maven-3.0.4-bin.tar.gz压缩包文件
- 执行
ln -s apache-maven-3.0.4 apache-maven
(为Maven做一个软链接,方便以后升级) 执行
vi /etc/profile
文件,插入如下内容
```
export M2_HOME=/usr/local/apache-maven
PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin
export PATH
```保存并退出VI编辑器,执行
source /etc/profile
命令使改动生效- 执行 mvn -v 命令,如出现如下内容表示安装配置成功
```
[root@xg ]# mvn -v
Apache Maven 3.0.4 (r1232337; 2012-01-17 16:44:56+0800)
Maven home: /usr/local/apache-maven
Java version: 1.6.0_33, vendor: Sun Microsystems Inc.
Java home: /usr/local/jdk1.6.0_33/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: “linux”, version: “2.6.32-279.2.1.el6.x86_64”, arch: “amd64”, family: “unix”
```
修改时区
timedatectl set-timezone Asia/Shanghai