首页 > 代码库 > CentOS下的开发环境配置

CentOS下的开发环境配置

软件的安装路径可安装在/usr、/usr/local或/opt,安装完毕后可在/usr下建立软链接,或者配置BASH的PATH
建议开发环境安装在/opt/software,在~/.bash_profile中配置PATH

  • 中文输入法

若不存在system->preference->input method
则yum install ibus ibus-pinyin

  • Python

(1)下载源码

wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz

(2)编译,并安装

./configure --prefix=/opt/Python/python2.7.6
make && make install

(3)设置环境变量

mv /usr/bin/python /usr/bin/python2.6.6
export PYTHON_HOME=/opt/Python/python2.7.6
export PATH=$PATH:$PYTHON_HOME/bin

Linux下有大量与Python相关的软件,建议建立软链接
ln -s /opt/Python/python2.7.7/bin/python /usr/bin/python
vi /usr/bin/yum

(4)安装Pip,可选

wget http://pypi.python.org/packages/source/p/pip/pip-0.7.2.tar.gz
tar -xzf pip-0.7.2.tar.gz
cd pip-0.7.2
python setup.py install
包(.py文件)安装路径:/usr/local/lib/python2.7/dist-packages

(5)安装Numpy,Scipy

yum install lapack lapack-devel blas blas-devel
pip install numpy
pip install scipy

  • Node

wget http://nodejs.org/dist/node-v0.10.12.tar.gz
./configure --prefix=/opt/Node
make && make install

export NODE_HOME=/opt/Node
export PATH=$PATH:$NODE_HOME/bin

  • Java

(1)安装JDK

wget http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-i586.rpm
rpm -ivh jdk-7u51-linux-i586.rpm --prefix /opt/Java

(2)设置环境变量

export JAVA_HOME=/opt/Java/jdk1.7.0_45
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib/rt.jar
export PATH=$PATH:$JAVA_HOME/bin

alternatives --install /usr/bin/java java /usr/Java/jdk1.7.0_45/bin/java 50
alternatives --install /usr/bin/javac javac /usr/Java/jdk1.7.0_45/bin/javac 50

(3)安装Tomcat

wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v8.0.3/bin/apache-tomcat-8.0.3.tar.gz
mkdir /opt/Tomcat
cp apache-tomcat-8.0.3.tar.gz /opt/Tomcat
tar -zxvf apache-tomcat-6.0.37.tar.gz

chmod +x /opt/Tomcat/apache-tomcat-6.0.37/bin/startup.sh
chmod +x /opt/Tomcat/apache-tomcat-6.0.37/bin/shutdown.sh

export CATALINA_BASE=/opt/Tomcat/apache-tomcat-6.0.37
export CATALINA_HOME=/opt/Tomcat/apache-tomcat-6.0.37

(4)安装Ant

wget http://mirror.esocc.com/apache//ant/binaries/apache-ant-1.9.3-bin.tar.bz2
mkdir /opt/Ant
cp apache-ant-1.8.1-bin.tar.bz2 /opt/Ant
tar -jxvf apache-ant-1.8.1-bin.tar.gz

export ANT_HOME=/opt/Ant/apache-ant-1.8.1
export PATH=$PATH:$ANT_HOME/bin

  • OpenCV

参考:

http://docs.opencv.org/trunk/doc/py_tutorials/py_setup/py_setup_in_fedora/py_setup_in_fedora.html#install-opencv-python-in-fedora

(1) 安装依赖包(很重要)

(2)安装CMake

tar -zxvf cmake-2.8.10.2.tar.gz
cd cmake-2.8.10.2
./configure
make && make install

(3)安装OpenCV

tar -xvf OpenCV-2.4.3.tar.bz2
cd OpenCV-2.4.3
cmake CMakeLists.txt
make && make install

(4)添加Python支持

cp /usr/local/lib/python2.6/site-packages/cv2.so /usr/lib/python2.6/site-packages
cp /usr/local/lib/python2.6/site-packages/cv.py /usr/lib/python2.6/site-packages