centos 软件安装 记录

 

1.一些所需包下载

yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers vsftpd patch zip

 

2.centos 安装mysql

yum -y install mysql mysql-server

yum -y install  mysql-connector-odbc mysql-devel

 

 

3.安装java

wget http://download.oracle.com/otn-pub/java/jdk/6u29-b11/jdk-6u29-linux-i586-rpm.bin

./jdk-6u29-linux-i586-rpm.bin

 

4.java环境变量配置

set JAVA_HOME=/home/chenjy/jdk1.6.0_21

export JAVA_HOME

set PATH=$JAVA_HOME/bin:$PATH

export PATH

set CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export CLASSPATH

 

5.配置 nginx 源

rpm -ivh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

 

6.安装nginx

yum -y install nginx

 

7.下载tomcat

wget http://mirror.bjtu.edu.cn/apache/tomcat/tomcat-6/v6.0.33/bin/apache-tomcat-6.0.33.tar.gz

tar -xvf apache-tomcat-6.0.33.tar.gz

mv apache-tomcat-6.0.33 /usr/apache-tomcat-6.0.33

 

8.设置tomcat开机自启动

vi /etc/init.d/tomcat

 

在里面填入一下信息:

#!/bin/sh

# chkconfig: 345 99 10

# description: Auto-starts tomcat

# /etc/init.d/tomcatd

# Tomcat auto-start

# Source function library.

#. /etc/init.d/functions

# source networking configuration.

#. /etc/sysconfig/network

RETVAL=0

export JRE_HOME=/usr/jdk1.6.0_29

export CATALINA_HOME=/usr/apache-tomcat-6.0.33

export CATALINA_BASE=/usr/apache-tomcat-6.0.33

start()

{

        if [ -f $CATALINA_HOME/bin/startup.sh ];

          then

            echo $"Starting Tomcat"

                $CATALINA_HOME/bin/startup.sh

            RETVAL=$?

            echo " OK"

            return $RETVAL

        fi

}

stop()

{

        if [ -f $CATALINA_HOME/bin/shutdown.sh ];

          then

            echo $"Stopping Tomcat"

                $CATALINA_HOME/bin/shutdown.sh

            RETVAL=$?

            sleep 1

            ps -fwwu tomcat | grep apache-tomcat|grep -v grep | grep -v PID | awk '{print $2}'|xargs kill -9

            echo " OK"

            # [ $RETVAL -eq 0 ] && rm -f /var/lock/...

            return $RETVAL

        fi

}

 

case "$1" in

 start) 

        start

        ;;

 stop)  

        stop

        ;;

 

 restart)

         echo $"Restaring Tomcat"

         $0 stop

         sleep 1

         $0 start

         ;;

 *)

        echo $"Usage: $0 {start|stop|restart}"

        exit 1

        ;;

esac

exit $RETVAL

 

chkconfig --add tomcat

 

打开tomcat:service tomcat start

关闭tomcat:service tomcat stop

 

9.防火墙开启端口

vi /etc/sysconfig/iptables

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

/etc/init.d/iptables save

 

设置mysql允许任何ip远程登录:

grant all privileges on *.* to root@'%' identified by 'password';

 

 

10.snmp安装

yum install -y net-snmp net-snmp-utils

vi /etc/snmp/snmpd.conf

 

rocommunity VPSMO 60.195.249.83

rocommunity VPSMO 60.195.252.107

rocommunity VPSMO 60.195.252.110

 

rouser VPSMO auth

createUser VPSMO MD5 mypwdmypwd

 

 

11.mysql 内存占用优化

vi /etc/my.cnf

 

[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

user=mysql

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

default-character-set=utf8

key_buffer = 256K

max_allowed_packet = 2M

thread_stack = 128K

table_cache = 4

sort_buffer = 64K

net_buffer_length = 2K

skip-innodb

 

[mysqldump]

quick

max_allowed_packet = 16M

 

 

[client]

default-character-set=utf8

 

 

[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

 

 

12.ftp安装

yum -y install vsftpd

 

 

 

 

13.pythons mysql 安装与配置

yum install python-devel mysql-devel zlib-devel openssl-devel

wget -q http://peak.telecommunity.com/dist/ez_setup.py

python ez_setup.py

wget http://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.3.tar.gz

tar -xvf MySQL-python-1.2.3.tar.gz

cd MySQL-python-1.2.3

python setup.py install

 

14.uwsgi 下载安装

wget http://projects.unbit.it/downloads/uwsgi-0.9.6.6.tar.gz

tar zxvf uwsgi-0.9.6.6.tar.gz

cd uwsgi-0.9.6.6

make

cp uwsgi /usr/sbin/uwsgi

 

 

15.djingo下载

wget http://www.djangoproject.com/download/1.3.1/tarball/

 

基本unrar用法:

wget  http://dag.wieers.com/rpm/packages/unrar/unrar-3.6.8-1.el5.rf.i386.rpm;

rpm -Uvh unrar-3.6.8-1.el5.rf.i386.rpm;

unrar x -o- -y  uu.rar 

 

 

Linux下python lxml模块的安装

需要先安装libxml2-devel libxslt-devel这两个rpm包,如果使用非root用户安装,可以下载libxml2和libxslt的源代码进行安装。

libxml2-devel、libxslt-devel装好后,解压lxml的包,切换到这个包的路径。 
加入CFLAGS进行编译和安装,在shell下依次输入如下命令:

CFLAGS=-I/usr/include/libxml2:/usr/include/libxslt/ python2.6 setup.py build 
CFLAGS=-I/usr/include/libxml2:/usr/include/libxslt/ python2.6 setup.py install

你可能感兴趣的:(centos)