首页 > 代码库 > centos配置数据源和java环境配置

centos配置数据源和java环境配置

---恢复内容开始---

一:前言

     今天送走了一位同事,看着别人走勾起了我蠢蠢欲动的心啊,但是我知道,我不能那么的任性,我是men,这几天难得的清闲,所以我就弄一弄linux,昨天把网给配通了,今天配置下数据源来下载jdk,tomcat等软件,一步一步的来吧。Go!

二:数据源的配置

   配置数据源的地方是在"/etc/yum.repos.d",所以我们用 cd /etc/yum.repos.d进入到这个目录下,用ls命令可以看到如下:

技术分享

其中,CentOS-Base.repo就是需要配置的数据源,我们再操作linux的文件是一般是先备份的,所以可以看到我这里有个备份文件"CentOS-Base.repo.bak",

把里面的东西删除,加入如下的配置:

# CentOS-Base.repo## The mirror system uses the connecting IP address of the client and the# update status of each mirror to pick mirrors that are updated to and# geographically close to the client.  You should use this for CentOS updates# unless you are manually picking other mirrors.## If the mirrorlist= does not work for you, as a fall back you can try the# remarked out baseurl= line instead.##[base]name=CentOS-$releasever - Base - 163.combaseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=osgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#released updates[updates]name=CentOS-$releasever - Updates - 163.combaseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updatesgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#additional packages that may be useful[extras]name=CentOS-$releasever - Extras - 163.combaseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extrasgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages[centosplus]name=CentOS-$releasever - Plus - 163.combaseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplusgpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users[contrib]name=CentOS-$releasever - Contrib - 163.combaseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contribgpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

配置完这些就可以下载jdk和tomcat了

用如下命令

wget http://download.oracle.com/otn-pub/java/jdk/7u75-b13/jdk-7u75-linux-x64.tar.gz?AuthParam=1422600482_6166cf9e13056ea25feb3b0057ba49c3-------下载jdk

在去apache的官网找到tomcat的下载路径下载 tomcat,

三:安装命令

   我用的是SecureCRT来连接虚拟机的,所以我再这里面需要安装rz的命令,安装不下

(1)rz命令安装: yum install -y lrzsz用yum命令直接进行安装。我是在网上搜了下,看见有先下载在进行安装的,wget http://www.ohse.de/uwe/releases/lrzsz.tar.gz

 (2)tar zxvf jdk-7u75-linux-x64.tar.gz解压后 我的解压目录为/usr/local/soft下面,所以配置如下

技术分享

配置好了执行这个命令:source /etc/profile,使得其立刻生效,此时在执行java或者java -version就可以看到

技术分享

四:总结

    今天终于走出了第一步,把java的环境和数据源给配置好了,感觉很不错,努力继续,同事中午走了,突然少了一个人,觉得好像很怎么怎么,天下没有不散的宴席啊,这条路上还真的是需要坚定啊。Go!

centos配置数据源和java环境配置