---
title: "CentOS下常用开发软件安装"
author: "boendev"
date: "2012-04-27T16:39:02Z"
tags: []
categories: ["操作系统"]
slug: "centos"
draft: false
lastmod: "2013-08-22T15:01:39Z"
id: 1502428
url: "https://boendev.iteye.com/blog/1502428"
---

记录了安装CentOS，以及在CentOS下安装及使用Epel、Convmv、JDK、Nginx、Mysql、Nexus、Confluence等。

 

 

 

 

F11 - 设置光驱启动,放入CentOS CD1,根据提示再放入CD2 ,最后再放入CD1

漫长的等待...

设置语言为 英文,设置字体大小...最好不要用中文版.

完成系统安装...

 

centOS下IP及端口相关设置:

查看 /etc/sysconf/network-scripts/下以ifcfg-开头文件,如ifcfg-eth0或ifcfg-em1等,一个网卡MAC地址对应一个ifcfg-开头文件

 

VI修改文件内容,设置IP.详细IP设置内容查看 [http://boendev.iteye.com/blog/1501819](/blog/1501819)设置完成后:wq保存

 

命令 service network restart 重启 (也可ifdown etho 然后 ifup eth0 独立启动eth0的IP设置)

 

 如重启动失败,可尝试删除 rm /etc/udev/rules.d/70-persistent-net.rules 文件,再试.

 

如果无法解析域名,设置/etc/resolv.conf  

添加谷歌域名解析 nameserver 8.8.8.8

        nameserver 8.8.4.4

重启系统 或 source resolv.conf  (有时候必须重启系统才生效)

 

/etc/hosts   修改域名绑定

 

安装wget支持 

yum -y wget

yum -y setup

 

查看端口或其他 netstat -anp | grep ssh 

 

设置 nginx 开机启动 chkconfig  nginx on

 

 

查看防火墙信息  
/etc/init.d/iptables status

开启指定端口

/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT  
注意：  
#80代表端口。你可以根据你的需求来写，可以添加多次不同的端口。  
dport的前面是兩個 — 不是一個.  
保存修改  
/etc/rc.d/init.d/iptables save  
重启防火墙  
/etc/init.d/iptables restart  
———————  
关闭防火墙  
/etc/init.d/iptables stop  
永久关闭防火墙（不推荐）  
chkconfig –level 35 iptables off

 

 

查看centos内核的版本：

1\) cat /proc/version

2)uname -a

 

2\. 查看linux版本：

1) lsb\_release -a

2)  cat /etc/issue

3\) cat /etc/redhat-release 

 

查看系统是64位还是32位:

1、getconf LONG\_BIT or getconf WORD\_BIT

\[root@localhost ~]# getconf LONG\_BIT

64

2、file /bin/ls

 

安装JDK jdk1.7.0\_04

rpm -e --nodeps java-1.7.0-openjdk-1.7.0.9-2.3.4.1.el6\_3.x86\_64

 

下载地址:[http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u4-downloads-1591156.html](http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u4-downloads-1591156.html)

 

下载完成后用SFTP或winSCP 等上传至 /usr/java/目录

 

修改执行权限  chmod 777 jdk-7u4-linux-x64.rpm 

执行安装 rpm -ivh jdk-7u4-linux-x64.rpm

安装完成后 java -verion 查看是否安装成功

 

修改java 环境变量, vi /etc/profile,在最后几行加入

export JAVA\_HOME=/etc/java/jdk1.7.0\_04  
export CLASSPATH=.:$JAVA\_HOME/jre/lib/rt.jar:$JAVA\_HOME/lib/dt.jar:$JAVA\_HOME/lib/tools.jar  
export PATH=$PATH:$JAVA\_HOME/bin

 

source /etc/profile 使环境变量生效

 

echo $JAVA\_HOME 看是否设置正确

 

 

使用CentOS 的YUM进行软件安装

**安装EPEL源**

[EPEL](http://www.vpser.net/manage/centos-rhel-linux-third-party-source-epel.html)（Extra Packages for Enterprise Linux） 是由 Fedora 社区打造，为 RHEL 及衍生发行版如 CentOS等提供高质量软件包的项目。装上了 [EPEL](http://www.vpser.net/manage/centos-rhel-linux-third-party-source-epel.html)，就像在 Fedora 上一样，可以通过 yum install 软件包名，即可安装很多以前需要编译安装的软件、常用的软件或一些比较流行的软件，比如现在流行的nginx, [openvpn](http://www.vpser.net/build/linode-install-openvpn.html)等等，都可以使用[EPEL](http://www.vpser.net/manage/centos-rhel-linux-third-party-source-epel.html)很方便的安装更新。

 

CentOS/RHEL 5 ：

rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86\_64/epel-release-5-4.noarch.rpm

CentOS/RHEL 6 ：

**rpm -ivh** **http://dl.fedoraproject.org/pub/epel/6/x86\_64/epel-release-6-8.noarch.rpm**

rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm

rpm -Uvh  http://dl.fedoraproject.org/pub/epel/6/x86\_64/epel-release-6-5.noarch.rpm

Ok，安装完毕。

**使用EPEL源安装软件**  
现在就可以执行：yum install 软件包名进行安装了，nginx、[openvpn](http://www.vpser.net/build/linode-install-openvpn.html)、htop、[ncdu](http://www.vpser.net/manage/ncdu.html)等等一些常用的软件都灰常简单的装上了。

安装maven nexus服务器

 

下载地址:[http://www.sonatype.org/nexus/go](http://www.sonatype.org/nexus/go)

 

下载完成后用SSH或SCP等工具上传至服务器/usr/nexus 或 /opt/nexus下

 

tar -zxvf nexus-2.0.4-bundle.tar.gz

 

默认会有两个目录nexus-2.0.4-1  和 sonatype-work

 

设置环境变量 export RUN\_AS\_USER="root" ,root 代表你用哪种身份执行该服务

 

在nexus-2.0.4-1/bin 目录下执行 ./nexus start

 

启动成功,则在浏览器中打开http://192.168.16.116:8081/nexus/index.html#welcome

 

显示nexus界面即为安装成功.

默认管理员账号密码为:admin/admin123

设置public group的configuration,将 Avaiable Repositories下全部移动到Ordered Group Repository

 

添加proxy Repository,获取更多jar包

http://repository.sonatype.org/content/groups/public/

reference:[http://www.xue-java.com/courses/maven/35.html](http://www.xue-java.com/courses/maven/35.html)

 

[https://repository.cloudera.com/artifactory/cloudera-repos/](https://repository.cloudera.com/artifactory/cloudera-repos/)  需要安装hadoop 添加CDH,增加cloudera仓库

 

安装nginx

 

yum -y install nginx

 

安装完成后

 

可以修改 rpm -ql nginx  查看下安装路径

 

修改 nginx.conf 

 

80端口默认不会开启,可以尝试文章开始部分网络设置.

 

 

如果nginx进行静态文件,文件名称含有中文乱码时,使用如下组件

安装convmv 文件名称编码转换

下载地址:[http://www.j3e.de/linux/convmv/](http://www.j3e.de/linux/convmv/)  使用最新版本即可

 

传入,解压,make install

 

convmv -f GBK -t UTF-8 --notest /需要转码文件夹/*

 

不成功提示找不到 /etc/.../perl ,表示你的系统没有安装perl

 

yum -y install perl ,安装完成重复之前操作

 

安装MYSQL(此部分为转载)

 

 

查看有没有安装包

\# yum list mysql

安装mysql客户端

\# yum install mysql

\# yum list mysql-server

安装mysql 服务器端

\# yum install mysql-server

安装过后需要启动mysql服务，我们可以通过一下两总方法：

1、service mysqld start

2、/etc/init.d/mysqld start

启动过后需要给mysql创建一个root管理员：

\# mysqladmin -u root password 123456

后我们就可以通过以下连接mysql，进入mysql命令行了：

\# mysql -u root -p

输入密码即可。。。

打开root的远程连接(通过jdbc,frontsql navicat 等工具连接均需使用该命令)

首先开放centos 的 3306端口,命令详见文章开头处

修改mysql 库 的 user表 的 host 为 %

update user set host = '%' where host = 'localhost' and user = 'root';

flush privileges;

即可远程连接

 

GRANT ALL PRIVILEGES ON \*.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

 

通过yum安装MySQL后，默认开机时不会自动启动，需要手动设置MySQL让它开机自启动。

首先通过chkconfig命令看看MySQL在不在可管理的列表中，命令是：

```
chkconfig --list
```

如果列表中没有mysqld这个，需要先用这个命令添加：

chkconfig add mysqld

然后用这个命令设置开机启动：

chkconfig mysqld on

最后确认一下是否设置成功，如图：

![](http://yubosun.akcms.com/pictures/2012/11/0-OB0l4g.png)

如果对应mysqld对应的6项中有3项是on就证明已经设置成功。

##### 本文链接地址：[http://yubosun.akcms.com/tech/mysql-autoload.htm](http://yubosun.akcms.com/tech/mysql-autoload.htm)

 

 

安装confluence 3.5.6

下载官方 3.5.6 linux安装版,安装版默认自带tomcat

tar -zxvf confluence-3.5.6-std.tar.gz

 

cd confluence-3.5.6-std 后新建 mkdir data 

vi  confluence/WEB-INF/classes/confluence-init.properties

添加 confluence.home=/usr/software/confluence/confluence-3.5.6-std/data 到末尾

 

下载两个包

http://www.kuaipan.cn/file/id\_25230334408786099.html   atlassian-extras-2.4.jar    破解包(也可以自己修改编译)

http://www.kuaipan.cn/file/id\_25230334408786100.html   confluence-zh\_CN-plugin.jar 语言包

将两个包用winscp 传入/usr/software/confluence/confluence-3.5.6-std/WEB-INF/lib 下

 

sh bin/startup.sh 

地址栏打链接  ip地址:8080

获取官方lisenese,注册等

设置mysql,使用jdbc连接时,在默认的连接地址上添加字符编码 useUnicode=true&characterEncoding=UTF-8

ip地址:8080/admin下可以查看 License Information

 

**支持周期** 您的商用Confluence支持和升级直到**七月 10, 2027**可用.

 

 

作者:刘伯恩

 

转载请注明出处.